Object.st
author Claus Gittinger <cg@exept.de>
Sat, 22 Mar 1997 16:19:44 +0100
changeset 2484 05bd2cc43192
parent 2480 077b0a0f9248
child 2502 8f3bf6043968
permissions -rw-r--r--
#privateClasses now returns an unsorted set; use #privateClassesSorted for old behavior.
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
2231
88ffbbaf1986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
    22
		ActivityNotificationSignal InternalErrorSignal
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
    23
		NonWeakDependencies SynchronizationSemaphores'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    24
	poolDictionaries:''
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    25
	category:'Kernel-Objects'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    26
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    27
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
    28
!Object class methodsFor:'documentation'!
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
    29
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    30
copyright
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    31
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    32
 COPYRIGHT (c) 1988 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
    33
	      All Rights Reserved
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    34
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    35
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    36
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    37
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    38
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    39
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    40
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    41
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    42
!
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    43
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    44
dependencies
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    45
"
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    46
   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
    47
   (we think they are better ;-).
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    48
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    49
   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
    50
   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
    51
   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
    52
   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
    53
   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
    54
   to dependent or the dependee.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    55
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    56
   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
    57
   prevent memory leaks.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    58
   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
    59
   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
    60
   need to care about dependencies.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    61
   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
    62
   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
    63
   (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
    64
    that behavior)
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    65
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    66
   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
    67
   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
    68
   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
    69
   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
    70
   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
    71
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    72
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    73
   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
    74
   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
    75
   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
    76
   references exist to the dependent.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    77
   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
    78
   (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
    79
   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
    80
   (see #addNonWeakDependent / #removeNonWeakDependent).
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
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    83
   Caveat:
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
    84
      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
    85
      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
    86
      automatically).
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    87
      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
    88
      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
    89
      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
    90
      (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
    91
      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
    92
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    93
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    94
   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
    95
"
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    96
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    97
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
    98
documentation
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
    99
"
1294
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   100
   Object is the superclass of most other classes. 
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   101
   (except for nil-subclasses, which inherit nothing,
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   102
    to catch any message into their #doesNotUnderstand: method)
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   103
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   104
   Protocol which is common to every object is defined here.
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   105
   Also some utility stuff (like notify) and error handling is implemented here.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   106
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   107
   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
   108
   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
   109
   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
   110
   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
   111
   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
   112
   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
   113
   (and also rewritten in some places).
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   114
1294
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   115
   [Class variables:]
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   116
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   117
        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
   118
                                        also, parent of all other signals.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   119
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   120
        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
   121
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   122
        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
   123
        UserInterruptSignal
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   124
        RecursionInterruptSignal 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   125
        ExceptionInterruptSignal
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   126
        SubscriptOutOfBoundsSignal 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   127
        NonIntegerIndexSignal
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   128
        NotFoundSignal 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   129
        KeyNotFoundSignal 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   130
        ElementOutOfBoundsSignal
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   131
        InformationSignal
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   132
        WarningSignal
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   133
        DeepCopyErrorSignal
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
   134
        InternalErrorSignal
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   135
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   136
        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
   137
                                        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
   138
                                        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
   139
                                        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
   140
                                        an error.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   141
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   142
        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
   143
                                        an error while handling an error).
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   144
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
   145
        Dependencies     <WeakDependencyDictionary>  
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
   146
                                        keeps track of object dependencies.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
   147
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
   148
        InfoPrinting     <Boolean>      controls weather informational messages 
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
   149
                                        are printed.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
   150
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
   151
        ActivityNotificationSignal <QuerySignal> 
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
   152
                                         raised on #activityNotification:
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
   153
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
   154
        NonWeakDependencies <Dictionary> keeps track of object dependencies.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
   155
                                         Dependents stay alive.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
   156
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
   157
        SynchronizationSemaphores <WeakIdentityDictionary>
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
   158
                                         Semaphores for per-object-monitor.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
   159
                                        
1294
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   160
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   161
    [author:]
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   162
        Claus Gittinger
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   163
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   164
"
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   165
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   166
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
   167
!Object class methodsFor:'initialization'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   168
a27a279701f8 Initial revision
claus
parents:
diff changeset
   169
initialize
a27a279701f8 Initial revision
claus
parents:
diff changeset
   170
    "called only once - initialize signals"
a27a279701f8 Initial revision
claus
parents:
diff changeset
   171
a27a279701f8 Initial revision
claus
parents:
diff changeset
   172
    ErrorSignal isNil ifTrue:[
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   173
        ErrorSignal := (Signal new) mayProceed:true.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   174
        ErrorSignal nameClass:self message:#errorSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   175
        ErrorSignal notifierString:'error encountered'.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   176
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   177
        HaltSignal := ErrorSignal newSignalMayProceed:true.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   178
        HaltSignal nameClass:self message:#haltSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   179
        HaltSignal notifierString:'halt encountered'.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   180
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   181
        MessageNotUnderstoodSignal := ErrorSignal newSignalMayProceed:true.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   182
        MessageNotUnderstoodSignal nameClass:self message:#messageNotUnderstoodSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   183
        MessageNotUnderstoodSignal notifierString:'message not understood'.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   184
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   185
        PrimitiveFailureSignal := ErrorSignal newSignalMayProceed:true.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   186
        PrimitiveFailureSignal nameClass:self message:#primitiveFailureSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   187
        PrimitiveFailureSignal notifierString:'primitive failed'.
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   188
2227
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   189
        InternalErrorSignal := ErrorSignal newSignalMayProceed:false.
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   190
        InternalErrorSignal nameClass:self message:#internalError.
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   191
        InternalErrorSignal notifierString:'VM internal error: '.
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   192
362
claus
parents: 359
diff changeset
   193
"/        UserInterruptSignal := ErrorSignal newSignalMayProceed:true.
2042
a92164c8bbf8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1958
diff changeset
   194
        UserInterruptSignal := (Signal new) mayProceed:true.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   195
        UserInterruptSignal nameClass:self message:#userInterruptSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   196
        UserInterruptSignal notifierString:'user Interrupt'.
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   197
362
claus
parents: 359
diff changeset
   198
"/        RecursionInterruptSignal := ErrorSignal newSignalMayProceed:false.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   199
        RecursionInterruptSignal := (Signal new) mayProceed:true.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   200
        RecursionInterruptSignal nameClass:self message:#recursionInterruptSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   201
        RecursionInterruptSignal notifierString:'recursion limit reached'.
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
        ExceptionInterruptSignal := ErrorSignal newSignalMayProceed:true.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   204
        ExceptionInterruptSignal nameClass:self message:#exceptionInterruptSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   205
        ExceptionInterruptSignal notifierString:'exception Interrupt'.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   206
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   207
        SubscriptOutOfBoundsSignal := ErrorSignal newSignalMayProceed:false.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   208
        SubscriptOutOfBoundsSignal nameClass:self message:#subscriptOutOfBoundsSignal.
1377
26e6af9693a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
   209
        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
   210
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   211
        ElementOutOfBoundsSignal := ErrorSignal newSignalMayProceed:false.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   212
        ElementOutOfBoundsSignal nameClass:self message:#elementOutOfBoundsSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   213
        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
   214
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   215
        NotFoundSignal := ErrorSignal newSignalMayProceed:true.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   216
        NotFoundSignal nameClass:self message:#notFoundSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   217
        NotFoundSignal notifierString:'no such element'.
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
        KeyNotFoundSignal := ErrorSignal newSignalMayProceed:true.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   220
        KeyNotFoundSignal nameClass:self message:#keyNotFoundSignal.
1377
26e6af9693a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
   221
        KeyNotFoundSignal notifierString:'no such key: '.
1217
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
        NonIntegerIndexSignal := ErrorSignal newSignalMayProceed:false.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   224
        NonIntegerIndexSignal nameClass:self message:#nonIntegerIndexSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   225
        NonIntegerIndexSignal notifierString:'index must be integer'.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   226
2042
a92164c8bbf8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1958
diff changeset
   227
        UserNotificationSignal := QuerySignal new.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   228
        UserNotificationSignal nameClass:self message:#userNotificationSignal.
2042
a92164c8bbf8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1958
diff changeset
   229
        UserNotificationSignal notifierString:'user notifiaction wanted'.
1217
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
        InformationSignal := UserNotificationSignal newSignalMayProceed:true.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   232
        InformationSignal nameClass:self message:#informationSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   233
        InformationSignal notifierString:'information'.
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
        WarningSignal := UserNotificationSignal newSignalMayProceed:true.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   236
        WarningSignal nameClass:self message:#warnungSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   237
        WarningSignal notifierString:'warning'.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   238
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   239
        ActivityNotificationSignal := UserNotificationSignal newSignalMayProceed:true.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   240
        ActivityNotificationSignal nameClass:self message:#activityNotificationSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   241
        ActivityNotificationSignal notifierString:'activity'.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   242
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   243
        DeepCopyErrorSignal := ErrorSignal newSignalMayProceed:true.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   244
        DeepCopyErrorSignal nameClass:self message:#deepCopyErrorSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   245
        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
   246
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   247
        "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   248
         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
   249
         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
   250
        "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   251
        AbortSignal := Signal new mayProceed:true.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   252
        AbortSignal nameClass:self message:#abortSignal.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   253
        AbortSignal notifierString:'unhandled abort signal'.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   254
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   255
        Dependencies isNil ifTrue:[
2096
bc7296b593ee use new WeakDependencyDictionary
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
   256
            Dependencies := WeakDependencyDictionary new.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   257
        ].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   258
        NonWeakDependencies isNil ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   259
            NonWeakDependencies := IdentityDictionary new.
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
   260
        ].
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
   261
        SynchronizationSemaphores isNil ifTrue:[
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
   262
            SynchronizationSemaphores := WeakIdentityDictionary new.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
   263
        ].
356
claus
parents: 348
diff changeset
   264
    ].
2114
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
   265
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
   266
    "/ 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
   267
    "/ (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
   268
    InfoPrinting := ObjectMemory infoPrinting.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   269
a27a279701f8 Initial revision
claus
parents:
diff changeset
   270
    "Object initialize"
812
00db9c0646fe notificationsignals are no longer children of ErrorSignal
Claus Gittinger <cg@exept.de>
parents: 783
diff changeset
   271
2096
bc7296b593ee use new WeakDependencyDictionary
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
   272
    "Modified: 9.1.1997 / 00:28:38 / cg"
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
   273
    "Modified: 28.1.1997 / 19:38:58 / stefan"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   274
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   275
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
   276
!Object class methodsFor:'Signal constants'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   277
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   278
abortSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   279
    "return the signal used to abort user actions. This signal is only
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   280
     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
   281
     currently active doIt/printIt or inspectIt. (also some others use
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   282
     this for a save abort)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   283
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   284
    ^ AbortSignal
579
2d26193415b5 allow catching of information: and warn: boxes
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   285
!
2d26193415b5 allow catching of information: and warn: boxes
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   286
782
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   287
activityNotificationSignal
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   288
    "return the signal used for activity notifications.
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   289
     A handler for this signal gets all #activityNotification: sends"
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   290
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   291
    ^ ActivityNotificationSignal
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   292
!
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   293
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   294
deepCopyErrorSignal 
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   295
    "return the signal raised when a deepcopy is asked for
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   296
     an object which cannot do this (for example, BlockClosures
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   297
     or Contexts)."
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   298
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   299
    ^ DeepCopyErrorSignal
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   300
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   301
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   302
elementOutOfBoundsSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   303
    "return the signal used for element error reporting
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   304
     (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
   305
      be put into a bytearray)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   306
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   307
    ^ ElementOutOfBoundsSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   308
!
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
errorSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   311
    "return the signal used for error/error: - handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   312
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   313
    ^ ErrorSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   314
!
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
exceptionInterruptSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   317
    "return the signal used for exception (display errors) error handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   318
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   319
    ^ ExceptionInterruptSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   320
!
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
haltSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   323
    "return the signal used for halt/halt: - handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   324
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   325
    ^ HaltSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   326
!
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
informationSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   329
    "return the signal used for informations. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   330
     A handler for this signal gets all #information: sends"
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
    ^ InformationSignal
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
2227
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   335
internalErrorSignal
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   336
    "return the signal used to report internal (VM-) errors."
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   337
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   338
    ^ InternalErrorSignal
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   339
!
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   340
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   341
keyNotFoundSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   342
    "return the signal used for no such key error reporting"
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
    ^ KeyNotFoundSignal
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
messageNotUnderstoodSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   348
    "return the signal used for doesNotUnderstand: - 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
    ^ MessageNotUnderstoodSignal
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
nonIntegerIndexSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   354
    "return the signal used for bad subscript error reporting"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   355
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   356
    ^ NonIntegerIndexSignal
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   359
notFoundSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   360
    "return the signal used for no element found error reporting"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   361
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   362
    ^ NotFoundSignal
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   365
primitiveFailureSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   366
    "return the signal used for primitiveFailed - error handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   367
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   368
    ^ PrimitiveFailureSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   369
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   370
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   371
privateMethodSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   372
    "return the signal used for privateMethod - error handling"
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
    ^ MessageNotUnderstoodSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   375
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   376
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   377
recursionInterruptSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   378
    "return the signal used for recursion overflow error handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   379
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   380
    ^ RecursionInterruptSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   381
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   382
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   383
subscriptOutOfBoundsSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   384
    "return the signal used for subscript error reporting.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   385
     (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
   386
      index less than 1 or greater than the array size)"
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
    ^ SubscriptOutOfBoundsSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   389
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   390
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   391
userInterruptSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   392
    "return the signal used for ^C interrupts handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   393
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   394
    ^ UserInterruptSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   395
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   396
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   397
userNotificationSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   398
    "the parent signal used with information and warnings.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   399
     Handling this allows handling of both information- and warning notifications."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   400
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   401
    ^ UserNotificationSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   402
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   403
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   404
warningSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   405
    "return the signal used for warnings.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   406
     A handler for this signal gets all #warn: sends"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   407
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   408
    ^ WarningSignal
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   409
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   410
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
   411
!Object class methodsFor:'info messages'!
356
claus
parents: 348
diff changeset
   412
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   413
infoPrinting
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   414
    "return the flag which controls information messages."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   415
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   416
    ^ InfoPrinting
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   417
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   418
356
claus
parents: 348
diff changeset
   419
infoPrinting:aBoolean
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   420
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   421
356
claus
parents: 348
diff changeset
   422
    "turn on/off printing of information messages.
claus
parents: 348
diff changeset
   423
     If the argument, aBoolean is false, infoPrint will not output
claus
parents: 348
diff changeset
   424
     messages. The default is true."
claus
parents: 348
diff changeset
   425
claus
parents: 348
diff changeset
   426
    InfoPrinting := aBoolean
claus
parents: 348
diff changeset
   427
! !
claus
parents: 348
diff changeset
   428
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
   429
!Object class methodsFor:'queries'!
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   430
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   431
isBuiltInClass
49
f1c2d75f2eb6 *** empty log message ***
claus
parents: 44
diff changeset
   432
    "return true, if this class is known by the run-time-system,
f1c2d75f2eb6 *** empty log message ***
claus
parents: 44
diff changeset
   433
     i.e. you cannot add/remove instance variables without recompiling
1266
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   434
     the VM.
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   435
     Here, true is returned for myself, false for subclasses."
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   436
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   437
    ^ self == Object
1266
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   438
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   439
    "Modified: 23.4.1996 / 16:00:07 / cg"
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   440
! !
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   441
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   442
!Object methodsFor:'accessing'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   443
a27a279701f8 Initial revision
claus
parents:
diff changeset
   444
at:index
a27a279701f8 Initial revision
claus
parents:
diff changeset
   445
    "return the indexed instance variable with index, anInteger;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   446
     this method can be redefined in subclasses."
a27a279701f8 Initial revision
claus
parents:
diff changeset
   447
a27a279701f8 Initial revision
claus
parents:
diff changeset
   448
    ^ self basicAt:index
a27a279701f8 Initial revision
claus
parents:
diff changeset
   449
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   450
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   451
at:index put:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   452
    "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
   453
     this method can be redefined in subclasses. Returns anObject (sigh)"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   454
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   455
    ^ self basicAt:index put:anObject
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   456
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   457
    "Modified: 19.4.1996 / 11:13:29 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   458
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   459
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   460
basicAt:index
a27a279701f8 Initial revision
claus
parents:
diff changeset
   461
    "return the indexed instance variable with index, anInteger.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   462
     Trigger an error if the receiver has no indexed instance variables.
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   463
     This method should NOT be redefined in any subclass (except with great care, for tuning)"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   464
a27a279701f8 Initial revision
claus
parents:
diff changeset
   465
%{  /* NOCONTEXT */
a27a279701f8 Initial revision
claus
parents:
diff changeset
   466
329
claus
parents: 325
diff changeset
   467
    REGISTER int nbytes, indx;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   468
    OBJ myClass;
329
claus
parents: 325
diff changeset
   469
    REGISTER char *pFirst;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   470
    unsigned char *cp;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   471
    unsigned short *sp;
1515
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   472
    short *ssp;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   473
    unsigned long *lp;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   474
    long *slp;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   475
    unsigned long ul;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   476
    long l;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   477
    OBJ *op;
329
claus
parents: 325
diff changeset
   478
/*    int nInstBytes, nInstVars, flags; */
claus
parents: 325
diff changeset
   479
    REGISTER int n;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   480
a27a279701f8 Initial revision
claus
parents:
diff changeset
   481
a27a279701f8 Initial revision
claus
parents:
diff changeset
   482
    /*
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   483
     * notice the missing test for self being a nonNilObject -
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   484
     * this can be done since basicAt: is defined both in UndefinedObject
a27a279701f8 Initial revision
claus
parents:
diff changeset
   485
     * and SmallInteger
a27a279701f8 Initial revision
claus
parents:
diff changeset
   486
     */
253
30daee717a53 *** empty log message ***
claus
parents: 228
diff changeset
   487
    if (__isSmallInteger(index)) {
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   488
        myClass = __qClass(self);
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   489
        indx = __intVal(index) - 1;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   490
        n /* nInstVars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   491
        n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* nInstVars */);
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   492
        nbytes = __qSize(self) - n /* nInstBytes */;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   493
        pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   494
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   495
        /* 
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   496
         * replaced switch by open-coded if; this is slightly faster 
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   497
         * 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
   498
         */
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   499
        n = (INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK);
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   500
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   501
        if ((n == __MASKSMALLINT(POINTERARRAY))
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   502
         || (n == __MASKSMALLINT(WKPOINTERARRAY))) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   503
            if ((indx >= 0) && (indx < (__BYTES2OBJS__(nbytes)))) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   504
                op = (OBJ *)pFirst + indx;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   505
                RETURN ( *op );
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(BYTEARRAY)) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   508
            if ((indx >= 0) && (indx < (nbytes / sizeof(char)))) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   509
                cp = (unsigned char *)pFirst + indx;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   510
                RETURN ( __MKSMALLINT(*cp & 0xFF) );
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(FLOATARRAY)) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   513
            if ((indx >= 0) && (indx < (nbytes / sizeof(float)))) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   514
                float *fp;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   515
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   516
                fp = (float *)pFirst + indx;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   517
                RETURN ( __MKFLOAT((double)(*fp)));
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   518
            }
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   519
        } else if (n == __MASKSMALLINT(DOUBLEARRAY)) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   520
            if ((indx >= 0) && (indx < (nbytes / sizeof(double)))) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   521
                double *dp;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   522
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   523
#ifdef NEED_DOUBLE_ALIGN
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   524
                /*
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   525
                 * care for filler
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   526
                 */
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   527
                pFirst += sizeof(FILLTYPE);
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   528
#endif
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   529
                dp = (double *)pFirst + indx;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   530
                RETURN ( __MKFLOAT(*dp));
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   531
            }
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   532
        } else if (n == __MASKSMALLINT(WORDARRAY)) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   533
            if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   534
                sp = (unsigned short *)pFirst + indx;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   535
                RETURN ( __MKSMALLINT(*sp & 0xFFFF) );
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   536
            }
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   537
        } else if (n == __MASKSMALLINT(SWORDARRAY)) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   538
            if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   539
                ssp = (short *)pFirst + indx;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   540
                RETURN ( __MKSMALLINT(*ssp) );
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   541
            }
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   542
        } else if (n == __MASKSMALLINT(LONGARRAY)) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   543
            if ((indx >= 0) && (indx < (nbytes / sizeof(long)))) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   544
                lp = (unsigned long *)pFirst + indx;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   545
                ul = *lp;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   546
                if (ul <= _MAX_INT)
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   547
                    RETURN ( __MKSMALLINT(ul) );
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   548
                RETURN ( __MKULARGEINT(ul) );
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   549
            }
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   550
        } else if (n == __MASKSMALLINT(SLONGARRAY)) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   551
            if ((indx >= 0) && (indx < (nbytes / sizeof(long)))) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   552
                slp = (long *)pFirst + indx;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   553
                l = *slp;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   554
                if ((l >= _MIN_INT) && (l <= _MAX_INT))
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   555
                    RETURN ( __MKSMALLINT(l) );
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   556
                RETURN ( __MKLARGEINT(l) );
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   557
            }
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   558
        }
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   559
    }
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   560
%}.
10
claus
parents: 5
diff changeset
   561
    index isInteger ifFalse:[
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   562
        ^ self indexNotInteger
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   563
    ].
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   564
    ^ self subscriptBoundsError:index
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   565
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   566
a27a279701f8 Initial revision
claus
parents:
diff changeset
   567
basicAt:index put:anObject
a27a279701f8 Initial revision
claus
parents:
diff changeset
   568
    "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
   569
     Returns anObject (sigh).
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   570
     Trigger an error if the receiver has no indexed instance variables.
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   571
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   572
     This method should NOT be redefined in any subclass (except with great care, for tuning)"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   573
a27a279701f8 Initial revision
claus
parents:
diff changeset
   574
%{  /* NOCONTEXT */
a27a279701f8 Initial revision
claus
parents:
diff changeset
   575
a27a279701f8 Initial revision
claus
parents:
diff changeset
   576
    register int nbytes, indx;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   577
    OBJ myClass;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   578
    register char *pFirst;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   579
    char *cp;
1515
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   580
    unsigned short *sp;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   581
    short *ssp;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   582
    unsigned long *lp;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   583
    long *slp;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   584
    OBJ *op;
329
claus
parents: 325
diff changeset
   585
/*    int nInstBytes, ninstvars, flags; */
claus
parents: 325
diff changeset
   586
    REGISTER int n;
1515
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   587
    unsigned int u;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   588
    int val;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   589
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   590
    /* notice the missing test for self being a nonNilObject -
77
6c38ca59927f *** empty log message ***
claus
parents: 71
diff changeset
   591
       this can be done since basicAt: is defined both in UndefinedObject
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   592
       and SmallInteger */
a27a279701f8 Initial revision
claus
parents:
diff changeset
   593
253
30daee717a53 *** empty log message ***
claus
parents: 228
diff changeset
   594
    if (__isSmallInteger(index)) {
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   595
        indx = __intVal(index) - 1;
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   596
        myClass = __qClass(self);
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   597
        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
   598
        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
   599
        nbytes = __qSize(self) - n /* nInstBytes */;
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   600
        pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */;
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   601
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   602
        n = (INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK);
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   603
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   604
        /* 
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   605
         * replaced switch by open-coded if; this is slightly faster 
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   606
         * 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
   607
         */
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   608
        if ((n == __MASKSMALLINT(POINTERARRAY))
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   609
         || (n == __MASKSMALLINT(WKPOINTERARRAY))) {
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   610
            if ((indx >= 0) && (indx < (__BYTES2OBJS__(nbytes)))) {
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   611
                op = (OBJ *)pFirst + indx;
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   612
                *op = anObject;
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   613
                __STORE(self, anObject);
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   614
                RETURN ( anObject );
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   615
            }
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   616
        } else if (n == __MASKSMALLINT(BYTEARRAY)) {
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   617
            if (__isSmallInteger(anObject)) {
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   618
                val = __intVal(anObject);
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   619
                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
   620
                    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
   621
                        cp = pFirst + indx;
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   622
                        *cp = val;
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   623
                        RETURN ( anObject );
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   624
                    }
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
            }
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   627
        } else if (n == __MASKSMALLINT(FLOATARRAY)) {
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   628
            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
   629
                float *fp;
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   630
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   631
                fp = (float *)pFirst + indx;
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   632
                if (__isFloatLike(anObject)) {
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   633
                    *fp = _floatVal(anObject);
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   634
                    RETURN ( anObject );
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   635
                }
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   636
                if (__isSmallInteger(anObject)) {
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   637
                    *fp = (float) __intVal(anObject);
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
            }
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   641
        } else if (n == __MASKSMALLINT(DOUBLEARRAY)) {
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   642
            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
   643
                double *dp;
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   644
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   645
#ifdef NEED_DOUBLE_ALIGN
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   646
                /*
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   647
                 * care for filler
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   648
                 */
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   649
                pFirst += sizeof(FILLTYPE);
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   650
#endif
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   651
                dp = (double *)pFirst + indx;
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   652
                if (__isFloatLike(anObject)) {
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   653
                    *dp = _floatVal(anObject);
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   654
                    RETURN ( anObject );
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   655
                }
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   656
                if (__isSmallInteger(anObject)) {
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   657
                    *dp = (double) __intVal(anObject);
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   658
                    RETURN ( anObject );
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   659
                }
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   660
            }
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   661
        } else if (n == __MASKSMALLINT(WORDARRAY)) {
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   662
            if (__isSmallInteger(anObject)) {
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   663
                val = __intVal(anObject);
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   664
                if ((val >= 0) && (val <= 0xFFFF)) {
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   665
                    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
   666
                        sp = (unsigned short *)pFirst + indx;
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   667
                        *sp = val;
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   668
                        RETURN ( anObject );
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   669
                    }
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   670
                }
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   671
            }
