Object.st
author Claus Gittinger <cg@exept.de>
Fri, 17 Jan 1997 20:42:19 +0100
changeset 2194 d9e23c3c53ce
parent 2192 ab86d9481b32
child 2203 5899dbf1b69c
permissions -rw-r--r--
checkin from browser
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
159
514c749165c3 *** empty log message ***
claus
parents: 143
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
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    13
nil subclass:#Object
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    14
	instanceVariableNames:''
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    15
	classVariableNames:'ErrorSignal HaltSignal MessageNotUnderstoodSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    16
		UserInterruptSignal RecursionInterruptSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    17
		ExceptionInterruptSignal SubscriptOutOfBoundsSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    18
		NonIntegerIndexSignal NotFoundSignal KeyNotFoundSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    19
		ElementOutOfBoundsSignal UserNotificationSignal InformationSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    20
		WarningSignal PrimitiveFailureSignal DeepCopyErrorSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    21
		AbortSignal ErrorRecursion Dependencies InfoPrinting
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    22
		ActivityNotificationSignal NonWeakDependencies'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    23
	poolDictionaries:''
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    24
	category:'Kernel-Objects'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    25
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    26
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
    27
!Object class methodsFor:'documentation'!
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
    28
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    29
copyright
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    30
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    31
 COPYRIGHT (c) 1988 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
    32
	      All Rights Reserved
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    33
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    34
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    35
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    36
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    37
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    38
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    39
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    40
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    41
!
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    42
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    43
dependencies
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    44
"
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    45
   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
    46
   (we think they are better ;-).
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    47
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    48
   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
    49
   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
    50
   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
    51
   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
    52
   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
    53
   to dependent or the dependee.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    54
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    55
   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
    56
   prevent memory leaks.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    57
   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
    58
   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
    59
   need to care about dependencies.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    60
   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
    61
   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
    62
   (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
    63
    that behavior)
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    64
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    65
   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
    66
   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
    67
   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
    68
   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
    69
   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
    70
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    71
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    72
   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
    73
   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
    74
   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
    75
   references exist to the dependent.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    76
   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
    77
   (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
    78
   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
    79
   (see #addNonWeakDependent / #removeNonWeakDependent).
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    80
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    81
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    82
   Caveat:
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
    83
      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
    84
      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
    85
      automatically).
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    86
      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
    87
      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
    88
      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
    89
      (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
    90
      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
    91
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    92
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    93
   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
    94
"
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    95
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    96
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
    97
documentation
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
    98
"
1294
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
    99
   Object is the superclass of most other classes. 
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   100
   (except for nil-subclasses, which inherit nothing,
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   101
    to catch any message into their #doesNotUnderstand: method)
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   102
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   103
   Protocol which is common to every object is defined here.
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   104
   Also some utility stuff (like notify) and error handling is implemented here.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   105
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   106
   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
   107
   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
   108
   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
   109
   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
   110
   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
   111
   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
   112
   (and also rewritten in some places).
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   113
1294
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   114
   [Class variables:]
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   115
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   116
        ErrorSignal     <Signal>        Signal raised for error/error: messages
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   117
                                        also, parent of all other signals.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   118
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   119
        HaltSignal      <Signal>        Signal raised for halt/halt: messages
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   120
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   121
        MessageNotUnderstoodSignal      Signals raised for various error conditions
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   122
        UserInterruptSignal
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   123
        RecursionInterruptSignal 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   124
        ExceptionInterruptSignal
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   125
        SubscriptOutOfBoundsSignal 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   126
        NonIntegerIndexSignal
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   127
        NotFoundSignal 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   128
        KeyNotFoundSignal 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   129
        ElementOutOfBoundsSignal
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   130
        InformationSignal
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   131
        WarningSignal
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   132
        DeepCopyErrorSignal
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   133
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   134
        AbortSignal      <Signal>       Signal raised by debugger, to abort a computation
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   135
                                        BUT, the debugger will only raise it if it is handled.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   136
                                        By handling the abortSignal, you can control where the
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   137
                                        debuggers abort-function resumes execution in case of
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   138
                                        an error.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   139
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   140
        ErrorRecursion   <Boolean>      controls behavior when recursive errors occur (i.e. 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   141
                                        an error while handling an error).
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   142
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   143
        Dependencies     <Dictionary>   keeps track of object dependencies
1294
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   144
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   145
    [author:]
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   146
        Claus Gittinger
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   147
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   148
"
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   149
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   150
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
   151
!Object class methodsFor:'initialization'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   152
a27a279701f8 Initial revision
claus
parents:
diff changeset
   153
initialize
a27a279701f8 Initial revision
claus
parents:
diff changeset
   154
    "called only once - initialize signals"
a27a279701f8 Initial revision
claus
parents:
diff changeset
   155
a27a279701f8 Initial revision
claus
parents:
diff changeset
   156
    ErrorSignal isNil ifTrue:[
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   157
        ErrorSignal := (Signal new) mayProceed:true.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   158
        ErrorSignal nameClass:self message:#errorSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   159
        ErrorSignal notifierString:'error encountered'.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   160
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   161
        HaltSignal := ErrorSignal newSignalMayProceed:true.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   162
        HaltSignal nameClass:self message:#haltSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   163
        HaltSignal notifierString:'halt encountered'.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   164
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   165
        MessageNotUnderstoodSignal := ErrorSignal newSignalMayProceed:true.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   166
        MessageNotUnderstoodSignal nameClass:self message:#messageNotUnderstoodSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   167
        MessageNotUnderstoodSignal notifierString:'message not understood'.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   168
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   169
        PrimitiveFailureSignal := ErrorSignal newSignalMayProceed:true.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   170
        PrimitiveFailureSignal nameClass:self message:#primitiveFailureSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   171
        PrimitiveFailureSignal notifierString:'primitive failed'.
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   172
362
claus
parents: 359
diff changeset
   173
"/        UserInterruptSignal := ErrorSignal newSignalMayProceed:true.
2042
a92164c8bbf8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1958
diff changeset
   174
        UserInterruptSignal := (Signal new) mayProceed:true.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   175
        UserInterruptSignal nameClass:self message:#userInterruptSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   176
        UserInterruptSignal notifierString:'user Interrupt'.
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   177
362
claus
parents: 359
diff changeset
   178
"/        RecursionInterruptSignal := ErrorSignal newSignalMayProceed:false.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   179
        RecursionInterruptSignal := (Signal new) mayProceed:true.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   180
        RecursionInterruptSignal nameClass:self message:#recursionInterruptSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   181
        RecursionInterruptSignal notifierString:'recursion limit reached'.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   182
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   183
        ExceptionInterruptSignal := ErrorSignal newSignalMayProceed:true.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   184
        ExceptionInterruptSignal nameClass:self message:#exceptionInterruptSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   185
        ExceptionInterruptSignal notifierString:'exception Interrupt'.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   186
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   187
        SubscriptOutOfBoundsSignal := ErrorSignal newSignalMayProceed:false.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   188
        SubscriptOutOfBoundsSignal nameClass:self message:#subscriptOutOfBoundsSignal.
1377
26e6af9693a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
   189
        SubscriptOutOfBoundsSignal notifierString:'subscript out of bounds: '.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   190
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   191
        ElementOutOfBoundsSignal := ErrorSignal newSignalMayProceed:false.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   192
        ElementOutOfBoundsSignal nameClass:self message:#elementOutOfBoundsSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   193
        ElementOutOfBoundsSignal notifierString:'element not appropriate or out of bounds'.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   194
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   195
        NotFoundSignal := ErrorSignal newSignalMayProceed:true.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   196
        NotFoundSignal nameClass:self message:#notFoundSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   197
        NotFoundSignal notifierString:'no such element'.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   198
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   199
        KeyNotFoundSignal := ErrorSignal newSignalMayProceed:true.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   200
        KeyNotFoundSignal nameClass:self message:#keyNotFoundSignal.
1377
26e6af9693a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
   201
        KeyNotFoundSignal notifierString:'no such key: '.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   202
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   203
        NonIntegerIndexSignal := ErrorSignal newSignalMayProceed:false.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   204
        NonIntegerIndexSignal nameClass:self message:#nonIntegerIndexSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   205
        NonIntegerIndexSignal notifierString:'index must be integer'.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   206
2042
a92164c8bbf8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1958
diff changeset
   207
        UserNotificationSignal := QuerySignal new.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   208
        UserNotificationSignal nameClass:self message:#userNotificationSignal.
2042
a92164c8bbf8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1958
diff changeset
   209
        UserNotificationSignal notifierString:'user notifiaction wanted'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   210
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   211
        InformationSignal := UserNotificationSignal newSignalMayProceed:true.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   212
        InformationSignal nameClass:self message:#informationSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   213
        InformationSignal notifierString:'information'.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   214
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   215
        WarningSignal := UserNotificationSignal newSignalMayProceed:true.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   216
        WarningSignal nameClass:self message:#warnungSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   217
        WarningSignal notifierString:'warning'.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   218
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   219
        ActivityNotificationSignal := UserNotificationSignal newSignalMayProceed:true.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   220
        ActivityNotificationSignal nameClass:self message:#activityNotificationSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   221
        ActivityNotificationSignal notifierString:'activity'.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   222
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   223
        DeepCopyErrorSignal := ErrorSignal newSignalMayProceed:true.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   224
        DeepCopyErrorSignal nameClass:self message:#deepCopyErrorSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   225
        DeepCopyErrorSignal notifierString:'object cannot be deepCopy-ed'.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   226
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   227
        "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   228
         AbortSignal is not a child of ErrorSignal -
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   229
         this would complicate abort from within a signal handler
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   230
        "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   231
        AbortSignal := Signal new mayProceed:true.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   232
        AbortSignal nameClass:self message:#abortSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   233
        AbortSignal notifierString:'unhandled abort signal'.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   234
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   235
        Dependencies isNil ifTrue:[
2096
bc7296b593ee use new WeakDependencyDictionary
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
   236
            Dependencies := WeakDependencyDictionary new.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   237
        ].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   238
        NonWeakDependencies isNil ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   239
            NonWeakDependencies := IdentityDictionary new.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   240
        ]
356
claus
parents: 348
diff changeset
   241
    ].
2114
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
   242
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
   243
    "/ 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
   244
    "/ (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
   245
    InfoPrinting := ObjectMemory infoPrinting.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   246
a27a279701f8 Initial revision
claus
parents:
diff changeset
   247
    "Object initialize"
812
00db9c0646fe notificationsignals are no longer children of ErrorSignal
Claus Gittinger <cg@exept.de>
parents: 783
diff changeset
   248
2096
bc7296b593ee use new WeakDependencyDictionary
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
   249
    "Modified: 9.1.1997 / 00:28:38 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   250
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   251
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
   252
!Object class methodsFor:'Signal constants'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   253
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   254
abortSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   255
    "return the signal used to abort user actions. This signal is only
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   256
     raised if cought (by the debugger), and will lead way out of the
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   257
     currently active doIt/printIt or inspectIt. (also some others use
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   258
     this for a save abort)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   259
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   260
    ^ AbortSignal
579
2d26193415b5 allow catching of information: and warn: boxes
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   261
!
2d26193415b5 allow catching of information: and warn: boxes
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   262
782
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   263
activityNotificationSignal
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   264
    "return the signal used for activity notifications.
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   265
     A handler for this signal gets all #activityNotification: sends"
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   266
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   267
    ^ ActivityNotificationSignal
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   268
!
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   269
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   270
deepCopyErrorSignal 
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   271
    "return the signal raised when a deepcopy is asked for
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   272
     an object which cannot do this (for example, BlockClosures
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   273
     or Contexts)."
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   274
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   275
    ^ DeepCopyErrorSignal
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   276
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   277
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   278
elementOutOfBoundsSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   279
    "return the signal used for element error reporting
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   280
     (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
   281
      be put into a bytearray)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   282
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   283
    ^ ElementOutOfBoundsSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   284
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   285
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   286
errorSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   287
    "return the signal used for error/error: - handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   288
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   289
    ^ ErrorSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   290
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   291
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   292
exceptionInterruptSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   293
    "return the signal used for exception (display errors) error handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   294
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   295
    ^ ExceptionInterruptSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   296
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   297
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   298
haltSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   299
    "return the signal used for halt/halt: - handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   300
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   301
    ^ HaltSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   302
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   303
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   304
informationSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   305
    "return the signal used for informations. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   306
     A handler for this signal gets all #information: sends"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   307
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   308
    ^ InformationSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   309
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   310
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   311
keyNotFoundSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   312
    "return the signal used for no such key error reporting"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   313
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   314
    ^ KeyNotFoundSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   315
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   316
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   317
messageNotUnderstoodSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   318
    "return the signal used for doesNotUnderstand: - error handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   319
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   320
    ^ MessageNotUnderstoodSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   321
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   322
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   323
nonIntegerIndexSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   324
    "return the signal used for bad subscript error reporting"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   325
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   326
    ^ NonIntegerIndexSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   327
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   328
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   329
notFoundSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   330
    "return the signal used for no element found error reporting"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   331
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   332
    ^ NotFoundSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   333
!
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
primitiveFailureSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   336
    "return the signal used for primitiveFailed - error handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   337
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   338
    ^ PrimitiveFailureSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   339
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   340
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   341
privateMethodSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   342
    "return the signal used for privateMethod - error handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   343
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   344
    ^ MessageNotUnderstoodSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   345
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   346
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   347
recursionInterruptSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   348
    "return the signal used for recursion overflow error handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   349
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   350
    ^ RecursionInterruptSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   351
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   352
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   353
subscriptOutOfBoundsSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   354
    "return the signal used for subscript error reporting.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   355
     (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
   356
      index less than 1 or greater than the array size)"
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
    ^ SubscriptOutOfBoundsSignal
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
userInterruptSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   362
    "return the signal used for ^C interrupts 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
    ^ UserInterruptSignal
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
userNotificationSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   368
    "the parent signal used with information and warnings.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   369
     Handling this allows handling of both information- and warning notifications."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   370
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   371
    ^ UserNotificationSignal
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   374
warningSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   375
    "return the signal used for warnings.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   376
     A handler for this signal gets all #warn: sends"
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
    ^ WarningSignal
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   379
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   380
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
   381
!Object class methodsFor:'info messages'!
356
claus
parents: 348
diff changeset
   382
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   383
infoPrinting
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   384
    "return the flag which controls information messages."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   385
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   386
    ^ InfoPrinting
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   387
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   388
356
claus
parents: 348
diff changeset
   389
infoPrinting:aBoolean
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   390
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   391
356
claus
parents: 348
diff changeset
   392
    "turn on/off printing of information messages.
claus
parents: 348
diff changeset
   393
     If the argument, aBoolean is false, infoPrint will not output
claus
parents: 348
diff changeset
   394
     messages. The default is true."
claus
parents: 348
diff changeset
   395
claus
parents: 348
diff changeset
   396
    InfoPrinting := aBoolean
claus
parents: 348
diff changeset
   397
! !
claus
parents: 348
diff changeset
   398
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
   399
!Object class methodsFor:'queries'!
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   400
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   401
isBuiltInClass
49
f1c2d75f2eb6 *** empty log message ***
claus
parents: 44
diff changeset
   402
    "return true, if this class is known by the run-time-system,
f1c2d75f2eb6 *** empty log message ***
claus
parents: 44
diff changeset
   403
     i.e. you cannot add/remove instance variables without recompiling
1266
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   404
     the VM.
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   405
     Here, true is returned for myself, false for subclasses."
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   406
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   407
    ^ self == Object
1266
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   408
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   409
    "Modified: 23.4.1996 / 16:00:07 / cg"
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   410
! !
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   411
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   412
!Object methodsFor:'accessing'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   413
a27a279701f8 Initial revision
claus
parents:
diff changeset
   414
at:index
a27a279701f8 Initial revision
claus
parents:
diff changeset
   415
    "return the indexed instance variable with index, anInteger;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   416
     this method can be redefined in subclasses."
a27a279701f8 Initial revision
claus
parents:
diff changeset
   417
a27a279701f8 Initial revision
claus
parents:
diff changeset
   418
    ^ self basicAt:index
a27a279701f8 Initial revision
claus
parents:
diff changeset
   419
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   420
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   421
at:index put:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   422
    "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
   423
     this method can be redefined in subclasses. Returns anObject (sigh)"
783
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
    ^ self basicAt:index put:anObject
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   426
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   427
    "Modified: 19.4.1996 / 11:13:29 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   428
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   429
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   430
basicAt:index
a27a279701f8 Initial revision
claus
parents:
diff changeset
   431
    "return the indexed instance variable with index, anInteger.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   432
     Trigger an error if the receiver has no indexed instance variables.
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   433
     This method should NOT be redefined in any subclass (except with great care, for tuning)"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   434
a27a279701f8 Initial revision
claus
parents:
diff changeset
   435
%{  /* NOCONTEXT */
a27a279701f8 Initial revision
claus
parents:
diff changeset
   436
329
claus
parents: 325
diff changeset
   437
    REGISTER int nbytes, indx;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   438
    OBJ myClass;
329
claus
parents: 325
diff changeset
   439
    REGISTER char *pFirst;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   440
    unsigned char *cp;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   441
    unsigned short *sp;
1515
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   442
    short *ssp;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   443
    unsigned long *lp;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   444
    long *slp;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   445
    unsigned long ul;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   446
    long l;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   447
    OBJ *op;
329
claus
parents: 325
diff changeset
   448
/*    int nInstBytes, nInstVars, flags; */
claus
parents: 325
diff changeset
   449
    REGISTER int n;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   450
a27a279701f8 Initial revision
claus
parents:
diff changeset
   451
a27a279701f8 Initial revision
claus
parents:
diff changeset
   452
    /*
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   453
     * notice the missing test for self being a nonNilObject -
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   454
     * this can be done since basicAt: is defined both in UndefinedObject
a27a279701f8 Initial revision
claus
parents:
diff changeset
   455
     * and SmallInteger
a27a279701f8 Initial revision
claus
parents:
diff changeset
   456
     */
253
30daee717a53 *** empty log message ***
claus
parents: 228
diff changeset
   457
    if (__isSmallInteger(index)) {
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   458
        myClass = __qClass(self);
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   459
        indx = __intVal(index) - 1;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   460
        n /* nInstVars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   461
        n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* nInstVars */);
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   462
        nbytes = __qSize(self) - n /* nInstBytes */;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   463
        pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   464
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   465
        /* 
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   466
         * replaced switch by open-coded if; this is slightly faster 
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   467
         * since it avoids the range check and also handles the most common case first
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   468
         */
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   469
        n = (INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK);
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   470
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   471
        if ((n == __MASKSMALLINT(POINTERARRAY))
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   472
         || (n == __MASKSMALLINT(WKPOINTERARRAY))) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   473
            if ((indx >= 0) && (indx < (__BYTES2OBJS__(nbytes)))) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   474
                op = (OBJ *)pFirst + indx;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   475
                RETURN ( *op );
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   476
            }
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   477
        } else if (n == __MASKSMALLINT(BYTEARRAY)) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   478
            if ((indx >= 0) && (indx < (nbytes / sizeof(char)))) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   479
                cp = (unsigned char *)pFirst + indx;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   480
                RETURN ( __MKSMALLINT(*cp & 0xFF) );
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   481
            }
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   482
        } else if (n == __MASKSMALLINT(FLOATARRAY)) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   483
            if ((indx >= 0) && (indx < (nbytes / sizeof(float)))) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   484
                float *fp;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   485
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   486
                fp = (float *)pFirst + indx;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   487
                RETURN ( __MKFLOAT((double)(*fp)));
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   488
            }
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   489
        } else if (n == __MASKSMALLINT(DOUBLEARRAY)) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   490
            if ((indx >= 0) && (indx < (nbytes / sizeof(double)))) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   491
                double *dp;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   492
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   493
#ifdef NEED_DOUBLE_ALIGN
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   494
                /*
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   495
                 * care for filler
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   496
                 */
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   497
                pFirst += sizeof(FILLTYPE);
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   498
#endif
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   499
                dp = (double *)pFirst + indx;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   500
                RETURN ( __MKFLOAT(*dp));
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   501
            }
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   502
        } else if (n == __MASKSMALLINT(WORDARRAY)) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   503
            if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   504
                sp = (unsigned short *)pFirst + indx;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   505
                RETURN ( __MKSMALLINT(*sp & 0xFFFF) );
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   506
            }
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   507
        } else if (n == __MASKSMALLINT(SWORDARRAY)) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   508
            if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   509
                ssp = (short *)pFirst + indx;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   510
                RETURN ( __MKSMALLINT(*ssp) );
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   511
            }
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   512
        } else if (n == __MASKSMALLINT(LONGARRAY)) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   513
            if ((indx >= 0) && (indx < (nbytes / sizeof(long)))) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   514
                lp = (unsigned long *)pFirst + indx;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   515
                ul = *lp;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   516
                if (ul <= _MAX_INT)
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   517
                    RETURN ( __MKSMALLINT(ul) );
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   518
                RETURN ( __MKULARGEINT(ul) );
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   519
            }
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   520
        } else if (n == __MASKSMALLINT(SLONGARRAY)) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   521
            if ((indx >= 0) && (indx < (nbytes / sizeof(long)))) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   522
                slp = (long *)pFirst + indx;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   523
                l = *slp;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   524
                if ((l >= _MIN_INT) && (l <= _MAX_INT))
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   525
                    RETURN ( __MKSMALLINT(l) );
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   526
                RETURN ( __MKLARGEINT(l) );
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   527
            }
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   528
        }
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   529
    }
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   530
%}.
10
claus
parents: 5
diff changeset
   531
    index isInteger ifFalse:[
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   532
        ^ self indexNotInteger
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   533
    ].
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   534
    ^ self subscriptBoundsError:index
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   535
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   536
a27a279701f8 Initial revision
claus
parents:
diff changeset
   537
basicAt:index put:anObject
a27a279701f8 Initial revision
claus
parents:
diff changeset
   538
    "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
   539
     Returns anObject (sigh).
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   540
     Trigger an error if the receiver has no indexed instance variables.
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   541
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   542
     This method should NOT be redefined in any subclass (except with great care, for tuning)"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   543
a27a279701f8 Initial revision
claus
parents:
diff changeset
   544