1515
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   672
        } else if (n == __MASKSMALLINT(SWORDARRAY)) {
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   673
            if (__isSmallInteger(anObject)) {
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   674
                val = __intVal(anObject);
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   675
                if ((val >= -32768) && (val < 32768)) {
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   676
                    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
   677
                        ssp = (short *)pFirst + indx;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   678
                        *ssp = val;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   679
                        RETURN ( anObject );
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   680
                    }
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   681
                }
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   682
            }
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   683
        } else if (n == __MASKSMALLINT(SLONGARRAY)) {
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   684
            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
   685
                slp = (long *)pFirst + indx;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   686
                if (__isSmallInteger(anObject)) {
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   687
                    *slp = __intVal(anObject);
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   688
                    RETURN ( anObject );
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   689
                }
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   690
                n = __signedLongIntVal(anObject);
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   691
                /* 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
   692
                if (n) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   693
                    *slp = n;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   694
                    RETURN ( anObject );
1515
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   695
                }
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   696
            }
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   697
        } else if (n == __MASKSMALLINT(LONGARRAY)) {
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   698
            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
   699
                lp = (unsigned long *)pFirst + indx;
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   700
                if (anObject == __MKSMALLINT(0)) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   701
                    *lp = 0;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   702
                    RETURN ( anObject );
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   703
                }
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   704
                u = __longIntVal(anObject);
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   705
                /* 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
   706
                if (u) {
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   707
                    *lp = u;
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   708
                    RETURN ( anObject );
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   709
                }
1515
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   710
            }
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   711
        }
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   712
    }
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   713
%}.
10
claus
parents: 5
diff changeset
   714
    index isInteger ifFalse:[
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
         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
   717
        "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   718
        ^ self indexNotInteger
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   719
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
   720
    (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
   721
        "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   722
         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
   723
         receiver collection
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   724
        "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   725
        ^ self subscriptBoundsError:index
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   726
    ].
643
04b2025af0e3 use new isFLoatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   727
    (self class isFloatsOrDoubles) ifTrue:[
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   728
        anObject isNumber ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   729
            ^ self basicAt:index put:(anObject asFloat)
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   730
        ]
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   731
    ].
10
claus
parents: 5
diff changeset
   732
    anObject isInteger ifFalse:[
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   733
        "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   734
         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
   735
         should be an integer number
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   736
        "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   737
        ^ self elementNotInteger
2
claus
parents: 1
diff changeset
   738
    ].
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   739
    "
213
3b56a17534fd *** empty log message ***
claus
parents: 202
diff changeset
   740
     the object to put into the receiver collection
362
claus
parents: 359
diff changeset
   741
     is not an instance of the expected element class,
claus
parents: 359
diff changeset
   742
     or the value is  not within the elements valid range.
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   743
    "
2
claus
parents: 1
diff changeset
   744
    ^ self elementBoundsError
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   745
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   746
    "Modified: 19.4.1996 / 11:14:10 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   747
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   748
a27a279701f8 Initial revision
claus
parents:
diff changeset
   749
instVarAt:index
a27a279701f8 Initial revision
claus
parents:
diff changeset
   750
    "return a non-indexed instance variable;
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   751
     peeking into an object this way is not very object oriented 
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   752
     - use with care (needed for copy, inspector etc.)"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   753
a27a279701f8 Initial revision
claus
parents:
diff changeset
   754
%{  /* NOCONTEXT */
a27a279701f8 Initial revision
claus
parents:
diff changeset
   755
a27a279701f8 Initial revision
claus
parents:
diff changeset
   756
    OBJ myClass;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   757
    int idx, ninstvars;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   758
253
30daee717a53 *** empty log message ***
claus
parents: 228
diff changeset
   759
    if (__isSmallInteger(index)) {
329
claus
parents: 325
diff changeset
   760
	myClass = __Class(self);
755
eaab1d1dacbd _-macros replcaed by __-macros (needed especially for MKLARGINT)
Claus Gittinger <cg@exept.de>
parents: 751
diff changeset
   761
	idx = __intVal(index) - 1;
357
claus
parents: 356
diff changeset
   762
	/*
claus
parents: 356
diff changeset
   763
	 * do not allow return of non-object fields.
claus
parents: 356
diff changeset
   764
	 * if subclass did not make privisions for that,
claus
parents: 356
diff changeset
   765
	 * we wont do so here ...
claus
parents: 356
diff changeset
   766
	 */
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   767
	if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) {
357
claus
parents: 356
diff changeset
   768
	    if (idx == 0) {
claus
parents: 356
diff changeset
   769
		RETURN ( nil )
claus
parents: 356
diff changeset
   770
	    }
claus
parents: 356
diff changeset
   771
	}
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   772
	ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   773
	if ((idx >= 0) && (idx < ninstvars)) {
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   774
	    RETURN ( __InstPtr(self)->i_instvars[idx] );
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   775
	}
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   776
    }
a27a279701f8 Initial revision
claus
parents:
diff changeset
   777
%}
a27a279701f8 Initial revision
claus
parents:
diff changeset
   778
.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   779
    index isInteger ifFalse:[
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   780
	^ self indexNotInteger
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   781
    ].
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   782
    ^ self subscriptBoundsError:index
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   783
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   784
a27a279701f8 Initial revision
claus
parents:
diff changeset
   785
instVarAt:index put:value
a27a279701f8 Initial revision
claus
parents:
diff changeset
   786
    "change a non-indexed instance variable;
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   787
     peeking into an object this way is not very object oriented 
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   788
     - use with care (needed for copy, inspector etc.)"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   789
a27a279701f8 Initial revision
claus
parents:
diff changeset
   790
%{  /* NOCONTEXT */
a27a279701f8 Initial revision
claus
parents:
diff changeset
   791
a27a279701f8 Initial revision
claus
parents:
diff changeset
   792
    OBJ myClass;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   793
    int idx, ninstvars;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   794
253
30daee717a53 *** empty log message ***
claus
parents: 228
diff changeset
   795
    if (__isSmallInteger(index)) {
329
claus
parents: 325
diff changeset
   796
	myClass = __Class(self);
755
eaab1d1dacbd _-macros replcaed by __-macros (needed especially for MKLARGINT)
Claus Gittinger <cg@exept.de>
parents: 751
diff changeset
   797
	idx = __intVal(index) - 1;
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   798
	ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
357
claus
parents: 356
diff changeset
   799
	/*
claus
parents: 356
diff changeset
   800
	 * do not allow setting of non-object fields.
claus
parents: 356
diff changeset
   801
	 * if subclass did not make privisions for that,
claus
parents: 356
diff changeset
   802
	 * we wont do so here ...
claus
parents: 356
diff changeset
   803
	 */
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   804
	if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) {
357
claus
parents: 356
diff changeset
   805
	    if (idx == 0) {
claus
parents: 356
diff changeset
   806
		RETURN ( nil )
claus
parents: 356
diff changeset
   807
	    }
claus
parents: 356
diff changeset
   808
	}
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   809
	if ((idx >= 0) && (idx < ninstvars)) {
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   810
	    __InstPtr(self)->i_instvars[idx] = value;
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   811
	    __STORE(self, value);
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   812
	    RETURN ( value );
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   813
	}
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   814
    }
a27a279701f8 Initial revision
claus
parents:
diff changeset
   815
%}
a27a279701f8 Initial revision
claus
parents:
diff changeset
   816
.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   817
    index isInteger ifFalse:[
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   818
	^ self indexNotInteger
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   819
    ].
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   820
    ^ self subscriptBoundsError:index
359
claus
parents: 357
diff changeset
   821
!
claus
parents: 357
diff changeset
   822
claus
parents: 357
diff changeset
   823
instVarNamed:name 
claus
parents: 357
diff changeset
   824
    "return a non-indexed instance variables value by name;
claus
parents: 357
diff changeset
   825
     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
   826
     - 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
   827
     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
   828
     parsed ad runtime)"
359
claus
parents: 357
diff changeset
   829
claus
parents: 357
diff changeset
   830
    ^ 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
   831
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   832
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   833
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   834
     |p|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   835
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   836
     p := Point x:10 y:20.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   837
     p instVarNamed:'x'  
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   838
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   839
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   840
    "Modified: 19.4.1996 / 11:12:39 / cg"
359
claus
parents: 357
diff changeset
   841
!
claus
parents: 357
diff changeset
   842
1528
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   843
instVarNamed:name ifAbsent:exceptionBlock
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   844
    "return a non-indexed instance variables value by name,
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   845
     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
   846
     peeking into an object this way is not very object oriented 
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   847
     - 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
   848
     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
   849
     parsed ad runtime)"
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   850
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   851
    |idx|
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   852
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   853
    idx := self class instVarOffsetOf:name.
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   854
    idx isNil ifTrue:[^ exceptionBlock value].
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   855
    ^ self instVarAt:idx
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   856
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   857
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   858
    "
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   859
     |p|
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   860
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   861
     p := Point x:10 y:20.
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   862
     p instVarNamed:'x'  
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   863
    "
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   864
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   865
    "Created: 6.7.1996 / 23:02:49 / cg"
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   866
    "Modified: 6.7.1996 / 23:03:41 / cg"
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   867
!
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   868
359
claus
parents: 357
diff changeset
   869
instVarNamed:name put:value
claus
parents: 357
diff changeset
   870
    "set a non-indexed instance variable by name;
claus
parents: 357
diff changeset
   871
     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
   872
     - 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
   873
     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
   874
     parsed ad runtime)"
359
claus
parents: 357
diff changeset
   875
claus
parents: 357
diff changeset
   876
    ^ 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
   877
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   878
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   879
     |p|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   880
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   881
     p := Point x:10 y:20.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   882
     p instVarNamed:'x' put:30.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   883
     p  
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   884
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   885
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   886
    "Modified: 19.4.1996 / 11:12:49 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   887
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   888
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   889
!Object methodsFor:'binary storage'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   890
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   891
hasSpecialBinaryRepresentation
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   892
    "return true, if the receiver has a special binary representation;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   893
     default here is false, but can be redefined in class which provide
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   894
     their own storeBinary/readBinary methods.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   895
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   896
     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
   897
     special classes such as True, False, UndefinedObject or SmallInteger.
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
     If your instances should be stored in a special way, see
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   900
     #representBinaryOn: and #readBinaryContentsFromdata:manager:."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   901
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   902
    ^ false
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   903
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   904
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   905
readBinaryContentsFrom:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   906
    "reconstruct the receivers instance variables by reading a binary
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   907
     binary representation from stream. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   908
     This is a general implementation, walking over instances 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   909
     and loading each recursively using manager.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   910
     Redefined by some classes to read a more compact representations
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   911
     (see String, SmallInteger etc).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   912
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   913
     Notice, that the object is already recreated as an empty corps
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   914
     with instance variables all nil and bit-instances (bytes, words etc.) 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   915
     already read and restored.
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
     Also notice: this method is not called for if a private representation
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   918
     has been stored (see representBinaryOn:). 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   919
     In that case, #readBinaryContentsFromData:manager: is called, which
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   920
     has to be reimplemented in the objects class."
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
    |size "{ Class: SmallInteger }"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   923
     instvarArray|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   924
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   925
    stream next == 1 ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   926
	"/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   927
	"/ special representation ...
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   928
	"/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   929
	instvarArray := Array new:(size := stream nextNumber:3).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   930
	1 to:size do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   931
	    instvarArray basicAt:i put:(manager nextObject)
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
	self readBinaryContentsFromData:instvarArray manager:manager.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   934
	^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   935
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   936
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
    "/ standard representation
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   939
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   940
    size := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   941
    size ~~ 0 ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   942
	self class isPointers ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   943
	    1 to:size do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   944
		self basicAt:i put:(manager nextObject)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   945
	    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   946
	]
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
    size := self class instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   949
    1 to:size do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   950
	self instVarAt:i put:(manager nextObject)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   951
    ].
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   954
readBinaryContentsFromData:instvarArray manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   955
    "reconstruct the receivers instance variables by filling instance
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   956
     variables with values from instvarArray. This array contains the instvars
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   957
     as specified in #representBinaryOn: when the object was stored.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   958
     It is the receivers responsibility to set its instance variables in the
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   959
     same order from that 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
    ^ self subclassResponsibility
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 (see also comment in #representBinaryOn:)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   964
     (for an object with foo, bar and baz as instance variables,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   965
      which did not store baz and wants baz to be reinitialized to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   966
      some constant string)
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
	foo := instvarArray at:1.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   969
	bar := instvarArray at:2.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   970
	baz := 'aConstant'.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   971
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   972
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   973
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   974
representBinaryOn:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   975
    "this method is called by the storage manager to ask objects
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   976
     if they wish to provide their own binary representation.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   977
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   978
     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
   979
     instance variables (named & indexed pointer) to be stored. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   980
     If not redefined, this method returns nil which means that all 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   981
     instance variables are to be stored.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   982
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   983
     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
   984
     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
   985
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   986
     If this is redefined returning non-nil, the corresponding class needs
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   987
     a redefined instance method named #readBinaryContentsFromData:manager:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   988
     which has to fill the receivers named (and optionally indexed pointer)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   989
     instance variables with corresponding values from a data array."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   990
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   991
    ^ nil
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   992
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   993
    "typical implementation:  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   994
     (see also comment in #readBinaryContentsFromData:manager:)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   995
     for an object with foo, bar and baz as instance variables,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   996
     which does not want to store baz:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   997
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   998
     representBinaryOn:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   999
	|data|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1000
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1001
	data := Array new:2.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1002
	data at:1 put:foo.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1003
	data at:2 put:bar.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1004
	^ data
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1005
    "
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1006
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1007
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1008
storeBinaryContentsFromData:instvarArray on:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1009
    "store the instvars (both named & indexed pointer)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1010
     as returned by #representBinaryOn:."
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
    |size "{ Class: SmallInteger }"|
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 := instvarArray size.
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:(instvarArray at:i) on:stream
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1017
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1018
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1019
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1020
storeBinaryContentsOn:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1021
    "store the receivers instance variables in a binary representation
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1022
     on a stream using manager.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1023
     This is a general implementation, walking over instances 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1024
     and storing each recursively using manager.
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
     Notice, that the objects definition and bit-instances (bytes, words etc.) 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1027
     are already stored. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1028
     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
  1029
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1030
     Also notice: this method is not called for if a private representation
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1031
     has been stored (see representBinaryOn:). 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1032
     In that case, #storeBinaryContentsFromData:manager: is called."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1033
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1034
    |size "{ Class: SmallInteger }"|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1035
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1036
    size := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1037
    size ~~ 0 ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1038
	self class isPointers ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1039
	    1 to:size do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1040
		manager putIdOf:(self basicAt:i) on:stream
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1041
	    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1042
	].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1043
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1044
    size := self class instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1045
    1 to:size do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1046
	manager putIdOf:(self instVarAt:i) on:stream
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1047
    ].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1048
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1049
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1050
storeBinaryDefinitionBodyOn:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1051
    "append a binary representation of the receivers body onto stream.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1052
     This is a general implementation walking over instances storing
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1053
     each recursively as an ID using manager.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1054
     Can be redefined in subclasses."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1055
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1056
    |basicSize "{ Class: SmallInteger }"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1057
     instSize  "{ Class: SmallInteger }"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1058
     myClass specialRep pointers|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1059
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1060
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1061
    instSize := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1062
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1063
    (pointers := myClass isPointers) ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1064
	"/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1065
	"/ inst size not needed - if you uncomment the line below,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1066
	"/ also uncomment the corresponding line in
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1067
	"/ Object>>binaryDefinitionFrom:manager:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1068
	"/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1069
	"/ stream nextPut:instSize. "mhmh this limits us to 255 named instvars"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1070
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1071
	myClass isVariable ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1072
	    stream nextNumber:3 put:(basicSize := self basicSize)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1073
	] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1074
	    basicSize := 0
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1075
	].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1076
    ] ifFalse: [
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1077
	stream nextNumber:4 put:(basicSize := self basicSize).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1078
	myClass isBytes ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1079
	    1 to:basicSize do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1080
		stream nextPut:(self basicAt:i)
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
	] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1083
	    myClass isWords ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1084
		1 to:basicSize do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1085
		    stream nextNumber:2 put:(self basicAt: i)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1086
		]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1087
	    ] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1088
		myClass isLongs ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1089
		    1 to:basicSize do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1090
			stream nextNumber:4 put:(self basicAt: i)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1091
		    ]
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
		    myClass isFloats ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1094
			"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
  1095
			1 to:basicSize do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1096
			    Float storeBinaryIEEESingle:(self basicAt:i) on:stream
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
		    ] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1099
			myClass isDoubles ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1100
			    "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
  1101
			    1 to:basicSize do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1102
				Float storeBinaryIEEEDouble:(self basicAt:i) on:stream
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1103
			    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1104
			] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1105
			    "/ should never be reached ...
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1106
			    1 to:basicSize do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1107
				manager putIdOf:(self basicAt:i) on:stream
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
			]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1110
		    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1111
		]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1112
	    ]
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1116
    (pointers or:[instSize ~~ 0]) ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1117
	specialRep := self representBinaryOn:manager.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1118
	specialRep notNil ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1119
	    stream nextPut:1.     "/ means: private representation follows
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1120
	    stream nextNumber:3 put:(specialRep basicSize).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1121
	    self storeBinaryContentsFromData:specialRep on:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1122
	] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1123
	    stream nextPut:0.     "/ means: full representation follows
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1124
	    self storeBinaryContentsOn:stream manager:manager
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1125
	]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1126
    ]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1127
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1128
    "Modified: 25.10.1995 / 14:00:51 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1129
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1130
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1131
storeBinaryDefinitionOn:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1132
    "append a binary representation of the receiver onto stream.
1260
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1231
diff changeset
  1133
     This is an internal interface for binary storage mechanism.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1134
     This method first stores the class, then the body, which is done
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1135
     in a separate method to allow redefinition of the bodies format.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1136
     Can be redefined in subclasses to write more compact representations
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1137
     (see String, SmallInteger etc)."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1138
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1139
    manager putIdOfClass:(self class) on:stream.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1140
    self storeBinaryDefinitionBodyOn:stream manager:manager
1260
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1231
diff changeset
  1141
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1231
diff changeset
  1142
    "Modified: 23.4.1996 / 09:31:12 / cg"
783
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1145
storeBinaryOn:aStream
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1146
    "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
  1147
     the object's structure to be reconstructed from the stream's contents"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1148
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1149
    BinaryOutputManager store:self on:aStream
899
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1150
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1151
    "
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1152
     |a s1 s2|
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1153
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1154
     s1 := 'hello'.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1155
     s2 := 'world'.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1156
     a := Array new:5.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1157
     a at:1 put:s1.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1158
     a at:2 put:s2.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1159
     a at:3 put:s1.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1160
     a at:4 put:s2.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1161
     a storeBinaryOn:'test.boss'
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1162
    "
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1163
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1164
    "
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1165
     (BinaryObjectStorage onOld:'test.boss' asFilename readStream)
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1166
	next
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1167
	    inspect
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1168
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1169
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1170
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1171
storeBinaryOn:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1172
    "append a binary representation of the receiver onto stream."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1173
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1174
    manager putIdOf:self on:stream
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1175
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1176
1826
aa574220fff4 category rename
Claus Gittinger <cg@exept.de>
parents: 1820
diff changeset
  1177