%{  /* NOCONTEXT */
a27a279701f8 Initial revision
claus
parents:
diff changeset
   545
a27a279701f8 Initial revision
claus
parents:
diff changeset
   546
    register int nbytes, indx;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   547
    OBJ myClass;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   548
    register char *pFirst;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   549
    char *cp;
1515
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   550
    unsigned short *sp;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   551
    short *ssp;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   552
    unsigned long *lp;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   553
    long *slp;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   554
    OBJ *op;
329
claus
parents: 325
diff changeset
   555
/*    int nInstBytes, ninstvars, flags; */
claus
parents: 325
diff changeset
   556
    REGISTER int n;
1515
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   557
    unsigned int u;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   558
    int val;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   559
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   560
    /* notice the missing test for self being a nonNilObject -
77
6c38ca59927f *** empty log message ***
claus
parents: 71
diff changeset
   561
       this can be done since basicAt: is defined both in UndefinedObject
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   562
       and SmallInteger */
a27a279701f8 Initial revision
claus
parents:
diff changeset
   563
253
30daee717a53 *** empty log message ***
claus
parents: 228
diff changeset
   564
    if (__isSmallInteger(index)) {
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   565
        indx = __intVal(index) - 1;
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   566
        myClass = __qClass(self);
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   567
        n /* ninstvars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   568
        n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* ninstvars */);
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   569
        nbytes = __qSize(self) - n /* nInstBytes */;
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   570
        pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */;
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   571
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   572
        n = (INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK);
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   573
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   574
        /* 
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   575
         * replaced switch by open-coded if; this is slightly faster 
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   576
         * since it avoids the range check and also handles the most common case first
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   577
         */
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   578
        if ((n == __MASKSMALLINT(POINTERARRAY))
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   579
         || (n == __MASKSMALLINT(WKPOINTERARRAY))) {
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   580
            if ((indx >= 0) && (indx < (__BYTES2OBJS__(nbytes)))) {
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   581
                op = (OBJ *)pFirst + indx;
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   582
                *op = anObject;
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   583
                __STORE(self, anObject);
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   584
                RETURN ( anObject );
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   585
            }
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   586
        } else if (n == __MASKSMALLINT(BYTEARRAY)) {
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   587
            if (__isSmallInteger(anObject)) {
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   588
                val = __intVal(anObject);
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   589
                if ((val & ~0xFF) == 0 /* i.e. (val >= 0) && (val <= 255) */) {
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   590
                    if ((indx >= 0) && (indx < (nbytes / sizeof(char)))) {
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   591
                        cp = pFirst + indx;
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   592
                        *cp = val;
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   593
                        RETURN ( anObject );
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   594
                    }
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   595
                }
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   596
            }
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   597
        } else if (n == __MASKSMALLINT(FLOATARRAY)) {
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   598
            if ((indx >= 0) && (indx < (nbytes / sizeof(float)))) {
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   599
                float *fp;
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   600
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   601
                fp = (float *)pFirst + indx;
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   602
                if (__isFloatLike(anObject)) {
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   603
                    *fp = _floatVal(anObject);
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   604
                    RETURN ( anObject );
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   605
                }
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   606
                if (__isSmallInteger(anObject)) {
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   607
                    *fp = (float) __intVal(anObject);
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   608
                    RETURN ( anObject );
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   609
                }
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   610
            }
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   611
        } else if (n == __MASKSMALLINT(DOUBLEARRAY)) {
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   612
            if ((indx >= 0) && (indx < (nbytes / sizeof(double)))) {
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   613
                double *dp;
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   614
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   615
#ifdef NEED_DOUBLE_ALIGN
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   616
                /*
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   617
                 * care for filler
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   618
                 */
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   619
                pFirst += sizeof(FILLTYPE);
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   620
#endif
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   621
                dp = (double *)pFirst + indx;
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   622
                if (__isFloatLike(anObject)) {
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   623
                    *dp = _floatVal(anObject);
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   624
                    RETURN ( anObject );
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   625
                }
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   626
                if (__isSmallInteger(anObject)) {
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   627
                    *dp = (double) __intVal(anObject);
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   628
                    RETURN ( anObject );
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   629
                }
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   630
            }
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   631
        } else if (n == __MASKSMALLINT(WORDARRAY)) {
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   632
            if (__isSmallInteger(anObject)) {
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   633
                val = __intVal(anObject);
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   634
                if ((val >= 0) && (val <= 0xFFFF)) {
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   635
                    if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) {
1515
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   636
                        sp = (unsigned short *)pFirst + indx;
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   637
                        *sp = val;
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   638
                        RETURN ( anObject );
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   639
                    }
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   640
                }
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   641
            }
1515
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   642
        } else if (n == __MASKSMALLINT(SWORDARRAY)) {
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   643
            if (__isSmallInteger(anObject)) {
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   644
                val = __intVal(anObject);
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   645
                if ((val >= -32768) && (val < 32768)) {
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   646
                    if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) {
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   647
                        ssp = (short *)pFirst + indx;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   648
                        *ssp = val;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   649
                        RETURN ( anObject );
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   650
                    }
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   651
                }
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   652
            }
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   653
        } else if (n == __MASKSMALLINT(SLONGARRAY)) {
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   654
            if ((indx >= 0) && (indx < (nbytes / sizeof(long)))) {
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   655
                slp = (long *)pFirst + indx;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   656
                if (__isSmallInteger(anObject)) {
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   657
                    *slp = __intVal(anObject);
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   658
                    RETURN ( anObject );
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   659
                }
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   660
                n = __signedLongIntVal(anObject);
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   661
                /* zero means failure for an int larger than 4 bytes  ... (would be a smallInteger) */
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   662
                if (n) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   663
                    *slp = n;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   664
                    RETURN ( anObject );
1515
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   665
                }
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   666
            }
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   667
        } else if (n == __MASKSMALLINT(LONGARRAY)) {
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   668
            if ((indx >= 0) && (indx < (nbytes / sizeof(long)))) {
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   669
                lp = (unsigned long *)pFirst + indx;
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   670
                if (anObject == __MKSMALLINT(0)) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   671
                    *lp = 0;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   672
                    RETURN ( anObject );
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   673
                }
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   674
                u = __longIntVal(anObject);
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   675
                /* zero means failure for an int larger than 4 bytes  ... (would be a smallInteger) */
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   676
                if (u) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   677
                    *lp = u;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   678
                    RETURN ( anObject );
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   679
                }
1515
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   680
            }
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   681
        }
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   682
    }
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   683
%}.
10
claus
parents: 5
diff changeset
   684
    index isInteger ifFalse:[
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   685
        "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   686
         the index should be an integer number
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   687
        "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   688
        ^ self indexNotInteger
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   689
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
   690
    (index between:1 and:self size) ifFalse:[
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   691
        "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   692
         the index is less than 1 or greater than the size of the
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   693
         receiver collection
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   694
        "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   695
        ^ self subscriptBoundsError:index
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   696
    ].
643
04b2025af0e3 use new isFLoatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   697
    (self class isFloatsOrDoubles) ifTrue:[
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   698
        anObject isNumber ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   699
            ^ self basicAt:index put:(anObject asFloat)
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   700
        ]
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   701
    ].
10
claus
parents: 5
diff changeset
   702
    anObject isInteger ifFalse:[
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   703
        "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   704
         the object to put into the receiver collection
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   705
         should be an integer number
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   706
        "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   707
        ^ self elementNotInteger
2
claus
parents: 1
diff changeset
   708
    ].
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   709
    "
213
3b56a17534fd *** empty log message ***
claus
parents: 202
diff changeset
   710
     the object to put into the receiver collection
362
claus
parents: 359
diff changeset
   711
     is not an instance of the expected element class,
claus
parents: 359
diff changeset
   712
     or the value is  not within the elements valid range.
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   713
    "
2
claus
parents: 1
diff changeset
   714
    ^ self elementBoundsError
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   715
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   716
    "Modified: 19.4.1996 / 11:14:10 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   717
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   718
a27a279701f8 Initial revision
claus
parents:
diff changeset
   719
instVarAt:index
a27a279701f8 Initial revision
claus
parents:
diff changeset
   720
    "return a non-indexed instance variable;
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   721
     peeking into an object this way is not very object oriented 
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   722
     - use with care (needed for copy, inspector etc.)"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   723
a27a279701f8 Initial revision
claus
parents:
diff changeset
   724
%{  /* NOCONTEXT */
a27a279701f8 Initial revision
claus
parents:
diff changeset
   725
a27a279701f8 Initial revision
claus
parents:
diff changeset
   726
    OBJ myClass;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   727
    int idx, ninstvars;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   728
253
30daee717a53 *** empty log message ***
claus
parents: 228
diff changeset
   729
    if (__isSmallInteger(index)) {
329
claus
parents: 325
diff changeset
   730
	myClass = __Class(self);
755
eaab1d1dacbd _-macros replcaed by __-macros (needed especially for MKLARGINT)
Claus Gittinger <cg@exept.de>
parents: 751
diff changeset
   731
	idx = __intVal(index) - 1;
357
claus
parents: 356
diff changeset
   732
	/*
claus
parents: 356
diff changeset
   733
	 * do not allow return of non-object fields.
claus
parents: 356
diff changeset
   734
	 * if subclass did not make privisions for that,
claus
parents: 356
diff changeset
   735
	 * we wont do so here ...
claus
parents: 356
diff changeset
   736
	 */
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   737
	if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) {
357
claus
parents: 356
diff changeset
   738
	    if (idx == 0) {
claus
parents: 356
diff changeset
   739
		RETURN ( nil )
claus
parents: 356
diff changeset
   740
	    }
claus
parents: 356
diff changeset
   741
	}
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   742
	ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   743
	if ((idx >= 0) && (idx < ninstvars)) {
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   744
	    RETURN ( __InstPtr(self)->i_instvars[idx] );
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   745
	}
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   746
    }
a27a279701f8 Initial revision
claus
parents:
diff changeset
   747
%}
a27a279701f8 Initial revision
claus
parents:
diff changeset
   748
.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   749
    index isInteger ifFalse:[
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   750
	^ self indexNotInteger
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   751
    ].
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   752
    ^ self subscriptBoundsError:index
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   753
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   754
a27a279701f8 Initial revision
claus
parents:
diff changeset
   755
instVarAt:index put:value
a27a279701f8 Initial revision
claus
parents:
diff changeset
   756
    "change a non-indexed instance variable;
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   757
     peeking into an object this way is not very object oriented 
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   758
     - use with care (needed for copy, inspector etc.)"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   759
a27a279701f8 Initial revision
claus
parents:
diff changeset
   760
%{  /* NOCONTEXT */
a27a279701f8 Initial revision
claus
parents:
diff changeset
   761
a27a279701f8 Initial revision
claus
parents:
diff changeset
   762
    OBJ myClass;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   763
    int idx, ninstvars;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   764
253
30daee717a53 *** empty log message ***
claus
parents: 228
diff changeset
   765
    if (__isSmallInteger(index)) {
329
claus
parents: 325
diff changeset
   766
	myClass = __Class(self);
755
eaab1d1dacbd _-macros replcaed by __-macros (needed especially for MKLARGINT)
Claus Gittinger <cg@exept.de>
parents: 751
diff changeset
   767
	idx = __intVal(index) - 1;
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   768
	ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
357
claus
parents: 356
diff changeset
   769
	/*
claus
parents: 356
diff changeset
   770
	 * do not allow setting of non-object fields.
claus
parents: 356
diff changeset
   771
	 * if subclass did not make privisions for that,
claus
parents: 356
diff changeset
   772
	 * we wont do so here ...
claus
parents: 356
diff changeset
   773
	 */
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   774
	if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) {
357
claus
parents: 356
diff changeset
   775
	    if (idx == 0) {
claus
parents: 356
diff changeset
   776
		RETURN ( nil )
claus
parents: 356
diff changeset
   777
	    }
claus
parents: 356
diff changeset
   778
	}
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   779
	if ((idx >= 0) && (idx < ninstvars)) {
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   780
	    __InstPtr(self)->i_instvars[idx] = value;
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   781
	    __STORE(self, value);
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   782
	    RETURN ( value );
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   783
	}
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   784
    }
a27a279701f8 Initial revision
claus
parents:
diff changeset
   785
%}
a27a279701f8 Initial revision
claus
parents:
diff changeset
   786
.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   787
    index isInteger ifFalse:[
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   788
	^ self indexNotInteger
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   789
    ].
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   790
    ^ self subscriptBoundsError:index
359
claus
parents: 357
diff changeset
   791
!
claus
parents: 357
diff changeset
   792
claus
parents: 357
diff changeset
   793
instVarNamed:name 
claus
parents: 357
diff changeset
   794
    "return a non-indexed instance variables value by name;
claus
parents: 357
diff changeset
   795
     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
   796
     - 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
   797
     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
   798
     parsed ad runtime)"
359
claus
parents: 357
diff changeset
   799
claus
parents: 357
diff changeset
   800
    ^ 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
   801
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   802
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   803
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   804
     |p|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   805
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   806
     p := Point x:10 y:20.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   807
     p instVarNamed:'x'  
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   808
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   809
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   810
    "Modified: 19.4.1996 / 11:12:39 / cg"
359
claus
parents: 357
diff changeset
   811
!
claus
parents: 357
diff changeset
   812
1528
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   813
instVarNamed:name ifAbsent:exceptionBlock
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   814
    "return a non-indexed instance variables value by name,
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   815
     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
   816
     peeking into an object this way is not very object oriented 
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   817
     - 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
   818
     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
   819
     parsed ad runtime)"
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   820
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   821
    |idx|
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   822
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   823
    idx := self class instVarOffsetOf:name.
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   824
    idx isNil ifTrue:[^ exceptionBlock value].
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   825
    ^ self instVarAt:idx
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   826
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   827
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   828
    "
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   829
     |p|
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   830
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   831
     p := Point x:10 y:20.
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   832
     p instVarNamed:'x'  
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   833
    "
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   834
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   835
    "Created: 6.7.1996 / 23:02:49 / cg"
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   836
    "Modified: 6.7.1996 / 23:03:41 / cg"
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   837
!
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   838
359
claus
parents: 357
diff changeset
   839
instVarNamed:name put:value
claus
parents: 357
diff changeset
   840
    "set a non-indexed instance variable by name;
claus
parents: 357
diff changeset
   841
     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
   842
     - 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
   843
     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
   844
     parsed ad runtime)"
359
claus
parents: 357
diff changeset
   845
claus
parents: 357
diff changeset
   846
    ^ 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
   847
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   848
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   849
     |p|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   850
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   851
     p := Point x:10 y:20.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   852
     p instVarNamed:'x' put:30.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   853
     p  
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   854
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   855
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   856
    "Modified: 19.4.1996 / 11:12:49 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   857
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   858
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   859
!Object methodsFor:'binary storage'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   860
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   861
hasSpecialBinaryRepresentation
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   862
    "return true, if the receiver has a special binary representation;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   863
     default here is false, but can be redefined in class which provide
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   864
     their own storeBinary/readBinary methods.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   865
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   866
     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
   867
     special classes such as True, False, UndefinedObject or SmallInteger.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   868
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   869
     If your instances should be stored in a special way, see
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   870
     #representBinaryOn: and #readBinaryContentsFromdata:manager:."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   871
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   872
    ^ false
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   873
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   874
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   875
readBinaryContentsFrom:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   876
    "reconstruct the receivers instance variables by reading a binary
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   877
     binary representation from stream. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   878
     This is a general implementation, walking over instances 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   879
     and loading each recursively using manager.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   880
     Redefined by some classes to read a more compact representations
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   881
     (see String, SmallInteger etc).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   882
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   883
     Notice, that the object is already recreated as an empty corps
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   884
     with instance variables all nil and bit-instances (bytes, words etc.) 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   885
     already read and restored.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   886
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   887
     Also notice: this method is not called for if a private representation
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   888
     has been stored (see representBinaryOn:). 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   889
     In that case, #readBinaryContentsFromData:manager: is called, which
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   890
     has to be reimplemented in the objects class."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   891
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   892
    |size "{ Class: SmallInteger }"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   893
     instvarArray|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   894
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   895
    stream next == 1 ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   896
	"/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   897
	"/ special representation ...
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   898
	"/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   899
	instvarArray := Array new:(size := stream nextNumber:3).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   900
	1 to:size do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   901
	    instvarArray basicAt:i put:(manager nextObject)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   902
	].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   903
	self readBinaryContentsFromData:instvarArray manager:manager.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   904
	^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   905
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   906
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   907
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   908
    "/ standard representation
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   909
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   910
    size := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   911
    size ~~ 0 ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   912
	self class isPointers ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   913
	    1 to:size do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   914
		self basicAt:i put:(manager nextObject)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   915
	    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   916
	]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   917
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   918
    size := self class instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   919
    1 to:size do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   920
	self instVarAt:i put:(manager nextObject)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   921
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   922
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   923
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   924
readBinaryContentsFromData:instvarArray manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   925
    "reconstruct the receivers instance variables by filling instance
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   926
     variables with values from instvarArray. This array contains the instvars
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   927
     as specified in #representBinaryOn: when the object was stored.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   928
     It is the receivers responsibility to set its instance variables in the
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   929
     same order from that array."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   930
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   931
    ^ self subclassResponsibility
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   932
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   933
    "typical implementation (see also comment in #representBinaryOn:)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   934
     (for an object with foo, bar and baz as instance variables,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   935
      which did not store baz and wants baz to be reinitialized to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   936
      some constant string)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   937
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   938
	foo := instvarArray at:1.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   939
	bar := instvarArray at:2.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   940
	baz := 'aConstant'.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   941
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   942
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   943
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   944
representBinaryOn:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   945
    "this method is called by the storage manager to ask objects
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   946
     if they wish to provide their own binary representation.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   947
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   948
     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
   949
     instance variables (named & indexed pointer) to be stored. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   950
     If not redefined, this method returns nil which means that all 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   951
     instance variables are to be stored.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   952
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   953
     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
   954
     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
   955
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   956
     If this is redefined returning non-nil, the corresponding class needs
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   957
     a redefined instance method named #readBinaryContentsFromData:manager:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   958
     which has to fill the receivers named (and optionally indexed pointer)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   959
     instance variables with corresponding values from a data array."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   960
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   961
    ^ nil
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   962
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   963
    "typical implementation:  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   964
     (see also comment in #readBinaryContentsFromData:manager:)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   965
     for an object with foo, bar and baz as instance variables,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   966
     which does not want to store baz:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   967
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   968
     representBinaryOn:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   969
	|data|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   970
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   971
	data := Array new:2.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   972
	data at:1 put:foo.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   973
	data at:2 put:bar.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   974
	^ data
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   975
    "
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   976
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   977
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   978
storeBinaryContentsFromData:instvarArray on:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   979
    "store the instvars (both named & indexed pointer)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   980
     as returned by #representBinaryOn:."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   981
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   982
    |size "{ Class: SmallInteger }"|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   983
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   984
    size := instvarArray size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   985
    1 to:size do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   986
	manager putIdOf:(instvarArray at:i) on:stream
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   987
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   988
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   989
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   990
storeBinaryContentsOn:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   991
    "store the receivers instance variables in a binary representation
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   992
     on a stream using manager.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   993
     This is a general implementation, walking over instances 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   994
     and storing each recursively using manager.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   995
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   996
     Notice, that the objects definition and bit-instances (bytes, words etc.) 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   997
     are already stored. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   998
     Here, we only have to deal with indexed-pointer and named instance variables.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   999
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1000
     Also notice: this method is not called for if a private representation
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1001
     has been stored (see representBinaryOn:). 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1002
     In that case, #storeBinaryContentsFromData:manager: is called."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1003
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1004
    |size "{ Class: SmallInteger }"|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1005
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1006
    size := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1007
    size ~~ 0 ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1008
	self class isPointers ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1009
	    1 to:size do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1010
		manager putIdOf:(self basicAt:i) on:stream
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1011
	    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1012
	].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1013
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1014
    size := self class instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1015
    1 to:size do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1016
	manager putIdOf:(self instVarAt:i) on:stream
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1017
    ].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1018
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1019
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1020
storeBinaryDefinitionBodyOn:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1021
    "append a binary representation of the receivers body onto stream.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1022
     This is a general implementation walking over instances storing
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1023
     each recursively as an ID using manager.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1024
     Can be redefined in subclasses."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1025
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1026
    |basicSize "{ Class: SmallInteger }"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1027
     instSize  "{ Class: SmallInteger }"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1028
     myClass specialRep pointers|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1029
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1030
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1031
    instSize := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1032
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1033
    (pointers := myClass isPointers) ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1034
	"/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1035
	"/ inst size not needed - if you uncomment the line below,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1036
	"/ also uncomment the corresponding line in
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1037
	"/ Object>>binaryDefinitionFrom:manager:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1038
	"/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1039
	"/ stream nextPut:instSize. "mhmh this limits us to 255 named instvars"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1040
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1041
	myClass isVariable ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1042
	    stream nextNumber:3 put:(basicSize := self basicSize)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1043
	] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1044
	    basicSize := 0
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1045
	].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1046
    ] ifFalse: [
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1047
	stream nextNumber:4 put:(basicSize := self basicSize).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1048
	myClass isBytes ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1049
	    1 to:basicSize do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1050
		stream nextPut:(self basicAt:i)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1051
	    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1052
	] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1053
	    myClass isWords ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1054
		1 to:basicSize do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1055
		    stream nextNumber:2 put:(self basicAt: i)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1056
		]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1057
	    ] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1058
		myClass isLongs ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1059
		    1 to:basicSize do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1060
			stream nextNumber:4 put:(self basicAt: i)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1061
		    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1062
		] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1063
		    myClass isFloats ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1064
			"could do it in one big write on machines which use IEEE floats ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1065
			1 to:basicSize do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1066
			    Float storeBinaryIEEESingle:(self basicAt:i) on:stream
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1067
			]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1068
		    ] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1069
			myClass isDoubles ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1070
			    "could do it in one big write on machines which use IEEE doubles ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1071
			    1 to:basicSize do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1072
				Float storeBinaryIEEEDouble:(self basicAt:i) on:stream
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1073
			    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1074
			] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1075
			    "/ should never be reached ...
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1076
			    1 to:basicSize do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1077
				manager putIdOf:(self basicAt:i) on:stream
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1078
			    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1079
			]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1080
		    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1081
		]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1082
	    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1083
	].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1084
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1085
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1086
    (pointers or:[instSize ~~ 0]) ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1087
	specialRep := self representBinaryOn:manager.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1088
	specialRep notNil ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1089
	    stream nextPut:1.     "/ means: private representation follows
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1090
	    stream nextNumber:3 put:(specialRep basicSize).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1091
	    self storeBinaryContentsFromData:specialRep on:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1092
	] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1093
	    stream nextPut:0.     "/ means: full representation follows
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1094
	    self storeBinaryContentsOn:stream manager:manager
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1095
	]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1096
    ]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1097
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1098
    "Modified: 25.10.1995 / 14:00:51 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1099
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1100
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1101
storeBinaryDefinitionOn:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1102
    "append a binary representation of the receiver onto stream.
1260
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1231
diff changeset
  1103
     This is an internal interface for binary storage mechanism.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1104
     This method first stores the class, then the body, which is done
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1105
     in a separate method to allow redefinition of the bodies format.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1106
     Can be redefined in subclasses to write more compact representations
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1107
     (see String, SmallInteger etc)."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1108
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1109
    manager putIdOfClass:(self class) on:stream.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1110
    self storeBinaryDefinitionBodyOn:stream manager:manager
1260
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1231
diff changeset
  1111
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1231
diff changeset
  1112
    "Modified: 23.4.1996 / 09:31:12 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1113
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1114
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1115
storeBinaryOn:aStream
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1116
    "Writes a description of the receiver onto aStream, in a way that allows
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1117
     the object's structure to be reconstructed from the stream's contents"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1118
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1119
    BinaryOutputManager store:self on:aStream
899
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1120
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1121
    "
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1122
     |a s1 s2|
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1123
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1124
     s1 := 'hello'.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1125
     s2 := 'world'.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1126
     a := Array new:5.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1127
     a at:1 put:s1.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1128
     a at:2 put:s2.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1129
     a at:3 put:s1.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1130
     a at:4 put:s2.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1131
     a storeBinaryOn:'test.boss'
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1132
    "
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1133
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1134
    "
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1135
     (BinaryObjectStorage onOld:'test.boss' asFilename readStream)
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1136
	next
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1137
	    inspect
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1138
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1139
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1140
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1141
storeBinaryOn:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1142
    "append a binary representation of the receiver onto stream."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1143
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1144
    manager putIdOf:self on:stream
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1145
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1146
1826
aa574220fff4 category rename
Claus Gittinger <cg@exept.de>
parents: 1820
diff changeset
  1147