!Object methodsFor:'change & update'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1178
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1179
broadcast:aSelectorSymbol
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1180
    "send a message with selector aSelectorSymbol to all my dependents"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1181
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1182
    self dependentsDo:[:dependent | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1183
	dependent perform:aSelectorSymbol
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1184
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1185
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1186
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1187
broadcast:aSelectorSymbol with:anArgument
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1188
    "send a message with selector aSelectorSymbol with an additional
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1189
     argument anArgument to all my dependents."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1190
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1191
    self dependentsDo:[:dependent | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1192
	dependent perform:aSelectorSymbol with:anArgument
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1193
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1194
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1195
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1196
changeRequest
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1197
    "the receiver wants to change - check if all dependents
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1198
     grant the request, and return true if so"
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1199
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1200
    self dependentsDo:[:dependent | 
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1201
	dependent updateRequest ifFalse:[^ false].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1202
    ].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1203
    ^ true
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1204
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1205
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1206
changeRequest:aParameter
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1207
    "the receiver wants to change - check if all dependents
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1208
     grant the request, and return true if so"
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1209
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1210
    self dependentsDo:[:dependent | 
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1211
	(dependent updateRequest:aParameter) ifFalse:[^ false].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1212
    ].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1213
    ^ true
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1214
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1215
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1216
changeRequest:aParameter from:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1217
    "the receiver wants to change - check if all dependents
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1218
     except anObject grant the request, and return true if so.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1219
     The argument anObject is typically going to be the one who is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1220
     about to send the change request."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1221
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1222
    self dependentsDo:[:dependent | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1223
	dependent == anObject ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1224
	    (dependent updateRequest:aParameter) ifFalse:[^ false].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1225
	]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1226
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1227
    ^ true
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1228
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1229
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1230
changeRequestFrom:anObject
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1231
    "the receiver wants to change - check if all dependents
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1232
     except anObject grant the request, and return true if so.
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1233
     The argument anObject is typically going to be the one who is
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1234
     about to send the change request."
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1235
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1236
    self dependentsDo:[:dependent | 
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1237
	dependent == anObject ifFalse:[
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1238
	    (dependent updateRequest) ifFalse:[^ false].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1239
	]
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1240
    ].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1241
    ^ true
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1242
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1243
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1244
changed
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1245
    "notify all dependents that the receiver has changed.
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1246
     Each dependent gets a '#update:'-message with the original
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1247
     receiver as argument."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1248
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1249
    self changed:nil
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1250
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1251
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1252
changed:aParameter
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1253
    "notify all dependents that the receiver has changed somehow.
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1254
     Each dependent gets a '#update:'-message with aParameter
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1255
     as argument."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1256
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1257
    self changed:aParameter with:nil
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1258
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1259
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1260
changed:aParameter with:anArgument
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1261
    "notify all dependents that the receiver has changed somehow.
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1262
     Each dependent gets a  '#update:with:from:'-message, with aParameter
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1263
     and anArgument as arguments."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1264
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1265
    self dependentsDo:[:dependent | 
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1266
	dependent update:aParameter with:anArgument from:self
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1267
    ]
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1268
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1269
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1270
update:aParameter
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1271
    "the message is sent to a dependent, when one of the objects
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1272
     on whom the receiver depends, has changed. The argument aParameter
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1273
     is either the changed object or the argument to the #changed: message.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1274
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1275
     Default behavior here is to do nothing"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1276
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1277
    ^ self
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1278
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1279
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1280
update:aParameter with:anArgument
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1281
    "dependent is notified of some change -
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1282
     Default is to try update:"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1283
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1284
    ^ self update:aParameter
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1285
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1286
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1287
update:aParameter with:anArgument from:sender
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1288
    "dependent is notified of some change -
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1289
     Default is to try update:with:"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1290
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1291
    ^ self update:aParameter with:anArgument
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1292
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1293
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1294
updateRequest
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1295
    "return true, if an update request is granted.
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1296
     Default here is to grant updates - may be used
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1297
     to lock updates if someone is making other changes
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1298
     from within an update. Or if someone has locked its
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1299
     state and does not want others to change things.
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1300
     However, these dependents must all honor the
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1301
     changeRequest - ifTrue - change protocol. I.e. they
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1302
     must first ask all others via changeRequest, and only do the change
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1303
     it returns true. The others must decide in updateRequest and
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1304
     return true if they think a change is ok."
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1305
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1306
    ^ true
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1307
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1308
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1309
updateRequest:aSymbol
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1310
    "return true, if an update request is granted.
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1311
     Default here a simple updateRequest"
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1312
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1313
    ^ self updateRequest
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1314
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1315
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1316
!Object methodsFor:'cleanup'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1317
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1318
lowSpaceCleanup
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1319
    "ignored here - redefined in some classes to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1320
     cleanup in low-memory situations"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1321
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1322
    ^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1323
! !
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
!Object methodsFor:'comparing'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1326
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1327
= anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1328
    "return true, if the receiver and the arg have the same structure"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1329
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1330
    ^ self == anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1331
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1332
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1333
== anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1334
    "return true, if the receiver and the arg are the same object"
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
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1337
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1338
    RETURN ( (self == anObject) ? true : false );
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
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1341
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1342
hash
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1343
    "return an Integer useful as a hash key for the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1344
     This hash should return same values for objects with same
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1345
     contents (i.e. use this to hash on structure)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1346
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1347
    ^ self identityHash
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1348
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1349
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1350
identityHash
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1351
    "return an Integer useful as a hash key for the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1352
     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
  1353
     this to hash on identity of objects).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1354
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1355
     We cannot use the Objects address (as other smalltalks do) since
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1356
     no object-table exists and the hashval must not change when objects
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1357
     are moved by the collector. Therefore we assign each object a unique
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1358
     Id in the object header itself as its hashed upon.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1359
     (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
  1360
     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
  1361
     object header will be needed, adding 4 bytes to every object. Alternatively,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1362
     hashed-upon objects could add an instvar containing the hash value."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1363
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1364
%{  /* NOCONTEXT */
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
    REGISTER unsigned hash;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1367
    static unsigned nextHash = 0;
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
    if (__isNonNilObject(self)) {
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1370
	hash = __GET_HASH(self);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1371
	if (hash == 0) {
2462
5ba287e9f5bf slightly faster identityHash
Claus Gittinger <cg@exept.de>
parents: 2448
diff changeset
  1372
	    /* has no hash yet */
5ba287e9f5bf slightly faster identityHash
Claus Gittinger <cg@exept.de>
parents: 2448
diff changeset
  1373
2480
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1374
	    if (++nextHash > __MAX_HASH__) {
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1375
		nextHash = 1;
2462
5ba287e9f5bf slightly faster identityHash
Claus Gittinger <cg@exept.de>
parents: 2448
diff changeset
  1376
	    }
2480
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1377
	    hash = nextHash;
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1378
	    __SET_HASH(self, hash);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1379
	}
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
	/*
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1382
	 * now, we got 11 bits for hashing;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1383
	 * make it as large as possible; since most hashers use the returned
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1384
	 * key and take it modulu some prime number, this will allow for
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1385
	 * better distribution (i.e. bigger empty spaces) in hashed collection.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1386
	 */
2480
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1387
	hash = __MAKE_HASH__(hash);
2462
5ba287e9f5bf slightly faster identityHash
Claus Gittinger <cg@exept.de>
parents: 2448
diff changeset
  1388
	RETURN ( __MKSMALLINT(hash) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1389
    }
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
    ^ 0 "never reached, since redefined in UndefinedObject and SmallInteger"
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
2479
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1394
identityHashForBinaryStore
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1395
    "hash which is usable if the object does not change its class
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1396
     and does not #become something else, while the hash is used.
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1397
     This is only used by the binary storage mechanism, during the
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1398
     object writing phase."
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1399
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1400
%{  /* NOCONTEXT */
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1401
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1402
    REGISTER unsigned hash, hash1, hash2, sz;
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1403
    OBJ o;
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1404
    static unsigned nextHash = 0;
2480
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1405
    static unsigned nextClassHash = 0;
2479
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1406
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1407
    if (__isNonNilObject(self)) {
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1408
        /*
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1409
         * my own identityHash
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1410
         */
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1411
        hash1 = __GET_HASH(self);
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1412
        if (hash1 == 0) {
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1413
            /* has no hash yet */
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1414
2480
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1415
            if (++nextHash > __MAX_HASH__) {
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1416
                nextHash = 1;
2479
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1417
            }
2480
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1418
            hash1 = nextHash;
2479
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1419
            __SET_HASH(self, hash1);
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1420
        }
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1421
        /*
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1422
         * my classes identityHash
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1423
         */
2480
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1424
        o = __qClass(self);
2479
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1425
        hash2 = __GET_HASH(o);
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1426
        if (hash2 == 0) {
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1427
            /* has no hash yet */
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1428
2480
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1429
            if (++nextClassHash > __MAX_HASH__) {
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1430
                nextClassHash = 1;
2479
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1431
            }
2480
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1432
            hash2 = nextClassHash;
2479
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1433
            __SET_HASH(o, hash2);
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1434
        }
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1435
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1436
        /*
2480
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1437
         * some bits of my size
2479
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1438
         */
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1439
        sz = __qSize(self);
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1440
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1441
        /*
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1442
         * now, we got 11 + 11 + 8 bits for hashing;
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1443
         * make it as large as possible; since most hashers use the returned
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1444
         * key and take it modulu some prime number, this will allow for
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1445
         * better distribution (i.e. bigger empty spaces) in hashed collection.
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1446
         */
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1447
        hash = (hash1 << 11) | hash2;           /* 22 bits */
2480
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1448
        hash = (hash << 8) | (sz & 0xFC);       /* 30 bits */
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1449
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1450
        while ((hash & 0x20000000) == 0) {
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1451
            hash <<= 1;
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1452
        }
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1453
2479
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1454
        RETURN ( __MKSMALLINT(hash) );
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1455
    }
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1456
%}.
2480
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1457
    ^ nil "never reached, since UndefinedObject and SmallInteger are not hashed upon in binary storage"
2479
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1458
!
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1459
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1460
isNil
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1461
    "return true, if the receiver is nil"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1462
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1463
    ^ false
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1464
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1465
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1466
notNil
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1467
    "return true, if the receiver is not nil"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1468
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1469
    ^ true
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1470
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1471
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1472
~= anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1473
    "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
  1474
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1475
    ^ (self = anObject) not
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1476
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1477
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1478
~~ anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1479
    "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
  1480
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1481
%{  /* NOCONTEXT */
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
    RETURN ( (self == anObject) ? false : true );
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
!Object methodsFor:'converting'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1488
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1489
asValue
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1490
    "return a valueHolder for for the receiver"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1491
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1492
    ^ ValueHolder with:self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1493
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1494
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1495
!Object methodsFor:'copying'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1496
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1497
copy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1498
    "return a copy of the receiver - defaults to shallowcopy here.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1499
     Notice, that copy does not copy dependents."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1500
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1501
    ^ self shallowCopy postCopy
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
deepCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1505
    "return a copy of the object with all subobjects also copied.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1506
     This method DOES handle cycles/self-refs; however the receivers
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1507
     class is not copied (to avoid the 'total' copy).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1508
     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
  1509
     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
  1510
     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
  1511
     no cycles, you can use the old simpleDeepCopy, which avoids this overhead,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1512
     but may run into trouble.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1513
     Notice, that copy does not copy dependents."
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
    ^ self deepCopyUsing:(IdentityDictionary new)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1516
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1517
    "an example which is not handled by the old deepCopy:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1518
    
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1519
     |a|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1520
     a := Array new:3.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1521
     a at:3 put:a.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1522
     a deepCopy inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1523
    "
1129
2734bcd503fe Fix typo in comment.
Stefan Vogel <sv@exept.de>
parents: 1119
diff changeset
  1524
2734bcd503fe Fix typo in comment.
Stefan Vogel <sv@exept.de>
parents: 1119
diff changeset
  1525
    "Modified: 27.3.1996 / 16:31:20 / stefan"
783
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1528
deepCopyError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1529
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1530
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1531
    "raise a signal, that deepCopy is not allowed for this object"
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
    ^ DeepCopyErrorSignal raise
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1536
deepCopyUsing:aDictionary
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1537
    "a helper for deepCopy; return a copy of the object with 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1538
     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
  1539
     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
  1540
     This method DOES handle cycles/self references."
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
    |myClass aCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1543
     sz "{ Class: SmallInteger }" 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1544
     iOrig iCopy|
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
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1547
    myClass isVariable ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1548
	sz := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1549
	aCopy := myClass basicNew:sz.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1550
    ] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1551
	sz := 0.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1552
	aCopy := myClass basicNew
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
    aCopy setHashFrom:self.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1555
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1556
    aDictionary at:self put:aCopy.
143
5ebe463ba109 got rid of globals;
claus
parents: 113
diff changeset
  1557
5ebe463ba109 got rid of globals;
claus
parents: 113
diff changeset
  1558
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1559
     copy indexed instvars - if any
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1560
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1561
    sz ~~ 0 ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1562
	myClass isBits ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1563
	    "block-copy indexed instvars"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1564
	    aCopy replaceFrom:1 to:sz with:self startingAt:1
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1565
	] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1566
	    "individual deep copy the indexed variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1567
	    1 to:sz do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1568
		iOrig := self basicAt:i.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1569
		iOrig notNil ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1570
		    (aDictionary includesKey:iOrig) ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1571
			iCopy := aDictionary at:iOrig
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1572
		    ] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1573
			iCopy := iOrig deepCopyUsing:aDictionary.
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
		    aCopy basicAt:i put:iCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1576
		]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1577
	    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1578
	]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1579
    ].
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
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1582
     copy the instance variables
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
    sz := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1585
    sz ~~ 0 ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1586
	1 to:sz do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1587
	    iOrig := self instVarAt:i.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1588
	    iOrig notNil ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1589
		(aDictionary includesKey:iOrig) ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1590
		    iCopy := aDictionary at:iOrig
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1591
		] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1592
		    iCopy := iOrig deepCopyUsing:aDictionary.
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
		aCopy instVarAt:i put:iCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1595
	    ]
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
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1598
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1599
    ^ aCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1600
!
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
postCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1603
    "this is for compatibility with ST-80 code, which uses postCopy for
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1604
     cleanup after copying, while ST/X passes the original in postCopyFrom:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1605
     (see there)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1606
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1607
    ^ self
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
postCopyFrom:original
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1611
    "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
  1612
     (a font could flush its device-handle for example). 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1613
     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
  1614
     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
  1615
     setHash: functionality)."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1616
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1617
    "for ST-80 compatibility, we try postCopy here ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1618
    ^ self postCopy
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1621
setHashFrom:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1622
    "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
  1623
     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
  1624
     Smalltalks, and may not be available in future ST/X versions.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1625
     DO NEVER use this for normal application code."
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
%{  /* NOCONTEXT */
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
    REGISTER unsigned h;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1630
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1631
    if (__isNonNilObject(self) && __isNonNilObject(anObject)) {
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1632
	h = __GET_HASH(anObject);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1633
	__SET_HASH(self, h);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1634
	RETURN (self);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1635
    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1636
%}
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1637
.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1638
    self primitiveFailed    "neither receiver not arg may be nil or SmallInteger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1639
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1640
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1641
shallowCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1642
    "return a copy of the object with shared subobjects (a shallow copy)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1643
     i.e. the copy shares referenced instvars with its original."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1644
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1645
    |myClass aCopy 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1646
     sz "{ Class: SmallInteger }" |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1647
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1648
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1649
    myClass isVariable ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1650
	sz := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1651
	aCopy := myClass basicNew:sz.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1652
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1653
	"copy the indexed variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1654
	1 to:sz do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1655
	    aCopy basicAt:i put:(self basicAt:i) 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1656
	]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1657
    ] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1658
	aCopy := myClass basicNew
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1661
    "copy the instance variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1662
    sz := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1663
    1 to:sz do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1664
	aCopy instVarAt:i put:(self instVarAt:i) 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1665
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1666
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1667
    ^ aCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1668
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1669
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1670
shallowCopyForFinalization
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1671
    "this is used to aquire a copy to be used for finalization -
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1672
     (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
  1673
     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
  1674
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1675
    ^ self shallowCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1676
!
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
simpleDeepCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1679
    "return a copy of the object with all subobjects also copied.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1680
     This method does NOT handle cycles - but is included to allow this 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1681
     slightly faster copy in situations where it is known that
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1682
     no recursive references occur (LargeIntegers for example).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1683
     NOTICE: you will run into trouble, when trying this with recursive
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1684
     objects (usually recursionInterrupt or memory-alert).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1685
     This method corresponds to the 'traditional' deepCopy found in
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1686
     the Blue book."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1687
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1688
    |myClass aCopy 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1689
     sz "{ Class: SmallInteger }" |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1690
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1691
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1692
    myClass isVariable ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1693
	sz := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1694
	aCopy := myClass basicNew:sz.
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
	"copy the indexed variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1697
	1 to:sz do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1698
	    aCopy basicAt:i put:((self basicAt:i) simpleDeepCopy)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1699
	]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1700
    ] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1701
	aCopy := myClass basicNew 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1702
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1703
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1704
    "copy the instance variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1705
    sz := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1706
    1 to:sz do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1707
	aCopy instVarAt:i put:((self instVarAt:i) simpleDeepCopy)
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1710
    ^ aCopy
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
    "a bad example (but ST/X should survive ...)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1713
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1714
     |a|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1715
     a := Array new:3.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1716
     a at:3 put:a.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1717
     a simpleDeepCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1718
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1719
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1720
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1721
!Object methodsFor:'debugging'!
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
basicInspect
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1724
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1725
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1726
    "launch an inspector on the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1727
     this method should NOT be redefined in subclasses."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1728
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1729
    Inspector isNil ifTrue:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  1730
        "
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  1731
         for systems without GUI
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  1732
        "
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  1733
        Transcript showCR:'no Inspector'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1734
    ] ifFalse:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  1735
        Inspector openOn:self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1736
    ]
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  1737
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  1738
    "Modified: 18.5.1996 / 15:43:25 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1739
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1740
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1741
inspect
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1742
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1743
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1744
    "launch an inspector on the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1745
     this method (or better: inspectorClass) can be redefined in subclasses 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1746
     to start special inspectors."
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
    |cls|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1749
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1750
    cls := self inspectorClass.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1751
    cls isNil ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1752
	^ self basicInspect
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
    cls openOn:self
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
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1757
     Object new inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1758
     (1 @ 2) inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1759
     Smalltalk inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1760
     #(1 2 3) asOrderedCollection inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1761
     (Color red) inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1762
     (Image fromFile:'bitmaps/garfield.gif') inspect
143
5ebe463ba109 got rid of globals;
claus
parents: 113
diff changeset
  1763
    "
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1764
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1765
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1766
inspectorClass
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1767
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1768
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1769
    "return the class to use for inspect. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1770
     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
  1771
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1772
    ^ Inspector
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1773
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1774
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1775
mustBeKindOf:aClass
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1776
    "for compatibility & debugging support: 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1777
     check if the receiver isKindOf:aClass and raise an error if not.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1778
     Notice:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1779
	it is VERY questionable, if it makes sense to add manual
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1780
	type checks to a dynamically typed language like smalltalk. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1781
	It will, at least, slow down performance,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1782
	make your code less reusable and clutter your code with stupid sends
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1783
	of this selector. Also, read the comment in isKindOf:, regarding the
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1784
	use of isXXX check methods.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1785
     You see: The author does not like this at all ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1786
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1787
    (self isKindOf:aClass) ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1788
	self error:'argument is not of expected type'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1789
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1790
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1791
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1792
obsoleteMethodWarning
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1793
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1794
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1795
    "in methods which are going to be obsoleted, a self send to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1796
     this method is used to tell programmers that a method is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1797
     used which is going to be removed in later ST/X versions.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1798
     Find all methods which will be obsolete soon by looking at senders
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1799
     of this message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1800
     Hopefully, this warning message is annoying enough for you to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1801
     change the code ... ;-)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1802
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1803
    self obsoleteMethodWarning:nil from:thisContext sender
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1804
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1805
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1806
obsoleteMethodWarning:message
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1807
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1808
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1809
    "in methods which are going to be obsoleted, a self send to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1810
     this method is used to tell programmers that a method is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1811
     used which is going to be removed in later ST/X versions.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1812
     Find all methods which will be obsolete soon by looking at senders
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1813
     of this message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1814
     Hopefully, this warning message is annoying enough for you to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1815
     change the code ... ;-)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1816
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1817
    self obsoleteMethodWarning:message from:thisContext sender
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1818
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1819
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1820
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
  1821
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1822
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1823
    "in methods which are going to be obsoleted, a self-send to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1824
     this method is used to tell programmers that a method is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1825
     used which is going to be removed in later ST/X versions.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1826
     Find all methods which will be obsolete soon by looking at senders
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1827
     of this message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1828
     Hopefully, this warning message is annoying enough for you to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1829
     change the code ... ;-)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1830
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1831
    |spec|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1832
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1833
    spec := aContext methodPrintString.
2136
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  1834
    ('WARNING: the ''' , spec , ''' method is obsolete.') errorPrintCR.
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  1835
    ('         And may not be present in future ST/X versions.') errorPrintCR.
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  1836
    ('         called from ' , aContext sender printString) errorPrintCR.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1837
    message notNil ifTrue:[
2136
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  1838
        '------>  ' errorPrint. message errorPrintCR
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1839
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1840
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1841
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1842
     Object obsoleteMethodWarning:'foo' from:thisContext sender sender
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1843
    "
2136
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  1844
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  1845
    "Modified: 10.1.1997 / 19:08:42 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1846
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1847
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1848
!Object methodsFor:'dependents access'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1849
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1850
addDependent:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1851
    "make the argument, anObject be a dependent of the receiver"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1852
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1853
    |wasBlocked|
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1854
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1855
    "/ 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
  1856
    "/ is possibly accessed from multiple threads.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1857
    "/ 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
  1858
    "/ faster execution.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1859
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1860
    wasBlocked := OperatingSystem blockInterrupts.
863
2c83fe958ca7 change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents: 861
diff changeset
  1861
    [
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1862
        |deps dep|
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1863
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1864
        deps := self dependents.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1865
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1866
        "/ 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
  1867
        "/ 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
  1868
        "/ 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
  1869
        "/ added.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1870
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1871
        deps isNil ifTrue:[
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1872
            self dependents:(WeakArray with:anObject)
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1873
        ] ifFalse:[
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1874
            deps class == WeakArray ifTrue:[
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1875
                dep := deps at:1.
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1876
                dep ~~ anObject ifTrue:[
1780
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1877
		    (dep isNil or:[dep == 0]) ifTrue:[
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1878
			deps at:1 put:anObject
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1879
		    ] ifFalse:[
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1880
                        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
  1881
		    ]
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1882
                ]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1883
            ] ifFalse:[
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1884
                deps add:anObject
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1885
            ]
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1886
        ]
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1887
    ] valueNowOrOnUnwindDo:[
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1888
        wasBlocked ifFalse:[
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1889
            OperatingSystem unblockInterrupts
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1890
        ]
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1891
    ]
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1892
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1893
    "Modified: 1.8.1996 / 14:21:20 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1894
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1895
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1896
dependents
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1897
    "return a Collection of dependents - nil if there is none.
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1898
     The default implementation here uses a global WeakDictionary to store
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1899
     dependents 
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1900
     This may be too slow for high frequency change&update,
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1901
     therefore, some classes (Model) redefine this for better performance.
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1902
     Notice the mentioning of a WeakDictionary - read the classes documentation."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1903
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1904
    ^ Dependencies at:self ifAbsent:[nil]
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1905
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1906
    "Modified: 19.4.1996 / 12:36:46 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1907
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1908
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1909
dependents:aCollection
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1910
    "set the collection of dependents.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1911
     The default implementation here uses a global Dictionary to store
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1912
     dependents which may be too slow for high frequency change&update.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1913
     Therefore, some classes (Model) redefine this for better performance."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1914
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1915
    "/ 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
  1916
    "/ 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
  1917
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
2336
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1918
    "/ faster execution (and to avoid creation of garbage blocks).
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1919
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1920
    (OperatingSystem blockInterrupts) ifTrue:[
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1921
        "/ the common case - already blocked
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1922
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1923
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1924
            Dependencies removeKey:self ifAbsent:[]
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1925
        ] ifFalse:[
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1926
            Dependencies at:self put:aCollection
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1927
        ].
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1928
        ^ self
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1929
    ].
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1930
863
2c83fe958ca7 change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents: 861
diff changeset
  1931
    [
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1932
        (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
  1933
            Dependencies removeKey:self ifAbsent:[]
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1934
        ] ifFalse:[
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1935
            Dependencies at:self put:aCollection
2336
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1936
        ].
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1937
    ] valueNowOrOnUnwindDo:[
2336
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1938
        OperatingSystem unblockInterrupts
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1939
    ]
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1940
2336
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1941
    "Modified: 30.1.1997 / 21:22:10 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1942
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1943
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1944
dependentsDo:aBlock
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1945
    "evaluate aBlock for all of my dependents"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1946
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1947
    |deps nwDeps|
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1948
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1949
    deps := self dependents.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1950
    deps notNil ifTrue:[
1780
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1951
        deps do:[:d | 
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1952
		    (d notNil and:[d ~~ 0]) ifTrue:[
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1953
			aBlock value:d
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1954
		    ]
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1955
		]
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1956
    ].
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1957
    nwDeps := self nonWeakDependents.
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1958
    (nwDeps notNil and:[nwDeps ~~ deps]) ifTrue:[
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1959
        nwDeps do:aBlock 
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1960
    ].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1961
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1962
    "Modified: 19.4.1996 / 12:35:54 / cg"
1098
e8543399e2a0 support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents: 1097
diff changeset
  1963
!
e8543399e2a0 support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents: 1097
diff changeset
  1964
2445
efd1b24db615 added #myDependents
ca
parents: 2437
diff changeset
  1965
myDependents
efd1b24db615 added #myDependents
ca
parents: 2437
diff changeset
  1966
    "same as dependents - ST-80 compatibility"
efd1b24db615 added #myDependents
ca
parents: 2437
diff changeset
  1967
efd1b24db615 added #myDependents
ca
parents: 2437
diff changeset
  1968
    ^ self dependents
efd1b24db615 added #myDependents
ca
parents: 2437
diff changeset
  1969
!
efd1b24db615 added #myDependents
ca
parents: 2437
diff changeset
  1970
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1971
release
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1972
    "remove all dependencies from the receiver"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1973
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1974
    self dependents:nil.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1975
    self nonWeakDependents: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
    "Modified: 19.4.1996 / 10:55:36 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1978
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1979
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1980
removeDependent:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1981
    "make the argument, anObject be independent of the receiver"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1982
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1983
    |wasBlocked|
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1984
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1985
    "/ 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
  1986
    "/ is possibly accessed from multiple threads.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1987
    "/ 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
  1988
    "/ faster execution.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1989
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  1990
    wasBlocked := OperatingSystem blockInterrupts.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1991
    [
1780
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  1992
        |deps n d|
1217
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
        deps := self dependents.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1995
        deps notNil ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1996
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1997
            "/ 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
  1998
            "/ 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
  1999
            "/ 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
  2000
            "/ 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
  2001
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2002
            deps class == WeakArray ifTrue:[
1780
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  2003
                ((d := deps at:1) == anObject 
2341
05b6a63f8b6f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  2004
                or:[d isNil
05b6a63f8b6f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  2005
                or:[d == 0]]) ifTrue:[
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2006
                    self dependents:nil
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
            ] ifFalse:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2009
                deps remove:anObject ifAbsent:[].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2010
                (n := deps size) == 0 ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2011
                    self dependents:nil
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2012
                ] ifFalse:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2013
                    n == 1 ifTrue:[
2341
05b6a63f8b6f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  2014
                        d := deps firstIfEmpty:nil.
05b6a63f8b6f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  2015
                        d notNil ifTrue:[
05b6a63f8b6f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  2016
                            deps := WeakArray with:d
05b6a63f8b6f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  2017
                        ] ifFalse:[
05b6a63f8b6f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  2018
                            deps := nil
05b6a63f8b6f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  2019
                        ].
05b6a63f8b6f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  2020
                        self dependents:deps.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2021
                    ]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2022
                ]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2023
            ]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2024
        ]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2025
    ] valueNowOrOnUnwindDo:[
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2026
        wasBlocked ifFalse:[
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2027
            OperatingSystem unblockInterrupts
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2028
        ]
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2029
    ]
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2030
2341
05b6a63f8b6f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  2031
    "Modified: 31.1.1997 / 12:36:16 / cg"
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
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2034
!Object methodsFor:'dependents access (nonWeak)'!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2035
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2036
addNonWeakDependent:anObject
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2037
    "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
  2038
     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
  2039
     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
  2040
     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
  2041
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2042
    |wasBlocked|
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2043
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2044
    "/ 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
  2045
    "/ is possibly accessed from multiple threads.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2046
    "/ 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
  2047
    "/ faster execution.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2048
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2049
    wasBlocked := OperatingSystem blockInterrupts.
863
2c83fe958ca7 change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents: 861
diff changeset
  2050
    [
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  2051
        |deps dep|
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2052
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2053
        deps := self nonWeakDependents.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2054
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2055
        "/ 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
  2056
        "/ 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
  2057
        "/ 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
  2058
        "/ added.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2059
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2060
        deps isNil ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2061
            self nonWeakDependents:(Array with:anObject)
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2062
        ] ifFalse:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2063
            deps class == Array ifTrue:[
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  2064
                dep := deps at:1.
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  2065
                dep ~~ anObject ifTrue:[
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  2066
                    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
  2067
                ]
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2068
            ] ifFalse:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2069
                deps add:anObject
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2070
            ]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2071
        ]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2072
    ] valueNowOrOnUnwindDo:[
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2073
        wasBlocked ifFalse:[
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2074
            OperatingSystem unblockInterrupts
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2075
        ]
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2076
    ]
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2077
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2078
    "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
  2079
    "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
  2080
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2081
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2082
nonWeakDependents
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2083
    "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
  2084
     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
  2085
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2086
    NonWeakDependencies isNil ifTrue:[^nil].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2087
    ^ NonWeakDependencies at:self ifAbsent:[nil]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2088
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2089
    "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
  2090
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2091
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2092
nonWeakDependents:aCollection
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2093
    "set the collection of nonWeak dependents.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2094
     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
  2095
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2096
    [
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2097
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2098
            NonWeakDependencies removeKey:self ifAbsent:[]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2099
        ] ifFalse:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2100
            NonWeakDependencies at:self put:aCollection
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2101
        ]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2102
    ] valueUninterruptably
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2103
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2104
    "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
  2105
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2106
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2107
removeNonWeakDependent:anObject
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2108
    "remove a nonWeak dependency from the receiver to the argument, anObject.
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2109
     (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
  2110
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2111
    |wasBlocked|
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2112
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2113
    "/ 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
  2114
    "/ is possibly accessed from multiple threads.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2115
    "/ 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
  2116
    "/ faster execution.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2117
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2118
    wasBlocked := OperatingSystem blockInterrupts.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2119
    [
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2120
        |deps n|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2121
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2122
        deps := self nonWeakDependents.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2123
        deps notNil ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2124
            deps class == Array ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2125
                (deps at:1) == anObject ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2126
                    self nonWeakDependents:nil
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2127
                ]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2128
            ] ifFalse:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2129
                deps remove:anObject ifAbsent:[].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2130
                (n := deps size) == 0 ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2131
                    self nonWeakDependents:nil
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2132
                ] ifFalse:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2133
                    n == 1 ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2134
                        self nonWeakDependents:(Array with:(deps first))
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2135
                    ]
1098
e8543399e2a0 support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents: 1097
diff changeset
  2136
                ]
e8543399e2a0 support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents: 1097
diff changeset
  2137
            ]
e8543399e2a0 support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents: 1097
diff changeset
  2138
        ]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2139
    ] valueNowOrOnUnwindDo:[
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2140
        wasBlocked ifFalse:[
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2141
            OperatingSystem unblockInterrupts
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2142
        ]
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2143
    ]
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2144
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2145
    "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
  2146
    "Modified: 19.7.1996 / 12:42:08 / cg"
783
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
!Object methodsFor:'error handling'!
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
appropriateDebugger:aSelector
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2152
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2153
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2154
    "return an appropriate debugger to use.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2155
     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
  2156
     the DebugView, return MiniDebugger (as a last chance) otherwise abort."
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
    |context|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2159
1678
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2160
    "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
  2161
1685
5f867e93af8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1684
diff changeset
  2162
    (Processor isNil 
1684
98ce4d199c9b scheisse
Claus Gittinger <cg@exept.de>
parents: 1678
diff changeset
  2163
    or:[Processor activeProcessIsSystemProcess]) ifTrue:[
1678
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2164
        ^ MiniDebugger
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2165
    ].
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2166
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2167
    context := thisContext.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2168
    context := context sender.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2169
    [context notNil] whileTrue:[
1678
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2170
        ((context receiver class == Debugger) 
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2171
         and:[context selector == aSelector]) ifTrue:[
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2172
            "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
  2173
            (Debugger == MiniDebugger) ifTrue:[
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2174
                "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
  2175
                ErrorRecursion ifFalse:[
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2176
                    Smalltalk fatalAbort:'recursive error ...'
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2177
                ]
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2178
            ].
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2179
            MiniDebugger isNil ifTrue:[
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2180
                Smalltalk fatalAbort:'no debugger'
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2181
            ].
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2182
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2183
            "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
  2184
             lets try MiniDebugger"
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2185
            ^ MiniDebugger
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2186
        ].
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2187
        context := context sender
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2188
    ].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2189
    "not within Debugger - no problem"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2190
    ^ Debugger
1678
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2191
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2192
    "Modified: 23.9.1996 / 12:14:52 / stefan"
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
2229
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  2195
cannotSendMessage:aMessage to:someReceiver
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  2196
    "this message is sent by the runtime system (VM),
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  2197
     when a message is sent to some object, whose class is not
2231
88ffbbaf1986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2198
     a valid behavior (see documentation in Behavior)."
2229
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  2199
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  2200
    ^ InternalErrorSignal
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  2201
          raiseRequestWith:someReceiver
2231
88ffbbaf1986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2202
          errorString:('bad class in send of #' , aMessage selector)
88ffbbaf1986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2203
88ffbbaf1986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2204
    "Modified: 23.1.1997 / 00:05:39 / cg"
2229
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  2205
!
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  2206
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2207
doesNotUnderstand:aMessage
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2208
    "this message is sent by the runtime system (VM) when
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2209
     a message is not understood by some object (i.e. there
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2210
     is no method for that selector). The original message has
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2211
     been packed into aMessage (i.e. the receiver, selector and
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2212
     any arguments) and the original receiver is then sent the
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2213
     #doesNotUnderstand: message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2214
     Here, we raise another signal which usually enters the debugger.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2215
     You can of course redefine #doesNotUnderstand: in your classes
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2216
     to implement message delegation, 
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2217
     or handle the MessageNotUnderstoodSignal gracefully."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2218
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2219
    |sel errorString cls sender|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2220
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2221
    "/ handle the case of an error during early startup
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2222
    "/ (output streams not yet initialized)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2223
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2224
    Stdout isNil ifTrue:[
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2225
        Smalltalk fatalAbort:'error during init: ' , aMessage selector , ' not understood'.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2226
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2227
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2228
    (sel := aMessage selector) isNil ifTrue:[
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2229
        "/
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2230
        "/ happens when things go mad, or a method has been
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2231
        "/ called by valueWithReceiver: with a wrong receiver.
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2232
        "/ To avoid later trouble (when concatenating strings),
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2233
        "/ replace the selector by some (nonNil) string
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2234
        "/
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2235
        sel := '(nil)'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2236
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2237
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2238
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2239
    "/ extract the class that should have implemented the message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2240
    "/ (in case of a super-send, this is not the receivers class)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2241
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2242
    sender := thisContext sender.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2243
    cls := sender searchClass.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2244
    cls isNil ifTrue:[
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2245
        "it was NOT a super or directed send ..."
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2246
        cls := self class
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2247
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2248
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2249
    cls notNil ifTrue:[
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2250
        "/
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2251
        "/ displayString is better than 'cls name',
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2252
        "/ since it appends (obsolete) for outdated classes.
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2253
        "/ (this happens if you send messages to old instances
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2254
        "/  after changing a classes definition)
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2255
        "/
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2256
        errorString := cls displayString.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2257
    ] ifFalse:[    
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2258
        errorString := '(** nil-class **)'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2259
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2260
    errorString := errorString , ' does not understand: ' , sel.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2261
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
    "/ this only happens, when YOU play around with my classvars ...
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2264
    "/ (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
  2265
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2266
    MessageNotUnderstoodSignal isNil ifTrue:[
1674
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2267
        ^ self 
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2268
	    enterDebuggerWithMessage:'oops - MessageNotUnderstoodSignal is gone'
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2269
	    on:thisContext.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2270
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2271
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2272
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2273
    "/ 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
  2274
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2275
    ^ MessageNotUnderstoodSignal
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2276
                raiseRequestWith:aMessage
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2277
                     errorString:errorString
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2278
                              in:sender
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2279
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2280
    "Modified: 3.5.1996 / 11:51:45 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2281
!
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
elementBoundsError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2284
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2285
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2286
    "report an error that badElement is out of bounds 
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2287
     (i.e. cannot be put into that collection).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2288
     The error is reported by raising the ElementOutOfBoundsSignal 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
    ^ ElementOutOfBoundsSignal raiseIn: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:12:45 / 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
elementNotCharacter
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 object to be stored is no Character.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2299
     (usually when storing into Strings).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2300
     The error is reported by raising the ElementOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2301
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2302
    ^ ElementOutOfBoundsSignal raiseIn:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2303
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2304
    "Modified: 8.5.1996 / 09:12:49 / cg"
783
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2307
elementNotInteger
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2308
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2309
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2310
    "report an error that object to be stored is not Integer.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2311
     (in collections that store integers only).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2312
     The error is reported by raising the ElementOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2313
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2314
    ^ ElementOutOfBoundsSignal raiseIn:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2315
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2316
    "Modified: 8.5.1996 / 09:12:51 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2317
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2318
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2319
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
  2320
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2321
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2322
    "enter the debugger with error-message aString"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2323
1674
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2324
    ^ self 
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2325
	enterDebuggerWithMessage:aString 
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2326
	on:anException suspendedContext
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2327
!
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2328
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2329
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
  2330
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2331
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2332
    "enter the debugger with error-message aString.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2333
     The first visible context shown there is aContext 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2334
     (this allows intermediate helpers to hide themselfes from what is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2335
     presented to the user)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2336
1094
af10927dc0f2 standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
  2337
    |debugger msg|
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2338
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2339
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2340
     if there is no debugger, exit smalltalk
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2341
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2342
    Debugger isNil ifTrue:[
1094
af10927dc0f2 standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
  2343
        msg := 'error: ' , aString.
af10927dc0f2 standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
  2344
af10927dc0f2 standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
  2345
        Smalltalk isStandAloneApp ifTrue:[
af10927dc0f2 standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
  2346
            Dialog notNil ifTrue:[
1097
14711c00f386 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2347
                (Dialog 
2136
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2348
                    confirm:msg title:(Smalltalk commandName)
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2349
                    yesLabel:'ignore' noLabel:'exit'
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2350
                ) ifTrue:[
1095
834d4fb13e9f standAlone changes
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  2351
                    ^ AbortSignal raise
1094
af10927dc0f2 standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
  2352
                ]
af10927dc0f2 standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
  2353
            ].
2136
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2354
            msg errorPrintCR.
1094
af10927dc0f2 standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
  2355
            OperatingSystem exit:1
af10927dc0f2 standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
  2356
        ].
2136
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2357
        msg errorPrintCR.
1094
af10927dc0f2 standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
  2358
        Smalltalk fatalAbort:'no Debugger defined'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2359
    ].
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  2360
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2361
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2362
     find an appropriate debugger to use
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2363
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2364
    debugger := self appropriateDebugger:#'enter:withMessage:'.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2365
    ^ 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
  2366
2136
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2367
    "Modified: 10.1.1997 / 19:11:52 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2368
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2369
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2370
error
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2371
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2372
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2373
    "report error that an error occured.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2374
     The error is reported by raising the ErrorSignal exception."
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2375
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2376
    ^ ErrorSignal raiseIn:thisContext sender
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2377
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2378
    "Modified: 8.5.1996 / 09:13:01 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2379
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2380
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2381
error:aString
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2382
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2383
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2384
    "enter debugger with error-message aString.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2385
     The error is reported by raising the ErrorSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2386
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2387
    ^ ErrorSignal raiseRequestWith:#error: 
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2388
                       errorString:aString
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2389
                                in:thisContext sender
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2390
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2391
    "Modified: 8.5.1996 / 09:13:04 / cg"
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2392
!
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2393
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2394
error:aString in:aContext
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2395
    "{ Pragma: +optSpace }"
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2396
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2397
    "enter debugger with error-message aString.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2398
     The error is reported by raising the ErrorSignal exception."
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2399
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2400
    ^ ErrorSignal raiseRequestWith:#error: 
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2401
                       errorString:aString
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2402
                                in:aContext
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2403
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2404
    "Created: 8.5.1996 / 09:07:59 / cg"
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2405
    "Modified: 8.5.1996 / 09:13:06 / 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
errorKeyNotFound:aKey
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 a key was not found in a collection.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2412
     The error is reported by raising the KeyNotFoundSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2413
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2414
    ^ KeyNotFoundSignal raiseRequestWith:aKey in:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2415
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2416
    "Modified: 8.5.1996 / 09:13:08 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2417
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2418
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2419
errorNotFound
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2420
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2421
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2422
    "report an error that no element was found in a collection.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2423
     The error is reported by raising the NotFoundSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2424
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2425
    ^ NotFoundSignal raiseIn:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2426
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2427
    "Modified: 8.5.1996 / 09:13:11 / cg"
783
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2430
halt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2431
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2432
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2433
    "enter debugger with halt-message.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2434
     The error is reported by raising the HaltSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2435
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2436
    ^ HaltSignal raiseIn:thisContext sender.
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2437
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2438
    "Modified: 8.5.1996 / 09:12:38 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2439
!
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
halt:aString
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2442
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2443
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2444
    "enter debugger with halt-message.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2445
     The error is reported by raising the HaltSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2446
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2447
    ^ HaltSignal raiseRequestWith:#halt: 
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2448
                      errorString:aString
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2449
                               in:thisContext sender
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2450
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2451
    "Modified: 8.5.1996 / 09:13:23 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2452
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2453
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2454
implementedBySubclass
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2455
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2456
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2457
    "this is sent by ST/V code - its the same as #subclassResponsibility"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2458
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2459
    ^ self subclassResponsibility
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2460
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2461
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2462
indexNotInteger
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2463
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2464
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2465
    "report an error that index is not an Integer.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2466
     (when accessing collections indexed by an integer key).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2467
     The error is reported by raising the NonIntegerIndexSignal exception."
783
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
    ^ NonIntegerIndexSignal raiseIn:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2470
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2471
    "Modified: 8.5.1996 / 09:13:37 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2472
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2473
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2474
integerCheckError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2475
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2476
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2477
    "generated when a variable declared with an integer type gets a bad
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2478
     value assigned"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2479
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2480
    ^ self error:'bad assign of ' , self printString , 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2481
		  ' (' , self class name , ') to integer-typed variable'
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2482
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2483
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2484
invalidMessage 
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2485
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2486
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2487
    "this is sent by ST/V code - its the same as #shouldNotImplement"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2488
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2489
    ^ self shouldNotImplement
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2490
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2491
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2492
mustBeRectangle
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2493
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2494
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2495
    "report an argument-not-rectangle-error"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2496
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2497
    ^ self error:'argument must be a Rectangle'
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2500
mustBeString
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2501
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2502
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2503
    "report an argument-not-string-error"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2504
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2505
    ^ self error:'argument must be a String'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2506
!
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
notIndexed
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2509
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2510
1611
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2511
    "report an error that receiver has no indexed instance variables.
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2512
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2513
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2514
    ^ SubscriptOutOfBoundsSignal 
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2515
        raiseErrorString:'receiver has no indexed variables'
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2516
        in:thisContext sender
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2517
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2518
    "Modified: 26.7.1996 / 16:43:13 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2519
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2520
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2521
primitiveFailed
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2522
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2523
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2524
    "report an error that some primitive code failed.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2525
     The error is reported by raising the PrimitiveFailureSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2526
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2527
    ^ PrimitiveFailureSignal raiseIn:(thisContext sender)
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2528
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2529
    "Modified: 8.5.1996 / 09:14:07 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2530
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2531
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2532
shouldNotImplement
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2533
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2534
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2535
    "report an error that this message should not be implemented"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2536
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2537
    ^ self error:'method not appropriate for this class'
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2538
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2539
    "Modified: 8.5.1996 / 09:09:44 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2540
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2541
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2542
subclassResponsibility
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2543
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2544
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2545
    "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
  2546
     subclass"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2547
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2548
    ^ self error:'method must be reimplemented in subclass' in:thisContext sender
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2549
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2550
    "Modified: 8.5.1996 / 09:09:26 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2551
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2552
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2553
subscriptBoundsError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2554
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2555
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2556
    "report an error that some index is out of bounds.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2557
     (when accessing indexable collections).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2558
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2559
1611
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2560
    ^ SubscriptOutOfBoundsSignal 
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2561
        raiseIn:thisContext sender
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2562
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2563
    "Modified: 26.7.1996 / 16:45:42 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2564
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2565
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2566
subscriptBoundsError:anIndex
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2567
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2568
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2569
    "report an error that anIndex is out of bounds.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2570
     (when accessing indexable collections).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2571
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2572
1021
b0c7f4a235fb show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
  2573
    ^ SubscriptOutOfBoundsSignal 
b0c7f4a235fb show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
  2574
        raiseRequestWith:anIndex 
b0c7f4a235fb show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
  2575
        errorString:('subscript (' , anIndex printString , ') out of bounds')
b0c7f4a235fb show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
  2576
        in:thisContext sender
b0c7f4a235fb show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
  2577
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2578
    "Modified: 8.5.1996 / 09:14:34 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2579
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2580
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2581
typeCheckError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2582
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2583
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2584
    "generated when a variable declared with a type hint gets a bad
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2585
     value assigned"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2586
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2587
    ^ self error:'bad assign of ' , self printString ,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2588
		  ' (' , self class name , ') to typed variable'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2589
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2590
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2591
!Object methodsFor:'evaluation'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2592
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2593
value
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2594
    "return the receiver itself.
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2595
     This allows every object to be used where blocks or valueHolders
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2596
     are typically used, and allows for valueHolders and blocks to be
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2597
     used interchangably in some situations.
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2598
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2599
     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
  2600
     style ... (the idea was borrowed from the Self language).
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2601
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2602
     WARNING: dont 'optimize' away ifXXX: blocks 
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2603
              (i.e. do NOT replace 
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2604
                        foo ifTrue:[var1] ifFalse:[var2]
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2605
               by:
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2606
                        foo ifTrue:var1 ifFalse:var2
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2607
              )
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2608
              - the compilers will only generate inline code for the if, 
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2609
                iff the argument(s) are blocks - otherwise, a true send is
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2610
                generated.
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2611
              This 'oprimization' will work semantically correct,
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2612
              but execute SLOWER instead."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2613
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2614
    ^ self
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2615
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2616
    "
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2617
     #(1 2 3 4) indexOf:5 ifAbsent:0     
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2618
     #(1 2 3 4) indexOf:5 ifAbsent:[0]     
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2619
     1 > 2 ifTrue:['yes'] ifFalse:['no']  
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2620
     1 > 2 ifTrue:'yes' ifFalse:'no'       
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2621
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2622
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2623
    "DO NOT DO THIS (its slower)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2624
     (1 > 4) ifTrue:'oops' ifFalse:'ok'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2625
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2626
     USE (the compiler optimizes blocks in if/while):
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2627
     (1 > 4) ifTrue:['oops'] ifFalse:['ok']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2628
    "
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2629
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2630
    "Modified: 3.5.1996 / 11:57:08 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2631
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2632
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2633
!Object methodsFor:'initialization'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2634
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2635
initialize
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2636
    "just to ignore initialize to objects which do not need it"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2637
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2638
    ^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2639
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2640
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2641
!Object methodsFor:'interest'!
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2642
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2643
addInterest:anInterest
1762
e7267ff590ff Fix misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1751
diff changeset
  2644
    "install an interest forwarder.
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2645
     Here, we use the nonWeakDependencies."
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2646
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2647
    self addNonWeakDependent:anInterest
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2648
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2649
    "Created: 14.10.1996 / 22:27:34 / stefan"
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2650
!
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2651
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2652
expressInterestIn:aspect for:anObject sendBack:aSelector
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2653
    "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
  2654
     changes aspect."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2655
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2656
    "/ 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
  2657
    "/ 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
  2658
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2659
    self addInterest:(InterestConverter 
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2660
                            destination:anObject 
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2661
                            selector:aSelector 
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2662
                            aspect:aspect)
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2663
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
     |p b|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2666
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2667
     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
  2668
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2669
     p := Point new.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2670
     Transcript showCR:'interest in #foo:'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2671
     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
  2672
     p x:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2673
     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
  2674
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2675
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2676
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2677
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2678
     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
  2679
     p changed:#foo.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2680
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2681
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2682
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2683
     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
  2684
     p retractInterestIn:#foo for:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2685
     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
  2686
     p changed:#foo.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2687
     Transcript cr.
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
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2690
     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
  2691
     p expressInterestIn:#bar for:b sendBack:#value.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2692
     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
  2693
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2694
     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
  2695
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2696
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2697
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2698
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2699
     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
  2700
     p expressInterestIn:#foo for:b sendBack:#value.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2701
     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
  2702
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2703
     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
  2704
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2705
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2706
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2707
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2708
     Transcript showCR:'no more interests:'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2709
     p retractInterestsFor:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2710
     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
  2711
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2712
     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
  2713
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2714
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2715
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2716
     p release.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2717
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2718
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2719
    "Created: 19.4.1996 / 10:26:22 / cg"
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2720
    "Modified: 19.4.1996 / 12:34:08 / cg"
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2721
    "Modified: 14.10.1996 / 22:28:20 / stefan"
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2722
!
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2723
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2724
interests
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2725
    "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
  2726
     Here, we use the nonWeakDependents for interests."
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2727
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2728
    ^ self nonWeakDependents
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2729
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2730
    "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
  2731
!
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
onChangeSend:aSelector to:anObject
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2734
    "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
  2735
     changes."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2736
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2737
    "/ 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
  2738
    "/ 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
  2739
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2740
    self addInterest:(InterestConverter 
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2741
                          destination:anObject 
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2742
                          selector:aSelector)
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2743
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2744
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2745
     |p b|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2746
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2747
     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
  2748
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2749
     p := Point new.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2750
     p onChangeSend:#value to:b.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2751
     p x:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2752
     Transcript showCR:'now changing'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2753
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2754
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2755
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2756
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2757
     Transcript showCR:'now changing'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2758
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2759
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2760
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2761
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2762
     Transcript showCR:'no more interest'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2763
     p retractInterestsFor:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2764
     Transcript showCR:'now changing again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2765
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2766
     Transcript cr.
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
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2769
     Transcript showCR:'interest again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2770
     p onChangeSend:#value to:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2771
     Transcript showCR:'now changing again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2772
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2773
     Transcript cr.
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
    "Created: 19.4.1996 / 10:26:38 / cg"
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2777
    "Modified: 19.4.1996 / 12:34:26 / cg"
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2778
    "Modified: 14.10.1996 / 22:28:27 / stefan"
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2779
!
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2780
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2781
removeInterest:anInterest
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2782
    "remove an interest forwarder.
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2783
     Here, we use the nonWeakDependencies."
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2784
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2785
    self removeNonWeakDependent:anInterest
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2786
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2787
    "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
  2788
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2789
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2790
retractInterestIn:aspect for:someOne
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2791
    "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
  2792
     (as installed with #expressInterestIn:for:sendBack:)."
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
    "/ for now, remove the interestConverter.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2795
    "/ 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
  2796
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2797
    |deps|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2798
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2799
    deps := self interests.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2800
    deps notNil ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2801
        deps do:[:dep |
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2802
            (dep isMemberOf:InterestConverter) ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2803
                dep destination == someOne ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2804
                    dep aspect == aspect ifTrue:[
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2805
                        self removeInterest:dep.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2806
                        ^ self
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
            ]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2810
        ]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2811
    ].
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
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2814
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2815
     |p b|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2816
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2817
     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
  2818
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2819
     p := Point new.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2820
     Transcript showCR:'interest in #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2821
     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
  2822
     p x:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2823
     Transcript showCR:'now changing #bar'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2824
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2825
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2826
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2827
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2828
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2829
     p changed:#foo.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2830
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2831
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2832
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2833
     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
  2834
     p retractInterestIn:#foo for:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2835
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2836
     p changed:#foo.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2837
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2838
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2839
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2840
     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
  2841
     p expressInterestIn:#bar for:b sendBack:#value.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2842
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2843
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2844
     Transcript showCR:'now changing #bar'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2845
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2846
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2847
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2848
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2849
     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
  2850
     p expressInterestIn:#foo for:b sendBack:#value.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2851
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2852
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2853
     Transcript showCR:'now changing #bar'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2854
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2855
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2856
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2857
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2858
     Transcript showCR:'no more interests'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2859
     p retractInterestsFor:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2860
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2861
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2862
     Transcript showCR:'now changing #bar'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2863
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2864
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2865
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2866
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2867
    "Created: 19.4.1996 / 10:27:11 / cg"
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2868
    "Modified: 19.4.1996 / 12:29:52 / cg"
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2869
    "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
  2870
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2871
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2872
retractInterestsFor:someOne
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2873
    "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
  2874
     (as installed with #onChangeSend:to:)."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2875
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2876
    "/ for now, remove the interestConverter.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2877
    "/ 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
  2878
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2879
    |coll deps|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2880
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2881
    "/ 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
  2882
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2883
    coll := IdentitySet new.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2884
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2885
    deps := self interests.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2886
    deps notNil ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2887
        deps do:[:dep |
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2888
            (dep isMemberOf:InterestConverter) ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2889
                dep destination == someOne ifTrue:[
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2890
                    coll add:dep.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2891
                ]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2892
            ]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2893
        ].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2894
    ].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2895
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2896
    coll do:[:dep |
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2897
        self removeInterest:dep.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2898
    ].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2899
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2900
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2901
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2902
     |p b|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2903
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2904
     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
  2905
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2906
     p := Point new.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2907
     p onChangeSend:#value to:b.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2908
     p x:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2909
     Transcript showCR:'now changing'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2910
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2911
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2912
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2913
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2914
     Transcript showCR:'now changing'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2915
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2916
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2917
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2918
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2919
     Transcript showCR:'no more interest'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2920
     p retractInterestsFor:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2921
     Transcript showCR:'now changing again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2922
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2923
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2924
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2925
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2926
     Transcript showCR:'interest again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2927
     p onChangeSend:#value to:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2928
     Transcript showCR:'now changing again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2929
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2930
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2931
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2932
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2933
    "Created: 19.4.1996 / 10:23:46 / cg"
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2934
    "Modified: 19.4.1996 / 12:30:03 / cg"
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2935
    "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
  2936
! !
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2937
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2938
!Object methodsFor:'interrupt handling'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2939
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2940
childSignalInterrupt
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2941
    "death of a child process (unix process) - do nothing"
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
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
customInterrupt
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
    "a custom interrupt"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2950
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2951
    ^ self error:'custom interrupt'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2952
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2953
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2954
errorInterrupt:errorID with:aParameter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2955
    "subsystem error. The arguments errorID and aParameter are the values passed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2956
     to the 'errorInterruptWithIDAndParameter(id, param)' function, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2957
     which can be called from C subsystems to raise an (asynchronous)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2958
     error exception.
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
     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
  2961
     used from other C subsystems too, to upcast errors.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2962
     Especially, for subsystems which call errorHandler functions asynchronously.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2963
     IDs (currently) used:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2964
	#DisplayError ..... x-error interrupt
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2965
	#XtError      ..... xt-error interrupt (Xt interface is not yet published)
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2966
    "
783
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
    |handler|
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
    handler := ObjectMemory registeredErrorInterruptHandlers at:errorID ifAbsent:nil.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2971
    handler notNil ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2972
	"/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2973
	"/ handler found; let it do whatever it wants ...
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
	handler errorInterrupt:errorID with:aParameter.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2976
	^ self
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2979
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2980
    "/ no handler - raise errorSignal passing the errorId as parameter
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
    ^ ErrorSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2983
	raiseRequestWith:errorID 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2984
	errorString:('Subsystem error. ErrorID = ' , errorID printString)
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
exceptionInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2988
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2989
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2990
    "exception interrupt - enter debugger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2991
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2992
    self error:'exception Interrupt'
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
fpExceptionInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2996
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2997
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2998
    "a floating point exception occured - this one
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2999
     has to be handled differently since it comes asynchronous
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3000
     on some machines (for example, on machines with a separate FPU
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3001
     or superscalar architectures. Also, errors from within primitive code
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3002
     (or library functions such as GL) are sent via the Unix-signal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3003
     mechanism this way."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3004
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3005
    ^ Float domainErrorSignal raise
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3006
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3007
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3008
internalError:msg
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3009
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3010
2227
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
  3011
    "this is triggered, when VM hits some bad error,
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3012
     such as corrupted class, corrupted method/selector array
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3013
     etc. The argument string gives some more information on what happened.
2227
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
  3014
     (for example, if you set an objects class to a non-behavior, nil etc.).
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3015
     Its not guaranteed, that the system is in a working condition once
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3016
     this error occurred ...."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3017
2227
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
  3018
    ^ InternalErrorSignal
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
  3019
          raiseRequestWith:self
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
  3020
          errorString:msg
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3021
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3022
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3023
ioInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3024
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3025
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3026
    "I/O (SIGIO/SIGPOLL) interrupt (supposed to be sent to Processor).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3027
     If we arrive here, there is either no handler (ObjMem>>ioInterruptHandler)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3028
     or it does not understand the ioInterrupt message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3029
     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
  3030
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3031
    self error:'I/O Interrupt - but no handler'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3032
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3033
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3034
memoryInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3035
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3036
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3037
    "out-of-memory interrupt and no handler - enter debugger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3038
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3039
    ^ self error:'almost out of memory'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3040
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3041
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3042
recursionInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3043
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3044
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3045
    "recursion limit (actually: stack overflow) interrupt.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3046
     This interrupt is triggered, when a process stack grows above
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3047
     its stackLimit - usually, this leads into the debugger, but
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3048
     could be cought and the stackLimit increased in the handler.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3049
     At the time we arrive here, the system has still some stack 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3050
     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
  3051
     debugging for a while.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3052
     If the signal is ignored, and the stack continues to grow, there
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3053
     will be a few more chances (and more interrupts) before the VM
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3054
     hard-terminates the process."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3055
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3056
    thisContext isRecursive ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3057
	^ RecursionInterruptSignal raise
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
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3060
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3061
schedulerInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3062
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3063
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3064
    "scheduler interrupt (supposed to be sent to Processor).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3065
     If we arrive here, either the Processor does not understand it,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3066
     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
  3067
     big trouble. Enter debugger."
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
    self error:'schedulerInterrupt - but no Processor'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3070
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3071
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3072
signalInterrupt:signalNumber
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3073
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3074
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3075
    "unix signal occured - some signals are handled as Smalltalk Exceptions 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3076
     (SIGPIPE), others (SIGBUS) are rather fatal ...
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3077
     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
  3078
     that one is raised.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3079
     TODO: add another argument, giving more detailed signal info (PC, VADDR,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3080
     exact cause etc.). This helps if segvs occur in primitive code.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3081
     Currently (temporary kludge), these are passed as global variables."
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
    |box name here sig ignorable titles actions badContext msg pc addr|
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
     special case - since SIGPIPE has an ST-signal associated
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3087
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3088
    (signalNumber == 13) ifTrue:[
2043
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3089
        "SIGPIPE - write on a pipe with no one to read"
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3090
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3091
        ^ PipeStream brokenPipeSignal raise.
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3094
    "if there has been an ST-signal installed, use it ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3095
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3096
    sig := OperatingSystem operatingSystemSignal:signalNumber.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3097
    sig notNil ifTrue:[
2043
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3098
        ^ sig raise
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3099
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3100
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3101
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3102
     ... otherwise , bring up a box asking for what to do ...
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3103
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3104
    name := OperatingSystem nameForSignal:signalNumber.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3105
    here := thisContext.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3106
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3107
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3108
     the context, in which the signal occurred:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3109
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3110
    badContext := here sender.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3111
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3112
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3113
     ungrab - in case it happened in a box/popupview
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3114
     otherwise display stays locked
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3115
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3116
    Display notNil ifTrue:[
2043
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3117
        Display ungrabPointer.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3118
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3119
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3120
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3121
     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
  3122
     since the system will retry the faulty instruction, which leads to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3123
     another signal - to avoid frustration, better not offer this option.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3124
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3125
    ignorable := (signalNumber ~~ OperatingSystem sigBUS)
2043
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3126
                  and:[signalNumber ~~ OperatingSystem sigILL
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3127
                  and:[signalNumber ~~ OperatingSystem sigSEGV]].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3128
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3129
    ignorable ifFalse:[
2043
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3130
        here isRecursive ifTrue:[
2132
05d2be2d280e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 2114
diff changeset
  3131
            'Object [hard error]: signal ' errorPrint. signalNumber errorPrintCR.
2043
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3132
            MiniDebugger enterWithMessage:'recursive signal'.
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3133
            ^ self
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3134
        ].
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3135
        "
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3136
         a hard signal - go into debugger immediately
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3137
        "
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3138
        msg := 'OS-signal: ', name.
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3139
        InterruptPcLow notNil ifTrue:[
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3140
            pc := InterruptPcLow + (InterruptPcHi bitShift:16).
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3141
            pc ~~ 0 ifTrue:[
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3142
                msg := msg , ' PC=' , (pc printStringRadix:16)
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3143
            ].
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3144
        ].
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3145
        InterruptAddrLow notNil ifTrue:[
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3146
            addr := InterruptAddrLow + (InterruptAddrHi bitShift:16).
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3147
            addr ~~ 0 ifTrue:[
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3148
                msg := msg , ' ADDR=' , (addr printStringRadix:16)
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3149
            ].
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3150
        ].
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3151
        Debugger enter:here withMessage:msg. 
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3152
        badContext return.
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3153
        ^ nil.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3154
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3155
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3156
    OptionBox isNil ifTrue:[
2043
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3157
        "
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3158
         a system without GUI ...
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3159
         go into minidebugger (if there is one)
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3160
        "
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3161
        MiniDebugger isNil ifTrue:[
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3162
            "
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3163
             a system without debugging facilities
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3164
             (i.e. a standalone system)
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3165
             output a message and exit.
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3166
            "
2136
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  3167
            ('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
  3168
            Smalltalk exit.
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3169
        ].
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3170
        MiniDebugger enterWithMessage:'Signal cought (' , name, ')'.
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3171
        ^ self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3172
    ].
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
    box := OptionBox 
2043
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3175
                title:'Signal cought (' , name, ')'
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3176
                numberOfOptions:(ignorable ifTrue:[5] ifFalse:[4]).
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3177
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3178
    titles := #('return' 'debug' 'dump' 'exit').
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3179
    actions := Array 
2043
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3180
                 with:[badContext return]
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3181
                 with:[Debugger enter:here withMessage:('Signal ', name). ^nil]
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3182
                 with:[Smalltalk fatalAbort]
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3183
                 with:[Smalltalk exit].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3184
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3185
    ignorable ifTrue:[
2043
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3186
        titles := #('ignore') , titles.
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3187
        actions := (Array with:[^ nil]) , actions.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3188
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3189
    box buttonTitles:titles.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3190
    box actions:actions.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3191
    box showAtPointer
2043
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3192
2136
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  3193
    "Modified: 10.1.1997 / 19:09:39 / cg"
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3196
spyInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3197
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3198
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3199
    "spy interrupt and no handler - enter debugger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3200
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3201
    self error:'spy Interrupt - but no handler'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3202
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3203
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3204
timerInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3205
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3206
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3207
    "timer interrupt and no handler - enter debugger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3208
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3209
    self error:'timer Interrupt - but no handler'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3210
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3211
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3212
userInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3213
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3214
1792
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3215
    "user (^c) interrupt.
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3216
     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
  3217
     controlling tty (i.e. in the xterm)."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3218
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3219
    UserInterruptSignal raise
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3220
!
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3221
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3222
userInterruptIn:aContext
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3223
    "{ Pragma: +optSpace }"
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3224
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3225
    "user (^c) interrupt - enter debugger, but show aContext
1792
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3226
     as top-context. 
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3227
     This is used to hide any intermediate scheduler contexts, 
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3228
     in case of an interrupted process. Typically, this is sent by
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3229
     the WindowGroup, when a keyboardEvent for the ctrl-C key is
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3230
     processed."
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3231
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3232
    UserInterruptSignal raiseIn:aContext
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3233
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3234
    "Created: 18.10.1996 / 20:46:04 / cg"
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3235
    "Modified: 20.10.1996 / 13:06:38 / cg"
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3236
! !
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3237
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3238
!Object methodsFor:'message sending'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3239
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3240
perform:aSelector
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3241
    "send the message aSelector to the receiver"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3242
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3243
%{
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3244
    struct inlineCache *pIlc;
1820
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3245
    static struct inlineCache ilc_0 = __ILCPERF0(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3246
    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
  3247
    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
  3248
    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
  3249
    static flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3250
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3251
    if (aSelector != last_0) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3252
        if (aSelector != last_1) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3253
            if (flip) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3254
                pIlc = &ilc_0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3255
                flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3256
                last_0 = aSelector;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3257
            } else {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3258
                pIlc = &ilc_1;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3259
                flip = 1;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3260
                last_1 = aSelector;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3261
            }
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3262
            pIlc->ilc_func = __SEND0ADDR__;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3263
            if (pIlc->ilc_poly) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3264
                __flushPolyCache(pIlc->ilc_poly);
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3265
                pIlc->ilc_poly = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3266
            }
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3267
        } else {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3268
            pIlc = &ilc_1;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3269
        }
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3270
    } else {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3271
        pIlc = &ilc_0;
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3272
    }
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3273
    RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc) );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3274
%}
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3275
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3276
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3277
perform:aSelector inClass:aClass withArguments:argArray
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3278
    "send the message aSelector with all args taken from argArray 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3279
     to the receiver as a super-send message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3280
     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
  3281
     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
  3282
     immediate superclass).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3283
     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
  3284
         '5 perform:#< inClass:Magnitude withArguments:#(6)'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3285
     and evaluate Magnitudes compare method even if there was one in Number.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3286
     This method is used by the interpreter to evaluate super sends
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3287
     and could be used for very special behavior (language extension ?).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3288
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3289
     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
  3290
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3291
    |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
  3292
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3293
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3294
     check, if aClass is really a superclass of the receiver
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3295
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3296
    (self class isSubclassOf:aClass) ifFalse:[
1818
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3297
        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
  3298
        ^ nil
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3299
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3300
    numberOfArgs := argArray size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3301
%{
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3302
    REGISTER OBJ *argP;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3303
    int nargs, i;
1818
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3304
    static struct inlineCache ilc0 = _DUMMYILCSELF0;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3305
    static struct inlineCache ilc1 = _DUMMYILCSELF1;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3306
    static struct inlineCache ilc2 = _DUMMYILCSELF2;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3307
    static struct inlineCache ilc3 = _DUMMYILCSELF3;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3308
    static struct inlineCache ilc4 = _DUMMYILCSELF4;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3309
    static struct inlineCache ilc5 = _DUMMYILCSELF5;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3310
    static struct inlineCache ilc6 = _DUMMYILCSELF6;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3311
    static struct inlineCache ilc7 = _DUMMYILCSELF7;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3312
    static struct inlineCache ilc8 = _DUMMYILCSELF8;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3313
    static struct inlineCache ilc9 = _DUMMYILCSELF9;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3314
    static struct inlineCache ilc10 = _DUMMYILCSELF10;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3315
    static struct inlineCache ilc11 = _DUMMYILCSELF11;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3316
    static struct inlineCache ilc12 = _DUMMYILCSELF12;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3317
    static struct inlineCache ilc13 = _DUMMYILCSELF13;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3318
    static struct inlineCache ilc14 = _DUMMYILCSELF14;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3319
    static struct inlineCache ilc15 = _DUMMYILCSELF15;
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3320
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3321
    if (__isSmallInteger(numberOfArgs)) {
1818
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3322
        nargs = __intVal(numberOfArgs);
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3323
        if (nargs == 0) {
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3324
            RETURN (_SEND0(self, aSelector, aClass, &ilc0));
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3325
        }
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3326
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3327
        argP = (OBJ *)(&a1);
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3328
        if (__Class(argArray) == @global(Array)) {
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3329
            for (i=0; i < nargs; i++) {
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3330
                *argP++ = __ArrayInstPtr(argArray)->a_element[i];
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3331
            }
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3332
        } else {
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3333
            for (i=1; i <= nargs; i++) {
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3334
                *argP++ = __AT_(argArray, __MKSMALLINT(i));
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3335
            }
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3336
        }
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3337
        switch (nargs) {
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3338
            case 1: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3339
                RETURN ( _SEND1(self, aSelector, aClass, &ilc1, a1));
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3340
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3341
            case 2: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3342
                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
  3343
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3344
            case 3: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3345
                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
  3346
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3347
            case 4: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3348
                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
  3349
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3350
            case 5: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3351
                RETURN ( _SEND5(self, aSelector, aClass, &ilc5, 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3352
                                a1, a2, a3, a4, a5));
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3353
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3354
            case 6: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3355
                RETURN ( _SEND6(self, aSelector, aClass, &ilc6, 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3356
                                a1, a2, a3, a4, a5, a6));
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3357
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3358
            case 7: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3359
                RETURN ( _SEND7(self, aSelector, aClass, &ilc7, 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3360
                                a1, a2, a3, a4, a5, a6, a7));
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3361
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3362
            case 8: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3363
                RETURN ( _SEND8(self, aSelector, aClass, &ilc8, 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3364
                                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
  3365
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3366
            case 9: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3367
                RETURN ( _SEND9(self, aSelector, aClass, &ilc9, 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3368
                                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
  3369
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3370
            case 10: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3371
                RETURN ( _SEND10(self, aSelector, aClass, &ilc10, 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3372
                                 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
  3373
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3374
            case 11: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3375
                RETURN ( _SEND11(self, aSelector, aClass, &ilc11, 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3376
                                 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
  3377
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3378
            case 12: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3379
                RETURN ( _SEND12(self, aSelector, aClass, &ilc12, 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3380
                                 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
  3381
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3382
            case 13: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3383
                RETURN ( _SEND13(self, aSelector, aClass, &ilc13, 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3384
                                 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
  3385
                                 a13));
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3386
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3387
            case 14: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3388
                RETURN ( _SEND14(self, aSelector, aClass, &ilc14, 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3389
                                 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
  3390
                                 a13, a14));
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3391
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3392
            case 15: 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3393
                RETURN ( _SEND15(self, aSelector, aClass, &ilc15, 
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3394
                                 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
  3395
                                 a13, a14, a15));
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3396
        }
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3397
    }
1626
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  3398
%}.
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  3399
    "/ arrive here, if bad number of arguments (too many)
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  3400
    "/ ST/X (currently) only allows up to 15 method arguments
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  3401
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3402
    ^ self primitiveFailed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3403
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3404
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3405
perform:aSelector with:anObject
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3406
    "send the one-arg-message aSelector to the receiver"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3407
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3408
%{
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3409
    struct inlineCache *pIlc;
1820
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3410
    static struct inlineCache ilc_0 = __ILCPERF1(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3411
    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
  3412
    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
  3413
    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
  3414
    static flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3415
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3416
    if (aSelector != last_0) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3417
        if (aSelector != last_1) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3418
            if (flip) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3419
                pIlc = &ilc_0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3420
                flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3421
                last_0 = aSelector;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3422
            } else {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3423
                pIlc = &ilc_1;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3424
                flip = 1;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3425
                last_1 = aSelector;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3426
            }
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3427
            pIlc->ilc_func = __SEND1ADDR__;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3428
            if (pIlc->ilc_poly) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3429
                __flushPolyCache(pIlc->ilc_poly);
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3430
                pIlc->ilc_poly = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3431
            }
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3432
        } else {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3433
            pIlc = &ilc_1;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3434
        }
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3435
    } else {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3436
        pIlc = &ilc_0;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3437
    }
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3438
    RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, anObject) );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3439
%}
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3440
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3441
!
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3442
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3443
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
  3444
    "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
  3445
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3446
%{
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3447
    struct inlineCache *pIlc;
1820
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3448
    static struct inlineCache ilc_0 = __ILCPERF2(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3449
    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
  3450
    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
  3451
    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
  3452
    static flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3453
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3454
    if (aSelector != last_0) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3455
        if (aSelector != last_1) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3456
            if (flip) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3457
                pIlc = &ilc_0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3458
                flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3459
                last_0 = aSelector;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3460
            } else {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3461
                pIlc = &ilc_1;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3462
                flip = 1;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3463
                last_1 = aSelector;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3464
            }
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3465
            pIlc->ilc_func = __SEND2ADDR__;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3466
            if (pIlc->ilc_poly) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3467
                __flushPolyCache(pIlc->ilc_poly);
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3468
                pIlc->ilc_poly = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3469
            }
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3470
        } else {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3471
            pIlc = &ilc_1;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3472
        }
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3473
    } else {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3474
        pIlc = &ilc_0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3475
    }
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3476
    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
  3477
%}
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3478
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3479
!
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3480
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3481
perform:aSelector with:arg1 with:arg2 with:arg3
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3482
    "send the three-arg-message aSelector to the receiver"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3483
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3484
%{
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3485
    struct inlineCache *pIlc;
1820
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3486
    static struct inlineCache ilc_0 = __ILCPERF3(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3487
    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
  3488
    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
  3489
    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
  3490
    static flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3491
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3492
    if (aSelector != last_0) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3493
        if (aSelector != last_1) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3494
            if (flip) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3495
                pIlc = &ilc_0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3496
                flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3497
                last_0 = aSelector;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3498
            } else {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3499
                pIlc = &ilc_1;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3500
                flip = 1;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3501
                last_1 = aSelector;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3502
            }
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3503
            pIlc->ilc_func = __SEND3ADDR__;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3504
            if (pIlc->ilc_poly) {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3505
                __flushPolyCache(pIlc->ilc_poly);
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3506
                pIlc->ilc_poly = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3507
            }
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3508
        } else {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3509
            pIlc = &ilc_1;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3510
        }
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3511
    } else {
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3512
        pIlc = &ilc_0;
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3513
    }
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3514
    RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, arg1, arg2, arg3) );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3515
%}
2437
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3516
!
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3517
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3518
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3519
    "send the four-arg-message aSelector to the receiver"
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3520
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3521
%{
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3522
    struct inlineCache *pIlc;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3523
    static struct inlineCache ilc_0 = __ILCPERF4(0);
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3524
    static struct inlineCache ilc_1 = __ILCPERF4(0);
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3525
    static OBJ last_0 = nil;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3526
    static OBJ last_1 = nil;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3527
    static flip = 0;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3528
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3529
    if (aSelector != last_0) {
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3530
        if (aSelector != last_1) {
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3531
            if (flip) {
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3532
                pIlc = &ilc_0;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3533
                flip = 0;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3534
                last_0 = aSelector;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3535
            } else {
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3536
                pIlc = &ilc_1;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3537
                flip = 1;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3538
                last_1 = aSelector;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3539
            }
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3540
            pIlc->ilc_func = __SEND4ADDR__;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3541
            if (pIlc->ilc_poly) {
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3542
                __flushPolyCache(pIlc->ilc_poly);
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3543
                pIlc->ilc_poly = 0;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3544
            }
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3545
        } else {
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3546
            pIlc = &ilc_1;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3547
        }
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3548
    } else {
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3549
        pIlc = &ilc_0;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3550
    }
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3551
    RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, arg1, arg2, arg3, arg4) );
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3552
%}
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3553
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3554
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3555
perform:aSelector withArguments:argArray
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3556
    "send the message aSelector with all args taken from argArray 
44
b262907c93ea *** empty log message ***
claus
parents: 39
diff changeset
  3557
     to the receiver."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3558
77
6c38ca59927f *** empty log message ***
claus
parents: 71
diff changeset
  3559
    |numberOfArgs a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3560
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3561
    numberOfArgs := argArray size.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3562
%{
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3563
    REGISTER OBJ *argP;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3564
    int nargs, i;
1820
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3565
    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
  3566
    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
  3567
    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
  3568
    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
  3569
    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
  3570
    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
  3571
    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
  3572
    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
  3573
    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
  3574
    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
  3575
    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
  3576
    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
  3577
    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
  3578
    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
  3579
    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
  3580
    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
  3581
    OBJ l;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3582
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3583
#if defined(xxxTHIS_CONTEXT) /* not because this has a context */
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3584
    /*
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  3585
     * must set lineno in sender by hand here ... (because of NOCONTEXT)
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3586
     */
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3587
    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
  3588
        _ContextInstPtr(__thisContext)->c_lineno = l;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3589
    }
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3590
#endif
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3591
253
30daee717a53 *** empty log message ***
claus
parents: 228
diff changeset
  3592
    if (__isSmallInteger(numberOfArgs)) {
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3593
        nargs = __intVal(numberOfArgs);
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3594
        if (nargs == 0) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3595
            if (aSelector != last0) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3596
                ilc0.ilc_func = __SEND0ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3597
                if (ilc0.ilc_poly) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3598
                    __flushPolyCache(ilc0.ilc_poly);
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3599
                    ilc0.ilc_poly = 0;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3600
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3601
                last0 = 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
            ilc0.ilc_lineNo = __pilc->ilc_lineNo;
44
b262907c93ea *** empty log message ***
claus
parents: 39
diff changeset
  3605
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3606
            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
  3607
        }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3608
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3609
        if (__isArray(argArray)) {
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  3610
            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
  3611
        } else {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3612
            argP = (OBJ *)(&a1);
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3613
            for (i=1; i <= nargs; i++) {
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3614
                *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
  3615
            }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3616
        }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3617
        switch (nargs) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3618
            case 1: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3619
                if (aSelector != last1) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3620
                    ilc1.ilc_func = __SEND1ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3621
                    if (ilc1.ilc_poly) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3622
                        __flushPolyCache(ilc1.ilc_poly);
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3623
                        ilc1.ilc_poly = 0;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3624
                    }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3625
                    last1 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3626
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3627
#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
  3628
                ilc1.ilc_lineNo = __pilc->ilc_lineNo;
44
b262907c93ea *** empty log message ***
claus
parents: 39
diff changeset
  3629
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3630
                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
  3631
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3632
            case 2: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3633
                if (aSelector != last2) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3634
                    ilc2.ilc_func = __SEND2ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3635
                    if (ilc2.ilc_poly) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3636
                        __flushPolyCache(ilc2.ilc_poly);
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3637
                        ilc2.ilc_poly = 0;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3638
                    }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3639
                    last2 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3640
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3641
#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
  3642
                ilc2.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3643
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3644
                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
  3645
                                                argP[0], argP[1]));
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3646
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3647
            case 3: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3648
                if (aSelector != last3) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3649
                    ilc3.ilc_func = __SEND3ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3650
                    if (ilc3.ilc_poly) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3651
                        __flushPolyCache(ilc3.ilc_poly);
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3652
                        ilc3.ilc_poly = 0;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3653
                    }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3654
                    last3 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3655
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3656
#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
  3657
                ilc3.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3658
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3659
                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
  3660
                                                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
  3661
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3662
            case 4: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3663
                if (aSelector != last4) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3664
                    ilc4.ilc_func = __SEND4ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3665
                    if (ilc4.ilc_poly) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3666
                        __flushPolyCache(ilc4.ilc_poly);
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3667
                        ilc4.ilc_poly = 0;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3668
                    }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3669
                    last4 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3670
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3671
#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
  3672
                ilc4.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3673
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3674
                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
  3675
                                                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
  3676
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3677
            case 5: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3678
                if (aSelector != last5) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3679
                    ilc5.ilc_func = __SEND5ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3680
                    if (ilc5.ilc_poly) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3681
                        __flushPolyCache(ilc5.ilc_poly);
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3682
                        ilc5.ilc_poly = 0;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3683
                    }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3684
                    last5 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3685
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3686
#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
  3687
                ilc5.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3688
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3689
                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
  3690
                                                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
  3691
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3692
            case 6: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3693
                if (aSelector != last6) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3694
                    ilc6.ilc_func = __SEND6ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3695
                    if (ilc6.ilc_poly) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3696
                        __flushPolyCache(ilc6.ilc_poly);
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3697
                        ilc6.ilc_poly = 0;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3698
                    }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3699
                    last6 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3700
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3701
#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
  3702
                ilc6.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3703
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3704
                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
  3705
                                                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
  3706
                                                argP[5]));
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3707
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3708
            case 7: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3709
                if (aSelector != last7) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3710
                    ilc7.ilc_func = __SEND7ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3711
                    if (ilc7.ilc_poly) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3712
                        __flushPolyCache(ilc7.ilc_poly);
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3713
                        ilc7.ilc_poly = 0;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3714
                    }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3715
                    last7 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3716
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3717
#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
  3718
                ilc7.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3719
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3720
                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
  3721
                                                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
  3722
                                                argP[5], argP[6]));
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3723
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3724
            case 8:
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3725
                if (aSelector != last8) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3726
                    ilc8.ilc_func = __SEND8ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3727
                    last8 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3728
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3729
#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
  3730
                ilc8.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3731
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3732
                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
  3733
                                                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
  3734
                                                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
  3735
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3736
            case 9: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3737
                if (aSelector != last9) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3738
                    ilc9.ilc_func = __SEND9ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3739
                    last9 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3740
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3741
#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
  3742
                ilc9.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3743
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3744
                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
  3745
                                                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
  3746
                                                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
  3747
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3748
            case 10: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3749
                if (aSelector != last10) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3750
                    ilc10.ilc_func = __SEND10ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3751
                    last10 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3752
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3753
#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
  3754
                ilc10.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3755
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3756
                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
  3757
                                                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
  3758
                                                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
  3759
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3760
            case 11: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3761
                if (aSelector != last11) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3762
                    ilc11.ilc_func = __SEND11ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3763
                    last11 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3764
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3765
#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
  3766
                ilc11.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3767
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3768
                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
  3769
                                                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
  3770
                                                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
  3771
                                                argP[10]));
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3772
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3773
            case 12: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3774
                if (aSelector != last12) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3775
                    ilc12.ilc_func = __SEND12ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3776
                    last12 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3777
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3778
#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
  3779
                ilc12.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3780
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3781
                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
  3782
                                                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
  3783
                                                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
  3784
                                                argP[10], argP[11]));
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3785
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3786
            case 13: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3787
                if (aSelector != last13) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3788
                    ilc13.ilc_func = __SEND13ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3789
                    last13 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3790
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3791
#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
  3792
                ilc13.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3793
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3794
                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
  3795
                                                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
  3796
                                                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
  3797
                                                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
  3798
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3799
            case 14: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3800
                if (aSelector != last14) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3801
                    ilc14.ilc_func = __SEND14ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3802
                    last14 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3803
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3804
#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
  3805
                ilc14.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3806
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3807
                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
  3808
                                                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
  3809
                                                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
  3810
                                                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
  3811
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3812
            case 15: 
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3813
                if (aSelector != last15) {
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3814
                    ilc15.ilc_func = __SEND15ADDR__;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3815
                    last15 = aSelector;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3816
                }
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3817
#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
  3818
                ilc15.ilc_lineNo = __pilc->ilc_lineNo;
77
6c38ca59927f *** empty log message ***
claus
parents: 71
diff changeset
  3819
#endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3820
                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
  3821
                                                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
  3822
                                                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
  3823
                                                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
  3824
                                                argP[14]));
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3825
        }
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3826
    }
1626
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  3827
%}.
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  3828
    "/ arrive here, if bad number of arguments (too many)
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  3829
    "/ ST/X (currently) only allows up to 15 method arguments
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  3830
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3831
    ^ self primitiveFailed
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3832
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3833
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3834
!Object methodsFor:'misc'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3835
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3836
-> anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3837
    "return an association with the receiver as key and
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3838
     the argument as value"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3839
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3840
    ^ Association key:self value:anObject
2
claus
parents: 1
diff changeset
  3841
! !
claus
parents: 1
diff changeset
  3842
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3843
!Object methodsFor:'printing & storing'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3844
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3845
className
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3846
    "return the classname of the receivers class"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3847
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3848
    ^ self class name
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  3849
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3850
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3851
     1 className
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3852
     1 class className   'this may change ...'
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3853
     $a className
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3854
     $a class className  'this may change ...'
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3855
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3856
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3857
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3858
classNameWithArticle
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3859
    "return a string consisting of classname preceeded by an article.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3860
     (dont expect me to write national variants for this ... :-)
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3861
     If you have special preferences, redefine it ..."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3862
1391
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  3863
    |classname cls|
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  3864
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  3865
    (cls := self class) == self ifTrue:[
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  3866
        ^ 'a funny object'
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  3867
    ].
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  3868
    classname := cls displayString.
85
claus
parents: 77
diff changeset
  3869
    ^ classname article , ' ' , classname
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  3870
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3871
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3872
     1 classNameWithArticle
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3873
     (1->2) classNameWithArticle
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3874
     XWorkstation basicNew classNameWithArticle
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3875
    "
1391
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  3876
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  3877
    "Modified: 13.5.1996 / 12:16:14 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3878
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3879
1445
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  3880
displayOn:aGc
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  3881
    "ST-80 Compatibility
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  3882
     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
  3883
     - 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
  3884
     (although the fallBack is to display its printString ...)"
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  3885
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  3886
    ^ self displayOn:aGc x:0 y:0.
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  3887
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  3888
    "Created: 29.5.1996 / 16:28:58 / cg"
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  3889
!
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  3890
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3891
displayOn:aGc at:aPoint
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3892
    "ST-80 Compatibility
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3893
     display the receiver in a graphicsContext - this method allows
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3894
     for any object to be displayed in a ListView - for example."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3895
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3896
    ^ self displayOn:aGc x:(aPoint x) y:(aPoint y).
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  3897
!
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  3898
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3899
displayOn:aGc x:x y:y
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3900
    "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
  3901
     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
  3902
     The fallBack here shows the receivers printString."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3903
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3904
    ^ 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
  3905
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  3906
    "Modified: 29.5.1996 / 16:29:38 / cg"
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  3907
!
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  3908
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3909
displayString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3910
    "return a string used when displaying the receiver in a view;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3911
     for example an Inspector. This is usually the same as printString,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3912
     but sometimes redefined for a better look."
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
    ^ self printString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3915
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
     #(1 2 3) printString    
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3918
     #(1 2 3) displayString  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3919
     #(1 2 3) storeString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3920
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3921
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3922
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3923
errorPrint
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3924
    "print the receiver on the standard error stream."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3925
1089
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  3926
    Stream streamErrorSignal catch:[
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  3927
        self printOn:Stderr
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  3928
    ]
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  3929
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  3930
    "Modified: 7.3.1996 / 19:11:29 / cg"
783
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
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3933
errorPrintCR
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3934
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3935
1089
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  3936
    "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
  3937
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  3938
    Stream streamErrorSignal catch:[
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  3939
        self printOn:Stderr.
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  3940
        Stderr cr
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  3941
    ]
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  3942
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  3943
    "Modified: 7.3.1996 / 19:13:01 / cg"
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3944
    "Created: 20.5.1996 / 10:20:41 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3945
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3946
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3947
errorPrintNL
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3948
    "{ Pragma: +optSpace }"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3949
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3950
    "print the receiver followed by a cr on the standard error stream.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3951
     Please use #errorPrintCR - this method exists for backward compatibility."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3952
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3953
    ^ self errorPrintCR
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3954
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3955
    "Modified: 20.5.1996 / 10:24:45 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3956
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3957
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3958
errorPrintNewline
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3959
    "{ Pragma: +optSpace }"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3960
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3961
    "print the receiver followed by a cr on the standard error stream.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3962
     Please use #errorPrintCR - this method exists for backward compatibility."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3963
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3964
    self errorPrintCR.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3965
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3966
    "Modified: 20.5.1996 / 10:24:38 / cg"
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3967
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3968
356
claus
parents: 348
diff changeset
  3969
infoPrint
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3970
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3971
356
claus
parents: 348
diff changeset
  3972
    "print the receiver on the standard error stream.
claus
parents: 348
diff changeset
  3973
     This is meant for information messages which are not warnings
claus
parents: 348
diff changeset
  3974
     or fatal messages.
claus
parents: 348
diff changeset
  3975
     These messages can be turned on/off by 'Object infoPrinting:true/false'"
claus
parents: 348
diff changeset
  3976
2114
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
  3977
    InfoPrinting == true ifTrue:[
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
  3978
	self errorPrint
356
claus
parents: 348
diff changeset
  3979
    ]
claus
parents: 348
diff changeset
  3980
!
claus
parents: 348
diff changeset
  3981
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3982
infoPrintCR
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3983
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3984
356
claus
parents: 348
diff changeset
  3985
    "print the receiver followed by a cr on the standard error stream.
claus
parents: 348
diff changeset
  3986
     This is meant for information messages which are not warnings
claus
parents: 348
diff changeset
  3987
     or fatal messages.
claus
parents: 348
diff changeset
  3988
     These messages can be turned on/off by 'Object infoPrinting:true/false'"
claus
parents: 348
diff changeset
  3989
2114
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
  3990
    InfoPrinting == true ifTrue:[
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3991
        self errorPrintCR
356
claus
parents: 348
diff changeset
  3992
    ]
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3993
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3994
    "Created: 20.5.1996 / 10:21:28 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3995
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3996
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3997
infoPrintNL
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3998
    "{ Pragma: +optSpace }"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  3999
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4000
    "print the receiver followed by a cr on the standard error stream.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4001
     This is meant for information messages which are not warnings
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4002
     or fatal messages.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4003
     These messages can be turned on/off by 'Object infoPrinting:true/false'.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4004
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4005
     Please use #infoPrintCR - this method exists for backward compatibility."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4006
2114
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
  4007
    ^ self infoPrintCR
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4008
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4009
    "Modified: 20.5.1996 / 10:25:07 / cg"
356
claus
parents: 348
diff changeset
  4010
!
claus
parents: 348
diff changeset
  4011
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4012
print
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  4013
    "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
  4014
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4015
    self printOn:Stdout
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  4016
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  4017
    "Modified: 4.11.1996 / 23:36:58 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4018
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4019
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4020
printCR
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  4021
    "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
  4022
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4023
    self printOn:Stdout.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4024
    Stdout cr
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4025
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4026
    "Created: 20.5.1996 / 10:21:37 / cg"
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  4027
    "Modified: 4.11.1996 / 23:37:06 / cg"
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4028
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4029
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4030
printNL
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4031
    "print the receiver followed by a cr on the standard output stream
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4032
     This exists for GNU Smalltalk compatibility - please use #printCR."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4033
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4034
    ^ self printCR
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4035
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4036
    "Modified: 20.5.1996 / 10:25:31 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4037
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4038
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4039
printNewline
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4040
    "print the receiver followed by a cr on the standard output stream.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4041
     This exists for backward compatibility - please use #printCR."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4042
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4043
    self printCR
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4044
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4045
    "Modified: 20.5.1996 / 10:25:46 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4046
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4047
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4048
printOn:aStream
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4049
    "print the receiver on the argument-stream.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4050
     The default here is to output the receivers class name.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4051
     BUT: this method is heavily redefined for objects which
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4052
     can print prettier."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4053
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4054
    aStream nextPutAll:self classNameWithArticle
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4055
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4056
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4057
printOn:aStream leftPaddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4058
    "print the receiver on aStream, padding with spaces up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4059
     padding is done on the left."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4060
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4061
    self printOn:aStream leftPaddedTo:size with:(Character space)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4062
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4063
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4064
     123 printOn:Transcript leftPaddedTo:10. Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4065
     123 printOn:Transcript leftPaddedTo:2. Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4066
    "
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4067
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4068
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4069
printOn:aStream leftPaddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4070
    "print the receiver on aStream, padding with padCharacters up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4071
     padding is done on the left."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4072
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4073
    aStream nextPutAll:(self printStringLeftPaddedTo:size with:padCharacter)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4074
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4075
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4076
     123 printOn:Transcript leftPaddedTo:10 with:$_ . Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4077
     123 printOn:Transcript leftPaddedTo:10 with:$. . Transcript cr
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
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4080
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4081
printOn:aStream paddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4082
    "print the receiver on aStream, padding with spaces up to size."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4083
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4084
    self printOn:aStream paddedTo:size with:(Character space)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4085
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
     123.0 printOn:Transcript paddedTo:10. Transcript nextPut:$|. Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4088
    "
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4089
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4090
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4091
printOn:aStream paddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4092
    "print the receiver on aStream, padding with padCharacter up to size"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4093
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4094
    aStream nextPutAll:(self printStringPaddedTo:size with:padCharacter).
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
     123 printOn:Transcript paddedTo:10 with:$_ . Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4098
     123 printOn:Transcript paddedTo:10 with:$. . Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4099
    "
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4102
printOn:aStream zeroPaddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4103
    "print the receiver on aStream, padding with zeros up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4104
     Usually used with float numbers."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4105
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4106
    self printOn:aStream paddedTo:size with:$0.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4107
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4108
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4109
     123.0 printOn:Transcript zeroPaddedTo:10
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4110
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4111
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4112
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4113
printRightAdjustLen:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4114
    "obsolete - just a name confusion.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4115
     This method will go away ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4116
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4117
    (self printStringLeftPaddedTo:size) printOn:Stdout
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4118
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4119
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4120
printString
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4121
    "return a string for printing the receiver.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4122
     Since we now use printOn: as the basic print mechanism,
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4123
     we have to create a stream and print into it."
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4124
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4125
    |s|
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4126
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4127
    s := WriteStream on:(String new:30).
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4128
    self printOn:s.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4129
    ^ s contents
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4130
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4131
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4132
printStringLeftPaddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4133
    "return my printString as a right-adjusted string of length size;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4134
     characters on the left are filled with spaces.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4135
     If the printString is longer than size, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4136
     it is returned unchanged (i.e. not truncated)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4137
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4138
    ^ self printStringLeftPaddedTo:size with:(Character space)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4139
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4140
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4141
     10 printStringLeftPaddedTo:10
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4142
     1 printStringLeftPaddedTo:10
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4143
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4144
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4145
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4146
printStringLeftPaddedTo:size ifLarger:alternative
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4147
    "return my printString as a right-adjusted string of length size;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4148
     characters on the left are filled with spaces.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4149
     If the printString is larger than size,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4150
     return the result from evaluating alternative."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4151
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4152
    ^ self printStringLeftPaddedTo:size with:(Character space) ifLarger:alternative
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4153
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4154
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4155
     12   printStringLeftPaddedTo:3 ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4156
     123  printStringLeftPaddedTo:3 ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4157
     1234 printStringLeftPaddedTo:3 ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4158
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4159
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4160
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4161
printStringLeftPaddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4162
    "return my printString as a right-adjusted string of length size;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4163
     characters on the left are filled with padCharacter.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4164
     If the printString is longer than size, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4165
     it is returned unchanged (i.e. not truncated)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4166
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4167
    ^ (self printString) leftPaddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4168
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4169
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4170
     123 printStringLeftPaddedTo:10 with:$.   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4171
     1 printStringLeftPaddedTo:10 with:$.      
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4172
     (Float pi) printStringLeftPaddedTo:20 with:$*
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4173
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4174
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4175
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4176
printStringLeftPaddedTo:size with:padCharacter ifLarger:alternative
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4177
    "return my printString as a right-adjusted string of length size;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4178
     characters on the left are filled with padCharacter.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4179
     If the printString is larger than size,
369
claus
parents: 362
diff changeset
  4180
     return the result from evaluating alternative."
claus
parents: 362
diff changeset
  4181
claus
parents: 362
diff changeset
  4182
    |s|
claus
parents: 362
diff changeset
  4183
claus
parents: 362
diff changeset
  4184
    s := self printString.
claus
parents: 362
diff changeset
  4185
    s size > size ifTrue:[^ alternative value].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4186
    ^ s leftPaddedTo:size with:padCharacter
369
claus
parents: 362
diff changeset
  4187
claus
parents: 362
diff changeset
  4188
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4189
     12   printStringLeftPaddedTo:3 with:$. ifLarger:['***']   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4190
     123  printStringLeftPaddedTo:3 with:$. ifLarger:['***']   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4191
     1234 printStringLeftPaddedTo:3 with:$. ifLarger:['***']   
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4192
    "
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4193
!
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4194
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4195
printStringPaddedTo:size
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4196
    "return a printed representation of the receiver,
369
claus
parents: 362
diff changeset
  4197
     padded with spaces (at the right) up to size.
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4198
     If the printString is longer than size, 
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4199
     it is returned unchanged (i.e. not truncated)"
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4200
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4201
    ^ self printStringPaddedTo:size with:(Character space)
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4202
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4203
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4204
     123 printStringPaddedTo:10    
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4205
     1234567890123456 printStringPaddedTo:10  
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4206
     'hello' printStringPaddedTo:10   
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4207
    "
2
claus
parents: 1
diff changeset
  4208
!
claus
parents: 1
diff changeset
  4209
369
claus
parents: 362
diff changeset
  4210
printStringPaddedTo:size ifLarger:alternative
claus
parents: 362
diff changeset
  4211
    "return a printed representation of the receiver,
claus
parents: 362
diff changeset
  4212
     padded with spaces (at the right) up to size.
claus
parents: 362
diff changeset
  4213
     If the resulting printString is too large, 
claus
parents: 362
diff changeset
  4214
     return the result from evaluating alternative."
claus
parents: 362
diff changeset
  4215
claus
parents: 362
diff changeset
  4216
    ^ self printStringPaddedTo:size with:(Character space) ifLarger:alternative
claus
parents: 362
diff changeset
  4217
claus
parents: 362
diff changeset
  4218
    "
claus
parents: 362
diff changeset
  4219
     12   printStringPaddedTo:3 ifLarger:['***']   
claus
parents: 362
diff changeset
  4220
     123  printStringPaddedTo:3 ifLarger:['***']   
claus
parents: 362
diff changeset
  4221
     1234 printStringPaddedTo:3 ifLarger:['***']   
claus
parents: 362
diff changeset
  4222
    "
claus
parents: 362
diff changeset
  4223
!
claus
parents: 362
diff changeset
  4224
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4225
printStringPaddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4226
    "return a printed representation of the receiver,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4227
     padded with padCharacter (at the right) up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4228
     If the printString is longer than size, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4229
     it is returned unchanged (i.e. not truncated)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4230
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4231
    ^ (self printString) paddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4232
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4233
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4234
     123  printStringPaddedTo:10 with:$.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4235
     123  printStringPaddedTo:10 with:$*
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4236
     123  printStringPaddedTo:3 with:$*   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4237
     1234 printStringPaddedTo:3 with:$*   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4238
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4239
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4240
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4241
printStringPaddedTo:size with:padCharacter ifLarger:alternative
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4242
    "return a printed representation of the receiver,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4243
     padded with padCharacter (at the right) up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4244
     If the resulting printString is too large, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4245
     return the result from evaluating alternative."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4246
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4247
    |s|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4248
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4249
    s := self printString.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4250
    s size > size ifTrue:[^ alternative value].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4251
    ^ s paddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4252
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
     123   printStringPaddedTo:3 with:$. ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4255
     12345 printStringPaddedTo:3 with:$. ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4256
    "
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
printStringRightAdjustLen:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4260
    "obsolete - just a name confusion.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4261
     This method will go away ..."
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
    ^ self printStringLeftPaddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4264
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4265
2
claus
parents: 1
diff changeset
  4266
printStringZeroPaddedTo:size
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4267
    "return a printed representation of the receiver, 
369
claus
parents: 362
diff changeset
  4268
     padded with zero (at the right) characters up to size.
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4269
     Usually used with float numbers."
2
claus
parents: 1
diff changeset
  4270
claus
parents: 1
diff changeset
  4271
    ^ self printStringPaddedTo:size with:$0
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4272
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4273
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4274
     123.0 printStringZeroPaddedTo:10 
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4275
    "
2
claus
parents: 1
diff changeset
  4276
!
claus
parents: 1
diff changeset
  4277
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4278
store
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4279
    "store the receiver on standard output.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4280
     this method is useless, but included for compatibility."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4281
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4282
    self storeOn:Stdout
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4283
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4284
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4285
storeCR
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4286
    "store the receiver on standard output; append a carriage return."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4287
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4288
    self store.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4289
    Character cr print
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4290
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4291
    "Created: 20.5.1996 / 10:26:01 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4292
    "Modified: 20.5.1996 / 10:26:57 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4293
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4294
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4295
storeNl
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4296
    "store the receiver on standard output; append a newline.
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4297
     This method is included for backward compatibility-  use #storeCR."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4298
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4299
    self storeCR.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4300
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4301
    "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
  4302
!
7e058858cc3b New Method: displayOn:aGc at:aPoint (ST80-compatibility).
Stefan Vogel <sv@exept.de>
parents: 446
diff changeset
  4303
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4304
storeOn:aStream
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4305
    "store the receiver on aStream; i.e. print an expression which will
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4306
     reconstruct the receiver.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4307
     Notice, that no self referencing or cyclic objects can be represented
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4308
     in this format.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4309
     Use storeBinaryOn:, which handles these cases correctly."
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4310
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4311
    |myClass hasSemi sz "{ Class: SmallInteger }" |
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4312
25
e34a6267c79b *** empty log message ***
claus
parents: 13
diff changeset
  4313
    thisContext isRecursive ifTrue:[
2287
3d5330d2b368 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4314
        ('Object [error]: storeString of self referencing object.') errorPrintCR.
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4315
        aStream nextPutAll:'#("recursive")'.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4316
        ^ self
25
e34a6267c79b *** empty log message ***
claus
parents: 13
diff changeset
  4317
    ].
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4318
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4319
    myClass := self class.
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4320
    aStream nextPut:$(.
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4321
    aStream nextPutAll:self class name.
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4322
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4323
    hasSemi := false.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4324
    myClass isVariable ifTrue:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4325
        aStream nextPutAll:' basicNew:'.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4326
        self basicSize printOn:aStream
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4327
    ] ifFalse:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4328
        aStream nextPutAll:' basicNew'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4329
    ].
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4330
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4331
    sz := myClass instSize.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4332
    1 to:sz do:[:i | 
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4333
        aStream nextPutAll:' instVarAt:'.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4334
        i printOn:aStream.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4335
        aStream nextPutAll:' put:'.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4336
        (self instVarAt:i) storeOn:aStream.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4337
        aStream nextPut:$;.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4338
        hasSemi := true
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4339
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4340
    myClass isVariable ifTrue:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4341
        sz := self basicSize.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4342
        1 to:sz do:[:i | 
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4343
            aStream nextPutAll:' basicAt:'.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4344
            i printOn:aStream.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4345
            aStream nextPutAll:' put:'.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4346
            (self basicAt:i) storeOn:aStream.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4347
            aStream nextPut:$;.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4348
            hasSemi := true
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4349
        ]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4350
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4351
    hasSemi ifTrue:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4352
        aStream nextPutAll:' yourself'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4353
    ].
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4354
    aStream nextPut:$).
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4355
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4356
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4357
     |s|
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4358
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4359
     s := WriteStream on:(String new).
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4360
     ('hello' -> 'world') storeOn:s.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4361
     s := ReadStream on:(s contents).
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4362
     (Object readFrom:s) inspect
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4363
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4364
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4365
     |s|
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4366
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4367
     s := 'data' asFilename writeStream.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4368
     ('hello' -> 'world') storeOn:s.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4369
     s close.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4370
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4371
     s := 'data' asFilename readStream.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4372
     (Object readFrom:s) inspect
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4373
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4374
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4375
    "does not work example:"
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4376
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4377
     |s a|
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4378
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4379
     a := Array new:2.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4380
     a at:1 put:a.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4381
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4382
     s := 'data' asFilename writeStream.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4383
     a storeOn:s.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4384
     s close.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4385
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4386
     s := 'data' asFilename readStream.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4387
     (Object readFrom:s) inspect
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4388
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4389
2287
3d5330d2b368 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4390
    "Modified: 28.1.1997 / 00:36:12 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4391
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4392
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4393
storeString
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4394
    "return a string representing an expression to reconstruct the receiver.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4395
     Notice, that no self referencing or cyclic objects can be represented
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4396
     in this format.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4397
     Use storeBinaryOn:, which handles these cases correctly."
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4398
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4399
    |s|
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4400
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4401
    s := WriteStream on:(String new:50).
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4402
    self storeOn:s.
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4403
    ^ s contents
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4404
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4405
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4406
!Object methodsFor:'queries'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4407
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4408
basicSize
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4409
    "return the number of the receivers indexed instance variables,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4410
     0 if it has none.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4411
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4412
     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
  4413
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4414
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4415
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4416
    REGISTER int nbytes;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4417
    REGISTER OBJ myClass;
2209
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4418
    REGISTER INT flags;
783
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
     * notice the missing test for self being a nonNilObject -
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4422
     * this can be done since basicSize is defined both in UndefinedObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4423
     * and SmallInteger
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4424
     */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4425
    myClass = __qClass(self);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4426
    nbytes = __qSize(self) 
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4427
              - OHDR_SIZE 
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4428
              - __OBJS2BYTES__(__intVal(__ClassInstPtr(myClass)->c_ninstvars));
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4429
2209
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4430
    flags = (INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK);
783
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
     * replaced switch by open-if; this is slightly faster since
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4433
     * 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
  4434
     */
2209
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4435
    if (flags == __MASKSMALLINT(POINTERARRAY)) {
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4436
        RETURN ( __MKSMALLINT(__BYTES2OBJS__(nbytes)) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4437
    }
2209
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4438
    if (flags == __MASKSMALLINT(BYTEARRAY)) {
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4439
            RETURN ( __MKSMALLINT(nbytes / sizeof(char)) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4440
    }
2209
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4441
    if (flags == __MASKSMALLINT(WKPOINTERARRAY)) {
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4442
	RETURN ( __MKSMALLINT(__BYTES2OBJS__(nbytes)) );
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4443
    }
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4444
    if (flags == __MASKSMALLINT(FLOATARRAY)) {
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4445
        RETURN ( __MKSMALLINT(nbytes / sizeof(float)) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4446
    }
2209
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4447
    if (flags == __MASKSMALLINT(DOUBLEARRAY)) {
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4448
#ifdef NEED_DOUBLE_ALIGN
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4449
            /*
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4450
             * care for filler
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4451
             */
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4452
            nbytes -= sizeof(FILLTYPE);
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4453
#endif
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4454
            RETURN ( __MKSMALLINT(nbytes / sizeof(double)) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4455
    }
2209
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4456
    if ((flags == __MASKSMALLINT(WORDARRAY)) || (flags == __MASKSMALLINT(SWORDARRAY))) {
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4457
        RETURN ( __MKSMALLINT(nbytes / sizeof(short)) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4458
    }
2209
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4459
    if ((flags == __MASKSMALLINT(LONGARRAY)) || (flags == __MASKSMALLINT(SLONGARRAY))) {
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4460
        RETURN ( __MKSMALLINT(nbytes / sizeof(long)) );
783
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
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4463
    ^ 0
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4464
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4465
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4466
class
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4467
    "return the receivers class"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4468
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4469
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4470
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4471
    RETURN ( __Class(self) );
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4472
%}
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4473
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4474
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4475
respondsTo:aSelector
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4476
    "return true, if the receiver implements a method with selector equal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4477
     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
  4478
     receivers class or one of its superclasses.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4479
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4480
     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
  4481
     an error being raised. For example, an implementation could send
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4482
     #shouldNotImplement or #subclassResponsibility."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4483
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4484
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4485
     should we go via the cache, or search (by class) ?
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4486
     The first is faster, most of the time; while the 2nd fills
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4487
     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
  4488
     For now, use the cache ...
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4489
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4490
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4491
829
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
  4492
    if (__lookup(__Class(self), aSelector) == nil) {
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4493
	RETURN ( false );
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4494
    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4495
    RETURN ( true );
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4496
%}
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4497
.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4498
"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4499
    ^ self class canUnderstand:aSelector
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4500
"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4501
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4502
    "'aString' respondsTo:#+"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4503
    "'aString' respondsTo:#,"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4504
    "'aString' respondsTo:#collect:"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4505
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4506
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4507
respondsToArithmetic
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4508
    "return true, if the receiver responds to arithmetic messages.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4509
     false is returned here - the method is redefined in ArithmeticValue."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4510
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4511
    ^ false
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4512
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4513
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4514
size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4515
    "return the number of the receivers indexed instance variables;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4516
     this method may be redefined in subclasses"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4517
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4518
    ^ self basicSize
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4519
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4520
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4521
species
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4522
    "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
  4523
     This is used to create an appropriate object when creating derived
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4524
     copies in the collection classes (sometimes redefined)."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4525
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4526
    ^ self class
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4527
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4528
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4529
yourself
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4530
    "return the receiver - used for cascades to return self at the end"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4531
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4532
    ^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4533
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4534
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4535
!Object methodsFor:'secure message sending'!
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
askFor:aSelector
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4538
    "try to send the receiver the message, aSelector.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4539
     If it does not understand it, return false. Otherwise
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4540
     the real value returned.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4541
     Useful to send messages such as: 'isColor' to unknown
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4542
     receivers."
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
    ^ self perform:aSelector ifNotUnderstood:[false]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4545
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4546
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4547
     1 askFor:#isColor
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4548
    "
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4551
perform:aSelector ifNotUnderstood:exceptionBlock
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4552
    "try to send message aSelector to the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4553
     If its understood, return the methods returned value,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4554
     otherwise return the value of the exceptionBlock"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4555
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4556
    |val|
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
    MessageNotUnderstoodSignal handle:[:ex |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4559
	^ exceptionBlock value
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4560
    ] do:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4561
	val := self perform:aSelector
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
    ^ val
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4564
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4565
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4566
     1.2345 perform:#foo ifNotUnderstood:['sorry'] 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4567
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4568
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4569
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4570
perform:aSelector with:argument ifNotUnderstood:exceptionBlock
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4571
    "try to send message aSelector to the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4572
     If its understood, return the methods returned value,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4573
     otherwise return the value of the exceptionBlock"
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
    |val|
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
    MessageNotUnderstoodSignal handle:[:ex |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4578
	^ exceptionBlock value
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4579
    ] do:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4580
	val := self perform:aSelector with:argument
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
    ^ val
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
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4585
     |unknown|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4586
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4587
     unknown := 1.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4588
     (unknown perform:#+ with:2 ifNotUnderstood:['sorry']) printNewline.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4589
     unknown := 'high there'.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4590
     (unknown perform:#+ with:2 ifNotUnderstood:['sorry']) printNewline.
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
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4593
2448
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4594
!Object methodsFor:'signal constants'!
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4595
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4596
messageNotUnderstoodSignal
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4597
    ^ MessageNotUnderstoodSignal
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4598
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4599
    "Created: 6.3.1997 / 15:46:52 / cg"
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4600
! !
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4601
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4602
!Object methodsFor:'special queries'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4603
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4604
allOwners
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4605
    "return a collection of all objects referencing the receiver"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4606
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4607
    ^ ObjectMemory whoReferences:self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4608
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4609
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4610
references:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4611
    "return true, if the receiver refers to the argument, anObject.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4612
     - for debugging only"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4613
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4614
"/    |myClass 
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4615
"/     numInst "{ Class: SmallInteger }" |
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4616
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4617
%{  /* NOCONTEXT */
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4618
    OBJ cls, flags;
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4619
    int nInsts, i;
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4620
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4621
    if (! __isNonNilObject(self)) {
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4622
	RETURN (false);
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4623
    }
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4624
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4625
    /*
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4626
     * a little optimization: use the fact that all old objects
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4627
     * 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
  4628
     * a trivial reject is possible, if anObject is a newbee
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4629
     */
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4630
    if (__isNonNilObject(anObject)) {
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4631
	if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) {
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4632
	    int spc;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4633
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4634
	    if (((spc = __qSpace(anObject)) == NEWSPACE) || (spc == SURVSPACE)) {
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4635
		RETURN (false);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4636
	    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4637
	}
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4638
    }
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4639
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4640
    cls = __qClass(self);
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4641
    if (cls == anObject) {
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4642
	RETURN (true);
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4643
    }
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4644
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4645
    flags = __ClassInstPtr(cls)->c_flags;
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
  4646
    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
  4647
        nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4648
    } else {
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4649
        nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4650
    }
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4651
    if (! nInsts) {
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4652
	RETURN (false);
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4653
    }
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4654
    for (i=0; i<nInsts; i++) {
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4655
        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
  4656
	    RETURN (true);
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4657
	}
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4658
    }
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4659
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4660
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4661
"/    myClass := self class.
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4662
"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4663
"/    "check the class"
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4664
"/    (myClass == anObject) ifTrue:[^ true].
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4665
"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4666
"/    "check the instance variables"
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4667
"/    numInst := myClass instSize.
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4668
"/    1 to:numInst do:[:i | 
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4669
"/	((self instVarAt:i) == anObject) ifTrue:[^ true]
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4670
"/    ].
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4671
"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4672
"/    "check the indexed variables"
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4673
"/    myClass isVariable ifTrue:[
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4674
"/	myClass isPointers ifFalse:[
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4675
"/	    "/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4676
"/	    "/ 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
  4677
"/	    "/ 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
  4678
"/	    "/ 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
  4679
"/	    "/ 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
  4680
"/	    "/ 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
  4681
"/	    "/ 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
  4682
"/	    "/ 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
  4683
"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4684
"/	    ^ false.
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4685
"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4686
"/	    "/ alternative:
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4687
"/	    "/  anObject isNumber ifFalse:[^ false].
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4688
"/	].
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4689
"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4690
"/	"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4691
"/	"/ 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
  4692
"/	"/ idenitytIndex method, use it
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4693
"/	"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4694
"/	myClass == Array ifTrue:[
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4695
"/	    ^ (self identityIndexOf:anObject) ~~ 0
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4696
"/	].
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4697
"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4698
"/	"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4699
"/	"/ otherwise, do it the slow way
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4700
"/	"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4701
"/	numInst := self basicSize.
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4702
"/	1 to:numInst do:[:i | 
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4703
"/	    ((self basicAt:i) == anObject) ifTrue:[^ true]
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4704
"/	]
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4705
"/    ].
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4706
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4707
    ^ false
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4708
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4709
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4710
     |v|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4711
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4712
     v := View new initialize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4713
     v references:Display. 
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
!
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
referencesDerivedInstanceOf:aClass
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4718
    "return true, if the receiver refers to an instance of
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4719
     the argument, aClass or its subclass. This method exists
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4720
     to support searching for users of a class."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4721
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4722
    |myClass 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4723
     numInst "{ Class: SmallInteger }" |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4724
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4725
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4726
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4727
    "check the class"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4728
    (myClass isKindOf:aClass) ifTrue:[^ true].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4729
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4730
    "check the instance variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4731
    numInst := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4732
    1 to:numInst do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4733
	((self instVarAt:i) isKindOf:aClass) ifTrue:[^ true]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4734
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4735
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4736
    "check the indexed variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4737
    myClass isVariable ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4738
	myClass isPointers ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4739
	    "no need to search in non pointer fields"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4740
	    ((aClass == Number) or:[aClass isSubclassOf:Number]) ifFalse:[^ false].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4741
	].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4742
	numInst := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4743
	1 to:numInst do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4744
	    ((self basicAt:i) isKindOf:aClass) ifTrue:[^ true]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4745
	]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4746
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4747
    ^ false
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4748
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4749
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4750
     (1 @ 3.4) referencesDerivedInstanceOf:Number  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4751
     (1 @ 3.4) referencesDerivedInstanceOf:Array   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4752
     View new initialize referencesDerivedInstanceOf:DeviceWorkstation  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4753
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4754
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4755
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4756
referencesInstanceOf:aClass
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4757
    "return true, if the receiver refers to an instance of
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4758
     the argument, aClass.This method exists
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4759
     to support searching for users of a class."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4760
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4761
    |myClass 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4762
     numInst "{ Class: SmallInteger }" |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4763
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4764
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4765
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4766
    "check the class"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4767
    (myClass isMemberOf:aClass) ifTrue:[^ true].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4768
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4769
    "check the instance variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4770
    numInst := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4771
    1 to:numInst do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4772
	((self instVarAt:i) isMemberOf:aClass) ifTrue:[^ true]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4773
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4774
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4775
    "check the indexed variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4776
    myClass isVariable ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4777
	myClass isPointers ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4778
	    "no need to search in non-pointer indexed fields"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4779
	    myClass isLongs ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4780
		(aClass == SmallInteger or:[aClass == LargeInteger]) ifFalse:[^ false].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4781
	    ] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4782
		myClass isFloatsOrDoubles ifTrue:[^ aClass == Float].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4783
		^ aClass == SmallInteger
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4784
	    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4785
	].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4786
	numInst := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4787
	1 to:numInst do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4788
	    ((self basicAt:i) isMemberOf:aClass) ifTrue:[^ true]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4789
	]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4790
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4791
    ^ false
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4792
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4793
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4794
     (1 @ 3.4) referencesInstanceOf:Float     
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4795
     (1 @ 3.4) referencesInstanceOf:Fraction    
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4796
     View new initialize referencesInstanceOf:(Display class)  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4797
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4798
! !
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4799
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4800
!Object methodsFor:'synchronized evaluation'!
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4801
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4802
freeSynchronizationSemaphore    
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4803
    "free synchronizationSemaphore. May be used, to save memory when
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4804
     an object is no longer used synchronized."
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4805
2342
4e72f4d7caf1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
  4806
    |sema|
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4807
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4808
    sema := self synchronizationSemaphore.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4809
    sema notNil ifTrue:[
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4810
        sema wait.              "/ get lock
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4811
        self synchronizationSemaphore:nil.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4812
    ].
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4813
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4814
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4815
     self synchronized:[].
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4816
     self synchronizationSemaphore.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4817
     self freeSynchronizationSemaphore.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4818
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4819
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4820
    "Created: 28.1.1997 / 19:31:20 / stefan"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4821
    "Modified: 28.1.1997 / 19:47:55 / stefan"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4822
!
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4823
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4824
synchronizationSemaphore
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4825
    "return the synchronization semaphore for myself.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4826
     subclasses may redefine"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4827
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4828
    ^ SynchronizationSemaphores at:self ifAbsent:[].
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4829
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4830
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4831
      self synchronizationSemaphore
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4832
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4833
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4834
    "Modified: 28.1.1997 / 19:47:09 / stefan"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4835
!
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4836
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4837
synchronizationSemaphore:aSemaphore
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4838
    "set the synchronisationSemaphore for myself.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4839
     subclasses may redefine this method"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4840
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4841
    aSemaphore isNil ifTrue:[
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4842
        "/ remove Semaphore
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4843
        SynchronizationSemaphores removeKey:self ifAbsent:[].
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4844
    ] ifFalse:[
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4845
        SynchronizationSemaphores at:self put:aSemaphore.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4846
    ].
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4847
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4848
    "Modified: 28.1.1997 / 19:37:48 / stefan"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4849
!
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4850
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4851
synchronized:aBlock
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4852
    "evaluate aBlock synchronized, i.e. use a monitor for this object"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4853
2412
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  4854
    |sema blocked gotSema|
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  4855
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  4856
    blocked := OperatingSystem blockInterrupts.
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  4857
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  4858
    "/ the following avoids creation of an additional
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  4859
    "/ block in the common case
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4860
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4861
    sema := self synchronizationSemaphore.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4862
    sema isNil ifTrue:[
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  4863
        "get a locked semaphore (with count = 0)"
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  4864
        sema := Semaphore new.  
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  4865
        self synchronizationSemaphore:sema.
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  4866
        blocked ifFalse:[OperatingSystem unblockInterrupts].
2412
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  4867
        ^ aBlock valueNowOrOnUnwindDo:[sema signal].
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  4868
    ].
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  4869
2412
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  4870
    "
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  4871
     Poll sema (never waits).
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  4872
     Assuming that this is the common operation, this saves the creation
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  4873
     of some blocks.
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  4874
    "
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  4875
    (sema waitWithTimeout:0) notNil ifTrue:[
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4876
        blocked ifFalse:[OperatingSystem unblockInterrupts].
2412
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  4877
        ^ aBlock valueNowOrOnUnwindDo:[sema signal].
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4878
    ].
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  4879
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  4880
    [
2412
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  4881
        gotSema := sema wait.
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  4882
        blocked ifFalse:[OperatingSystem unblockInterrupts].
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  4883
        ^ aBlock value.
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  4884
    ] valueNowOrOnUnwindDo:[
2412
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  4885
        gotSema notNil ifTrue:[gotSema signal]
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  4886
    ].
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4887
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4888
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4889
       [Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'1']] fork.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4890
       [Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'2']] fork.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4891
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4892
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4893
    "Created: 28.1.1997 / 17:52:56 / stefan"
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  4894
    "Modified: 30.1.1997 / 13:38:54 / cg"
2412
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  4895
    "Modified: 20.2.1997 / 09:43:35 / stefan"
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4896
! !
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  4897
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4898
!Object methodsFor:'system primitives'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4899
1957
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4900
asOop
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4901
    "ST-80 compatibility:
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4902
     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
  4903
     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
  4904
     be used (since its changing over time), we return the objects identityHash 
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4905
     key, which provides (at least) some identity indication.
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4906
     However, notice that (in contrast to ST-80's #asOop), the identityHash
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4907
     key of two non-identical objects may be the same.
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4908
     You'd better not use it - especially do not misuse it."
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4909
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4910
    ^ self identityHash
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4911
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4912
    "Created: 9.11.1996 / 19:09:56 / cg"
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4913
    "Modified: 9.11.1996 / 19:16:04 / cg"
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4914
!
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  4915
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4916
become:anotherObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4917
    "make all references to the receiver become references to anotherObject
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4918
     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
  4919
     This can be a very dangerous operation - be warned.
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  4920
     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
  4921
     produce many strange effects (think of hashing in Sets, Dictionaries etc.).
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  4922
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  4923
     This may also be an expensive (i.e. slow) operation, 
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4924
     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
  4925
     references to the two objects (although the primitive tries hard to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4926
     limit the search, for acceptable performance in most cases). 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4927
     This method fails, if the receiver or the argument is a SmallInteger 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4928
     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
  4929
     returned).
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4930
     (notice that #become: is not used heavily by the system 
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4931
      - the Collection-classes have been rewritten to not use it.)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4932
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  4933
    if (__primBecome(self, anotherObject)) {
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4934
	RETURN ( self );
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4935
    }
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4936
%}.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4937
    self primitiveFailed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4938
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4939
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4940
becomeNil
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4941
    "make all references to the receiver become nil - effectively getting
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4942
     rid of the receiver. 
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4943
     This can be a very dangerous operation - be warned.
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4944
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4945
     This may be an expensive (i.e. slow) operation.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4946
     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
  4947
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4948
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  4949
    if (__primBecomeNil(self)) {
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4950
	RETURN ( nil );
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4951
    }
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4952
%}.
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4953
    self primitiveFailed
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4954
!
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4955
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4956
becomeSameAs:anotherObject
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4957
    "make all references to the receiver become references to anotherObject
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  4958
     but NOT vice versa (as done in #become:).
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4959
     This can be a very dangerous operation - be warned.
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  4960
     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
  4961
     produce many strange effects (think of hashing in Sets, Dictionaries etc.).
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  4962
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  4963
     This may also be an expensive (i.e. slow) operation,
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4964
     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
  4965
     references to the two objects (although the primitive tries hard to
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4966
     limit the search, for acceptable performance in most cases).
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4967
     This method fails, if the receiver or the argument is a SmallInteger
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4968
     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
  4969
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  4970
    if (__primBecomeSameAs(self, anotherObject)) {
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4971
	RETURN ( self );
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4972
    }
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4973
%}.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4974
    self primitiveFailed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4975
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4976
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4977
changeClassTo:otherClass
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4978
    "changes the class of the receiver to the argument, otherClass.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4979
     This is only allowed (possible), if the receivers class and the argument
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4980
     have the same structure (i.e. number of named instance variables and
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4981
     type of indexed instance variables). 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4982
     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
  4983
     is UndefinedObject or a Smallinteger, a primitive error is triggered."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4984
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4985
    |myClass ok|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4986
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4987
    "check for UndefinedObject/SmallInteger receiver or newClass"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4988
%{
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4989
    {
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4990
        OBJ other = otherClass;
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4991
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4992
        if (__isNonNilObject(self) 
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4993
         && __isNonNilObject(other)
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4994
         && (other != UndefinedObject)
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4995
         && (other != SmallInteger)) {
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4996
            ok = true;
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4997
        } else {
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4998
            ok = false;
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4999
        }
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5000
    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5001
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5002
    ok ifTrue:[
1022
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5003
        ok := false.
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5004
        myClass := self class.
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5005
        myClass flags == otherClass flags ifTrue:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5006
            myClass instSize == otherClass instSize ifTrue:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5007
                "same instance layout and types: its ok to do it"
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5008
                ok := true.
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5009
            ] ifFalse:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5010
                myClass isPointers ifTrue:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5011
                    myClass isVariable ifTrue:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5012
                        ok := true
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5013
                    ]
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5014
                ]
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5015
            ]
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5016
        ] ifFalse:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5017
            myClass isPointers ifTrue:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5018
                "if newClass is a variable class, with instSize <= my instsize,
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5019
                 we can do it (effectively mapping additional instvars into the
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5020
                 variable part) - usefulness is questionable, though"
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5021
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5022
                otherClass isPointers ifTrue:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5023
                    otherClass isVariable ifTrue:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5024
                        otherClass instSize <= (myClass instSize + self basicSize) 
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5025
                        ifTrue:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5026
                            ok := true
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5027
                        ]
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5028
                    ] ifFalse:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5029
                        otherClass instSize == (myClass instSize + self basicSize) 
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5030
                        ifTrue:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5031
                            ok := true
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5032
                        ]
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5033
                    ]
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5034
                ] ifFalse:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5035
                    "it does not make sense to convert pointers to bytes ..."
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5036
                ]
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5037
            ] ifFalse:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5038
                "does it make sense, to convert bits ?"
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5039
                "could allow byteArray->wordArray->longArray->floatArray->doubleArray here ..."
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5040
                (myClass isBits and:[otherClass isBits]) ifTrue:[
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5041
                    ok := true
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5042
                ]
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5043
            ]
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5044
        ]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5045
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5046
    ok ifTrue:[
1022
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5047
        "now, change the receivers class ..."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5048
%{
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  5049
	{
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  5050
	    OBJ me = self;
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  5051
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  5052
            __qClass(me) = otherClass;
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  5053
            __STORE(me, otherClass);
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  5054
            RETURN (me);
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  5055
	}
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5056
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5057
    ].
1022
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5058
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5059
    "
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5060
     the receiver cannot be represented as a instance of
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5061
     the desired class.
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5062
     For example, you cannot change a bitInstance (byteArray etc.) 
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5063
     into a pointer object and vice versa.
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5064
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5065
    self primitiveFailed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5066
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5067
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5068
changeClassToThatOf:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5069
    "changes the class of the receiver to that of the argument, anObject.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5070
     This is only allowed (possible), if the receivers class and the arguments
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5071
     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
  5072
     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
  5073
     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
  5074
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5075
    self changeClassTo:(anObject class)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5076
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5077
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5078
!Object methodsFor:'testing'!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5079
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5080
? defaultValue
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5081
     "if the receiver is nil, return the defaultValue;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5082
      otherwise, return the receiver.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5083
      This method is only redefined in UndefinedObject - therefore,
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5084
      the recevier is retuned here.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5085
1958
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  5086
      Thus, if foo and bar are simple variables or constants,
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  5087
          foo ? bar
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  5088
      is the same as:
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  5089
          (foo isNil ifTrue:[bar] ifFalse:[foo])
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  5090
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  5091
      if they are message sends, the equivalent code is:
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  5092
          [
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  5093
              |t1 t2|
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  5094
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  5095
              t1 := foo.
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  5096
              t2 := bar.
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  5097
              t1 isNil ifTrue:[t2] ifFalse:[t1]
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  5098
          ] value
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  5099
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5100
      Can be used to provide defaultValues to variables,
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5101
      as in:
1958
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  5102
          foo := arg ? #defaultValue
2147
3579ce76c8c8 comment
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  5103
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  5104
      Note: this method should never be redefined in classes other than UndefinedObject.
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5105
     "
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5106
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5107
    ^ self
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
     1 ? #default
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5111
     nil ? #default
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5112
    "
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5113
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5114
    "Created: 4.11.1996 / 20:36:19 / cg"
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  5115
    "Modified: 11.1.1997 / 14:56:47 / cg"
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5116
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5117
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5118
isArray
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5119
    "return true, if the receiver is some kind of array (or weakArray etc);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5120
     false is returned here - the method is only redefined in Array."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5121
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
isAssociation
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5126
    "return true, if the receiver is some kind of association;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5127
     false is returned here - the method is only redefined in Association."
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
    "Created: 14.5.1996 / 17:03:45 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5132
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5133
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5134
isBehavior
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5135
    "return true, if the receiver is some kind of class (i.e. behavior);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5136
     false is returned here - the method is only redefined in Behavior."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5137
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5138
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5139
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5140
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5141
isBlock
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5142
    "return true, if the receiver is some kind of block;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5143
     false returned here - the method is only redefined in Block."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5144
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5145
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5146
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5147
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5148
isCharacter
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5149
    "return true, if the receiver is some kind of character;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5150
     false is returned here - the method is only redefined in Character."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5151
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5152
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5153
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5154
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5155
isClass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5156
    "return true, if the receiver is some kind of class (real class, 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5157
     not just behavior);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5158
     false is returned here - the method is only redefined in Class."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5159
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5160
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5161
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5162
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5163
isCollection
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5164
    "return true, if the receiver is some kind of collection;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5165
     false is returned here - the method is only redefined in Collection."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5166
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5167
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5168
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5169
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5170
isColor
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5171
    "return true, if the receiver is some kind of color;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5172
     false is returned here - the method is only redefined in Color."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5173
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5174
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5175
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5176
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5177
isContext
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5178
    "return true, if the receiver is some kind of context;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5179
     false returned here - the method is only redefined in Context."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5180
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5181
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5182
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5183
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5184
isExternalStream
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5185
    "return true, if the receiver is some kind of externalStream;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5186
     false is returned here - the method is only redefined in ExternalStream."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5187
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5188
    ^false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5189
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5190
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5191
isFileStream
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5192
    "return true, if the receiver is some kind of fileStream;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5193
     false is returned here - the method is only redefined in FileStream."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5194
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5195
    ^false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5196
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5197
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5198
isFixedPoint
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5199
    "return true, if the receiver is some kind of fixedPoint number;
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5200
     false is returned here - the method is only redefined in FixedPoint."
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5201
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5202
    ^ false
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5203
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5204
    "Created: 5.11.1996 / 19:23:04 / cg"
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5205
!
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5206
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5207
isFixedSize
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5208
    "return true if the receiver cannot grow easily 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5209
     (i.e. a grow may be expensive, since it involves a become:)"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5210
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5211
    ^ true
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5212
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5213
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5214
isForm
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5215
    "return true, if the receiver is some kind of form;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5216
     false is returned here - the method is only redefined in Form."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5217
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5218
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5219
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5220
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5221
isFraction
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5222
    "return true, if the receiver is some kind of fraction;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5223
     false is returned here - the method is only redefined in Fraction."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5224
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5225
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5226
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5227
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5228
isImage
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5229
    "return true, if the receiver is some kind of image;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5230
     false is returned here - the method is only redefined in Image."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5231
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5232
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5233
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5234
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5235
isImageOrForm
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5236
    "return true, if the receiver is some kind of image or form;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5237
     false is returned here - the method is only redefined in Image and Form."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5238
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5239
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5240
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5241
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5242
isInteger
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5243
    "return true, if the receiver is some kind of integer number;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5244
     false is returned here - the method is only redefined in Integer."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5245
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5246
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5247
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5248
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5249
isKindOf:aClass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5250
    "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
  5251
     subclasses, false otherwise.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5252
     Advice: 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5253
	use of this to check objects for certain attributes/protocoll should
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5254
	be avoided; it limits the reusability of your classes by limiting use
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5255
	to instances of certain classes and fences you into a specific inheritance 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5256
	hierarchy.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5257
	Use check-methods to check an object for a certain attributes/protocol
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5258
	(such as #isXXXX, #respondsTo: or #isNumber).
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5259
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5260
	Using #isKindOf: is considered BAD STYLE.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5261
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5262
     Advice2:
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5263
	Be aware, that using an #isXXX method is usually much faster than 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5264
	using #isKindOf:; because isKindOf: has to walk up all the superclass 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5265
	hierarchy, comparing every class on the way. 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5266
	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
  5267
	a single function call.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5268
     "
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5269
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5270
%{  /* NOCONTEXT */
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5271
    register OBJ thisClass;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5272
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5273
    thisClass = __Class(self);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5274
    while (thisClass != nil) {
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5275
	if (thisClass == aClass) {
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5276
	    RETURN ( true );
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5277
	}
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5278
	thisClass = __ClassInstPtr(thisClass)->c_superclass;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5279
    }
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5280
%}
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5281
.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5282
"/
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5283
"/  the above code is equivalent to:
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5284
"/
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5285
"/  thisClass := self class.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5286
"/  [thisClass notNil] whileTrue:[
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5287
"/      thisClass == aClass ifTrue:[^ true].
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5288
"/      thisClass := thisClass superclass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5289
"/  ]
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5290
"/
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5291
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5292
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5293
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5294
isLayout
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5295
    "return true, if the receiver is some kind of layout;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5296
     false is returned here - the method is only redefined in Layout."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5297
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5298
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5299
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5300
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5301
isLiteral
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5302
    "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
  5303
     false is returned here - the method is redefined in some classes."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5304
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5305
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5306
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5307
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5308
isMemberOf:aClass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5309
    "return true, if the receiver is an instance of aClass, false otherwise.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5310
     Advice: 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5311
	use of this to check objects for certain attributes/protocoll should
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5312
	be avoided; it limits the reusability of your classes by limiting use
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5313
	to instances of a certain class.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5314
	Use check-methods to check an object for a certain attributes/protocol
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5315
	(such as #isXXX, #respondsTo: or #isNumber);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5316
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5317
	Using #isMemberOf: is considered BAD STYLE."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5318
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5319
    ^ (self class) == aClass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5320
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5321
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5322
isMeta
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5323
    "return true, if the receiver is some kind of metaclass;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5324
     false is returned here - the method is only redefined in Metaclass."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5325
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5326
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5327
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5328
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5329
isMethod
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5330
    "return true, if the receiver is some kind of method;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5331
     false returned here - the method is only redefined in Method."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5332
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5333
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5334
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5335
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5336
isNamespace
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5337
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5338
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5339
    "Created: 11.10.1996 / 18:08:56 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5340
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5341
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5342
isNumber
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5343
    "return true, if the receiver is some kind of number;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5344
     false is returned here - the method is only redefined in Number."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5345
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5346
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5347
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5348
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5349
isPoint
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5350
    "return true, if the receiver is some kind of point;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5351
     false is returned here - the method is only redefined in Point."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5352
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5353
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5354
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5355
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5356
isReal
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5357
    "return true, if the receiver is some kind of real number;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5358
     false is returned here - the method is only redefined in LimitedPrecisionReal."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5359
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5360
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5361
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5362
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5363
isRectangle
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5364
    "return true, if the receiver is some kind of rectangle;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5365
     false is returned here - the method is only redefined in Rectangle."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5366
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5367
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5368
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5369
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5370
isRemoteObject
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5371
    "return true, if the receiver is some kind of remoteObject,
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5372
     false if its local - the method is only redefined in RemoteObject."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5373
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5374
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5375
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5376
    "Created: 28.10.1996 / 15:18:45 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5377
    "Modified: 28.10.1996 / 15:20:57 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5378
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5379
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5380
isSequenceable
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5381
    "return true, if the receiver is some kind of sequenceable collection;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5382
     false is returned here - the method is only redefined in SequenceableCollection."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5383
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5384
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5385
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5386
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5387
isSequenceableCollection
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5388
    "OBSOLETE: use isSequenceable for ST-80 compatibility.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5389
     This method is a historic leftover and will be removed soon ..."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5390
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5391
    self obsoleteMethodWarning:'use #isSequenceable'.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5392
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5393
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5394
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5395
isSignal
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5396
    "return true, if the receiver is some kind of signal;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5397
     false returned here - the method is only redefined in Signal."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5398
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5399
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5400
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5401
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5402
isStream
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5403
    "return true, if the receiver is some kind of stream;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5404
     false is returned here - the method is only redefined in Stream."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5405
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5406
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5407
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5408
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5409
isString
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5410
    "return true, if the receiver is some kind of string;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5411
     false is returned here - the method is only redefined in String."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5412
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5413
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5414
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5415
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5416
isSymbol
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5417
    "return true, if the receiver is some kind of symbol;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5418
     false is returned here - the method is only redefined in Symbol."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5419
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5420
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5421
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5422
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5423
isText
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5424
    "return true, if the receiver is some kind of text object;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5425
     false is returned here - the method is only redefined in Text."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5426
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5427
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5428
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5429
    "Created: 12.5.1996 / 10:56:50 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5430
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5431
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5432
isVariable
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5433
    "return true if the receiver has indexed instance variables,
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5434
     false otherwise."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5435
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5436
    ^ self class isVariable
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5437
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5438
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5439
isView
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5440
    "return true, if the receiver is some kind of view;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5441
     false is returned here - the method is only redefined in View."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5442
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5443
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5444
! !
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5445
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5446
!Object methodsFor:'user interaction & notifications'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5447
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5448
activityNotification:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5449
    "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
  5450
     some long-time activity.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5451
     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
  5452
     passing the argument. The handler should show this message whereever it likes,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5453
     and proceed. If there is no handler, this is simply ignored.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5454
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5455
     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
  5456
     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
  5457
     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
  5458
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5459
    ActivityNotificationSignal isHandled ifTrue:[
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5460
	^ ActivityNotificationSignal raiseRequestWith:self errorString:aString
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5461
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5462
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5463
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5464
     nil activityNotification:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5465
     self activityNotification:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5466
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5467
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5468
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5469
     ActivityNotificationSignal handle:[:ex |
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5470
	ex errorString printNL.
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5471
	ex proceed.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5472
     ] do:[
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5473
	'hello' printNL.
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5474
	self activityNotification:'doing some long time computation'.
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5475
	'world' printNL.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5476
     ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5477
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5478
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5479
    "Modified: 16.12.1995 / 18:23:42 / cg"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5480
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5481
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5482
confirm:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5483
    "launch a confirmer, which allows user to enter yes or no.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5484
     return true for yes, false for no"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5485
925
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5486
    "
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5487
     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
  5488
     and return true (as if yes was answered)
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5489
     Q: should we ask user by reading Stdin ?
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5490
    "
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5491
    Smalltalk isInitialized ifFalse:[
1905
c28c1f8048a3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
  5492
        '*** confirmation requested during initialization:' printCR. 
c28c1f8048a3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
  5493
        aString printCR.
c28c1f8048a3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
  5494
        '*** I''ll continue, assuming <yes> ...' printCR.
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5495
        ^ true
925
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5496
    ].
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5497
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5498
    Dialog isNil ifTrue:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5499
        Transcript showCR:aString.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5500
        Transcript showCR:'continue, assuming <yes>'.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5501
        ^ true
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5502
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5503
    Dialog autoload.        "in case its autoloaded"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5504
    ^ Dialog confirm:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5505
        
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5506
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5507
     nil confirm:'hello'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5508
     self confirm:'hello'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5509
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5510
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5511
    "Modified: 20.5.1996 / 10:28:40 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5512
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5513
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5514
errorNotify:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5515
    "launch a Notifier, showing top stack, telling user something
2150
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5516
     and give user a chance to enter debugger."
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5517
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5518
    ^ self
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5519
        errorNotify:aString 
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5520
        from:thisContext sender
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5521
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5522
    "
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5523
     nil errorNotify:'hello there'
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5524
     self errorNotify:'hello there'
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5525
    "
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5526
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5527
    "Modified: 11.1.1997 / 18:39:20 / cg"
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5528
!
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5529
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5530
errorNotify:aString from:aContext
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5531
    "launch a Notifier, showing top stack (above aContext), 
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5532
     telling user something and give user a chance to enter debugger."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5533
2082
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5534
    |info con sender action|
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5535
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5536
    Smalltalk isInitialized ifFalse:[
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5537
        'errorNotification: ' print. aString printCR.
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5538
        ^ self
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5539
    ].
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5540
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5541
    Dialog isNil ifTrue:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5542
        "
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5543
         on systems without GUI, simply show
2203
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5544
         the message on the Transcript and abort.
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5545
        "
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5546
        Transcript showCR:aString.
2203
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5547
        AbortSignal raise.
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5548
        ^ self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5549
    ].
2203
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5550
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5551
    Processor activeProcessIsSystemProcess ifTrue:[
2192
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5552
        action := #debug.
2296
97eb35d5ce43 dont pass nil as context, when opening a modalDebugger
Claus Gittinger <cg@exept.de>
parents: 2295
diff changeset
  5553
        sender := aContext.
2203
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5554
    ] ifFalse:[
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5555
        Dialog autoload.        "in case its autoloaded"
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5556
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5557
        ErrorSignal handle:[:ex |
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5558
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5559
            "/ a recursive error - quickly enter debugger
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5560
            "/ this happened, when I corrupted the Dialog class ...
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5561
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5562
            ('Object [error]: ' , ex errorString , ' cought in errorNotification') errorPrintCR.
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5563
            action := #debug.
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5564
            ex return.
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5565
        ] do:[
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5566
            sender := aContext.
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5567
            sender isNil ifTrue:[
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5568
                sender := thisContext sender.
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5569
                "/
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5570
                "/ for your convenience: skip the emergencyHandler block
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5571
"/                sender isBlockContext ifTrue:[
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5572
"/                    sender := sender sender
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5573
"/                ].
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5574
            ].
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5575
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5576
            "/ skip intermediate (signal & exception) contexts
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5577
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5578
            DebugView notNil ifTrue:[
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5579
                sender := DebugView interestingContextFrom:sender
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5580
            ].
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5581
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5582
            "/ show the first 5 contexts
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5583
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5584
            con := sender.
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5585
            info := aString , Character cr asString , Character cr asString.
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5586
            1 to:5 do:[:n |
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5587
                con notNil ifTrue:[
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5588
                    info := info , con printString , Character cr asString.
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5589
                    con := con sender
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5590
                ]
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5591
            ].
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5592
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5593
            action := Dialog 
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5594
                        choose:info 
2359
fdc5d828bb5e add process name to exception notifyer boxes window-title
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  5595
                        label:('Exception [' , Processor activeProcess nameOrId , ']')
2203
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5596
                        labels:#('proceed' 'abort' 'debug')
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5597
                        values:#(#proceed #abort #debug)
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5598
                        default:#debug.
2192
ab86d9481b32 handle errors while showing errorNotifier.
Claus Gittinger <cg@exept.de>
parents: 2150
diff changeset
  5599
        ].
2082
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5600
    ].
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5601
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5602
    action == #debug ifTrue:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5603
        Debugger enter:sender withMessage:aString
2082
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5604
    ] ifFalse:[
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5605
        action == #abort ifTrue:[
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5606
            AbortSignal raise
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5607
        ]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5608
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5609
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5610
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5611
     nil errorNotify:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5612
     self errorNotify:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5613
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5614
2150
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5615
    "Created: 11.1.1997 / 17:53:09 / cg"
2359
fdc5d828bb5e add process name to exception notifyer boxes window-title
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  5616
    "Modified: 8.2.1997 / 12:47:41 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5617
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5618
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5619
information:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5620
    "launch an InfoBox, telling user something. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5621
     These info-boxes can be suppressed by handling the 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5622
     UserNotification- or InformationSignal and proceeding in the handler."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5623
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5624
    InformationSignal isHandled ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5625
	^ InformationSignal raiseRequestWith:self errorString:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5626
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5627
    self notify:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5628
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5629
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5630
     nil information:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5631
     self information:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5632
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5633
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5634
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5635
     InformationSignal handle:[:ex |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5636
	'no box popped' printNL.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5637
	ex proceed.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5638
     ] do:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5639
	'hello' printNL.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5640
	self information:'some info'.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5641
	'world' printNL.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5642
     ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5643
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5644
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5645
    "Modified: 24.11.1995 / 22:29:49 / cg"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5646
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5647
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5648
notify:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5649
    "launch a Notifier, telling user something.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5650
     Use #information: for ignorable messages."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5651
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5652
    Smalltalk isInitialized ifFalse:[
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5653
        'information: ' print. aString printCR.
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5654
        ^ self
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5655
    ].
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5656
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5657
    Dialog isNil ifTrue:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5658
        "
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5659
         on systems without GUI, simply show
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5660
         the message on the Transcript.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5661
        "
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5662
        Transcript showCR:aString.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5663
        ^ self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5664
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5665
    Dialog autoload.        "in case its autoloaded"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5666
    Dialog information:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5667
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5668
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5669
     nil notify:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5670
     self notify:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5671
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5672
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5673
    "Modified: 20.5.1996 / 10:28:48 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5674
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5675
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5676
warn:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5677
    "launch a WarningBox, telling user something.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5678
     These warn-boxes can be suppressed by handling the 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5679
     UserNotification- or WarningSignal and proceeding in the handler."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5680
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5681
    WarningSignal isHandled ifTrue:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5682
        ^ WarningSignal raiseRequestWith:self errorString:aString
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5683
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5684
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5685
    Smalltalk isInitialized ifFalse:[
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5686
        'warning: ' print. aString printCR.
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5687
        ^ self
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5688
    ].
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5689
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5690
    Dialog isNil ifTrue:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5691
        "
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5692
         on systems without GUI, simply show
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5693
         the message on the Transcript.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5694
        "
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5695
        Transcript showCR:aString.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5696
        ^ self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5697
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5698
    Dialog autoload.        "in case its autoloaded"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5699
    Dialog warn:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5700
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5701
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5702
     nil warn:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5703
     self warn:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5704
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5705
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5706
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5707
     WarningSignal handle:[:ex |
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5708
        ex proceed.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5709
     ] do:[
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5710
        'hello' printNL.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5711
        self warn:'some info'.
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5712
        'world' printNL.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5713
     ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5714
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5715
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5716
    "Modified: 20.5.1996 / 10:28:53 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5717
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5718
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  5719
!Object class methodsFor:'documentation'!
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5720
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5721
version
2480
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  5722
    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.184 1997-03-21 21:22:21 cg Exp $'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5723
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5724
Object initialize!