!Object methodsFor:'change & update'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1148
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1149
broadcast:aSelectorSymbol
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1150
    "send a message with selector aSelectorSymbol to all my dependents"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1151
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1152
    self dependentsDo:[:dependent | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1153
	dependent perform:aSelectorSymbol
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1154
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1155
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1156
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1157
broadcast:aSelectorSymbol with:anArgument
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1158
    "send a message with selector aSelectorSymbol with an additional
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1159
     argument anArgument to all my dependents."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1160
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1161
    self dependentsDo:[:dependent | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1162
	dependent perform:aSelectorSymbol with:anArgument
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1163
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1164
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1165
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1166
changeRequest
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1167
    "the receiver wants to change - check if all dependents
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1168
     grant the request, and return true if so"
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1169
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1170
    self dependentsDo:[:dependent | 
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1171
	dependent updateRequest ifFalse:[^ false].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1172
    ].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1173
    ^ true
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1174
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1175
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1176
changeRequest:aParameter
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1177
    "the receiver wants to change - check if all dependents
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1178
     grant the request, and return true if so"
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1179
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1180
    self dependentsDo:[:dependent | 
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1181
	(dependent updateRequest:aParameter) ifFalse:[^ false].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1182
    ].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1183
    ^ true
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1184
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1185
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1186
changeRequest:aParameter from:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1187
    "the receiver wants to change - check if all dependents
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1188
     except anObject grant the request, and return true if so.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1189
     The argument anObject is typically going to be the one who is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1190
     about to send the change request."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1191
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1192
    self dependentsDo:[:dependent | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1193
	dependent == anObject ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1194
	    (dependent updateRequest:aParameter) ifFalse:[^ false].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1195
	]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1196
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1197
    ^ true
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1198
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1199
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1200
changeRequestFrom:anObject
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1201
    "the receiver wants to change - check if all dependents
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1202
     except anObject grant the request, and return true if so.
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1203
     The argument anObject is typically going to be the one who is
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1204
     about to send the change request."
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1205
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1206
    self dependentsDo:[:dependent | 
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1207
	dependent == anObject ifFalse:[
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1208
	    (dependent updateRequest) ifFalse:[^ false].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1209
	]
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1210
    ].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1211
    ^ true
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1212
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1213
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1214
changed
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1215
    "notify all dependents that the receiver has changed.
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1216
     Each dependent gets a '#update:'-message with the original
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1217
     receiver as argument."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1218
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1219
    self changed:nil
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1220
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1221
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1222
changed:aParameter
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1223
    "notify all dependents that the receiver has changed somehow.
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1224
     Each dependent gets a '#update:'-message with aParameter
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1225
     as argument."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1226
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1227
    self changed:aParameter with:nil
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1228
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1229
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1230
changed:aParameter with:anArgument
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1231
    "notify all dependents that the receiver has changed somehow.
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1232
     Each dependent gets a  '#update:with:from:'-message, with aParameter
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1233
     and anArgument as arguments."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1234
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1235
    self dependentsDo:[:dependent | 
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1236
	dependent update:aParameter with:anArgument from:self
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1237
    ]
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1238
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1239
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1240
update:aParameter
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1241
    "the message is sent to a dependent, when one of the objects
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1242
     on whom the receiver depends, has changed. The argument aParameter
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1243
     is either the changed object or the argument to the #changed: message.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1244
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1245
     Default behavior here is to do nothing"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1246
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1247
    ^ self
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1248
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1249
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1250
update:aParameter with:anArgument
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1251
    "dependent is notified of some change -
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1252
     Default is to try update:"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1253
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1254
    ^ self update:aParameter
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1255
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1256
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1257
update:aParameter with:anArgument from:sender
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1258
    "dependent is notified of some change -
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1259
     Default is to try update:with:"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1260
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1261
    ^ self update:aParameter with:anArgument
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1262
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1263
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1264
updateRequest
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1265
    "return true, if an update request is granted.
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1266
     Default here is to grant updates - may be used
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1267
     to lock updates if someone is making other changes
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1268
     from within an update. Or if someone has locked its
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1269
     state and does not want others to change things.
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1270
     However, these dependents must all honor the
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1271
     changeRequest - ifTrue - change protocol. I.e. they
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1272
     must first ask all others via changeRequest, and only do the change
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1273
     it returns true. The others must decide in updateRequest and
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1274
     return true if they think a change is ok."
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1275
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1276
    ^ true
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1277
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1278
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1279
updateRequest:aSymbol
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1280
    "return true, if an update request is granted.
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1281
     Default here a simple updateRequest"
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1282
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1283
    ^ self updateRequest
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1284
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1285
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1286
!Object methodsFor:'cleanup'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1287
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1288
lowSpaceCleanup
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1289
    "ignored here - redefined in some classes to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1290
     cleanup in low-memory situations"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1291
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1292
    ^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1293
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1294
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1295
!Object methodsFor:'comparing'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1296
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1297
= anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1298
    "return true, if the receiver and the arg have the same structure"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1299
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1300
    ^ self == anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1301
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1302
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1303
== anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1304
    "return true, if the receiver and the arg are the same object"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1305
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1306
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1307
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1308
    RETURN ( (self == anObject) ? true : false );
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1309
%}
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1310
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1311
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1312
hash
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1313
    "return an Integer useful as a hash key for the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1314
     This hash should return same values for objects with same
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1315
     contents (i.e. use this to hash on structure)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1316
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1317
    ^ self identityHash
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1318
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1319
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1320
identityHash
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1321
    "return an Integer useful as a hash key for the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1322
     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
  1323
     this to hash on identity of objects).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1324
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1325
     We cannot use the Objects address (as other smalltalks do) since
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1326
     no object-table exists and the hashval must not change when objects
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1327
     are moved by the collector. Therefore we assign each object a unique
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1328
     Id in the object header itself as its hashed upon.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1329
     (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
  1330
     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
  1331
     object header will be needed, adding 4 bytes to every object. Alternatively,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1332
     hashed-upon objects could add an instvar containing the hash value."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1333
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1334
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1335
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1336
    REGISTER unsigned hash;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1337
    static unsigned nextHash = 0;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1338
    OBJ cls;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1339
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1340
    if (__isNonNilObject(self)) {
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1341
	hash = __GET_HASH(self);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1342
	if (hash == 0) {
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1343
	    hash = nextHash++;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1344
	    __SET_HASH(self, hash);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1345
	    hash = __GET_HASH(self);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1346
	    if (hash == 0) {
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1347
		hash = nextHash++;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1348
		__SET_HASH(self, hash);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1349
		hash = __GET_HASH(self);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1350
	    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1351
	}
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1352
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1353
	/*
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1354
	 * now, we got 11 bits for hashing;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1355
	 * make it as large as possible; since most hashers use the returned
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1356
	 * key and take it modulu some prime number, this will allow for
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1357
	 * better distribution (i.e. bigger empty spaces) in hashed collection.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1358
	 * we could shift it up to the 30 bit limit - not making it negative.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1359
	 */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1360
	RETURN ( __MKSMALLINT(hash << __HASH_SHIFT__) );
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1361
    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1362
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1363
    ^ 0 "never reached, since redefined in UndefinedObject and SmallInteger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1364
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1365
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1366
isNil
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1367
    "return true, if the receiver is nil"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1368
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1369
    ^ false
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1370
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1371
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1372
notNil
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1373
    "return true, if the receiver is not nil"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1374
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1375
    ^ true
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1376
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1377
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1378
~= anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1379
    "return true, if the receiver and the arg do not have the same structure"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1380
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1381
    ^ (self = anObject) not
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1382
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1383
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1384
~~ anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1385
    "return true, if the receiver and the arg are not the same object"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1386
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1387
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1388
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1389
    RETURN ( (self == anObject) ? false : true );
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1390
%}
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1391
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1392
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1393
!Object methodsFor:'converting'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1394
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1395
asValue
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1396
    "return a valueHolder for for the receiver"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1397
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1398
    ^ ValueHolder with:self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1399
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1400
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1401
!Object methodsFor:'copying'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1402
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1403
copy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1404
    "return a copy of the receiver - defaults to shallowcopy here.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1405
     Notice, that copy does not copy dependents."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1406
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1407
    ^ self shallowCopy postCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1408
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1409
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1410
deepCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1411
    "return a copy of the object with all subobjects also copied.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1412
     This method DOES handle cycles/self-refs; however the receivers
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1413
     class is not copied (to avoid the 'total' copy).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1414
     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
  1415
     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
  1416
     copied object does not include duplicates (or you do not care) and
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1417
     no cycles, you can use the old simpleDeepCopy, which avoids this overhead,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1418
     but may run into trouble.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1419
     Notice, that copy does not copy dependents."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1420
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1421
    ^ self deepCopyUsing:(IdentityDictionary new)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1422
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1423
    "an example which is not handled by the old deepCopy:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1424
    
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1425
     |a|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1426
     a := Array new:3.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1427
     a at:3 put:a.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1428
     a deepCopy inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1429
    "
1129
2734bcd503fe Fix typo in comment.
Stefan Vogel <sv@exept.de>
parents: 1119
diff changeset
  1430
2734bcd503fe Fix typo in comment.
Stefan Vogel <sv@exept.de>
parents: 1119
diff changeset
  1431
    "Modified: 27.3.1996 / 16:31:20 / stefan"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1432
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1433
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1434
deepCopyError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1435
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1436
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1437
    "raise a signal, that deepCopy is not allowed for this object"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1438
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1439
    ^ DeepCopyErrorSignal raise
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1440
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1441
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1442
deepCopyUsing:aDictionary
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1443
    "a helper for deepCopy; return a copy of the object with 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1444
     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
  1445
     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
  1446
     This method DOES handle cycles/self references."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1447
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1448
    |myClass aCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1449
     sz "{ Class: SmallInteger }" 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1450
     iOrig iCopy|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1451
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1452
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1453
    myClass isVariable ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1454
	sz := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1455
	aCopy := myClass basicNew:sz.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1456
    ] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1457
	sz := 0.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1458
	aCopy := myClass basicNew
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1459
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1460
    aCopy setHashFrom:self.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1461
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1462
    aDictionary at:self put:aCopy.
143
5ebe463ba109 got rid of globals;
claus
parents: 113
diff changeset
  1463
5ebe463ba109 got rid of globals;
claus
parents: 113
diff changeset
  1464
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1465
     copy indexed instvars - if any
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1466
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1467
    sz ~~ 0 ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1468
	myClass isBits ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1469
	    "block-copy indexed instvars"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1470
	    aCopy replaceFrom:1 to:sz with:self startingAt:1
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1471
	] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1472
	    "individual deep copy the indexed variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1473
	    1 to:sz do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1474
		iOrig := self basicAt:i.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1475
		iOrig notNil ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1476
		    (aDictionary includesKey:iOrig) ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1477
			iCopy := aDictionary at:iOrig
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1478
		    ] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1479
			iCopy := iOrig deepCopyUsing:aDictionary.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1480
		    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1481
		    aCopy basicAt:i put:iCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1482
		]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1483
	    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1484
	]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1485
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1486
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1487
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1488
     copy the instance variables
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1489
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1490
    sz := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1491
    sz ~~ 0 ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1492
	1 to:sz do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1493
	    iOrig := self instVarAt:i.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1494
	    iOrig notNil ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1495
		(aDictionary includesKey:iOrig) ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1496
		    iCopy := aDictionary at:iOrig
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1497
		] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1498
		    iCopy := iOrig deepCopyUsing:aDictionary.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1499
		].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1500
		aCopy instVarAt:i put:iCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1501
	    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1502
	].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1503
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1504
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1505
    ^ aCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1506
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1507
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1508
postCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1509
    "this is for compatibility with ST-80 code, which uses postCopy for
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1510
     cleanup after copying, while ST/X passes the original in postCopyFrom:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1511
     (see there)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1512
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1513
    ^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1514
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1515
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1516
postCopyFrom:original
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1517
    "sent to a freshly deep-copied object to give it a chance to adjust things.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1518
     (a font could flush its device-handle for example). 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1519
     Notice, that for Sets/Dicts etc. a rehash is not needed, since the deepCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1520
     will have the same hash key as the receiver (as long as ST/X provides the 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1521
     setHash: functionality)."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1522
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1523
    "for ST-80 compatibility, we try postCopy here ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1524
    ^ self postCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1525
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1526
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1527
setHashFrom:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1528
    "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
  1529
     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
  1530
     Smalltalks, and may not be available in future ST/X versions.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1531
     DO NEVER use this for normal application code."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1532
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1533
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1534
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1535
    REGISTER unsigned h;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1536
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1537
    if (__isNonNilObject(self) && __isNonNilObject(anObject)) {
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1538
	h = __GET_HASH(anObject);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1539
	__SET_HASH(self, h);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1540
	RETURN (self);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1541
    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1542
%}
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1543
.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1544
    self primitiveFailed    "neither receiver not arg may be nil or SmallInteger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1545
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1546
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1547
shallowCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1548
    "return a copy of the object with shared subobjects (a shallow copy)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1549
     i.e. the copy shares referenced instvars with its original."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1550
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1551
    |myClass aCopy 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1552
     sz "{ Class: SmallInteger }" |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1553
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1554
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1555
    myClass isVariable ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1556
	sz := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1557
	aCopy := myClass basicNew:sz.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1558
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1559
	"copy the indexed variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1560
	1 to:sz do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1561
	    aCopy basicAt:i put:(self basicAt:i) 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1562
	]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1563
    ] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1564
	aCopy := myClass basicNew
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1565
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1566
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1567
    "copy the instance variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1568
    sz := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1569
    1 to:sz do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1570
	aCopy instVarAt:i put:(self instVarAt:i) 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1571
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1572
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1573
    ^ aCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1574
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1575
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1576
shallowCopyForFinalization
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1577
    "this is used to aquire a copy to be used for finalization -
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1578
     (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
  1579
     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
  1580
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1581
    ^ self shallowCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1582
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1583
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1584
simpleDeepCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1585
    "return a copy of the object with all subobjects also copied.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1586
     This method does NOT handle cycles - but is included to allow this 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1587
     slightly faster copy in situations where it is known that
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1588
     no recursive references occur (LargeIntegers for example).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1589
     NOTICE: you will run into trouble, when trying this with recursive
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1590
     objects (usually recursionInterrupt or memory-alert).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1591
     This method corresponds to the 'traditional' deepCopy found in
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1592
     the Blue book."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1593
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1594
    |myClass aCopy 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1595
     sz "{ Class: SmallInteger }" |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1596
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1597
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1598
    myClass isVariable ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1599
	sz := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1600
	aCopy := myClass basicNew:sz.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1601
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1602
	"copy the indexed variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1603
	1 to:sz do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1604
	    aCopy basicAt:i put:((self basicAt:i) simpleDeepCopy)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1605
	]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1606
    ] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1607
	aCopy := myClass basicNew 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1608
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1609
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1610
    "copy the instance variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1611
    sz := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1612
    1 to:sz do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1613
	aCopy instVarAt:i put:((self instVarAt:i) simpleDeepCopy)
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1616
    ^ aCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1617
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1618
    "a bad example (but ST/X should survive ...)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1619
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1620
     |a|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1621
     a := Array new:3.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1622
     a at:3 put:a.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1623
     a simpleDeepCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1624
    "
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
!Object methodsFor:'debugging'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1628
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1629
basicInspect
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1630
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1631
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1632
    "launch an inspector on the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1633
     this method should NOT be redefined in subclasses."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1634
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1635
    Inspector isNil ifTrue:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  1636
        "
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  1637
         for systems without GUI
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  1638
        "
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  1639
        Transcript showCR:'no Inspector'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1640
    ] ifFalse:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  1641
        Inspector openOn:self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1642
    ]
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  1643
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  1644
    "Modified: 18.5.1996 / 15:43:25 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1645
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1646
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1647
inspect
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1648
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1649
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1650
    "launch an inspector on the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1651
     this method (or better: inspectorClass) can be redefined in subclasses 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1652
     to start special inspectors."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1653
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1654
    |cls|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1655
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1656
    cls := self inspectorClass.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1657
    cls isNil ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1658
	^ self basicInspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1659
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1660
    cls openOn:self
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
     Object new inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1664
     (1 @ 2) inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1665
     Smalltalk inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1666
     #(1 2 3) asOrderedCollection inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1667
     (Color red) inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1668
     (Image fromFile:'bitmaps/garfield.gif') inspect
143
5ebe463ba109 got rid of globals;
claus
parents: 113
diff changeset
  1669
    "
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1670
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1671
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1672
inspectorClass
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1673
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1674
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1675
    "return the class to use for inspect. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1676
     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
  1677
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1678
    ^ Inspector
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1679
!
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
mustBeKindOf:aClass
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1682
    "for compatibility & debugging support: 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1683
     check if the receiver isKindOf:aClass and raise an error if not.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1684
     Notice:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1685
	it is VERY questionable, if it makes sense to add manual
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1686
	type checks to a dynamically typed language like smalltalk. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1687
	It will, at least, slow down performance,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1688
	make your code less reusable and clutter your code with stupid sends
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1689
	of this selector. Also, read the comment in isKindOf:, regarding the
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1690
	use of isXXX check methods.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1691
     You see: The author does not like this at all ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1692
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1693
    (self isKindOf:aClass) ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1694
	self error:'argument is not of expected type'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1695
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1696
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1697
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1698
obsoleteMethodWarning
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1699
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1700
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1701
    "in methods which are going to be obsoleted, a self send to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1702
     this method is used to tell programmers that a method is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1703
     used which is going to be removed in later ST/X versions.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1704
     Find all methods which will be obsolete soon by looking at senders
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1705
     of this message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1706
     Hopefully, this warning message is annoying enough for you to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1707
     change the code ... ;-)"
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
    self obsoleteMethodWarning:nil from:thisContext sender
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1710
!
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
obsoleteMethodWarning:message
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1713
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1714
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1715
    "in methods which are going to be obsoleted, a self send to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1716
     this method is used to tell programmers that a method is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1717
     used which is going to be removed in later ST/X versions.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1718
     Find all methods which will be obsolete soon by looking at senders
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1719
     of this message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1720
     Hopefully, this warning message is annoying enough for you to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1721
     change the code ... ;-)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1722
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1723
    self obsoleteMethodWarning:message from:thisContext sender
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1724
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1725
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1726
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
  1727
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1728
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1729
    "in methods which are going to be obsoleted, a self-send to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1730
     this method is used to tell programmers that a method is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1731
     used which is going to be removed in later ST/X versions.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1732
     Find all methods which will be obsolete soon by looking at senders
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1733
     of this message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1734
     Hopefully, this warning message is annoying enough for you to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1735
     change the code ... ;-)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1736
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1737
    |spec|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1738
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1739
    spec := aContext methodPrintString.
2136
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  1740
    ('WARNING: the ''' , spec , ''' method is obsolete.') errorPrintCR.
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  1741
    ('         And may not be present in future ST/X versions.') errorPrintCR.
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  1742
    ('         called from ' , aContext sender printString) errorPrintCR.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1743
    message notNil ifTrue:[
2136
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  1744
        '------>  ' errorPrint. message errorPrintCR
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1745
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1746
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1747
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1748
     Object obsoleteMethodWarning:'foo' from:thisContext sender sender
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1749
    "
2136
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  1750
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  1751
    "Modified: 10.1.1997 / 19:08:42 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1752
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1753
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1754
!Object methodsFor:'dependents access'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1755
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1756
addDependent:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1757
    "make the argument, anObject be a dependent of the receiver"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1758
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1759
    |wasBlocked|
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1760
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1761
    "/ 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
  1762
    "/ is possibly accessed from multiple threads.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1763
    "/ 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
  1764
    "/ faster execution.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1765
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1766
    wasBlocked := OperatingSystem blockInterrupts.
863
2c83fe958ca7 change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents: 861
diff changeset
  1767
    [
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1768
        |deps dep|
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1769
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1770
        deps := self dependents.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1771
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1772
        "/ to save a fair amount of memory in case of
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1773
        "/ many dependencies, we store a single dependent in
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1774
        "/ a WeakArray, and switch to a WeakSet if more dependents are
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1775
        "/ added.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1776
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1777
        deps isNil ifTrue:[
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1778
            self dependents:(WeakArray with:anObject)
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1779
        ] ifFalse:[
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1780
            deps class == WeakArray ifTrue:[
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1781
                dep := deps at:1.
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1782
                dep ~~ anObject ifTrue:[
1780
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1783
		    (dep isNil or:[dep == 0]) ifTrue:[
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1784
			deps at:1 put:anObject
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1785
		    ] ifFalse:[
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1786
                        self dependents:(WeakIdentitySet with:dep with:anObject)
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1787
		    ]
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1788
                ]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1789
            ] ifFalse:[
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1790
                deps add:anObject
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1791
            ]
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1792
        ]
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1793
    ] valueNowOrOnUnwindDo:[
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1794
        wasBlocked ifFalse:[
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1795
            OperatingSystem unblockInterrupts
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1796
        ]
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1797
    ]
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1798
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1799
    "Modified: 1.8.1996 / 14:21:20 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1800
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1801
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1802
dependents
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1803
    "return a Collection of dependents - nil if there is none.
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1804
     The default implementation here uses a global WeakDictionary to store
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1805
     dependents 
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1806
     This may be too slow for high frequency change&update,
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1807
     therefore, some classes (Model) redefine this for better performance.
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1808
     Notice the mentioning of a WeakDictionary - read the classes documentation."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1809
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1810
    ^ Dependencies at:self ifAbsent:[nil]
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1811
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1812
    "Modified: 19.4.1996 / 12:36:46 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1813
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1814
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1815
dependents:aCollection
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1816
    "set the collection of dependents.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1817
     The default implementation here uses a global Dictionary to store
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1818
     dependents which may be too slow for high frequency change&update.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1819
     Therefore, some classes (Model) redefine this for better performance."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1820
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1821
    |wasBlocked|
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1822
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1823
    "/ 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
  1824
    "/ 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
  1825
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1826
    "/ faster execution.
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1827
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1828
    wasBlocked := OperatingSystem blockInterrupts.
863
2c83fe958ca7 change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents: 861
diff changeset
  1829
    [
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1830
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1831
            Dependencies removeKey:self ifAbsent:[]
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1832
        ] ifFalse:[
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1833
            Dependencies at:self put:aCollection
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1834
        ]
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1835
    ] valueNowOrOnUnwindDo:[
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1836
        wasBlocked ifFalse:[
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1837
            OperatingSystem unblockInterrupts
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1838
        ]
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1839
    ]
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1840
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1841
    "Modified: 1.8.1996 / 14:16:41 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1842
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1843
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1844
dependentsDo:aBlock
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1845
    "evaluate aBlock for all of my dependents"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1846
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1847
    |deps nwDeps|
783
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
    deps := self dependents.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1850
    deps notNil ifTrue:[
1780
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1851
        deps do:[:d | 
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1852
		    (d notNil and:[d ~~ 0]) ifTrue:[
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1853
			aBlock value:d
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1854
		    ]
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1855
		]
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1856
    ].
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1857
    nwDeps := self nonWeakDependents.
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1858
    (nwDeps notNil and:[nwDeps ~~ deps]) ifTrue:[
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1859
        nwDeps do:aBlock 
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1860
    ].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1861
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1862
    "Modified: 19.4.1996 / 12:35:54 / cg"
1098
e8543399e2a0 support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents: 1097
diff changeset
  1863
!
e8543399e2a0 support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents: 1097
diff changeset
  1864
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1865
release
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1866
    "remove all dependencies from the receiver"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1867
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1868
    self dependents:nil.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1869
    self nonWeakDependents:nil
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1870
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1871
    "Modified: 19.4.1996 / 10:55:36 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1872
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1873
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1874
removeDependent:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1875
    "make the argument, anObject be independent of the receiver"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1876
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1877
    |wasBlocked|
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1878
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1879
    "/ 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
  1880
    "/ is possibly accessed from multiple threads.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1881
    "/ 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
  1882
    "/ faster execution.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1883
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1884
    wasBlocked := OperatingSystem blockInterrupts.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1885
    [
1780
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1886
        |deps n d|
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1887
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1888
        deps := self dependents.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1889
        deps notNil ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1890
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1891
            "/ to save a fair amount of memory in case of
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1892
            "/ many dependencies, we store a single dependent in
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1893
            "/ a WeakArray, and switch to a WeakSet if more dependents are
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1894
            "/ added. Here we have to do the inverse ...
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1895
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1896
            deps class == WeakArray ifTrue:[
1780
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1897
                ((d := deps at:1) == anObject 
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1898
		or:[d isNil
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1899
		or:[d == 0]]) ifTrue:[
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1900
                    self dependents:nil
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1901
                ]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1902
            ] ifFalse:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1903
                deps remove:anObject ifAbsent:[].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1904
                (n := deps size) == 0 ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1905
                    self dependents:nil
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1906
                ] ifFalse:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1907
                    n == 1 ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1908
                        self dependents:(WeakArray with:(deps first))
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1909
                    ]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1910
                ]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1911
            ]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1912
        ]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1913
    ] valueNowOrOnUnwindDo:[
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1914
        wasBlocked ifFalse:[
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1915
            OperatingSystem unblockInterrupts
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1916
        ]
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1917
    ]
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1918
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1919
    "Modified: 19.7.1996 / 12:40:23 / cg"
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1920
! !
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1921
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1922
!Object methodsFor:'dependents access (nonWeak)'!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1923
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1924
addNonWeakDependent:anObject
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1925
    "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
  1926
     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
  1927
     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
  1928
     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
  1929
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1930
    |wasBlocked|
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1931
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1932
    "/ 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
  1933
    "/ is possibly accessed from multiple threads.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1934
    "/ 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
  1935
    "/ faster execution.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1936
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1937
    wasBlocked := OperatingSystem blockInterrupts.
863
2c83fe958ca7 change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents: 861
diff changeset
  1938
    [
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1939
        |deps dep|
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1940
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1941
        deps := self nonWeakDependents.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1942
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1943
        "/ to save a fair amount of memory in case of
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1944
        "/ many dependencies, we store a single dependent in
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1945
        "/ an Array, and switch to a Set if more dependents are
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1946
        "/ added.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1947
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1948
        deps isNil ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1949
            self nonWeakDependents:(Array with:anObject)
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1950
        ] ifFalse:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1951
            deps class == Array ifTrue:[
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1952
                dep := deps at:1.
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1953
                dep ~~ anObject ifTrue:[
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1954
                    self nonWeakDependents:(IdentitySet with:dep with:anObject)
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1955
                ]
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1956
            ] ifFalse:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1957
                deps add:anObject
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1958
            ]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1959
        ]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1960
    ] valueNowOrOnUnwindDo:[
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1961
        wasBlocked ifFalse:[
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1962
            OperatingSystem unblockInterrupts
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1963
        ]
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1964
    ]
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1965
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1966
    "Created: 19.4.1996 / 10:54:08 / cg"
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1967
    "Modified: 1.8.1996 / 14:22:12 / cg"
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1968
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1969
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1970
nonWeakDependents
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1971
    "return a Collection of nonWeakDependents - nil if there is none.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1972
     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
  1973
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1974
    NonWeakDependencies isNil ifTrue:[^nil].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1975
    ^ NonWeakDependencies at:self ifAbsent:[nil]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1976
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1977
    "Created: 19.4.1996 / 10:55:06 / cg"
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1978
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1979
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1980
nonWeakDependents:aCollection
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1981
    "set the collection of nonWeak dependents.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1982
     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
  1983
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1984
    [
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1985
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1986
            NonWeakDependencies removeKey:self ifAbsent:[]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1987
        ] ifFalse:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1988
            NonWeakDependencies at:self put:aCollection
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1989
        ]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1990
    ] valueUninterruptably
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1991
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1992
    "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
  1993
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1994
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1995
removeNonWeakDependent:anObject
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1996
    "remove a nonWeak dependency from the receiver to the argument, anObject.
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1997
     (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
  1998
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1999
    |wasBlocked|
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2000
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2001
    "/ 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
  2002
    "/ is possibly accessed from multiple threads.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2003
    "/ 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
  2004
    "/ faster execution.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2005
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2006
    wasBlocked := OperatingSystem blockInterrupts.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2007
    [
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2008
        |deps n|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2009
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2010
        deps := self nonWeakDependents.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2011
        deps notNil ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2012
            deps class == Array ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2013
                (deps at:1) == anObject ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2014
                    self nonWeakDependents:nil
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2015
                ]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2016
            ] ifFalse:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2017
                deps remove:anObject ifAbsent:[].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2018
                (n := deps size) == 0 ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2019
                    self nonWeakDependents:nil
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2020
                ] ifFalse:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2021
                    n == 1 ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2022
                        self nonWeakDependents:(Array with:(deps first))
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2023
                    ]
1098
e8543399e2a0 support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents: 1097
diff changeset
  2024
                ]
e8543399e2a0 support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents: 1097
diff changeset
  2025
            ]
e8543399e2a0 support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents: 1097
diff changeset
  2026
        ]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2027
    ] valueNowOrOnUnwindDo:[
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2028
        wasBlocked ifFalse:[
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2029
            OperatingSystem unblockInterrupts
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2030
        ]
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2031
    ]
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2032
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2033
    "Created: 19.4.1996 / 11:44:44 / cg"
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2034
    "Modified: 19.7.1996 / 12:42:08 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2035
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2036
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2037
!Object methodsFor:'error handling'!
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
appropriateDebugger:aSelector
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2040
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2041
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2042
    "return an appropriate debugger to use.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2043
     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
  2044
     the DebugView, return MiniDebugger (as a last chance) otherwise abort."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2045
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2046
    |context|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2047
1678
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2048
    "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
  2049
1685
5f867e93af8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1684
diff changeset
  2050
    (Processor isNil 
1684
98ce4d199c9b scheisse
Claus Gittinger <cg@exept.de>
parents: 1678
diff changeset
  2051
    or:[Processor activeProcessIsSystemProcess]) ifTrue:[
1678
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2052
        ^ MiniDebugger
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2053
    ].
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2054
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2055
    context := thisContext.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2056
    context := context sender.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2057
    [context notNil] whileTrue:[
1678
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2058
        ((context receiver class == Debugger) 
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2059
         and:[context selector == aSelector]) ifTrue:[
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2060
            "we are already in some Debugger"
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2061
            (Debugger == MiniDebugger) ifTrue:[
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2062
                "we are already in the MiniDebugger"
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2063
                ErrorRecursion ifFalse:[
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2064
                    Smalltalk fatalAbort:'recursive error ...'
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2065
                ]
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2066
            ].
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2067
            MiniDebugger isNil ifTrue:[
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2068
                Smalltalk fatalAbort:'no debugger'
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2069
            ].
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2070
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2071
            "ok, an error occured while in the graphical debugger;
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2072
             lets try MiniDebugger"
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2073
            ^ MiniDebugger
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2074
        ].
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2075
        context := context sender
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2076
    ].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2077
    "not within Debugger - no problem"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2078
    ^ Debugger
1678
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2079
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2080
    "Modified: 23.9.1996 / 12:14:52 / stefan"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2081
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2082
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2083
doesNotUnderstand:aMessage
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2084
    "this message is sent by the runtime system (VM) when
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2085
     a message is not understood by some object (i.e. there
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2086
     is no method for that selector). The original message has
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2087
     been packed into aMessage (i.e. the receiver, selector and
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2088
     any arguments) and the original receiver is then sent the
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2089
     #doesNotUnderstand: message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2090
     Here, we raise another signal which usually enters the debugger.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2091
     You can of course redefine #doesNotUnderstand: in your classes
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2092
     to implement message delegation, 
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2093
     or handle the MessageNotUnderstoodSignal gracefully."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2094
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2095
    |sel errorString cls sender|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2096
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2097
    "/ handle the case of an error during early startup
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2098
    "/ (output streams not yet initialized)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2099
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2100
    Stdout isNil ifTrue:[
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2101
        Smalltalk fatalAbort:'error during init: ' , aMessage selector , ' not understood'.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2102
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2103
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2104
    (sel := aMessage selector) isNil ifTrue:[
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2105
        "/
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2106
        "/ happens when things go mad, or a method has been
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2107
        "/ called by valueWithReceiver: with a wrong receiver.
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2108
        "/ To avoid later trouble (when concatenating strings),
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2109
        "/ replace the selector by some (nonNil) string
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2110
        "/
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2111
        sel := '(nil)'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2112
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2113
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2114
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2115
    "/ extract the class that should have implemented the message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2116
    "/ (in case of a super-send, this is not the receivers class)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2117
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2118
    sender := thisContext sender.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2119
    cls := sender searchClass.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2120
    cls isNil ifTrue:[
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2121
        "it was NOT a super or directed send ..."
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2122
        cls := self class
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2123
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2124
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2125
    cls notNil ifTrue:[
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2126
        "/
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2127
        "/ displayString is better than 'cls name',
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2128
        "/ since it appends (obsolete) for outdated classes.
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2129
        "/ (this happens if you send messages to old instances
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2130
        "/  after changing a classes definition)
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2131
        "/
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2132
        errorString := cls displayString.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2133
    ] ifFalse:[    
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2134
        errorString := '(** nil-class **)'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2135
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2136
    errorString := errorString , ' does not understand: ' , sel.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2137
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2138
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2139
    "/ this only happens, when YOU play around with my classvars ...
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2140
    "/ (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
  2141
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2142
    MessageNotUnderstoodSignal isNil ifTrue:[
1674
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2143
        ^ self 
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2144
	    enterDebuggerWithMessage:'oops - MessageNotUnderstoodSignal is gone'
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2145
	    on:thisContext.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2146
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2147
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2148
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2149
    "/ 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
  2150
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2151
    ^ MessageNotUnderstoodSignal
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2152
                raiseRequestWith:aMessage
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2153
                     errorString:errorString
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2154
                              in:sender
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2155
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2156
    "Modified: 3.5.1996 / 11:51:45 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2157
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2158
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2159
elementBoundsError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2160
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2161
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2162
    "report an error that badElement is out of bounds 
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2163
     (i.e. cannot be put into that collection).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2164
     The error is reported by raising the ElementOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2165
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2166
    ^ ElementOutOfBoundsSignal raiseIn:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2167
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2168
    "Modified: 8.5.1996 / 09:12:45 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2169
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2170
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2171
elementNotCharacter
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2172
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2173
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2174
    "report an error that object to be stored is no Character.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2175
     (usually when storing into Strings).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2176
     The error is reported by raising the ElementOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2177
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2178
    ^ ElementOutOfBoundsSignal raiseIn:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2179
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2180
    "Modified: 8.5.1996 / 09:12:49 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2181
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2182
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2183
elementNotInteger
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2184
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2185
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2186
    "report an error that object to be stored is not Integer.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2187
     (in collections that store integers only).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2188
     The error is reported by raising the ElementOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2189
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2190
    ^ ElementOutOfBoundsSignal raiseIn:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2191
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2192
    "Modified: 8.5.1996 / 09:12:51 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2193
!
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
enterDebuggerWith:anException message:aString
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2196
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2197
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2198
    "enter the debugger with error-message aString"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2199
1674
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2200
    ^ self 
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2201
	enterDebuggerWithMessage:aString 
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2202
	on:anException suspendedContext
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2203
!
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2204
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2205
enterDebuggerWithMessage:aString on:aContext 
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2206
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2207
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2208
    "enter the debugger with error-message aString.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2209
     The first visible context shown there is aContext 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2210
     (this allows intermediate helpers to hide themselfes from what is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2211
     presented to the user)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2212
1094
af10927dc0f2 standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
  2213
    |debugger msg|
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2214
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2215
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2216
     if there is no debugger, exit smalltalk
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2217
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2218
    Debugger isNil ifTrue:[
1094
af10927dc0f2 standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
  2219
        msg := 'error: ' , aString.
af10927dc0f2 standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
  2220
af10927dc0f2 standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
  2221
        Smalltalk isStandAloneApp ifTrue:[
af10927dc0f2 standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
  2222
            Dialog notNil ifTrue:[
1097
14711c00f386 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2223
                (Dialog 
2136
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2224
                    confirm:msg title:(Smalltalk commandName)
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2225
                    yesLabel:'ignore' noLabel:'exit'
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2226
                ) ifTrue:[
1095
834d4fb13e9f standAlone changes
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  2227
                    ^ AbortSignal raise
1094
af10927dc0f2 standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
  2228
                ]
af10927dc0f2 standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
  2229
            ].
2136
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2230
            msg errorPrintCR.
1094
af10927dc0f2 standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
  2231
            OperatingSystem exit:1
af10927dc0f2 standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
  2232
        ].
2136
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2233
        msg errorPrintCR.
1094
af10927dc0f2 standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
  2234
        Smalltalk fatalAbort:'no Debugger defined'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2235
    ].
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  2236
783
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
     find an appropriate debugger to use
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2239
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2240
    debugger := self appropriateDebugger:#'enter:withMessage:'.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2241
    ^ debugger enter:aContext withMessage:aString.
1094
af10927dc0f2 standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
  2242
2136
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2243
    "Modified: 10.1.1997 / 19:11:52 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2244
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2245
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2246
error
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2247
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2248
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2249
    "report error that an error occured.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2250
     The error is reported by raising the ErrorSignal exception."
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2251
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2252
    ^ ErrorSignal raiseIn:thisContext sender
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2253
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2254
    "Modified: 8.5.1996 / 09:13:01 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2255
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2256
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2257
error:aString
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2258
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2259
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2260
    "enter debugger with error-message aString.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2261
     The error is reported by raising the ErrorSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2262
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2263
    ^ ErrorSignal raiseRequestWith:#error: 
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2264
                       errorString:aString
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2265
                                in:thisContext sender
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2266
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2267
    "Modified: 8.5.1996 / 09:13:04 / cg"
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2268
!
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2269
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2270
error:aString in:aContext
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2271
    "{ Pragma: +optSpace }"
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2272
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2273
    "enter debugger with error-message aString.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2274
     The error is reported by raising the ErrorSignal exception."
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2275
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2276
    ^ ErrorSignal raiseRequestWith:#error: 
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2277
                       errorString:aString
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2278
                                in:aContext
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2279
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2280
    "Created: 8.5.1996 / 09:07:59 / cg"
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2281
    "Modified: 8.5.1996 / 09:13:06 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2282
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2283
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2284
errorKeyNotFound:aKey
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2285
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2286
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2287
    "report an error that a key was not found in a collection.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2288
     The error is reported by raising the KeyNotFoundSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2289
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2290
    ^ KeyNotFoundSignal raiseRequestWith:aKey in:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2291
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2292
    "Modified: 8.5.1996 / 09:13:08 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2293
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2294
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2295
errorNotFound
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2296
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2297
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2298
    "report an error that no element was found in a collection.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2299
     The error is reported by raising the NotFoundSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2300
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2301
    ^ NotFoundSignal raiseIn:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2302
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2303
    "Modified: 8.5.1996 / 09:13:11 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2304
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2305
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2306
halt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2307
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2308
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2309
    "enter debugger with halt-message.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2310
     The error is reported by raising the HaltSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2311
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2312
    ^ HaltSignal raiseIn:thisContext sender.
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2313
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2314
    "Modified: 8.5.1996 / 09:12:38 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2315
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2316
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2317
halt:aString
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2318
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2319
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2320
    "enter debugger with halt-message.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2321
     The error is reported by raising the HaltSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2322
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2323
    ^ HaltSignal raiseRequestWith:#halt: 
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2324
                      errorString:aString
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2325
                               in:thisContext sender
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2326
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2327
    "Modified: 8.5.1996 / 09:13:23 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2328
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2329
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2330
implementedBySubclass
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2331
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2332
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2333
    "this is sent by ST/V code - its the same as #subclassResponsibility"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2334
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2335
    ^ self subclassResponsibility
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2336
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2337
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2338
indexNotInteger
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2339
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2340
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2341
    "report an error that index is not an Integer.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2342
     (when accessing collections indexed by an integer key).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2343
     The error is reported by raising the NonIntegerIndexSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2344
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2345
    ^ NonIntegerIndexSignal raiseIn:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2346
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2347
    "Modified: 8.5.1996 / 09:13:37 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2348
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2349
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2350
integerCheckError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2351
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2352
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2353
    "generated when a variable declared with an integer type gets a bad
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2354
     value assigned"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2355
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2356
    ^ self error:'bad assign of ' , self printString , 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2357
		  ' (' , self class name , ') to integer-typed variable'
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2358
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2359
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2360
invalidMessage 
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2361
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2362
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2363
    "this is sent by ST/V code - its the same as #shouldNotImplement"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2364
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2365
    ^ self shouldNotImplement
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2366
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2367
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2368
mustBeRectangle
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2369
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2370
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2371
    "report an argument-not-rectangle-error"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2372
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2373
    ^ self error:'argument must be a Rectangle'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2374
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2375
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2376
mustBeString
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2377
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2378
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2379
    "report an argument-not-string-error"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2380
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2381
    ^ self error:'argument must be a String'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2382
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2383
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2384
notIndexed
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2385
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2386
1611
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2387
    "report an error that receiver has no indexed instance variables.
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2388
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2389
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2390
    ^ SubscriptOutOfBoundsSignal 
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2391
        raiseErrorString:'receiver has no indexed variables'
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2392
        in:thisContext sender
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2393
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2394
    "Modified: 26.7.1996 / 16:43:13 / cg"
783
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2397
primitiveFailed
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2398
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2399
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2400
    "report an error that some primitive code failed.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2401
     The error is reported by raising the PrimitiveFailureSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2402
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2403
    ^ PrimitiveFailureSignal raiseIn:(thisContext sender)
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2404
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2405
    "Modified: 8.5.1996 / 09:14:07 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2406
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2407
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2408
shouldNotImplement
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2409
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2410
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2411
    "report an error that this message should not be implemented"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2412
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2413
    ^ self error:'method not appropriate for this class'
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2414
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2415
    "Modified: 8.5.1996 / 09:09:44 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2416
!
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
subclassResponsibility
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2419
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2420
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2421
    "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
  2422
     subclass"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2423
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2424
    ^ self error:'method must be reimplemented in subclass' in:thisContext sender
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2425
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2426
    "Modified: 8.5.1996 / 09:09:26 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2427
!
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
subscriptBoundsError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2430
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2431
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2432
    "report an error that some index is out of bounds.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2433
     (when accessing indexable collections).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2434
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2435
1611
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2436
    ^ SubscriptOutOfBoundsSignal 
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2437
        raiseIn:thisContext sender
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2438
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2439
    "Modified: 26.7.1996 / 16:45:42 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2440
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2441
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2442
subscriptBoundsError:anIndex
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2443
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2444
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2445
    "report an error that anIndex is out of bounds.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2446
     (when accessing indexable collections).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2447
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2448
1021
b0c7f4a235fb show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
  2449
    ^ SubscriptOutOfBoundsSignal 
b0c7f4a235fb show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
  2450
        raiseRequestWith:anIndex 
b0c7f4a235fb show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
  2451
        errorString:('subscript (' , anIndex printString , ') out of bounds')
b0c7f4a235fb show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
  2452
        in:thisContext sender
b0c7f4a235fb show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
  2453
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2454
    "Modified: 8.5.1996 / 09:14:34 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2455
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2456
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2457
typeCheckError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2458
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2459
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2460
    "generated when a variable declared with a type hint gets a bad
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2461
     value assigned"
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
    ^ self error:'bad assign of ' , self printString ,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2464
		  ' (' , self class name , ') to typed variable'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2465
! !
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
!Object methodsFor:'evaluation'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2468
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2469
value
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2470
    "return the receiver itself.
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2471
     This allows every object to be used where blocks or valueHolders
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2472
     are typically used, and allows for valueHolders and blocks to be
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2473
     used interchangably in some situations.
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2474
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2475
     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
  2476
     style ... (the idea was borrowed from the Self language).
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2477
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2478
     WARNING: dont 'optimize' away ifXXX: blocks 
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2479
              (i.e. do NOT replace 
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2480
                        foo ifTrue:[var1] ifFalse:[var2]
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2481
               by:
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2482
                        foo ifTrue:var1 ifFalse:var2
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2483
              )
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2484
              - the compilers will only generate inline code for the if, 
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2485
                iff the argument(s) are blocks - otherwise, a true send is
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2486
                generated.
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2487
              This 'oprimization' will work semantically correct,
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2488
              but execute SLOWER instead."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2489
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2490
    ^ self
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2491
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2492
    "
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2493
     #(1 2 3 4) indexOf:5 ifAbsent:0     
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2494
     #(1 2 3 4) indexOf:5 ifAbsent:[0]     
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2495
     1 > 2 ifTrue:['yes'] ifFalse:['no']  
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2496
     1 > 2 ifTrue:'yes' ifFalse:'no'       
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2497
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2498
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2499
    "DO NOT DO THIS (its slower)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2500
     (1 > 4) ifTrue:'oops' ifFalse:'ok'
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
     USE (the compiler optimizes blocks in if/while):
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2503
     (1 > 4) ifTrue:['oops'] ifFalse:['ok']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2504
    "
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2505
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2506
    "Modified: 3.5.1996 / 11:57:08 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2507
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2508
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2509
!Object methodsFor:'initialization'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2510
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2511
initialize
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2512
    "just to ignore initialize to objects which do not need it"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2513
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2514
    ^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2515
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2516
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2517
!Object methodsFor:'interest'!
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2518
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2519
addInterest:anInterest
1762
e7267ff590ff Fix misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1751
diff changeset
  2520
    "install an interest forwarder.
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2521
     Here, we use the nonWeakDependencies."
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2522
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2523
    self addNonWeakDependent:anInterest
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2524
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2525
    "Created: 14.10.1996 / 22:27:34 / stefan"
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2526
!
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2527
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2528
expressInterestIn:aspect for:anObject sendBack:aSelector
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2529
    "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
  2530
     changes aspect."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2531
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2532
    "/ 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
  2533
    "/ 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
  2534
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2535
    self addInterest:(InterestConverter 
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2536
                            destination:anObject 
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2537
                            selector:aSelector 
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2538
                            aspect:aspect)
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2539
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2540
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2541
     |p b|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2542
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2543
     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
  2544
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2545
     p := Point new.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2546
     Transcript showCR:'interest in #foo:'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2547
     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
  2548
     p x:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2549
     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
  2550
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2551
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2552
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2553
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2554
     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
  2555
     p changed:#foo.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2556
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2557
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2558
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2559
     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
  2560
     p retractInterestIn:#foo for:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2561
     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
  2562
     p changed:#foo.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2563
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2564
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2565
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2566
     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
  2567
     p expressInterestIn:#bar for:b sendBack:#value.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2568
     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
  2569
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2570
     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
  2571
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2572
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2573
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2574
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2575
     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
  2576
     p expressInterestIn:#foo for:b sendBack:#value.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2577
     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
  2578
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2579
     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
  2580
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2581
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2582
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2583
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2584
     Transcript showCR:'no more interests:'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2585
     p retractInterestsFor:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2586
     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
  2587
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2588
     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
  2589
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2590
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2591
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2592
     p release.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2593
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2594
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2595
    "Created: 19.4.1996 / 10:26:22 / cg"
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2596
    "Modified: 19.4.1996 / 12:34:08 / cg"
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2597
    "Modified: 14.10.1996 / 22:28:20 / stefan"
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2598
!
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2599
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2600
interests
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2601
    "return a Collection of interests - nil if there is none.
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2602
     Here, we use the nonWeakDependents for interests."
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2603
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2604
    ^ self nonWeakDependents
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2605
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2606
    "Created: 14.10.1996 / 22:20:51 / stefan"
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2607
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2608
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2609
onChangeSend:aSelector to:anObject
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2610
    "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
  2611
     changes."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2612
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2613
    "/ 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
  2614
    "/ 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
  2615
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2616
    self addInterest:(InterestConverter 
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2617
                          destination:anObject 
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2618
                          selector:aSelector)
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2619
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2620
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2621
     |p b|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2622
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2623
     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
  2624
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2625
     p := Point new.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2626
     p onChangeSend:#value to:b.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2627
     p x:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2628
     Transcript showCR:'now changing'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2629
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2630
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2631
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2632
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2633
     Transcript showCR:'now changing'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2634
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2635
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2636
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2637
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2638
     Transcript showCR:'no more interest'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2639
     p retractInterestsFor:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2640
     Transcript showCR:'now changing again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2641
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2642
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2643
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2644
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2645
     Transcript showCR:'interest again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2646
     p onChangeSend:#value to:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2647
     Transcript showCR:'now changing again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2648
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2649
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2650
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2651
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2652
    "Created: 19.4.1996 / 10:26:38 / cg"
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2653
    "Modified: 19.4.1996 / 12:34:26 / cg"
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2654
    "Modified: 14.10.1996 / 22:28:27 / stefan"
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2655
!
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2656
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2657
removeInterest:anInterest
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2658
    "remove an interest forwarder.
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2659
     Here, we use the nonWeakDependencies."
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2660
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2661
    self removeNonWeakDependent:anInterest
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2662
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2663
    "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
  2664
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2665
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2666
retractInterestIn:aspect for:someOne
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2667
    "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
  2668
     (as installed with #expressInterestIn:for:sendBack:)."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2669
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2670
    "/ for now, remove the interestConverter.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2671
    "/ 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
  2672
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2673
    |deps|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2674
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2675
    deps := self interests.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2676
    deps notNil ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2677
        deps do:[:dep |
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2678
            (dep isMemberOf:InterestConverter) ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2679
                dep destination == someOne ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2680
                    dep aspect == aspect ifTrue:[
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2681
                        self removeInterest:dep.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2682
                        ^ self
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2683
                    ]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2684
                ]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2685
            ]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2686
        ]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2687
    ].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2688
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2689
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2690
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2691
     |p b|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2692
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2693
     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
  2694
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2695
     p := Point new.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2696
     Transcript showCR:'interest in #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2697
     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
  2698
     p x:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2699
     Transcript showCR:'now changing #bar'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2700
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2701
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2702
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2703
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2704
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2705
     p changed:#foo.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2706
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2707
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2708
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2709
     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
  2710
     p retractInterestIn:#foo for:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2711
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2712
     p changed:#foo.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2713
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2714
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2715
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2716
     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
  2717
     p expressInterestIn:#bar for:b sendBack:#value.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2718
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2719
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2720
     Transcript showCR:'now changing #bar'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2721
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2722
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2723
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2724
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2725
     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
  2726
     p expressInterestIn:#foo for:b sendBack:#value.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2727
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2728
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2729
     Transcript showCR:'now changing #bar'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2730
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2731
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2732
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2733
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2734
     Transcript showCR:'no more interests'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2735
     p retractInterestsFor:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2736
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2737
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2738
     Transcript showCR:'now changing #bar'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2739
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2740
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2741
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2742
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2743
    "Created: 19.4.1996 / 10:27:11 / cg"
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2744
    "Modified: 19.4.1996 / 12:29:52 / cg"
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2745
    "Modified: 14.10.1996 / 22:21:19 / stefan"
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2746
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2747
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2748
retractInterestsFor:someOne
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2749
    "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
  2750
     (as installed with #onChangeSend:to:)."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2751
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2752
    "/ for now, remove the interestConverter.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2753
    "/ 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
  2754
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2755
    |coll deps|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2756
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2757
    "/ 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
  2758
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2759
    coll := IdentitySet new.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2760
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2761
    deps := self interests.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2762
    deps notNil ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2763
        deps do:[:dep |
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2764
            (dep isMemberOf:InterestConverter) ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2765
                dep destination == someOne ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2766
                    coll add:dep.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2767
                ]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2768
            ]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2769
        ].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2770
    ].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2771
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2772
    coll do:[:dep |
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2773
        self removeInterest:dep.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2774
    ].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2775
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2776
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2777
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2778
     |p b|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2779
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2780
     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
  2781
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2782
     p := Point new.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2783
     p onChangeSend:#value to:b.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2784
     p x:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2785
     Transcript showCR:'now changing'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2786
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2787
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2788
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2789
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2790
     Transcript showCR:'now changing'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2791
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2792
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2793
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2794
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2795
     Transcript showCR:'no more interest'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2796
     p retractInterestsFor:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2797
     Transcript showCR:'now changing again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2798
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2799
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2800
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2801
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2802
     Transcript showCR:'interest again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2803
     p onChangeSend:#value to:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2804
     Transcript showCR:'now changing again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2805
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2806
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2807
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2808
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2809
    "Created: 19.4.1996 / 10:23:46 / cg"
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2810
    "Modified: 19.4.1996 / 12:30:03 / cg"
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2811
    "Modified: 14.10.1996 / 22:21:25 / stefan"
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2812
! !
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2813
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2814
!Object methodsFor:'interrupt handling'!
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
childSignalInterrupt
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2817
    "death of a child process (unix process) - do nothing"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2818
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2819
    ^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2820
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2821
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2822
customInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2823
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2824
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2825
    "a custom interrupt"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2826
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2827
    ^ self error:'custom interrupt'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2828
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2829
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2830
errorInterrupt:errorID with:aParameter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2831
    "subsystem error. The arguments errorID and aParameter are the values passed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2832
     to the 'errorInterruptWithIDAndParameter(id, param)' function, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2833
     which can be called from C subsystems to raise an (asynchronous)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2834
     error exception.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2835
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2836
     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
  2837
     used from other C subsystems too, to upcast errors.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2838
     Especially, for subsystems which call errorHandler functions asynchronously.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2839
     IDs (currently) used:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2840
	#DisplayError ..... x-error interrupt
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2841
	#XtError      ..... xt-error interrupt (Xt interface is not yet published)
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2842
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2843
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2844
    |handler|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2845
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2846
    handler := ObjectMemory registeredErrorInterruptHandlers at:errorID ifAbsent:nil.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2847
    handler notNil ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2848
	"/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2849
	"/ handler found; let it do whatever it wants ...
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2850
	"/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2851
	handler errorInterrupt:errorID with:aParameter.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2852
	^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2853
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2854
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2855
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2856
    "/ no handler - raise errorSignal passing the errorId as parameter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2857
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2858
    ^ ErrorSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2859
	raiseRequestWith:errorID 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2860
	errorString:('Subsystem error. ErrorID = ' , errorID printString)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2861
!
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
exceptionInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2864
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2865
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2866
    "exception interrupt - enter debugger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2867
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2868
    self error:'exception Interrupt'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2869
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2870
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2871
fpExceptionInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2872
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2873
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2874
    "a floating point exception occured - this one
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2875
     has to be handled differently since it comes asynchronous
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2876
     on some machines (for example, on machines with a separate FPU
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2877
     or superscalar architectures. Also, errors from within primitive code
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2878
     (or library functions such as GL) are sent via the Unix-signal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2879
     mechanism this way."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2880
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2881
    ^ Float domainErrorSignal raise
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2882
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2883
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2884
internalError:msg
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2885
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2886
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2887
    "this is triggered, when system hits some bad error,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2888
     such as corrupted class, corrupted method/selector array
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2889
     etc. The argument string gives some more information on what happened.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2890
     (for example, if you set an objects class to a smallInteger, nil etc). 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2891
     Its not guaranteed, that the system is in a working condition once
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2892
     this error occurred ...."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2893
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2894
    ^ self error:msg
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2895
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2896
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2897
ioInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2898
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2899
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2900
    "I/O (SIGIO/SIGPOLL) interrupt (supposed to be sent to Processor).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2901
     If we arrive here, there is either no handler (ObjMem>>ioInterruptHandler)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2902
     or it does not understand the ioInterrupt message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2903
     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
  2904
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2905
    self error:'I/O Interrupt - but no handler'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2906
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2907
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2908
memoryInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2909
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2910
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2911
    "out-of-memory interrupt and no handler - enter debugger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2912
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2913
    ^ self error:'almost out of memory'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2914
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2915
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2916
recursionInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2917
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2918
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2919
    "recursion limit (actually: stack overflow) interrupt.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2920
     This interrupt is triggered, when a process stack grows above
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2921
     its stackLimit - usually, this leads into the debugger, but
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2922
     could be cought and the stackLimit increased in the handler.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2923
     At the time we arrive here, the system has still some stack 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2924
     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
  2925
     debugging for a while.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2926
     If the signal is ignored, and the stack continues to grow, there
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2927
     will be a few more chances (and more interrupts) before the VM
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2928
     hard-terminates the process."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2929
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2930
    thisContext isRecursive ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2931
	^ RecursionInterruptSignal raise
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2932
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2933
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2934
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2935
schedulerInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2936
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2937
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2938
    "scheduler interrupt (supposed to be sent to Processor).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2939
     If we arrive here, either the Processor does not understand it,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2940
     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
  2941
     big trouble. Enter debugger."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2942
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2943
    self error:'schedulerInterrupt - but no Processor'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2944
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2945
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2946
signalInterrupt:signalNumber
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2947
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2948
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2949
    "unix signal occured - some signals are handled as Smalltalk Exceptions 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2950
     (SIGPIPE), others (SIGBUS) are rather fatal ...
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2951
     In any case, if a smalltalk-signal has been connected to the OS signal,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2952
     that one is raised.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2953
     TODO: add another argument, giving more detailed signal info (PC, VADDR,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2954
     exact cause etc.). This helps if segvs occur in primitive code.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2955
     Currently (temporary kludge), these are passed as global variables."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2956
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2957
    |box name here sig ignorable titles actions badContext msg pc addr|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2958
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2959
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2960
     special case - since SIGPIPE has an ST-signal associated
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
    (signalNumber == 13) ifTrue:[
2043
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  2963
        "SIGPIPE - write on a pipe with no one to read"
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  2964
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  2965
        ^ PipeStream brokenPipeSignal raise.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2966
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2967
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2968
    "if there has been an ST-signal installed, use it ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2969
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2970
    sig := OperatingSystem operatingSystemSignal:signalNumber.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2971
    sig notNil ifTrue:[
2043
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  2972
        ^ sig raise
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2973
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2974
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2975
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2976
     ... otherwise , bring up a box asking for what to do ...
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2977
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2978
    name := OperatingSystem nameForSignal:signalNumber.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2979
    here := thisContext.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2980
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2981
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2982
     the context, in which the signal occurred:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2983
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2984
    badContext := here sender.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2985
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2986
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2987
     ungrab - in case it happened in a box/popupview
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2988
     otherwise display stays locked
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2989
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2990
    Display notNil ifTrue:[
2043
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  2991
        Display ungrabPointer.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2992
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2993
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2994
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2995
     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
  2996
     since the system will retry the faulty instruction, which leads to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2997
     another signal - to avoid frustration, better not offer this option.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2998
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2999
    ignorable := (signalNumber ~~ OperatingSystem sigBUS)
2043
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3000
                  and:[signalNumber ~~ OperatingSystem sigILL
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3001
                  and:[signalNumber ~~ OperatingSystem sigSEGV]].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3002
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3003
    ignorable ifFalse:[
2043
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3004
        here isRecursive ifTrue:[
2132
05d2be2d280e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 2114
diff changeset
  3005
            'Object [hard error]: signal ' errorPrint. signalNumber errorPrintCR.
2043
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3006
            MiniDebugger enterWithMessage:'recursive signal'.
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3007
            ^ self
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3008
        ].
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3009
        "
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3010
         a hard signal - go into debugger immediately
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3011
        "
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3012
        msg := 'OS-signal: ', name.
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3013
        InterruptPcLow notNil ifTrue:[
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3014
            pc := InterruptPcLow + (InterruptPcHi bitShift:16).
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3015
            pc ~~ 0 ifTrue:[
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3016
                msg := msg , ' PC=' , (pc printStringRadix:16)
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3017
            ].
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3018
        ].
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3019
        InterruptAddrLow notNil ifTrue:[
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3020
            addr := InterruptAddrLow + (InterruptAddrHi bitShift:16).
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3021
            addr ~~ 0 ifTrue:[
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3022
                msg := msg , ' ADDR=' , (addr printStringRadix:16)
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3023
            ].
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3024
        ].
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3025
        Debugger enter:here withMessage:msg. 
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3026
        badContext return.
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3027
        ^ nil.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3028
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3029
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3030
    OptionBox isNil ifTrue:[
2043
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3031
        "
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3032
         a system without GUI ...
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3033
         go into minidebugger (if there is one)
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3034
        "
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3035
        MiniDebugger isNil ifTrue:[
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3036
            "
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3037
             a system without debugging facilities
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3038
             (i.e. a standalone system)
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3039
             output a message and exit.
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3040
            "
2136
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  3041
            ('Object [error]: exit due to Signal ' , name , ' - and no debugger.') errorPrintCR.
2043
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3042
            Smalltalk exit.
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3043
        ].
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3044
        MiniDebugger enterWithMessage:'Signal cought (' , name, ')'.
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3045
        ^ self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3046
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3047
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3048
    box := OptionBox 
2043
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3049
                title:'Signal cought (' , name, ')'
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3050
                numberOfOptions:(ignorable ifTrue:[5] ifFalse:[4]).
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3051
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3052
    titles := #('return' 'debug' 'dump' 'exit').
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3053
    actions := Array 
2043
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3054
                 with:[badContext return]
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3055
                 with:[Debugger enter:here withMessage:('Signal ', name). ^nil]
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3056
                 with:[Smalltalk fatalAbort]
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3057
                 with:[Smalltalk exit].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3058
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3059
    ignorable ifTrue:[
2043
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3060
        titles := #('ignore') , titles.
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3061
        actions := (Array with:[^ nil]) , actions.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3062
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3063
    box buttonTitles:titles.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3064
    box actions:actions.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3065
    box showAtPointer
2043
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3066
2136
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  3067
    "Modified: 10.1.1997 / 19:09:39 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3068
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3069
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3070
spyInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3071
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3072
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3073
    "spy interrupt and no handler - enter debugger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3074
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3075
    self error:'spy Interrupt - but no handler'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3076
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3077
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3078
timerInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3079
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3080
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3081
    "timer interrupt and no handler - enter debugger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3082
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3083
    self error:'timer Interrupt - but no handler'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3084
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3085
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3086
userInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3087
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3088
1792
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3089
    "user (^c) interrupt.
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3090
     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
  3091
     controlling tty (i.e. in the xterm)."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3092
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3093
    UserInterruptSignal raise
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3094
!
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3095
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3096
userInterruptIn:aContext
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3097
    "{ Pragma: +optSpace }"
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3098
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3099
    "user (^c) interrupt - enter debugger, but show aContext
1792
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3100
     as top-context. 
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3101
     This is used to hide any intermediate scheduler contexts, 
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3102
     in case of an interrupted process. Typically, this is sent by
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3103
     the WindowGroup, when a keyboardEvent for the ctrl-C key is
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3104
     processed."
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3105
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3106
    UserInterruptSignal raiseIn:aContext
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3107
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3108
    "Created: 18.10.1996 / 20:46:04 / cg"
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3109
    "Modified: 20.10.1996 / 13:06:38 / cg"
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3110
! !
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3111
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3112
!Object methodsFor:'message sending'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3113
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3114
perform:aSelector
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3115
    "send the message aSelector to the receiver"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3116
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3117
%{
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3118
    struct inlineCache *pIlc;
1820
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3119
    static struct inlineCache ilc_0 = __ILCPERF0(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3120
    static struct inlineCache ilc_1 = __ILCPERF0(0);
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3121
    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
  3122
    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
  3123
    static flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3124
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3125
    if (aSelector != last_0) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3126
        if (aSelector != last_1) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3127
            if (flip) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3128
                pIlc = &ilc_0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3129
                flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3130
                last_0 = aSelector;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3131
            } else {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3132
                pIlc = &ilc_1;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3133
                flip = 1;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3134
                last_1 = aSelector;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3135
            }
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3136
            pIlc->ilc_func = __SEND0ADDR__;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3137
            if (pIlc->ilc_poly) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3138
                __flushPolyCache(pIlc->ilc_poly);
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3139
                pIlc->ilc_poly = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3140
            }
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3141
        } else {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3142
            pIlc = &ilc_1;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3143
        }
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3144
    } else {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3145
        pIlc = &ilc_0;
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3146
    }
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3147
    RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc) );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3148
%}
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3149
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3150
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3151
perform:aSelector inClass:aClass withArguments:argArray
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3152
    "send the message aSelector with all args taken from argArray 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3153
     to the receiver as a super-send message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3154
     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
  3155
     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
  3156
     immediate superclass).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3157
     Thus, it is (theoretically) possible to do 
1818
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3158
         '5 perform:#< inClass:Magnitude withArguments:#(6)'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3159
     and evaluate Magnitudes compare method even if there was one in Number.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3160
     This method is used by the interpreter to evaluate super sends
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3161
     and could be used for very special behavior (language extension ?).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3162
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3163
     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
  3164
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3165
    |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
  3166
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3167
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3168
     check, if aClass is really a superclass of the receiver
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3169
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3170
    (self class isSubclassOf:aClass) ifFalse:[
1818
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3171
        self error:'class argument is not a superclass of the receiver'.
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3172
        ^ nil
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3173
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3174
    numberOfArgs := argArray size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3175
%{
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3176
    REGISTER OBJ *argP;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3177
    int nargs, i;
1818
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3178
    static struct inlineCache ilc0 = _DUMMYILCSELF0;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3179
    static struct inlineCache ilc1 = _DUMMYILCSELF1;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3180
    static struct inlineCache ilc2 = _DUMMYILCSELF2;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3181
    static struct inlineCache ilc3 = _DUMMYILCSELF3;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3182
    static struct inlineCache ilc4 = _DUMMYILCSELF4;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3183
    static struct inlineCache ilc5 = _DUMMYILCSELF5;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3184
    static struct inlineCache ilc6 = _DUMMYILCSELF6;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3185
    static struct inlineCache ilc7 = _DUMMYILCSELF7;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3186
    static struct inlineCache ilc8 = _DUMMYILCSELF8;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3187
    static struct inlineCache ilc9 = _DUMMYILCSELF9;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3188
    static struct inlineCache ilc10 = _DUMMYILCSELF10;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3189
    static struct inlineCache ilc11 = _DUMMYILCSELF11;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3190
    static struct inlineCache ilc12 = _DUMMYILCSELF12;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3191
    static struct inlineCache ilc13 = _DUMMYILCSELF13;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3192
    static struct inlineCache ilc14 = _DUMMYILCSELF14;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3193
    static struct inlineCache ilc15 = _DUMMYILCSELF15;
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3194
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3195
    if (__isSmallInteger(numberOfArgs)) {
1818
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3196
        nargs = __intVal(numberOfArgs);
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3197
        if (nargs == 0) {
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3198
            RETURN (_SEND0(self, aSelector, aClass, &ilc0));
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3199
        }
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3200
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3201
        argP = (OBJ *)(&a1);
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3202
        if (__Class(argArray) == @global(Array)) {
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3203
            for (i=0; i < nargs; i++) {
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3204
                *argP++ = __ArrayInstPtr(argArray)->a_element[i];
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3205
            }
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3206
        } else {
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3207
            for (i=1; i <= nargs; i++) {
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3208
                *argP++ = __AT_(argArray, __MKSMALLINT(i));
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3209
            }
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3210
        }
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3211
        switch (nargs) {
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3212
            case 1: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3213
                RETURN ( _SEND1(self, aSelector, aClass, &ilc1, a1));
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3214
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3215
            case 2: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3216
                RETURN ( _SEND2(self, aSelector, aClass, &ilc2, a1, a2));
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3217
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3218
            case 3: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3219
                RETURN ( _SEND3(self, aSelector, aClass, &ilc3, a1, a2, a3));
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3220
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3221
            case 4: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3222
                RETURN ( _SEND4(self, aSelector, aClass, &ilc4, a1, a2, a3, a4));
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3223
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3224
            case 5: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3225
                RETURN ( _SEND5(self, aSelector, aClass, &ilc5, 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3226
                                a1, a2, a3, a4, a5));
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3227
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3228
            case 6: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3229
                RETURN ( _SEND6(self, aSelector, aClass, &ilc6, 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3230
                                a1, a2, a3, a4, a5, a6));
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3231
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3232
            case 7: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3233
                RETURN ( _SEND7(self, aSelector, aClass, &ilc7, 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3234
                                a1, a2, a3, a4, a5, a6, a7));
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3235
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3236
            case 8: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3237
                RETURN ( _SEND8(self, aSelector, aClass, &ilc8, 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3238
                                a1, a2, a3, a4, a5, a6, a7, a8));
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3239
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3240
            case 9: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3241
                RETURN ( _SEND9(self, aSelector, aClass, &ilc9, 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3242
                                a1, a2, a3, a4, a5, a6, a7, a8, a9));
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3243
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3244
            case 10: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3245
                RETURN ( _SEND10(self, aSelector, aClass, &ilc10, 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3246
                                 a1, a2, a3, a4, a5, a6, a7, a8, a9, a10));
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3247
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3248
            case 11: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3249
                RETURN ( _SEND11(self, aSelector, aClass, &ilc11, 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3250
                                 a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11));
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3251
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3252
            case 12: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3253
                RETURN ( _SEND12(self, aSelector, aClass, &ilc12, 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3254
                                 a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12));
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3255
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3256
            case 13: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3257
                RETURN ( _SEND13(self, aSelector, aClass, &ilc13, 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3258
                                 a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3259
                                 a13));
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3260
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3261
            case 14: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3262
                RETURN ( _SEND14(self, aSelector, aClass, &ilc14, 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3263
                                 a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3264
                                 a13, a14));
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3265
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3266
            case 15: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3267
                RETURN ( _SEND15(self, aSelector, aClass, &ilc15, 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3268
                                 a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12,
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3269
                                 a13, a14, a15));
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3270
        }
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3271
    }
1626
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  3272
%}.
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  3273
    "/ arrive here, if bad number of arguments (too many)
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  3274
    "/ ST/X (currently) only allows up to 15 method arguments
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  3275
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3276
    ^ self primitiveFailed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3277
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3278
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3279
perform:aSelector with:anObject
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3280
    "send the one-arg-message aSelector to the receiver"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3281
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3282
%{
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3283
    struct inlineCache *pIlc;
1820
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3284
    static struct inlineCache ilc_0 = __ILCPERF1(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3285
    static struct inlineCache ilc_1 = __ILCPERF1(0);
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3286
    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
  3287
    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
  3288
    static flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3289
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3290
    if (aSelector != last_0) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3291
        if (aSelector != last_1) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3292
            if (flip) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3293
                pIlc = &ilc_0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3294
                flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3295
                last_0 = aSelector;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3296
            } else {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3297
                pIlc = &ilc_1;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3298
                flip = 1;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3299
                last_1 = aSelector;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3300
            }
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3301
            pIlc->ilc_func = __SEND1ADDR__;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3302
            if (pIlc->ilc_poly) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3303
                __flushPolyCache(pIlc->ilc_poly);
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3304
                pIlc->ilc_poly = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3305
            }
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3306
        } else {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3307
            pIlc = &ilc_1;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3308
        }
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3309
    } else {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3310
        pIlc = &ilc_0;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3311
    }
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3312
    RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, anObject) );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3313
%}
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3314
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3315
!
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3316
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3317
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
  3318
    "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
  3319
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3320
%{
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3321
    struct inlineCache *pIlc;
1820
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3322
    static struct inlineCache ilc_0 = __ILCPERF2(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3323
    static struct inlineCache ilc_1 = __ILCPERF2(0);
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3324
    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
  3325
    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
  3326
    static flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3327
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3328
    if (aSelector != last_0) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3329
        if (aSelector != last_1) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3330
            if (flip) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3331
                pIlc = &ilc_0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3332
                flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3333
                last_0 = aSelector;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3334
            } else {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3335
                pIlc = &ilc_1;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3336
                flip = 1;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3337
                last_1 = aSelector;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3338
            }
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3339
            pIlc->ilc_func = __SEND2ADDR__;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3340
            if (pIlc->ilc_poly) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3341
                __flushPolyCache(pIlc->ilc_poly);
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3342
                pIlc->ilc_poly = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3343
            }
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3344
        } else {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3345
            pIlc = &ilc_1;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3346
        }
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3347
    } else {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3348
        pIlc = &ilc_0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3349
    }
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3350
    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
  3351
%}
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3352
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3353
!
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3354
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3355
perform:aSelector with:arg1 with:arg2 with:arg3
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3356
    "send the three-arg-message aSelector to the receiver"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3357
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3358
%{
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3359
    struct inlineCache *pIlc;
1820
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3360
    static struct inlineCache ilc_0 = __ILCPERF3(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3361
    static struct inlineCache ilc_1 = __ILCPERF3(0);
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3362
    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
  3363
    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
  3364
    static flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3365
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3366
    if (aSelector != last_0) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3367
        if (aSelector != last_1) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3368
            if (flip) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3369
                pIlc = &ilc_0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3370
                flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3371
                last_0 = aSelector;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3372
            } else {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3373
                pIlc = &ilc_1;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3374
                flip = 1;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3375
                last_1 = aSelector;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3376
            }
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3377
            pIlc->ilc_func = __SEND3ADDR__;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3378
            if (pIlc->ilc_poly) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3379
                __flushPolyCache(pIlc->ilc_poly);
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3380
                pIlc->ilc_poly = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3381
            }
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3382
        } else {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3383
            pIlc = &ilc_1;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3384
        }
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3385
    } else {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3386
        pIlc = &ilc_0;
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3387
    }
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3388
    RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, arg1, arg2, arg3) );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3389
%}
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3390
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3391
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3392
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3393
perform:aSelector withArguments:argArray
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3394
    "send the message aSelector with all args taken from argArray 
44
b262907c93ea *** empty log message ***
claus
parents: 39
diff changeset
  3395
     to the receiver."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3396
77
6c38ca59927f *** empty log message ***
claus
parents: 71
diff changeset
  3397
    |numberOfArgs a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3398
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3399
    numberOfArgs := argArray size.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3400
%{
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3401
    REGISTER OBJ *argP;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3402
    int nargs, i;
1820
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3403
    static OBJ last0 = nil; static struct inlineCache ilc0 = __ILCPERF0(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3404
    static OBJ last1 = nil; static struct inlineCache ilc1 = __ILCPERF1(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3405
    static OBJ last2 = nil; static struct inlineCache ilc2 = __ILCPERF2(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3406
    static OBJ last3 = nil; static struct inlineCache ilc3 = __ILCPERF3(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3407
    static OBJ last4 = nil; static struct inlineCache ilc4 = __ILCPERF4(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3408
    static OBJ last5 = nil; static struct inlineCache ilc5 = __ILCPERF5(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3409
    static OBJ last6 = nil; static struct inlineCache ilc6 = __ILCPERF6(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3410
    static OBJ last7 = nil; static struct inlineCache ilc7 = __ILCPERF7(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3411
    static OBJ last8 = nil; static struct inlineCache ilc8 = __ILCPERF8(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3412
    static OBJ last9 = nil; static struct inlineCache ilc9 = __ILCPERF9(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3413
    static OBJ last10 = nil; static struct inlineCache ilc10 = __ILCPERF10(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3414
    static OBJ last11 = nil; static struct inlineCache ilc11 = __ILCPERF11(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3415
    static OBJ last12 = nil; static struct inlineCache ilc12 = __ILCPERF12(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3416
    static OBJ last13 = nil; static struct inlineCache ilc13 = __ILCPERF13(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3417
    static OBJ last14 = nil; static struct inlineCache ilc14 = __ILCPERF14(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3418
    static OBJ last15 = nil; static struct inlineCache ilc15 = __ILCPERF15(0);
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3419
    OBJ l;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3420
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3421
#if defined(xxxTHIS_CONTEXT) /* not because this has a context */
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3422
    /*
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  3423
     * must set lineno in sender by hand here ... (because of NOCONTEXT)
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3424
     */
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3425
    if ((l = __ILC_LNO_AS_OBJ(__pilc)) != __MKSMALLINT(0)) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3426
        _ContextInstPtr(__thisContext)->c_lineno = l;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3427
    }
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3428
#endif
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3429
253
30daee717a53 *** empty log message ***
claus
parents: 228
diff changeset
  3430
    if (__isSmallInteger(numberOfArgs)) {
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3431
        nargs = __intVal(numberOfArgs);
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3432
        if (nargs == 0) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3433
            if (aSelector != last0) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3434
                ilc0.ilc_func = __SEND0ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3435
                if (ilc0.ilc_poly) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3436
                    __flushPolyCache(ilc0.ilc_poly);
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3437
                    ilc0.ilc_poly = 0;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3438
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3439
                last0 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3440
            }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3441
#ifdef xxTHIS_CONTEXT  /* not because this has a context */
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3442
            ilc0.ilc_lineNo = __pilc->ilc_lineNo;
44
b262907c93ea *** empty log message ***
claus
parents: 39
diff changeset
  3443
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3444
            RETURN ((*ilc0.ilc_func)(self, aSelector, nil, &ilc0));
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3445
        }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3446
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3447
        if (__isArray(argArray)) {
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  3448
            argP = __ArrayInstPtr(argArray)->a_element;
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3449
        } else {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3450
            argP = (OBJ *)(&a1);
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3451
            for (i=1; i <= nargs; i++) {
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3452
                *argP++ = __AT_(argArray, __MKSMALLINT(i));
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3453
            }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3454
        }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3455
        switch (nargs) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3456
            case 1: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3457
                if (aSelector != last1) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3458
                    ilc1.ilc_func = __SEND1ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3459
                    if (ilc1.ilc_poly) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3460
                        __flushPolyCache(ilc1.ilc_poly);
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3461
                        ilc1.ilc_poly = 0;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3462
                    }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3463
                    last1 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3464
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3465
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3466
                ilc1.ilc_lineNo = __pilc->ilc_lineNo;
44
b262907c93ea *** empty log message ***
claus
parents: 39
diff changeset
  3467
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3468
                RETURN ( (*ilc1.ilc_func)(self, aSelector, nil, &ilc1, argP[0]));
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3469
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3470
            case 2: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3471
                if (aSelector != last2) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3472
                    ilc2.ilc_func = __SEND2ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3473
                    if (ilc2.ilc_poly) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3474
                        __flushPolyCache(ilc2.ilc_poly);
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3475
                        ilc2.ilc_poly = 0;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3476
                    }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3477
                    last2 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3478
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3479
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3480
                ilc2.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3481
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3482
                RETURN ( (*ilc2.ilc_func)(self, aSelector, nil, &ilc2, 
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3483
                                                argP[0], argP[1]));
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3484
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3485
            case 3: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3486
                if (aSelector != last3) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3487
                    ilc3.ilc_func = __SEND3ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3488
                    if (ilc3.ilc_poly) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3489
                        __flushPolyCache(ilc3.ilc_poly);
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3490
                        ilc3.ilc_poly = 0;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3491
                    }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3492
                    last3 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3493
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3494
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3495
                ilc3.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3496
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3497
                RETURN ( (*ilc3.ilc_func)(self, aSelector, nil, &ilc3, 
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3498
                                                argP[0], argP[1], argP[2]));
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3499
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3500
            case 4: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3501
                if (aSelector != last4) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3502
                    ilc4.ilc_func = __SEND4ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3503
                    if (ilc4.ilc_poly) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3504
                        __flushPolyCache(ilc4.ilc_poly);
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3505
                        ilc4.ilc_poly = 0;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3506
                    }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3507
                    last4 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3508
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3509
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3510
                ilc4.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3511
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3512
                RETURN ( (*ilc4.ilc_func)(self, aSelector, nil, &ilc4,
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3513
                                                argP[0], argP[1], argP[2], argP[3]));
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3514
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3515
            case 5: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3516
                if (aSelector != last5) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3517
                    ilc5.ilc_func = __SEND5ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3518
                    if (ilc5.ilc_poly) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3519
                        __flushPolyCache(ilc5.ilc_poly);
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3520
                        ilc5.ilc_poly = 0;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3521
                    }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3522
                    last5 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3523
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3524
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3525
                ilc5.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3526
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3527
                RETURN ( (*ilc5.ilc_func)(self, aSelector, nil, &ilc5, 
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3528
                                                argP[0], argP[1], argP[2], argP[3], argP[4]));
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3529
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3530
            case 6: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3531
                if (aSelector != last6) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3532
                    ilc6.ilc_func = __SEND6ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3533
                    if (ilc6.ilc_poly) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3534
                        __flushPolyCache(ilc6.ilc_poly);
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3535
                        ilc6.ilc_poly = 0;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3536
                    }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3537
                    last6 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3538
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3539
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3540
                ilc6.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3541
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3542
                RETURN ( (*ilc6.ilc_func)(self, aSelector, nil, &ilc6, 
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3543
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3544
                                                argP[5]));
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3545
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3546
            case 7: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3547
                if (aSelector != last7) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3548
                    ilc7.ilc_func = __SEND7ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3549
                    if (ilc7.ilc_poly) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3550
                        __flushPolyCache(ilc7.ilc_poly);
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3551
                        ilc7.ilc_poly = 0;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3552
                    }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3553
                    last7 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3554
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3555
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3556
                ilc7.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3557
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3558
                RETURN ( (*ilc7.ilc_func)(self, aSelector, nil, &ilc7, 
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3559
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3560
                                                argP[5], argP[6]));
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3561
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3562
            case 8:
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3563
                if (aSelector != last8) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3564
                    ilc8.ilc_func = __SEND8ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3565
                    last8 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3566
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3567
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3568
                ilc8.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3569
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3570
                RETURN ( (*ilc8.ilc_func)(self, aSelector, nil, &ilc8, 
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3571
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3572
                                                argP[5], argP[6], argP[7]));
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3573
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3574
            case 9: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3575
                if (aSelector != last9) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3576
                    ilc9.ilc_func = __SEND9ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3577
                    last9 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3578
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3579
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3580
                ilc9.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3581
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3582
                RETURN ( (*ilc9.ilc_func)(self, aSelector, nil, &ilc9, 
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3583
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3584
                                                argP[5], argP[6], argP[7], argP[8]));
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3585
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3586
            case 10: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3587
                if (aSelector != last10) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3588
                    ilc10.ilc_func = __SEND10ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3589
                    last10 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3590
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3591
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3592
                ilc10.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3593
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3594
                RETURN ( (*ilc10.ilc_func)(self, aSelector, nil, &ilc10, 
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3595
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3596
                                                argP[5], argP[6], argP[7], argP[8], argP[9]));
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3597
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3598
            case 11: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3599
                if (aSelector != last11) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3600
                    ilc11.ilc_func = __SEND11ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3601
                    last11 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3602
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3603
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3604
                ilc11.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3605
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3606
                RETURN ( (*ilc11.ilc_func)(self, aSelector, nil, &ilc11, 
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3607
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3608
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3609
                                                argP[10]));
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3610
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3611
            case 12: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3612
                if (aSelector != last12) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3613
                    ilc12.ilc_func = __SEND12ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3614
                    last12 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3615
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3616
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3617
                ilc12.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3618
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3619
                RETURN ( (*ilc12.ilc_func)(self, aSelector, nil, &ilc12, 
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3620
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3621
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3622
                                                argP[10], argP[11]));
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3623
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3624
            case 13: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3625
                if (aSelector != last13) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3626
                    ilc13.ilc_func = __SEND13ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3627
                    last13 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3628
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3629
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3630
                ilc13.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3631
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3632
                RETURN ( (*ilc13.ilc_func)(self, aSelector, nil, &ilc13, 
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3633
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3634
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3635
                                                argP[10], argP[11], argP[12]));
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3636
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3637
            case 14: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3638
                if (aSelector != last14) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3639
                    ilc14.ilc_func = __SEND14ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3640
                    last14 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3641
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3642
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3643
                ilc14.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3644
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3645
                RETURN ( (*ilc14.ilc_func)(self, aSelector, nil, &ilc14, 
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3646
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3647
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3648
                                                argP[10], argP[11], argP[12], argP[13]));
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3649
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3650
            case 15: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3651
                if (aSelector != last15) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3652
                    ilc15.ilc_func = __SEND15ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3653
                    last15 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3654
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3655
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3656
                ilc15.ilc_lineNo = __pilc->ilc_lineNo;
77
6c38ca59927f *** empty log message ***
claus
parents: 71
diff changeset
  3657
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3658
                RETURN ( (*ilc15.ilc_func)(self, aSelector, nil, &ilc15, 
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3659
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3660
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3661
                                                argP[10], argP[11], argP[12], argP[13],
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3662
                                                argP[14]));
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3663
        }
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3664
    }
1626
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  3665
%}.
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  3666
    "/ arrive here, if bad number of arguments (too many)
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  3667
    "/ ST/X (currently) only allows up to 15 method arguments
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  3668
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3669
    ^ self primitiveFailed
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3670
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3671
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3672
!Object methodsFor:'misc'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3673
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3674
-> anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3675
    "return an association with the receiver as key and
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3676
     the argument as value"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3677
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3678
    ^ Association key:self value:anObject
2
claus
parents: 1
diff changeset
  3679
! !
claus
parents: 1
diff changeset
  3680
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3681
!Object methodsFor:'printing & storing'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3682
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3683
className
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3684
    "return the classname of the receivers class"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3685
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3686
    ^ self class name
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  3687
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3688
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3689
     1 className
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3690
     1 class className   'this may change ...'
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3691
     $a className
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3692
     $a class className  'this may change ...'
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3693
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3694
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3695
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3696
classNameWithArticle
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3697
    "return a string consisting of classname preceeded by an article.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3698
     (dont expect me to write national variants for this ... :-)
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3699
     If you have special preferences, redefine it ..."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3700
1391
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  3701
    |classname cls|
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  3702
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  3703
    (cls := self class) == self ifTrue:[
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  3704
        ^ 'a funny object'
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  3705
    ].
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  3706
    classname := cls displayString.
85
claus
parents: 77
diff changeset
  3707
    ^ classname article , ' ' , classname
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  3708
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3709
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3710
     1 classNameWithArticle
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3711
     (1->2) classNameWithArticle
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3712
     XWorkstation basicNew classNameWithArticle
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3713
    "
1391
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  3714
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  3715
    "Modified: 13.5.1996 / 12:16:14 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3716
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3717
1445
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  3718
displayOn:aGc
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  3719
    "ST-80 Compatibility
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  3720
     display the receiver in a graphicsContext at 0@0
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  3721
     - this method allows for any object to be displayed in some view
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  3722
     (although the fallBack is to display its printString ...)"
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  3723
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  3724
    ^ self displayOn:aGc x:0 y:0.
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  3725
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  3726
    "Created: 29.5.1996 / 16:28:58 / cg"
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  3727
!
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  3728
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3729
displayOn:aGc at:aPoint
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3730
    "ST-80 Compatibility
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3731
     display the receiver in a graphicsContext - this method allows
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3732
     for any object to be displayed in a ListView - for example."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3733
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3734
    ^ self displayOn:aGc x:(aPoint x) y:(aPoint y).
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  3735
!
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  3736
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3737
displayOn:aGc x:x y:y
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3738
    "display the receiver in a graphicsContext - this method allows
1445
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  3739
     for any object to be displayed in a ListView - for example.
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  3740
     The fallBack here shows the receivers printString."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3741
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3742
    ^ aGc displayString:(self displayString) x:x y:y.
1445
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  3743
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  3744
    "Modified: 29.5.1996 / 16:29:38 / cg"
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  3745
!
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  3746
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3747
displayString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3748
    "return a string used when displaying the receiver in a view;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3749
     for example an Inspector. This is usually the same as printString,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3750
     but sometimes redefined for a better look."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3751
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3752
    ^ self printString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3753
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3754
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3755
     #(1 2 3) printString    
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3756
     #(1 2 3) displayString  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3757
     #(1 2 3) storeString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3758
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3759
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3760
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3761
errorPrint
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3762
    "print the receiver on the standard error stream."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3763
1089
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  3764
    Stream streamErrorSignal catch:[
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  3765
        self printOn:Stderr
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  3766
    ]
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  3767
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  3768
    "Modified: 7.3.1996 / 19:11:29 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3769
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3770
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3771
errorPrintCR
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3772
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3773
1089
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  3774
    "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
  3775
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  3776
    Stream streamErrorSignal catch:[
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  3777
        self printOn:Stderr.
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  3778
        Stderr cr
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  3779
    ]
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  3780
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  3781
    "Modified: 7.3.1996 / 19:13:01 / cg"
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3782
    "Created: 20.5.1996 / 10:20:41 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3783
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3784
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3785
errorPrintNL
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3786
    "{ Pragma: +optSpace }"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3787
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3788
    "print the receiver followed by a cr on the standard error stream.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3789
     Please use #errorPrintCR - this method exists for backward compatibility."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3790
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3791
    ^ self errorPrintCR
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3792
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3793
    "Modified: 20.5.1996 / 10:24:45 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3794
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3795
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3796
errorPrintNewline
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3797
    "{ Pragma: +optSpace }"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3798
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3799
    "print the receiver followed by a cr on the standard error stream.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3800
     Please use #errorPrintCR - this method exists for backward compatibility."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3801
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3802
    self errorPrintCR.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3803
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3804
    "Modified: 20.5.1996 / 10:24:38 / cg"
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3805
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3806
356
claus
parents: 348
diff changeset
  3807
infoPrint
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3808
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3809
356
claus
parents: 348
diff changeset
  3810
    "print the receiver on the standard error stream.
claus
parents: 348
diff changeset
  3811
     This is meant for information messages which are not warnings
claus
parents: 348
diff changeset
  3812
     or fatal messages.
claus
parents: 348
diff changeset
  3813
     These messages can be turned on/off by 'Object infoPrinting:true/false'"
claus
parents: 348
diff changeset
  3814
2114
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
  3815
    InfoPrinting == true ifTrue:[
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
  3816
	self errorPrint
356
claus
parents: 348
diff changeset
  3817
    ]
claus
parents: 348
diff changeset
  3818
!
claus
parents: 348
diff changeset
  3819
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3820
infoPrintCR
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3821
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3822
356
claus
parents: 348
diff changeset
  3823
    "print the receiver followed by a cr on the standard error stream.
claus
parents: 348
diff changeset
  3824
     This is meant for information messages which are not warnings
claus
parents: 348
diff changeset
  3825
     or fatal messages.
claus
parents: 348
diff changeset
  3826
     These messages can be turned on/off by 'Object infoPrinting:true/false'"
claus
parents: 348
diff changeset
  3827
2114
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
  3828
    InfoPrinting == true ifTrue:[
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3829
        self errorPrintCR
356
claus
parents: 348
diff changeset
  3830
    ]
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3831
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3832
    "Created: 20.5.1996 / 10:21:28 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3833
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3834
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3835
infoPrintNL
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3836
    "{ Pragma: +optSpace }"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3837
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3838
    "print the receiver followed by a cr on the standard error stream.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3839
     This is meant for information messages which are not warnings
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3840
     or fatal messages.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3841
     These messages can be turned on/off by 'Object infoPrinting:true/false'.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3842
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3843
     Please use #infoPrintCR - this method exists for backward compatibility."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3844
2114
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
  3845
    ^ self infoPrintCR
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3846
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3847
    "Modified: 20.5.1996 / 10:25:07 / cg"
356
claus
parents: 348
diff changeset
  3848
!
claus
parents: 348
diff changeset
  3849
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3850
print
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  3851
    "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
  3852
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3853
    self printOn:Stdout
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  3854
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  3855
    "Modified: 4.11.1996 / 23:36:58 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3856
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3857
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3858
printCR
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  3859
    "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
  3860
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3861
    self printOn:Stdout.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3862
    Stdout cr
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3863
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3864
    "Created: 20.5.1996 / 10:21:37 / cg"
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  3865
    "Modified: 4.11.1996 / 23:37:06 / cg"
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3866
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3867
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3868
printNL
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3869
    "print the receiver followed by a cr on the standard output stream
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3870
     This exists for GNU Smalltalk compatibility - please use #printCR."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3871
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3872
    ^ self printCR
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3873
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3874
    "Modified: 20.5.1996 / 10:25:31 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3875
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3876
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3877
printNewline
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3878
    "print the receiver followed by a cr on the standard output stream.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3879
     This exists for backward compatibility - please use #printCR."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3880
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3881
    self printCR
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3882
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3883
    "Modified: 20.5.1996 / 10:25:46 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3884
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3885
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3886
printOn:aStream
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3887
    "print the receiver on the argument-stream.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3888
     The default here is to output the receivers class name.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3889
     BUT: this method is heavily redefined for objects which
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3890
     can print prettier."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3891
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3892
    aStream nextPutAll:self classNameWithArticle
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3893
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3894
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3895
printOn:aStream leftPaddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3896
    "print the receiver on aStream, padding with spaces up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3897
     padding is done on the left."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3898
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3899
    self printOn:aStream leftPaddedTo:size with:(Character space)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3900
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3901
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3902
     123 printOn:Transcript leftPaddedTo:10. Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3903
     123 printOn:Transcript leftPaddedTo:2. Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3904
    "
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3905
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3906
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3907
printOn:aStream leftPaddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3908
    "print the receiver on aStream, padding with padCharacters up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3909
     padding is done on the left."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3910
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3911
    aStream nextPutAll:(self printStringLeftPaddedTo:size with:padCharacter)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3912
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3913
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3914
     123 printOn:Transcript leftPaddedTo:10 with:$_ . Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3915
     123 printOn:Transcript leftPaddedTo:10 with:$. . Transcript cr
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
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3918
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3919
printOn:aStream paddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3920
    "print the receiver on aStream, padding with spaces up to size."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3921
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3922
    self printOn:aStream paddedTo:size with:(Character space)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3923
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3924
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3925
     123.0 printOn:Transcript paddedTo:10. Transcript nextPut:$|. Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3926
    "
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3927
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3928
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3929
printOn:aStream paddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3930
    "print the receiver on aStream, padding with padCharacter up to size"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3931
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3932
    aStream nextPutAll:(self printStringPaddedTo:size with:padCharacter).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3933
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3934
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3935
     123 printOn:Transcript paddedTo:10 with:$_ . Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3936
     123 printOn:Transcript paddedTo:10 with:$. . Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3937
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3938
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3939
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3940
printOn:aStream zeroPaddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3941
    "print the receiver on aStream, padding with zeros up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3942
     Usually used with float numbers."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3943
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3944
    self printOn:aStream paddedTo:size with:$0.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3945
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3946
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3947
     123.0 printOn:Transcript zeroPaddedTo:10
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3948
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3949
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3950
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3951
printRightAdjustLen:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3952
    "obsolete - just a name confusion.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3953
     This method will go away ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3954
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3955
    (self printStringLeftPaddedTo:size) printOn:Stdout
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3956
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3957
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3958
printString
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3959
    "return a string for printing the receiver.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3960
     Since we now use printOn: as the basic print mechanism,
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3961
     we have to create a stream and print into it."
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3962
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3963
    |s|
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3964
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3965
    s := WriteStream on:(String new:30).
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3966
    self printOn:s.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3967
    ^ s contents
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3968
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3969
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3970
printStringLeftPaddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3971
    "return my printString as a right-adjusted string of length size;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3972
     characters on the left are filled with spaces.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3973
     If the printString is longer than size, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3974
     it is returned unchanged (i.e. not truncated)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3975
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3976
    ^ self printStringLeftPaddedTo:size with:(Character space)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3977
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3978
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3979
     10 printStringLeftPaddedTo:10
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3980
     1 printStringLeftPaddedTo:10
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3981
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3982
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3983
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3984
printStringLeftPaddedTo:size ifLarger:alternative
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3985
    "return my printString as a right-adjusted string of length size;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3986
     characters on the left are filled with spaces.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3987
     If the printString is larger than size,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3988
     return the result from evaluating alternative."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3989
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3990
    ^ self printStringLeftPaddedTo:size with:(Character space) ifLarger:alternative
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3991
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3992
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3993
     12   printStringLeftPaddedTo:3 ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3994
     123  printStringLeftPaddedTo:3 ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3995
     1234 printStringLeftPaddedTo:3 ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3996
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3997
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3998
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3999
printStringLeftPaddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4000
    "return my printString as a right-adjusted string of length size;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4001
     characters on the left are filled with padCharacter.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4002
     If the printString is longer than size, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4003
     it is returned unchanged (i.e. not truncated)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4004
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4005
    ^ (self printString) leftPaddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4006
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4007
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4008
     123 printStringLeftPaddedTo:10 with:$.   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4009
     1 printStringLeftPaddedTo:10 with:$.      
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4010
     (Float pi) printStringLeftPaddedTo:20 with:$*
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4011
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4012
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4013
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4014
printStringLeftPaddedTo:size with:padCharacter ifLarger:alternative
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4015
    "return my printString as a right-adjusted string of length size;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4016
     characters on the left are filled with padCharacter.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4017
     If the printString is larger than size,
369
claus
parents: 362
diff changeset
  4018
     return the result from evaluating alternative."
claus
parents: 362
diff changeset
  4019
claus
parents: 362
diff changeset
  4020
    |s|
claus
parents: 362
diff changeset
  4021
claus
parents: 362
diff changeset
  4022
    s := self printString.
claus
parents: 362
diff changeset
  4023
    s size > size ifTrue:[^ alternative value].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4024
    ^ s leftPaddedTo:size with:padCharacter
369
claus
parents: 362
diff changeset
  4025
claus
parents: 362
diff changeset
  4026
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4027
     12   printStringLeftPaddedTo:3 with:$. ifLarger:['***']   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4028
     123  printStringLeftPaddedTo:3 with:$. ifLarger:['***']   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4029
     1234 printStringLeftPaddedTo:3 with:$. ifLarger:['***']   
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4030
    "
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4031
!
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4032
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4033
printStringPaddedTo:size
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4034
    "return a printed representation of the receiver,
369
claus
parents: 362
diff changeset
  4035
     padded with spaces (at the right) up to size.
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4036
     If the printString is longer than size, 
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4037
     it is returned unchanged (i.e. not truncated)"
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4038
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4039
    ^ self printStringPaddedTo:size with:(Character space)
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4040
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4041
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4042
     123 printStringPaddedTo:10    
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4043
     1234567890123456 printStringPaddedTo:10  
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4044
     'hello' printStringPaddedTo:10   
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4045
    "
2
claus
parents: 1
diff changeset
  4046
!
claus
parents: 1
diff changeset
  4047
369
claus
parents: 362
diff changeset
  4048
printStringPaddedTo:size ifLarger:alternative
claus
parents: 362
diff changeset
  4049
    "return a printed representation of the receiver,
claus
parents: 362
diff changeset
  4050
     padded with spaces (at the right) up to size.
claus
parents: 362
diff changeset
  4051
     If the resulting printString is too large, 
claus
parents: 362
diff changeset
  4052
     return the result from evaluating alternative."
claus
parents: 362
diff changeset
  4053
claus
parents: 362
diff changeset
  4054
    ^ self printStringPaddedTo:size with:(Character space) ifLarger:alternative
claus
parents: 362
diff changeset
  4055
claus
parents: 362
diff changeset
  4056
    "
claus
parents: 362
diff changeset
  4057
     12   printStringPaddedTo:3 ifLarger:['***']   
claus
parents: 362
diff changeset
  4058
     123  printStringPaddedTo:3 ifLarger:['***']   
claus
parents: 362
diff changeset
  4059
     1234 printStringPaddedTo:3 ifLarger:['***']   
claus
parents: 362
diff changeset
  4060
    "
claus
parents: 362
diff changeset
  4061
!
claus
parents: 362
diff changeset
  4062
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4063
printStringPaddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4064
    "return a printed representation of the receiver,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4065
     padded with padCharacter (at the right) up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4066
     If the printString is longer than size, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4067
     it is returned unchanged (i.e. not truncated)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4068
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4069
    ^ (self printString) paddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4070
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4071
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4072
     123  printStringPaddedTo:10 with:$.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4073
     123  printStringPaddedTo:10 with:$*
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4074
     123  printStringPaddedTo:3 with:$*   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4075
     1234 printStringPaddedTo:3 with:$*   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4076
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4077
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4078
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4079
printStringPaddedTo:size with:padCharacter ifLarger:alternative
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4080
    "return a printed representation of the receiver,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4081
     padded with padCharacter (at the right) up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4082
     If the resulting printString is too large, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4083
     return the result from evaluating alternative."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4084
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4085
    |s|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4086
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4087
    s := self printString.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4088
    s size > size ifTrue:[^ alternative value].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4089
    ^ s paddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4090
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4091
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4092
     123   printStringPaddedTo:3 with:$. ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4093
     12345 printStringPaddedTo:3 with:$. ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4094
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4095
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4096
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4097
printStringRightAdjustLen:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4098
    "obsolete - just a name confusion.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4099
     This method will go away ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4100
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4101
    ^ self printStringLeftPaddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4102
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4103
2
claus
parents: 1
diff changeset
  4104
printStringZeroPaddedTo:size
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4105
    "return a printed representation of the receiver, 
369
claus
parents: 362
diff changeset
  4106
     padded with zero (at the right) characters up to size.
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4107
     Usually used with float numbers."
2
claus
parents: 1
diff changeset
  4108
claus
parents: 1
diff changeset
  4109
    ^ self printStringPaddedTo:size with:$0
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4110
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4111
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4112
     123.0 printStringZeroPaddedTo:10 
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4113
    "
2
claus
parents: 1
diff changeset
  4114
!
claus
parents: 1
diff changeset
  4115
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4116
store
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4117
    "store the receiver on standard output.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4118
     this method is useless, but included for compatibility."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4119
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4120
    self storeOn:Stdout
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4121
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4122
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4123
storeCR
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4124
    "store the receiver on standard output; append a carriage return."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4125
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4126
    self store.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4127
    Character cr print
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4128
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4129
    "Created: 20.5.1996 / 10:26:01 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4130
    "Modified: 20.5.1996 / 10:26:57 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4131
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4132
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4133
storeNl
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4134
    "store the receiver on standard output; append a newline.
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4135
     This method is included for backward compatibility-  use #storeCR."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4136
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4137
    self storeCR.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4138
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4139
    "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
  4140
!
7e058858cc3b New Method: displayOn:aGc at:aPoint (ST80-compatibility).
Stefan Vogel <sv@exept.de>
parents: 446
diff changeset
  4141
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4142
storeOn:aStream
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4143
    "store the receiver on aStream; i.e. print an expression which will
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4144
     reconstruct the receiver.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4145
     Notice, that no self referencing or cyclic objects can be represented
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4146
     in this format.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4147
     Use storeBinaryOn:, which handles these cases correctly."
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4148
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4149
    |myClass hasSemi sz "{ Class: SmallInteger }" |
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4150
25
e34a6267c79b *** empty log message ***
claus
parents: 13
diff changeset
  4151
    thisContext isRecursive ifTrue:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4152
        Transcript showCR:'Error: storeString of self referencing object.'.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4153
        aStream nextPutAll:'#("recursive")'.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4154
        ^ self
25
e34a6267c79b *** empty log message ***
claus
parents: 13
diff changeset
  4155
    ].
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4156
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4157
    myClass := self class.
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4158
    aStream nextPut:$(.
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4159
    aStream nextPutAll:self class name.
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4160
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4161
    hasSemi := false.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4162
    myClass isVariable ifTrue:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4163
        aStream nextPutAll:' basicNew:'.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4164
        self basicSize printOn:aStream
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4165
    ] ifFalse:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4166
        aStream nextPutAll:' basicNew'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4167
    ].
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4168
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4169
    sz := myClass instSize.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4170
    1 to:sz do:[:i | 
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4171
        aStream nextPutAll:' instVarAt:'.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4172
        i printOn:aStream.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4173
        aStream nextPutAll:' put:'.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4174
        (self instVarAt:i) storeOn:aStream.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4175
        aStream nextPut:$;.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4176
        hasSemi := true
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4177
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4178
    myClass isVariable ifTrue:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4179
        sz := self basicSize.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4180
        1 to:sz do:[:i | 
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4181
            aStream nextPutAll:' basicAt:'.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4182
            i printOn:aStream.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4183
            aStream nextPutAll:' put:'.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4184
            (self basicAt:i) storeOn:aStream.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4185
            aStream nextPut:$;.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4186
            hasSemi := true
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4187
        ]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4188
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4189
    hasSemi ifTrue:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4190
        aStream nextPutAll:' yourself'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4191
    ].
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4192
    aStream nextPut:$).
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4193
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4194
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4195
     |s|
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4196
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4197
     s := WriteStream on:(String new).
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4198
     ('hello' -> 'world') storeOn:s.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4199
     s := ReadStream on:(s contents).
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4200
     (Object readFrom:s) inspect
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4201
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4202
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4203
     |s|
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4204
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4205
     s := 'data' asFilename writeStream.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4206
     ('hello' -> 'world') storeOn:s.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4207
     s close.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4208
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4209
     s := 'data' asFilename readStream.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4210
     (Object readFrom:s) inspect
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4211
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4212
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4213
    "does not work example:"
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4214
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4215
     |s a|
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4216
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4217
     a := Array new:2.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4218
     a at:1 put:a.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4219
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4220
     s := 'data' asFilename writeStream.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4221
     a storeOn:s.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4222
     s close.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4223
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4224
     s := 'data' asFilename readStream.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4225
     (Object readFrom:s) inspect
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4226
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4227
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4228
    "Modified: 18.5.1996 / 15:43:35 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4229
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4230
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4231
storeString
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4232
    "return a string representing an expression to reconstruct the receiver.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4233
     Notice, that no self referencing or cyclic objects can be represented
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4234
     in this format.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4235
     Use storeBinaryOn:, which handles these cases correctly."
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4236
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4237
    |s|
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4238
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4239
    s := WriteStream on:(String new:50).
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4240
    self storeOn:s.
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4241
    ^ s contents
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4242
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4243
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4244
!Object methodsFor:'queries'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4245
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4246
basicSize
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4247
    "return the number of the receivers indexed instance variables,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4248
     0 if it has none.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4249
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4250
     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
  4251
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4252
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4253
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4254
    REGISTER int nbytes;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4255
    REGISTER OBJ myClass;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4256
    REGISTER int flags;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4257
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
     * notice the missing test for self being a nonNilObject -
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4260
     * this can be done since basicSize is defined both in UndefinedObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4261
     * and SmallInteger
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4262
     */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4263
    myClass = __qClass(self);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4264
    nbytes = __qSize(self) 
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4265
              - OHDR_SIZE 
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4266
              - __OBJS2BYTES__(__intVal(__ClassInstPtr(myClass)->c_ninstvars));
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4267
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4268
    flags = __intVal(__ClassInstPtr(myClass)->c_flags) & ARRAYMASK;
783
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
     * replaced switch by open-if; this is slightly faster since
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4271
     * it avoids the range check and also checks the most common case first
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4272
     */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4273
    if ((flags == POINTERARRAY)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4274
     || (flags == WKPOINTERARRAY)) {
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4275
        RETURN ( __MKSMALLINT(__BYTES2OBJS__(nbytes)) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4276
    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4277
    if (flags == BYTEARRAY) {
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4278
            RETURN ( __MKSMALLINT(nbytes / sizeof(char)) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4279
    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4280
    if (flags == FLOATARRAY) {
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4281
        RETURN ( __MKSMALLINT(nbytes / sizeof(float)) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4282
    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4283
    if (flags == DOUBLEARRAY) {
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4284
#ifdef NEED_DOUBLE_ALIGN
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4285
            /*
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4286
             * care for filler
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4287
             */
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4288
            nbytes -= sizeof(FILLTYPE);
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4289
#endif
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4290
            RETURN ( __MKSMALLINT(nbytes / sizeof(double)) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4291
    }
1515
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
  4292
    if ((flags == WORDARRAY) || (flags == SWORDARRAY)) {
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4293
        RETURN ( __MKSMALLINT(nbytes / sizeof(short)) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4294
    }
1515
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
  4295
    if ((flags == LONGARRAY) || (flags == SLONGARRAY)) {
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4296
        RETURN ( __MKSMALLINT(nbytes / sizeof(long)) );
783
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
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4299
    ^ 0
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4300
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4301
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4302
class
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4303
    "return the receivers class"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4304
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4305
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4306
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4307
    RETURN ( __Class(self) );
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4308
%}
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
respondsTo:aSelector
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4312
    "return true, if the receiver implements a method with selector equal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4313
     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
  4314
     receivers class or one of its superclasses.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4315
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4316
     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
  4317
     an error being raised. For example, an implementation could send
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4318
     #shouldNotImplement or #subclassResponsibility."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4319
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4320
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4321
     should we go via the cache, or search (by class) ?
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4322
     The first is faster, most of the time; while the 2nd fills
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4323
     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
  4324
     For now, use the cache ...
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4325
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4326
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4327
829
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
  4328
    if (__lookup(__Class(self), aSelector) == nil) {
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4329
	RETURN ( false );
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4330
    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4331
    RETURN ( true );
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4332
%}
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4333
.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4334
"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4335
    ^ self class canUnderstand:aSelector
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
    "'aString' respondsTo:#+"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4339
    "'aString' respondsTo:#,"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4340
    "'aString' respondsTo:#collect:"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4341
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4342
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4343
respondsToArithmetic
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4344
    "return true, if the receiver responds to arithmetic messages.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4345
     false is returned here - the method is redefined in ArithmeticValue."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4346
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4347
    ^ false
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4348
!
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
size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4351
    "return the number of the receivers indexed instance variables;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4352
     this method may be redefined in subclasses"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4353
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4354
    ^ self basicSize
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4355
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4356
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4357
species
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4358
    "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
  4359
     This is used to create an appropriate object when creating derived
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4360
     copies in the collection classes (sometimes redefined)."
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
    ^ self class
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4363
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4364
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4365
yourself
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4366
    "return the receiver - used for cascades to return self at the end"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4367
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4368
    ^ self
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4371
!Object methodsFor:'secure message sending'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4372
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4373
askFor:aSelector
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4374
    "try to send the receiver the message, aSelector.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4375
     If it does not understand it, return false. Otherwise
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4376
     the real value returned.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4377
     Useful to send messages such as: 'isColor' to unknown
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4378
     receivers."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4379
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4380
    ^ self perform:aSelector ifNotUnderstood:[false]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4381
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4382
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4383
     1 askFor:#isColor
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4384
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4385
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4386
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4387
perform:aSelector ifNotUnderstood:exceptionBlock
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4388
    "try to send message aSelector to the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4389
     If its understood, return the methods returned value,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4390
     otherwise return the value of the exceptionBlock"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4391
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4392
    |val|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4393
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4394
    MessageNotUnderstoodSignal handle:[:ex |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4395
	^ exceptionBlock value
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4396
    ] do:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4397
	val := self perform:aSelector
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4398
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4399
    ^ val
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4400
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4401
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4402
     1.2345 perform:#foo ifNotUnderstood:['sorry'] 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4403
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4404
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4405
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4406
perform:aSelector with:argument ifNotUnderstood:exceptionBlock
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4407
    "try to send message aSelector to the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4408
     If its understood, return the methods returned value,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4409
     otherwise return the value of the exceptionBlock"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4410
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4411
    |val|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4412
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4413
    MessageNotUnderstoodSignal handle:[:ex |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4414
	^ exceptionBlock value
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4415
    ] do:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4416
	val := self perform:aSelector with:argument
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4417
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4418
    ^ val
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4419
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4420
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4421
     |unknown|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4422
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4423
     unknown := 1.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4424
     (unknown perform:#+ with:2 ifNotUnderstood:['sorry']) printNewline.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4425
     unknown := 'high there'.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4426
     (unknown perform:#+ with:2 ifNotUnderstood:['sorry']) printNewline.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4427
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4428
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4429
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4430
!Object methodsFor:'special queries'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4431
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4432
allOwners
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4433
    "return a collection of all objects referencing the receiver"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4434
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4435
    ^ ObjectMemory whoReferences:self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4436
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4437
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4438
references:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4439
    "return true, if the receiver refers to the argument, anObject.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4440
     - for debugging only"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4441
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4442
"/    |myClass 
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4443
"/     numInst "{ Class: SmallInteger }" |
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4444
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4445
%{  /* NOCONTEXT */
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4446
    OBJ cls, flags;
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4447
    int nInsts, i;
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4448
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4449
    if (! __isNonNilObject(self)) {
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4450
	RETURN (false);
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4451
    }
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4452
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4453
    /*
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4454
     * a little optimization: use the fact that all old objects
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4455
     * 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
  4456
     * a trivial reject is possible, if anObject is a newbee
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4457
     */
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4458
    if (__isNonNilObject(anObject)) {
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4459
	if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) {
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4460
	    int spc;
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
	    if (((spc = __qSpace(anObject)) == NEWSPACE) || (spc == SURVSPACE)) {
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4463
		RETURN (false);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4464
	    }
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
    }
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4467
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4468
    cls = __qClass(self);
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4469
    if (cls == anObject) {
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4470
	RETURN (true);
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4471
    }
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4472
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4473
    flags = __ClassInstPtr(cls)->c_flags;
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
  4474
    if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4475
        nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4476
    } else {
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4477
        nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4478
    }
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4479
    if (! nInsts) {
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4480
	RETURN (false);
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4481
    }
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4482
    for (i=0; i<nInsts; i++) {
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4483
        if (__InstPtr(self)->i_instvars[i] == anObject) {
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4484
	    RETURN (true);
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4485
	}
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4486
    }
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4487
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4488
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4489
"/    myClass := self class.
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4490
"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4491
"/    "check the class"
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4492
"/    (myClass == anObject) ifTrue:[^ true].
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4493
"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4494
"/    "check the instance variables"
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4495
"/    numInst := myClass instSize.
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4496
"/    1 to:numInst do:[:i | 
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4497
"/	((self instVarAt:i) == anObject) ifTrue:[^ true]
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4498
"/    ].
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4499
"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4500
"/    "check the indexed variables"
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4501
"/    myClass isVariable ifTrue:[
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4502
"/	myClass isPointers ifFalse:[
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4503
"/	    "/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4504
"/	    "/ we could argue about the following unconditional return:
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4505
"/	    "/ it says that a non pointer array never has a reference to the
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4506
"/	    "/ corresponding object - not mimicing a reference to a copy of the
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4507
"/	    "/ integer. However, it avoids useless searches in huge byteArray
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4508
"/	    "/ like objects when searching for owners. If in doubt, remove it.
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4509
"/	    "/ A consequence of the return below is that #[1 2 3] will say that it
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4510
"/	    "/ does not refer to the number 2 (think of keeping a copy instead)
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4511
"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4512
"/	    ^ false.
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4513
"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4514
"/	    "/ alternative:
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4515
"/	    "/  anObject isNumber ifFalse:[^ false].
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4516
"/	].
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4517
"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4518
"/	"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4519
"/	"/ because arrays are so common, and those have a highly tuned
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4520
"/	"/ idenitytIndex method, use it
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4521
"/	"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4522
"/	myClass == Array ifTrue:[
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4523
"/	    ^ (self identityIndexOf:anObject) ~~ 0
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4524
"/	].
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4525
"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4526
"/	"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4527
"/	"/ otherwise, do it the slow way
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4528
"/	"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4529
"/	numInst := self basicSize.
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4530
"/	1 to:numInst do:[:i | 
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4531
"/	    ((self basicAt:i) == anObject) ifTrue:[^ true]
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4532
"/	]
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4533
"/    ].
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4534
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4535
    ^ false
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4536
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4537
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4538
     |v|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4539
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4540
     v := View new initialize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4541
     v references:Display. 
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
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4544
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4545
referencesDerivedInstanceOf:aClass
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4546
    "return true, if the receiver refers to an instance of
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4547
     the argument, aClass or its subclass. This method exists
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4548
     to support searching for users of a class."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4549
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4550
    |myClass 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4551
     numInst "{ Class: SmallInteger }" |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4552
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4553
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4554
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4555
    "check the class"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4556
    (myClass isKindOf:aClass) ifTrue:[^ true].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4557
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4558
    "check the instance variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4559
    numInst := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4560
    1 to:numInst do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4561
	((self instVarAt:i) isKindOf:aClass) ifTrue:[^ true]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4562
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4563
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4564
    "check the indexed variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4565
    myClass isVariable ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4566
	myClass isPointers ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4567
	    "no need to search in non pointer fields"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4568
	    ((aClass == Number) or:[aClass isSubclassOf:Number]) ifFalse:[^ false].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4569
	].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4570
	numInst := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4571
	1 to:numInst do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4572
	    ((self basicAt:i) isKindOf:aClass) ifTrue:[^ true]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4573
	]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4574
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4575
    ^ false
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4576
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4577
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4578
     (1 @ 3.4) referencesDerivedInstanceOf:Number  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4579
     (1 @ 3.4) referencesDerivedInstanceOf:Array   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4580
     View new initialize referencesDerivedInstanceOf:DeviceWorkstation  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4581
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4582
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4583
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4584
referencesInstanceOf:aClass
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4585
    "return true, if the receiver refers to an instance of
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4586
     the argument, aClass.This method exists
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4587
     to support searching for users of a class."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4588
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4589
    |myClass 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4590
     numInst "{ Class: SmallInteger }" |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4591
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4592
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4593
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4594
    "check the class"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4595
    (myClass isMemberOf:aClass) ifTrue:[^ true].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4596
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4597
    "check the instance variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4598
    numInst := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4599
    1 to:numInst do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4600
	((self instVarAt:i) isMemberOf:aClass) ifTrue:[^ true]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4601
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4602
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4603
    "check the indexed variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4604
    myClass isVariable ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4605
	myClass isPointers ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4606
	    "no need to search in non-pointer indexed fields"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4607
	    myClass isLongs ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4608
		(aClass == SmallInteger or:[aClass == LargeInteger]) ifFalse:[^ false].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4609
	    ] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4610
		myClass isFloatsOrDoubles ifTrue:[^ aClass == Float].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4611
		^ aClass == SmallInteger
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4612
	    ]
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
	numInst := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4615
	1 to:numInst do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4616
	    ((self basicAt:i) isMemberOf:aClass) ifTrue:[^ true]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4617
	]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4618
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4619
    ^ false
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4620
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
     (1 @ 3.4) referencesInstanceOf:Float     
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4623
     (1 @ 3.4) referencesInstanceOf:Fraction    
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4624
     View new initialize referencesInstanceOf:(Display class)  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4625
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4626
! !
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4627
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4628
!Object methodsFor:'system primitives'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4629
1957
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4630
asOop
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4631
    "ST-80 compatibility:
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4632
     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
  4633
     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
  4634
     be used (since its changing over time), we return the objects identityHash 
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4635
     key, which provides (at least) some identity indication.
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4636
     However, notice that (in contrast to ST-80's #asOop), the identityHash
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4637
     key of two non-identical objects may be the same.
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4638
     You'd better not use it - especially do not misuse it."
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4639
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4640
    ^ self identityHash
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4641
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4642
    "Created: 9.11.1996 / 19:09:56 / cg"
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4643
    "Modified: 9.11.1996 / 19:16:04 / cg"
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4644
!
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4645
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4646
become:anotherObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4647
    "make all references to the receiver become references to anotherObject
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4648
     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
  4649
     This can be a very dangerous operation - be warned.
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  4650
     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
  4651
     produce many strange effects (think of hashing in Sets, Dictionaries etc.).
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  4652
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  4653
     This may also be an expensive (i.e. slow) operation, 
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4654
     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
  4655
     references to the two objects (although the primitive tries hard to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4656
     limit the search, for acceptable performance in most cases). 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4657
     This method fails, if the receiver or the argument is a SmallInteger 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4658
     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
  4659
     returned).
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4660
     (notice that #become: is not used heavily by the system 
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4661
      - the Collection-classes have been rewritten to not use it.)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4662
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  4663
    if (__primBecome(self, anotherObject)) {
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4664
	RETURN ( self );
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4665
    }
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4666
%}.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4667
    self primitiveFailed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4668
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4669
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4670
becomeNil
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4671
    "make all references to the receiver become nil - effectively getting
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4672
     rid of the receiver. 
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4673
     This can be a very dangerous operation - be warned.
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4674
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4675
     This may be an expensive (i.e. slow) operation.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4676
     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
  4677
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4678
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  4679
    if (__primBecomeNil(self)) {
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4680
	RETURN ( nil );
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4681
    }
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4682
%}.
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4683
    self primitiveFailed
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4684
!
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4685
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4686
becomeSameAs:anotherObject
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4687
    "make all references to the receiver become references to anotherObject
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  4688
     but NOT vice versa (as done in #become:).
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4689
     This can be a very dangerous operation - be warned.
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  4690
     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
  4691
     produce many strange effects (think of hashing in Sets, Dictionaries etc.).
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  4692
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  4693
     This may also be an expensive (i.e. slow) operation,
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4694
     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
  4695
     references to the two objects (although the primitive tries hard to
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4696
     limit the search, for acceptable performance in most cases).
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4697
     This method fails, if the receiver or the argument is a SmallInteger
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4698
     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
  4699
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  4700
    if (__primBecomeSameAs(self, anotherObject)) {
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4701
	RETURN ( self );
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4702
    }
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4703
%}.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4704
    self primitiveFailed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4705
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4706
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4707
changeClassTo:otherClass
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4708
    "changes the class of the receiver to the argument, otherClass.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4709
     This is only allowed (possible), if the receivers class and the argument
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4710
     have the same structure (i.e. number of named instance variables and
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4711
     type of indexed instance variables). 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4712
     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
  4713
     is UndefinedObject or a Smallinteger, a primitive error is triggered."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4714
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4715
    |myClass ok|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4716
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4717
    "check for UndefinedObject/SmallInteger receiver or newClass"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4718
%{
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4719
    {
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4720
        OBJ other = otherClass;
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4721
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4722
        if (__isNonNilObject(self) 
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4723
         && __isNonNilObject(other)
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4724
         && (other != UndefinedObject)
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4725
         && (other != SmallInteger)) {
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4726
            ok = true;
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4727
        } else {
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4728
            ok = false;
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4729
        }
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4730
    }
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
    ok ifTrue:[
1022
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4733
        ok := false.
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4734
        myClass := self class.
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4735
        myClass flags == otherClass flags ifTrue:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4736
            myClass instSize == otherClass instSize ifTrue:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4737
                "same instance layout and types: its ok to do it"
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4738
                ok := true.
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4739
            ] ifFalse:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4740
                myClass isPointers ifTrue:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4741
                    myClass isVariable ifTrue:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4742
                        ok := true
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4743
                    ]
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4744
                ]
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4745
            ]
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4746
        ] ifFalse:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4747
            myClass isPointers ifTrue:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4748
                "if newClass is a variable class, with instSize <= my instsize,
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4749
                 we can do it (effectively mapping additional instvars into the
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4750
                 variable part) - usefulness is questionable, though"
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4751
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4752
                otherClass isPointers ifTrue:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4753
                    otherClass isVariable ifTrue:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4754
                        otherClass instSize <= (myClass instSize + self basicSize) 
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4755
                        ifTrue:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4756
                            ok := true
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4757
                        ]
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4758
                    ] ifFalse:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4759
                        otherClass instSize == (myClass instSize + self basicSize) 
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4760
                        ifTrue:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4761
                            ok := true
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4762
                        ]
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4763
                    ]
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4764
                ] ifFalse:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4765
                    "it does not make sense to convert pointers to bytes ..."
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4766
                ]
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4767
            ] ifFalse:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4768
                "does it make sense, to convert bits ?"
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4769
                "could allow byteArray->wordArray->longArray->floatArray->doubleArray here ..."
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4770
                (myClass isBits and:[otherClass isBits]) ifTrue:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4771
                    ok := true
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4772
                ]
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4773
            ]
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4774
        ]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4775
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4776
    ok ifTrue:[
1022
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4777
        "now, change the receivers class ..."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4778
%{
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4779
	{
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4780
	    OBJ me = self;
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4781
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4782
            __qClass(me) = otherClass;
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4783
            __STORE(me, otherClass);
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4784
            RETURN (me);
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4785
	}
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4786
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4787
    ].
1022
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4788
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4789
    "
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4790
     the receiver cannot be represented as a instance of
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4791
     the desired class.
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4792
     For example, you cannot change a bitInstance (byteArray etc.) 
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4793
     into a pointer object and vice versa.
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4794
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4795
    self primitiveFailed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4796
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4797
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4798
changeClassToThatOf:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4799
    "changes the class of the receiver to that of the argument, anObject.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4800
     This is only allowed (possible), if the receivers class and the arguments
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4801
     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
  4802
     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
  4803
     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
  4804
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4805
    self changeClassTo:(anObject class)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4806
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4807
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4808
!Object methodsFor:'testing'!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4809
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4810
? defaultValue
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4811
     "if the receiver is nil, return the defaultValue;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4812
      otherwise, return the receiver.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4813
      This method is only redefined in UndefinedObject - therefore,
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4814
      the recevier is retuned here.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4815
1958
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  4816
      Thus, if foo and bar are simple variables or constants,
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  4817
          foo ? bar
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  4818
      is the same as:
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  4819
          (foo isNil ifTrue:[bar] ifFalse:[foo])
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  4820
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  4821
      if they are message sends, the equivalent code is:
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  4822
          [
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  4823
              |t1 t2|
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  4824
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  4825
              t1 := foo.
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  4826
              t2 := bar.
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  4827
              t1 isNil ifTrue:[t2] ifFalse:[t1]
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  4828
          ] value
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  4829
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4830
      Can be used to provide defaultValues to variables,
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4831
      as in:
1958
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  4832
          foo := arg ? #defaultValue
2147
3579ce76c8c8 comment
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  4833
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4834
      Note: this method should never be redefined in classes other than UndefinedObject.
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4835
     "
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4836
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4837
    ^ self
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4838
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4839
    "
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4840
     1 ? #default
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4841
     nil ? #default
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4842
    "
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4843
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4844
    "Created: 4.11.1996 / 20:36:19 / cg"
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4845
    "Modified: 11.1.1997 / 14:56:47 / cg"
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4846
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4847
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4848
isArray
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4849
    "return true, if the receiver is some kind of array (or weakArray etc);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4850
     false is returned here - the method is only redefined in Array."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4851
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4852
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4853
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4854
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4855
isAssociation
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4856
    "return true, if the receiver is some kind of association;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4857
     false is returned here - the method is only redefined in Association."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4858
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4859
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4860
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4861
    "Created: 14.5.1996 / 17:03:45 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4862
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4863
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4864
isBehavior
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4865
    "return true, if the receiver is some kind of class (i.e. behavior);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4866
     false is returned here - the method is only redefined in Behavior."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4868
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4869
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4870
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4871
isBlock
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4872
    "return true, if the receiver is some kind of block;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4873
     false returned here - the method is only redefined in Block."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4874
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4875
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4876
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4877
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4878
isCharacter
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4879
    "return true, if the receiver is some kind of character;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4880
     false is returned here - the method is only redefined in Character."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4881
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4882
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4883
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4884
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4885
isClass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4886
    "return true, if the receiver is some kind of class (real class, 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4887
     not just behavior);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4888
     false is returned here - the method is only redefined in Class."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4889
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4890
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4891
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4892
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4893
isCollection
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4894
    "return true, if the receiver is some kind of collection;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4895
     false is returned here - the method is only redefined in Collection."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4896
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4897
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4898
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4899
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4900
isColor
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4901
    "return true, if the receiver is some kind of color;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4902
     false is returned here - the method is only redefined in Color."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4903
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4904
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4905
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4906
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4907
isContext
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4908
    "return true, if the receiver is some kind of context;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4909
     false returned here - the method is only redefined in Context."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4910
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4911
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4912
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4913
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4914
isExternalStream
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4915
    "return true, if the receiver is some kind of externalStream;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4916
     false is returned here - the method is only redefined in ExternalStream."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4917
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4918
    ^false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4919
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4920
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4921
isFileStream
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4922
    "return true, if the receiver is some kind of fileStream;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4923
     false is returned here - the method is only redefined in FileStream."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4924
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4925
    ^false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4926
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4927
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  4928
isFixedPoint
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  4929
    "return true, if the receiver is some kind of fixedPoint number;
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  4930
     false is returned here - the method is only redefined in FixedPoint."
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  4931
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  4932
    ^ false
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  4933
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  4934
    "Created: 5.11.1996 / 19:23:04 / cg"
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  4935
!
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  4936
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4937
isFixedSize
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4938
    "return true if the receiver cannot grow easily 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4939
     (i.e. a grow may be expensive, since it involves a become:)"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4940
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4941
    ^ true
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4942
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4943
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4944
isForm
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4945
    "return true, if the receiver is some kind of form;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4946
     false is returned here - the method is only redefined in Form."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4947
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4948
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4949
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4950
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4951
isFraction
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4952
    "return true, if the receiver is some kind of fraction;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4953
     false is returned here - the method is only redefined in Fraction."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4954
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4955
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4956
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4957
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4958
isImage
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4959
    "return true, if the receiver is some kind of image;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4960
     false is returned here - the method is only redefined in Image."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4961
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4962
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4963
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4964
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4965
isImageOrForm
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4966
    "return true, if the receiver is some kind of image or form;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4967
     false is returned here - the method is only redefined in Image and Form."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4968
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4969
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4970
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4971
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4972
isInteger
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4973
    "return true, if the receiver is some kind of integer number;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4974
     false is returned here - the method is only redefined in Integer."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4975
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4976
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4977
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4978
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4979
isKindOf:aClass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4980
    "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
  4981
     subclasses, false otherwise.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4982
     Advice: 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4983
	use of this to check objects for certain attributes/protocoll should
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4984
	be avoided; it limits the reusability of your classes by limiting use
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4985
	to instances of certain classes and fences you into a specific inheritance 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4986
	hierarchy.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4987
	Use check-methods to check an object for a certain attributes/protocol
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4988
	(such as #isXXXX, #respondsTo: or #isNumber).
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4989
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4990
	Using #isKindOf: is considered BAD STYLE.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4991
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4992
     Advice2:
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4993
	Be aware, that using an #isXXX method is usually much faster than 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4994
	using #isKindOf:; because isKindOf: has to walk up all the superclass 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4995
	hierarchy, comparing every class on the way. 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4996
	Due to caching in the VM, a call to #isXXX is normally reached via
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4997
	a single function call.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4998
     "
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4999
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5000
%{  /* NOCONTEXT */
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5001
    register OBJ thisClass;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5002
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5003
    thisClass = __Class(self);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5004
    while (thisClass != nil) {
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5005
	if (thisClass == aClass) {
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5006
	    RETURN ( true );
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5007
	}
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5008
	thisClass = __ClassInstPtr(thisClass)->c_superclass;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5009
    }
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5010
%}
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5011
.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5012
"/
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5013
"/  the above code is equivalent to:
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5014
"/
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5015
"/  thisClass := self class.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5016
"/  [thisClass notNil] whileTrue:[
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5017
"/      thisClass == aClass ifTrue:[^ true].
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5018
"/      thisClass := thisClass superclass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5019
"/  ]
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5020
"/
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5021
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5022
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5023
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5024
isLayout
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5025
    "return true, if the receiver is some kind of layout;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5026
     false is returned here - the method is only redefined in Layout."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5027
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5028
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5029
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5030
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5031
isLiteral
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5032
    "return true, if the receiver can be represented as a constant in ST syntax;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5033
     false is returned here - the method is redefined in some classes."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5034
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5035
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5036
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5037
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5038
isMemberOf:aClass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5039
    "return true, if the receiver is an instance of aClass, false otherwise.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5040
     Advice: 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5041
	use of this to check objects for certain attributes/protocoll should
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5042
	be avoided; it limits the reusability of your classes by limiting use
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5043
	to instances of a certain class.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5044
	Use check-methods to check an object for a certain attributes/protocol
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5045
	(such as #isXXX, #respondsTo: or #isNumber);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5046
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5047
	Using #isMemberOf: is considered BAD STYLE."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5048
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5049
    ^ (self class) == aClass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5050
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5051
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5052
isMeta
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5053
    "return true, if the receiver is some kind of metaclass;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5054
     false is returned here - the method is only redefined in Metaclass."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5055
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5056
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5057
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5058
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5059
isMethod
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5060
    "return true, if the receiver is some kind of method;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5061
     false returned here - the method is only redefined in Method."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5062
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5063
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5064
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5065
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5066
isNamespace
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5067
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5068
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5069
    "Created: 11.10.1996 / 18:08:56 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5070
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5071
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5072
isNumber
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5073
    "return true, if the receiver is some kind of number;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5074
     false is returned here - the method is only redefined in Number."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5075
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5076
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5077
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5078
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5079
isPoint
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5080
    "return true, if the receiver is some kind of point;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5081
     false is returned here - the method is only redefined in Point."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5082
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5083
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5084
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5085
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5086
isReal
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5087
    "return true, if the receiver is some kind of real number;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5088
     false is returned here - the method is only redefined in LimitedPrecisionReal."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5089
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5090
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5091
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5092
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5093
isRectangle
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5094
    "return true, if the receiver is some kind of rectangle;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5095
     false is returned here - the method is only redefined in Rectangle."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5096
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5097
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5098
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5099
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5100
isRemoteObject
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5101
    "return true, if the receiver is some kind of remoteObject,
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5102
     false if its local - the method is only redefined in RemoteObject."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5103
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5104
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5105
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5106
    "Created: 28.10.1996 / 15:18:45 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5107
    "Modified: 28.10.1996 / 15:20:57 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5108
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5109
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5110
isSequenceable
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5111
    "return true, if the receiver is some kind of sequenceable collection;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5112
     false is returned here - the method is only redefined in SequenceableCollection."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5113
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5114
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5115
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5116
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5117
isSequenceableCollection
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5118
    "OBSOLETE: use isSequenceable for ST-80 compatibility.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5119
     This method is a historic leftover and will be removed soon ..."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5120
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5121
    self obsoleteMethodWarning:'use #isSequenceable'.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5122
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5123
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5124
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5125
isSignal
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5126
    "return true, if the receiver is some kind of signal;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5127
     false returned here - the method is only redefined in Signal."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5128
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5129
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5130
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5131
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5132
isStream
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5133
    "return true, if the receiver is some kind of stream;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5134
     false is returned here - the method is only redefined in Stream."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5135
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5136
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5137
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5138
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5139
isString
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5140
    "return true, if the receiver is some kind of string;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5141
     false is returned here - the method is only redefined in String."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5142
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5143
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5144
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5145
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5146
isSymbol
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5147
    "return true, if the receiver is some kind of symbol;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5148
     false is returned here - the method is only redefined in Symbol."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5149
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5150
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5151
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5152
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5153
isText
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5154
    "return true, if the receiver is some kind of text object;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5155
     false is returned here - the method is only redefined in Text."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5156
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5157
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5158
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5159
    "Created: 12.5.1996 / 10:56:50 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5160
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5161
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5162
isVariable
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5163
    "return true if the receiver has indexed instance variables,
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5164
     false otherwise."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5165
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5166
    ^ self class isVariable
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5167
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5168
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5169
isView
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5170
    "return true, if the receiver is some kind of view;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5171
     false is returned here - the method is only redefined in View."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5172
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5173
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5174
! !
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5175
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5176
!Object methodsFor:'user interaction & notifications'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5177
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5178
activityNotification:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5179
    "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
  5180
     some long-time activity.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5181
     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
  5182
     passing the argument. The handler should show this message whereever it likes,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5183
     and proceed. If there is no handler, this is simply ignored.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5184
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5185
     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
  5186
     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
  5187
     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
  5188
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5189
    ActivityNotificationSignal isHandled ifTrue:[
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5190
	^ ActivityNotificationSignal raiseRequestWith:self errorString:aString
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5191
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5192
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5193
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5194
     nil activityNotification:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5195
     self activityNotification:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5196
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5197
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5198
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5199
     ActivityNotificationSignal handle:[:ex |
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5200
	ex errorString printNL.
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5201
	ex proceed.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5202
     ] do:[
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5203
	'hello' printNL.
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5204
	self activityNotification:'doing some long time computation'.
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5205
	'world' printNL.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5206
     ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5207
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5208
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5209
    "Modified: 16.12.1995 / 18:23:42 / cg"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5210
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5211
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5212
confirm:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5213
    "launch a confirmer, which allows user to enter yes or no.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5214
     return true for yes, false for no"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5215
925
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5216
    "
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5217
     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
  5218
     and return true (as if yes was answered)
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5219
     Q: should we ask user by reading Stdin ?
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5220
    "
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5221
    Smalltalk isInitialized ifFalse:[
1905
c28c1f8048a3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
  5222
        '*** confirmation requested during initialization:' printCR. 
c28c1f8048a3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
  5223
        aString printCR.
c28c1f8048a3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
  5224
        '*** I''ll continue, assuming <yes> ...' printCR.
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5225
        ^ true
925
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5226
    ].
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5227
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5228
    Dialog isNil ifTrue:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5229
        Transcript showCR:aString.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5230
        Transcript showCR:'continue, assuming <yes>'.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5231
        ^ true
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5232
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5233
    Dialog autoload.        "in case its autoloaded"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5234
    ^ Dialog confirm:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5235
        
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5236
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5237
     nil confirm:'hello'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5238
     self confirm:'hello'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5239
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5240
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5241
    "Modified: 20.5.1996 / 10:28:40 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5242
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5243
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5244
errorNotify:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5245
    "launch a Notifier, showing top stack, telling user something
2150
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5246
     and give user a chance to enter debugger."
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5247
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5248
    ^ self
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5249
        errorNotify:aString 
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5250
        from:thisContext sender
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5251
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5252
    "
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5253
     nil errorNotify:'hello there'
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5254
     self errorNotify:'hello there'
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5255
    "
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5256
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5257
    "Modified: 11.1.1997 / 18:39:20 / cg"
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5258
!
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5259
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5260
errorNotify:aString from:aContext
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5261
    "launch a Notifier, showing top stack (above aContext), 
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5262
     telling user something and give user a chance to enter debugger."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5263
2082
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5264
    |info con sender action|
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5265
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5266
    Smalltalk isInitialized ifFalse:[
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5267
        'errorNotification: ' print. aString printCR.
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5268
        ^ self
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5269
    ].
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5270
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5271
    Dialog isNil ifTrue:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5272
        "
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5273
         on systems without GUI, simply show
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5274
         the message on the Transcript.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5275
        "
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5276
        Transcript showCR:aString.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5277
        ^ self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5278
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5279
    Dialog autoload.        "in case its autoloaded"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5280
2192
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5281
    ErrorSignal handle:[:ex |
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5282
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5283
        "/ a recursive error - quickly enter debugger
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5284
        "/ this happened, when I corrupted the Dialog class ...
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5285
2194
d9e23c3c53ce checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2192
diff changeset
  5286
        ('Object [error]: ' , ex errorString , ' cought in errorNotification') errorPrintCR.
2192
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5287
        action := #debug.
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5288
        ex return.
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5289
    ] do:[
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5290
        sender := aContext.
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5291
        sender isNil ifTrue:[
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5292
            sender := thisContext sender.
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5293
            "/
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5294
            "/ for your convenience: skip the emergencyHandler block
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5295
"/            sender isBlockContext ifTrue:[
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5296
"/                sender := sender sender
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5297
"/            ].
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5298
        ].
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5299
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5300
        "/ skip intermediate (signal & exception) contexts
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5301
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5302
        DebugView notNil ifTrue:[
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5303
            sender := DebugView interestingContextFrom:sender
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5304
        ].
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5305
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5306
        "/ show the first 5 contexts
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5307
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5308
        con := sender.
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5309
        info := aString , Character cr asString , Character cr asString.
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5310
        1 to:5 do:[:n |
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5311
            con notNil ifTrue:[
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5312
                info := info , con printString , Character cr asString.
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5313
                con := con sender
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5314
            ]
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5315
        ].
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5316
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5317
        action := Dialog 
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5318
                    choose:info 
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5319
                    label:'Exception'
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5320
                    labels:#('proceed' 'abort' 'debug')
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5321
                    values:#(#proceed #abort #debug)
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5322
                    default:#debug.
2082
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5323
    ].
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5324
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5325
    action == #debug ifTrue:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5326
        Debugger enter:sender withMessage:aString
2082
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5327
    ] ifFalse:[
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5328
        action == #abort ifTrue:[
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5329
            AbortSignal raise
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5330
        ]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5331
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5332
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5333
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5334
     nil errorNotify:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5335
     self errorNotify:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5336
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5337
2150
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5338
    "Created: 11.1.1997 / 17:53:09 / cg"
2194
d9e23c3c53ce checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2192
diff changeset
  5339
    "Modified: 17.1.1997 / 18:21:58 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5340
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5341
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5342
information:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5343
    "launch an InfoBox, telling user something. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5344
     These info-boxes can be suppressed by handling the 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5345
     UserNotification- or InformationSignal and proceeding in the handler."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5346
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5347
    InformationSignal isHandled ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5348
	^ InformationSignal raiseRequestWith:self errorString:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5349
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5350
    self notify:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5351
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5352
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5353
     nil information:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5354
     self information:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5355
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5356
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5357
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5358
     InformationSignal handle:[:ex |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5359
	'no box popped' printNL.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5360
	ex proceed.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5361
     ] do:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5362
	'hello' printNL.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5363
	self information:'some info'.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5364
	'world' printNL.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5365
     ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5366
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5367
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5368
    "Modified: 24.11.1995 / 22:29:49 / cg"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5369
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5370
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5371
notify:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5372
    "launch a Notifier, telling user something.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5373
     Use #information: for ignorable messages."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5374
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5375
    Smalltalk isInitialized ifFalse:[
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5376
        'information: ' print. aString printCR.
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5377
        ^ self
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5378
    ].
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5379
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5380
    Dialog isNil ifTrue:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5381
        "
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5382
         on systems without GUI, simply show
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5383
         the message on the Transcript.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5384
        "
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5385
        Transcript showCR:aString.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5386
        ^ self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5387
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5388
    Dialog autoload.        "in case its autoloaded"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5389
    Dialog information:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5390
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5391
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5392
     nil notify:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5393
     self notify:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5394
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5395
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5396
    "Modified: 20.5.1996 / 10:28:48 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5397
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5398
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5399
warn:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5400
    "launch a WarningBox, telling user something.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5401
     These warn-boxes can be suppressed by handling the 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5402
     UserNotification- or WarningSignal and proceeding in the handler."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5403
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5404
    WarningSignal isHandled ifTrue:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5405
        ^ WarningSignal raiseRequestWith:self errorString:aString
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5406
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5407
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5408
    Smalltalk isInitialized ifFalse:[
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5409
        'warning: ' print. aString printCR.
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5410
        ^ self
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5411
    ].
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5412
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5413
    Dialog isNil ifTrue:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5414
        "
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5415
         on systems without GUI, simply show
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5416
         the message on the Transcript.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5417
        "
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5418
        Transcript showCR:aString.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5419
        ^ self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5420
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5421
    Dialog autoload.        "in case its autoloaded"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5422
    Dialog warn:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5423
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5424
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5425
     nil warn:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5426
     self warn:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5427
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5428
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5429
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5430
     WarningSignal handle:[:ex |
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5431
        ex proceed.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5432
     ] do:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5433
        'hello' printNL.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5434
        self warn:'some info'.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5435
        'world' printNL.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5436
     ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5437
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5438
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5439
    "Modified: 20.5.1996 / 10:28:53 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5440
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5441
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  5442
!Object class methodsFor:'documentation'!
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5443
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5444
version
2194
d9e23c3c53ce checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2192
diff changeset
  5445
    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.163 1997-01-17 19:42:19 cg Exp $'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5446
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5447
Object initialize!