Object.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 29 Apr 2013 19:43:44 +0100
branchjv
changeset 18057 8da7c39a6322
parent 18052 47b429933e0e
parent 15193 e84b5268e918
child 18059 b882507b9fdf
permissions -rw-r--r--
Merged ac63da6d9b6c and e58049d58d1d (branch default - CVS HEAD)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     1
"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     2
 COPYRIGHT (c) 1988 by Claus Gittinger
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
     3
              All Rights Reserved
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     4
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     5
 This software is furnished under a license and may be used
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     6
 only in accordance with the terms of that license and with the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     8
 be provided or otherwise made available to, or used by, any
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     9
 other person.  No title to or ownership of the software is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    10
 hereby transferred.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    11
"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    12
"{ Package: 'stx:libbasic' }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    13
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    14
nil subclass:#Object
15034
a52015f9ee8b class: Object
Claus Gittinger <cg@exept.de>
parents: 14975
diff changeset
    15
	instanceVariableNames:''
a52015f9ee8b class: Object
Claus Gittinger <cg@exept.de>
parents: 14975
diff changeset
    16
	classVariableNames:'ErrorSignal HaltSignal MessageNotUnderstoodSignal
a52015f9ee8b class: Object
Claus Gittinger <cg@exept.de>
parents: 14975
diff changeset
    17
		UserInterruptSignal RecursionInterruptSignal
a52015f9ee8b class: Object
Claus Gittinger <cg@exept.de>
parents: 14975
diff changeset
    18
		ExceptionInterruptSignal SubscriptOutOfBoundsSignal
a52015f9ee8b class: Object
Claus Gittinger <cg@exept.de>
parents: 14975
diff changeset
    19
		IndexNotFoundSignal NonIntegerIndexSignal NotFoundSignal
a52015f9ee8b class: Object
Claus Gittinger <cg@exept.de>
parents: 14975
diff changeset
    20
		KeyNotFoundSignal ElementOutOfBoundsSignal UserNotificationSignal
a52015f9ee8b class: Object
Claus Gittinger <cg@exept.de>
parents: 14975
diff changeset
    21
		InformationSignal WarningSignal PrimitiveFailureSignal
a52015f9ee8b class: Object
Claus Gittinger <cg@exept.de>
parents: 14975
diff changeset
    22
		DeepCopyErrorSignal AbortSignal ErrorRecursion Dependencies
a52015f9ee8b class: Object
Claus Gittinger <cg@exept.de>
parents: 14975
diff changeset
    23
		InfoPrinting ActivityNotificationSignal InternalErrorSignal
a52015f9ee8b class: Object
Claus Gittinger <cg@exept.de>
parents: 14975
diff changeset
    24
		NonWeakDependencies SynchronizationSemaphores ObjectAttributes
a52015f9ee8b class: Object
Claus Gittinger <cg@exept.de>
parents: 14975
diff changeset
    25
		OSSignalInterruptSignal FinalizationLobby
a52015f9ee8b class: Object
Claus Gittinger <cg@exept.de>
parents: 14975
diff changeset
    26
		RecursiveStoreStringSignal AbortAllSignal EnabledBreakPoints'
a52015f9ee8b class: Object
Claus Gittinger <cg@exept.de>
parents: 14975
diff changeset
    27
	poolDictionaries:''
a52015f9ee8b class: Object
Claus Gittinger <cg@exept.de>
parents: 14975
diff changeset
    28
	category:'Kernel-Objects'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    29
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    30
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    31
!Object class methodsFor:'documentation'!
3023
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
    32
5754
333aba8041c2 checkin from browser
tm
parents: 5706
diff changeset
    33
copyright
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    34
"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    35
 COPYRIGHT (c) 1988 by Claus Gittinger
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
    36
              All Rights Reserved
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    37
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    38
 This software is furnished under a license and may be used
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    39
 only in accordance with the terms of that license and with the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    40
 inclusion of the above copyright notice.   This software may not
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    41
 be provided or otherwise made available to, or used by, any
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    42
 other person.  No title to or ownership of the software is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    43
 hereby transferred.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    44
"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    45
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    46
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    47
dependencies
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    48
"
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
    49
   ST/X dependencies are slightly modified from ST-80's
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    50
   (we think they are better ;-).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    51
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    52
   One problem occuring very often in ST-80 is that some object
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    53
   cannot be garbage collected because some dependency is present,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    54
   having the object as a dependent of some other object.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    55
   In ST-80, this association remains alive (because a Dictionary
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    56
   is used to hold dependents) - even if no other references exist to
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    57
   to dependent or the dependee.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    58
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    59
   This means, that in ST-80, a #release is mandatory in order to
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    60
   prevent memory leaks.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    61
   We think, that this is a bad solution, since after all, exactly that
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    62
   kind of work should be performed by a garbage collector - you should not
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    63
   need to care about dependencies.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
    64
   From a philosophical point of view, why should some object depend on
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    65
   something that the programmer considers a dead object ?
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    66
   (well - worse than that: it seems that some ST-80 code even depends on
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    67
    that behavior)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    68
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    69
   In order to limit the trouble, ST-80 reimplemented the way dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    70
   are stored in the model class - this one keeps the dependents locally,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    71
   so these dependents go away, once the model is reclaimed.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    72
   That may make things even more confusing: with models, no #release is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    73
   needed, with general objects it is mandatory.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    74
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    75
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    76
   In ST/X, dependencies are implemented using a WeakDictionary; this means,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    77
   that once the dependee dies, the dependency association is removed automatically,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    78
   and the dependent can be reclaimed by the garbage collector, if no other
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    79
   references exist to the dependent.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    80
   In order to (at least) provide a mechanism for the old behavior
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    81
   (in case your application heavily depends on the ST-80 mechanism), complementary
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
    82
   protocol to add nonWeak dependencies is provided
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    83
   (see #addNonWeakDependent / #removeNonWeakDependent).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    84
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    85
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    86
   Caveat:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    87
      since interests are implemented using InterestConverter (which are simply
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    88
      forwarding messages), these must use the nonWeak mechanism (as done in ST-80
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    89
      automatically).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    90
      The reason is that there are usually no direct references to the converters,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    91
      and those would be reclaimed if stored in a weakDictionary.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    92
      This means, that those interests MUST be removed with #retractInterest
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
    93
      (which is bug-compatible to ST-80).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    94
      We rewrite things to provide a more convenient mechanism in the future ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    95
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    96
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    97
   I like to hear comments on the above - do you think its better ?
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    98
"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    99
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   100
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   101
documentation
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   102
"
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   103
   Object is the superclass of most other classes.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   104
   (except for nil-subclasses, which inherit nothing,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   105
    to catch any message into their #doesNotUnderstand: method)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   106
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   107
   Protocol which is common to every object is defined here.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   108
   Also some utility stuff (like notify) and error handling is implemented here.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   109
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   110
   Object has no instance variables (and may not get any added). One reason is, that
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   111
   UndefinedObject and SmallInteger are also inheriting from Object - these two cannot
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   112
   have instance variables (due to their implementation).
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   113
   The other reason is that the runtime system (VM) knows about the layout of some built-in
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   114
   classes (think of Class, Method, Block and also Integer or Float).
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   115
   If you were allowed to add instance variables to Object, the VM had to be recompiled
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   116
   (and also rewritten in some places).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   117
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   118
   [Class variables:]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   119
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   120
        ErrorSignal     <Signal>        Signal raised for error/error: messages
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   121
                                        also, parent of all other signals.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   122
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   123
        HaltSignal      <Signal>        Signal raised for halt/halt: messages
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   124
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   125
        MessageNotUnderstoodSignal      Signals raised for various error conditions
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   126
        UserInterruptSignal
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   127
        RecursionInterruptSignal
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   128
        ExceptionInterruptSignal
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   129
        SubscriptOutOfBoundsSignal
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   130
        NonIntegerIndexSignal
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   131
        NotFoundSignal
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   132
        KeyNotFoundSignal
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   133
        ElementOutOfBoundsSignal
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   134
        InformationSignal
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   135
        WarningSignal
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   136
        DeepCopyErrorSignal
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   137
        InternalErrorSignal
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   138
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   139
        AbortSignal      <Signal>       Signal raised by debugger, to abort a computation
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   140
                                        BUT, the debugger will only raise it if it is handled.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   141
                                        By handling the abortSignal, you can control where the
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   142
                                        debuggers abort-function resumes execution in case of
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   143
                                        an error.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   144
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   145
        ErrorRecursion   <Boolean>      controls behavior when recursive errors occur (i.e.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   146
                                        an error while handling an error).
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   147
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   148
        Dependencies     <WeakDependencyDictionary>
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   149
                                        keeps track of object dependencies.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   150
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   151
        InfoPrinting     <Boolean>      controls weather informational messages
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   152
                                        are printed.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   153
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   154
        ActivityNotificationSignal <QuerySignal>
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   155
                                         raised on #activityNotification:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   156
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   157
        NonWeakDependencies <Dictionary> keeps track of object dependencies.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   158
                                         Dependents stay alive.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   159
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   160
        SynchronizationSemaphores <WeakIdentityDictionary>
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   161
                                         Semaphores for per-object-monitor.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   162
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   163
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   164
    [author:]
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   165
        Claus Gittinger
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   166
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   167
"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   168
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   169
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   170
!Object class methodsFor:'initialization'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   171
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   172
initSignals
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   173
    "called only once - initialize signals"
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   174
15193
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   175
    "/ notice: the class variables here are a leftover from times
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   176
    "/ when errors where signal-instance, not class based.
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   177
    "/ then, signal instances where created here and kept as class vars,
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   178
    "/ to be fetched from the class var or via signal-getter methods.
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   179
    "/ Nowadays, we use class based exceptions, where the exception class   
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   180
    "/ is directly referenced.
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   181
    "/ the classvars here are kept for backward compatibility, but they now
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   182
    "/ simply alias the corresponding exception class.
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   183
    "/ Old code should be rewritten to access the error class.
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   184
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   185
    ErrorSignal := Error.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   186
    HaltSignal := HaltInterrupt.
5977
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   187
    MessageNotUnderstoodSignal := MessageNotUnderstood.
6000
d6fbafc5879e more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5995
diff changeset
   188
    PrimitiveFailureSignal := PrimitiveFailure.
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   189
    InternalErrorSignal := VMInternalError.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   190
    UserInterruptSignal := UserInterrupt.
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   191
    RecursionInterruptSignal := RecursionError.
5977
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   192
    NotFoundSignal := NotFoundError.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   193
    IndexNotFoundSignal := IndexNotFoundError.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   194
    SubscriptOutOfBoundsSignal := SubscriptOutOfBoundsError.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   195
    NonIntegerIndexSignal := NonIntegerIndexError.
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   196
    KeyNotFoundSignal := KeyNotFoundError.
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   197
    ElementOutOfBoundsSignal := ElementBoundsError.
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
   198
    UserNotificationSignal := UserNotification.
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
   199
    WarningSignal := Warning.
7035
1d049fb7ae5a Make UserInformation a class based exception
Stefan Vogel <sv@exept.de>
parents: 7033
diff changeset
   200
    InformationSignal := UserInformation.
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   201
    ActivityNotificationSignal := ActivityNotification.
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   202
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   203
    DeepCopyErrorSignal := DeepCopyError.
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   204
6203
d39d75849383 class based exceptions - abortSignal
Claus Gittinger <cg@exept.de>
parents: 6199
diff changeset
   205
    AbortSignal := AbortOperationRequest.
6877
ab4e7d42f9f8 AbortAllOperation - now class based
Claus Gittinger <cg@exept.de>
parents: 6874
diff changeset
   206
    AbortAllSignal := AbortAllOperationRequest.
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   207
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   208
    OSSignalInterruptSignal := OSSignalInterrupt.
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   209
    RecursiveStoreStringSignal := RecursiveStoreError.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   210
5980
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   211
    "
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   212
     Object initSignals
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   213
    "
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   214
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   215
    "Modified: / 22.1.1998 / 21:23:40 / av"
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   216
    "Modified: / 4.8.1999 / 08:54:06 / stefan"
6203
d39d75849383 class based exceptions - abortSignal
Claus Gittinger <cg@exept.de>
parents: 6199
diff changeset
   217
    "Modified: / 16.11.2001 / 16:30:08 / cg"
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   218
!
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   219
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   220
initialize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   221
    "called only once - initialize signals"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   222
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   223
    ErrorSignal isNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   224
        self initSignals
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   225
    ].
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   226
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   227
    ObjectAttributes isNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   228
        ObjectAttributes := WeakIdentityDictionary new.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   229
    ].
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   230
    Dependencies isNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   231
        Dependencies := WeakDependencyDictionary new.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   232
    ].
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   233
    NonWeakDependencies isNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   234
        NonWeakDependencies := IdentityDictionary new.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   235
    ].
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   236
    SynchronizationSemaphores isNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   237
        SynchronizationSemaphores := WeakIdentityDictionary new.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   238
    ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   239
    FinalizationLobby isNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   240
        FinalizationLobby := Registry new.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   241
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   242
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   243
    "/ initialize InfoPrinting to the VM's infoPrint setting
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   244
    "/ (which can be turned off via a command line argument)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   245
    InfoPrinting := ObjectMemory infoPrinting.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   246
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   247
    "Object initialize"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   248
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   249
    "Modified: / 22.1.1998 / 21:23:40 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   250
    "Modified: / 3.2.1998 / 18:55:09 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   251
    "Modified: / 4.8.1999 / 08:54:06 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   252
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   253
7303
98111fb6a285 category
Claus Gittinger <cg@exept.de>
parents: 7285
diff changeset
   254
!Object class methodsFor:'Compatibility-ST80'!
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   255
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   256
rootError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   257
    "return the signal used for error/error: - handling.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   258
     Same as errorSignal for ST80 compatibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   259
7094
617eeaf2f8ba Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7081
diff changeset
   260
    ^ Error
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   261
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   262
    "Created: / 15.1.1998 / 23:47:05 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   263
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   264
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   265
!Object class methodsFor:'Signal constants'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   266
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   267
abortAllSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   268
    "return the signal used to abort user actions (much like AbortSignal).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   269
     This signal is supposed to abort multiple operation actions, and get out of
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   270
     the loop (such as when confirming multiple class deletions etc.)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   271
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   272
    ^ AbortAllSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   273
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   274
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   275
abortSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   276
    "return the signal used to abort user actions. This signal is only
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   277
     raised if caught (by the debugger), and will lead way out of the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   278
     currently active doIt/printIt or inspectIt. (also some others use
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   279
     this for a save abort)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   280
8521
60f0e479ffc1 use class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8502
diff changeset
   281
    ^ AbortOperationRequest
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   282
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   283
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   284
activityNotificationSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   285
    "return the signal used for activity notifications.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   286
     A handler for this signal gets all #activityNotification: sends"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   287
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   288
    ^ ActivityNotification
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   289
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   290
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   291
ambiguousMessageSignal
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   292
    "return the signal used for ambiguousMessage: - error handling"
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   293
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   294
    ^ AmbiguousMessage
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   295
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   296
    "Created: / 21-07-2010 / 15:39:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   297
!
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   298
11132
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
   299
conversionErrorSignal
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
   300
    "return the signal used for conversion error handling"
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
   301
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
   302
    ^ ConversionError
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
   303
!
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
   304
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   305
deepCopyErrorSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   306
    "return the signal raised when a deepcopy is asked for
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   307
     an object which cannot do this (for example, BlockClosures
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   308
     or Contexts)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   309
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   310
    ^ DeepCopyError
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   311
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   312
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   313
elementOutOfBoundsSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   314
    "return the signal used for element error reporting
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   315
     (this signal is used for example when a value not in 0..255 is to
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   316
      be put into a bytearray)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   317
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   318
    ^ ElementBoundsError
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   319
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   320
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   321
errorSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   322
    "return the signal used for error/error: - handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   323
7094
617eeaf2f8ba Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7081
diff changeset
   324
    ^ Error
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   325
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   326
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   327
haltSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   328
    "return the signal used for halt/halt: - handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   329
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   330
    ^ HaltSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   331
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   332
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   333
indexNotFoundSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   334
    "return the signal used for bad index error reporting.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   335
     This is also the parentSignal of the nonIntegerIndex- and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   336
     subscriptOutOfBoundsSignal"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   337
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   338
    ^ IndexNotFoundSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   339
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   340
    "Created: / 8.11.1997 / 19:15:48 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   341
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   342
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   343
informationSignal
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   344
    "return the signal used for informations.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   345
     A handler for this signal gets all #information: sends"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   346
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   347
    ^ InformationSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   348
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   349
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   350
internalErrorSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   351
    "return the signal used to report internal (VM-) errors."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   352
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   353
    ^ VMInternalError
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   354
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   355
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   356
keyNotFoundSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   357
    "return the signal used for no such key error reporting"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   358
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   359
    ^ KeyNotFoundError
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   360
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   361
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   362
messageNotUnderstoodSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   363
    "return the signal used for doesNotUnderstand: - error handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   364
15193
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   365
    ^ MessageNotUnderstood
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   366
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   367
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   368
nonIntegerIndexSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   369
    "return the signal used for bad subscript error reporting"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   370
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   371
    ^ NonIntegerIndexSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   372
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   373
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   374
notFoundSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   375
    "return the signal used for no element found error reporting"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   376
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   377
    ^ NotFoundSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   378
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   379
7644
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   380
notifySignal
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   381
    "return the parent of all notification signals."
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   382
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   383
    ^ Notification
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   384
!
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   385
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   386
osSignalInterruptSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   387
    "return the signal used for OS-signal error reporting;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   388
     This is only raised if handled - otherwise, a debugger is entered."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   389
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   390
    ^ OSSignalInterrupt
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   391
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   392
    "Modified: / 12.6.1998 / 16:27:26 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   393
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   394
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   395
primitiveFailureSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   396
    "return the signal used for primitiveFailed - error handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   397
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   398
    ^ PrimitiveFailure
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   399
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   400
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   401
privateMethodSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   402
    "return the signal used for privateMethod - error handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   403
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   404
    ^ MessageNotUnderstoodSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   405
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   406
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   407
recursionInterruptSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   408
    "return the signal used for recursion overflow error handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   409
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   410
    ^ RecursionInterruptSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   411
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   412
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   413
recursiveStoreStringSignal
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   414
    "return the notification used to report storeString generation of recursive objects"
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   415
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   416
    ^ RecursiveStoreError
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   417
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   418
    "
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   419
     RecursiveStoreError handle:[:ex |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   420
        self halt
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   421
     ] do:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   422
        |a|
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   423
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   424
        a := Array new:1.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   425
        a at:1 put:a.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   426
        a storeOn:Transcript
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   427
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   428
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   429
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   430
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   431
     |a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   432
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   433
     a := Array new:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   434
     a at:1 put:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   435
     a storeOn:Transcript
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   436
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   437
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   438
5980
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   439
subclassResponsibilitySignal
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   440
    "return the signal used for subclassResponsibility error reporting.
6652
4cfba8cb0652 typo and undo renaming of #/#cons:
Stefan Vogel <sv@exept.de>
parents: 6647
diff changeset
   441
     (this signal is used to signal incomplete subclasses - i.e. a programmers error)"
5980
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   442
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   443
    ^ SubclassResponsibilityError
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   444
!
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   445
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   446
subscriptOutOfBoundsSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   447
    "return the signal used for subscript error reporting.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   448
     (this signal is used for example when an array is accessed with an
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   449
      index less than 1 or greater than the array size)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   450
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   451
    ^ SubscriptOutOfBoundsSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   452
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   453
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   454
userInterruptSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   455
    "return the signal used for ^C interrupts handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   456
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   457
    ^ UserInterruptSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   458
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   459
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   460
userNotificationSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   461
    "the parent signal used with information and warnings.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   462
     Handling this allows handling of both information- and warning notifications."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   463
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   464
    ^ UserNotificationSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   465
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   466
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   467
warningSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   468
    "return the signal used for warnings.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   469
     A handler for this signal gets all #warn: sends"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   470
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   471
    ^ WarningSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   472
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   473
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   474
!Object class methodsFor:'info messages'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   475
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   476
infoPrinting
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   477
    "return the flag which controls information messages."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   478
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   479
    ^ InfoPrinting
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   480
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   481
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   482
infoPrinting:aBoolean
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   483
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   484
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   485
    "turn on/off printing of information messages.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   486
     If the argument, aBoolean is false, infoPrint will not output
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   487
     messages. The default is true."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   488
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   489
    InfoPrinting := aBoolean
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   490
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   491
15193
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   492
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   493
!Object class methodsFor:'queries'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   494
8892
5d05a7f150a5 +isAbstract
Claus Gittinger <cg@exept.de>
parents: 8879
diff changeset
   495
isAbstract
11221
1e88faaa1249 comment
Claus Gittinger <cg@exept.de>
parents: 11161
diff changeset
   496
    "Return if this class is an abstract class.
1e88faaa1249 comment
Claus Gittinger <cg@exept.de>
parents: 11161
diff changeset
   497
     True is returned for Object here; false for subclasses.
1e88faaa1249 comment
Claus Gittinger <cg@exept.de>
parents: 11161
diff changeset
   498
     Abstract subclasses must redefine again."
1e88faaa1249 comment
Claus Gittinger <cg@exept.de>
parents: 11161
diff changeset
   499
8892
5d05a7f150a5 +isAbstract
Claus Gittinger <cg@exept.de>
parents: 8879
diff changeset
   500
    ^ self == Object
5d05a7f150a5 +isAbstract
Claus Gittinger <cg@exept.de>
parents: 8879
diff changeset
   501
!
5d05a7f150a5 +isAbstract
Claus Gittinger <cg@exept.de>
parents: 8879
diff changeset
   502
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   503
isBuiltInClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   504
    "return true, if this class is known by the run-time-system,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   505
     i.e. you cannot add/remove instance variables without recompiling
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   506
     the VM.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   507
     Here, true is returned for myself, false for subclasses."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   508
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   509
    ^ self == Object
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   510
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   511
    "Modified: 23.4.1996 / 16:00:07 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   512
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   513
14296
fe82bc5091f9 added: #isUUID
Stefan Vogel <sv@exept.de>
parents: 14292
diff changeset
   514
15193
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   515
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   516
8441
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   517
!Object methodsFor:'Compatibility-Dolphin'!
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   518
11161
3888d6f4e6f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11142
diff changeset
   519
stbFixup: anSTBInFiler at: newObjectIndex
3888d6f4e6f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11142
diff changeset
   520
    "Answer the true object that must be used to represent the receiver when read from anSTBInFiler.
3888d6f4e6f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11142
diff changeset
   521
     Typically this is overridden by subclasses of STBProxy to answer the proxied object. Other classes
3888d6f4e6f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11142
diff changeset
   522
     may also override this method to effectively 'one way become' the receiver to some other object"
3888d6f4e6f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11142
diff changeset
   523
3888d6f4e6f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11142
diff changeset
   524
    ^ self
8441
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   525
! !
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   526
14682
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   527
!Object methodsFor:'Compatibility-GNU'!
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   528
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   529
display
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   530
    "print the receiver on the standard output stream (which is not the Transcript).
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   531
     Added for GNU-ST compatibility"
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   532
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   533
    self print
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   534
!
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   535
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   536
displayNl
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   537
    "print the receiver followed by a cr on the standard output stream (which is not the Transcript).
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   538
     Added for GNU-ST compatibility"
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   539
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   540
    self printCR
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   541
! !
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   542
7261
f35fc9cee675 method category rename
Claus Gittinger <cg@exept.de>
parents: 7216
diff changeset
   543
!Object methodsFor:'Compatibility-ST80'!
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   544
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   545
isMetaclass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   546
    ^ self isMeta
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   547
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   548
7261
f35fc9cee675 method category rename
Claus Gittinger <cg@exept.de>
parents: 7216
diff changeset
   549
!Object methodsFor:'Compatibility-Squeak'!
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   550
9071
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   551
becomeForward:anotherObject
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   552
    self becomeSameAs:anotherObject
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   553
!
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   554
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   555
becomeForward:anotherObject copyHash:copyHash
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   556
    copyHash ifTrue:[ self error:'unsupported operation' ].
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   557
    self becomeSameAs:anotherObject
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   558
!
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   559
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   560
clone
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   561
    ^ self shallowCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   562
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   563
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   564
copyTwoLevel
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   565
    "one more level than a shallowCopy"
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   566
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   567
    ^ self copyToLevel:2
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   568
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   569
    "
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   570
     |original copy elL1 elL2 elL3 copyOfElL1|
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   571
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   572
     original := Array new:3.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   573
     original at:1 put:1234.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   574
     original at:2 put:'hello'.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   575
     original at:3 put:(elL1 := Array new:3).
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   576
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   577
     elL1 at:1 put:1234.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   578
     elL1 at:2 put:'hello'.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   579
     elL1 at:3 put:(elL2 := Array new:3).
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   580
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   581
     elL2 at:1 put:1234.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   582
     elL2 at:2 put:'hello'.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   583
     elL2 at:3 put:(elL3 := Array new:3).
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   584
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   585
     elL3 at:1 put:1234.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   586
     elL3 at:2 put:'hello'.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   587
     elL3 at:3 put:(Array new:3).
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   588
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   589
     copy := original copyTwoLevel.
14534
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
   590
     self assert:((original at:2) ~~ (copy at:2)).
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
   591
     self assert:((original at:3) ~~ (copy at:3)).
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   592
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   593
     copyOfElL1 := copy at:3.
14534
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
   594
     self assert:((elL1 at:2) == (copyOfElL1 at:2)).
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
   595
     self assert:((elL1 at:3) == (copyOfElL1 at:3)).
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   596
    "
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   597
!
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   598
7320
0d5b4de4045a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7303
diff changeset
   599
explore
0d5b4de4045a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7303
diff changeset
   600
    (self confirm:'The Squeak explorer has not yet been ported to ST/X\\Inspect instead ?' withCRs)
0d5b4de4045a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7303
diff changeset
   601
    ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   602
        self inspect
7320
0d5b4de4045a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7303
diff changeset
   603
    ]
0d5b4de4045a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7303
diff changeset
   604
!
0d5b4de4045a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7303
diff changeset
   605
12285
54773840f621 added: #inform: - squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 12158
diff changeset
   606
inform: aString
54773840f621 added: #inform: - squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 12158
diff changeset
   607
    "Display a message for the user to read and then dismiss."
54773840f621 added: #inform: - squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 12158
diff changeset
   608
54773840f621 added: #inform: - squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 12158
diff changeset
   609
    self information:aString
54773840f621 added: #inform: - squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 12158
diff changeset
   610
!
54773840f621 added: #inform: - squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 12158
diff changeset
   611
9335
2dcbf8f91693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9314
diff changeset
   612
isInMemory
2dcbf8f91693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9314
diff changeset
   613
    "All normal objects are."
2dcbf8f91693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9314
diff changeset
   614
2dcbf8f91693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9314
diff changeset
   615
    ^ true
2dcbf8f91693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9314
diff changeset
   616
!
2dcbf8f91693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9314
diff changeset
   617
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   618
stringForReadout
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   619
        ^ self stringRepresentation
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   620
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   621
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   622
stringRepresentation
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   623
        "Answer a string that represents the receiver.  For most objects this is simply its printString, but for strings themselves, it's themselves.  6/12/96 sw"
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   624
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   625
        ^ self printString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   626
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   627
9146
56176a7bf685 +valueWithPossibleArguments:
Claus Gittinger <cg@exept.de>
parents: 9105
diff changeset
   628
valueWithPossibleArguments:argArray
56176a7bf685 +valueWithPossibleArguments:
Claus Gittinger <cg@exept.de>
parents: 9105
diff changeset
   629
     ^ self
56176a7bf685 +valueWithPossibleArguments:
Claus Gittinger <cg@exept.de>
parents: 9105
diff changeset
   630
!
56176a7bf685 +valueWithPossibleArguments:
Claus Gittinger <cg@exept.de>
parents: 9105
diff changeset
   631
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   632
veryDeepCopy
8383
dea5311899c5 comments in copy methods
Claus Gittinger <cg@exept.de>
parents: 8377
diff changeset
   633
     ^ self deepCopyUsing:(IdentityDictionary new)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   634
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   635
7567
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   636
!Object methodsFor:'Compatibility-VW'!
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   637
8637
e7e695f53819 *** empty log message ***
penk
parents: 8632
diff changeset
   638
isCharacters
e7e695f53819 *** empty log message ***
penk
parents: 8632
diff changeset
   639
    "added for visual works compatibility"
e7e695f53819 *** empty log message ***
penk
parents: 8632
diff changeset
   640
    ^ false
e7e695f53819 *** empty log message ***
penk
parents: 8632
diff changeset
   641
!
e7e695f53819 *** empty log message ***
penk
parents: 8632
diff changeset
   642
7567
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   643
keyNotFoundError:aKey
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   644
    "VW compatibility"
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   645
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   646
    self errorKeyNotFound:aKey.
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   647
!
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   648
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   649
oneWayBecome:anotherObject
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   650
    ^ self becomeSameAs:anotherObject
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   651
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   652
    "
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   653
     |arr o1 o2|
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   654
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   655
     arr := Array new:2.
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   656
     arr at:1 put:(o1 := Object new).
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   657
     arr at:2 put:(o2 := Point new).
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   658
     o1 oneWayBecome:o2.
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   659
     (arr at:1) ~~ o2 ifTrue:[self halt].
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   660
    "
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   661
    "
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   662
     |arr o1 o2|
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   663
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   664
     arr := Array new:2.
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   665
     arr at:1 put:(o1 := Object new).
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   666
     arr at:2 put:(o2 := Point new).
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   667
     o1 becomeSameAs:o2.
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   668
     (arr at:1) ~~ o2 ifTrue:[self halt].
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   669
    "
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   670
! !
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   671
15193
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   672
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   673
!Object methodsFor:'accessing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   674
13320
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   675
_at:index
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   676
    "experimental:
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   677
     this is a synthetic selector, generated by the compiler,
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   678
     if a construct of the form expr[idx...] is parsed.
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   679
     I.e.
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   680
        v[n]
13320
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   681
     generates
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   682
        v _at: n
13320
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   683
    "
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   684
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   685
    ^ self at:index
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   686
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   687
    "Created: / 21-03-2011 / 14:07:57 / cg"
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   688
!
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   689
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   690
_at:index put:value
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   691
    "experimental:
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   692
     this is a synthetic selector, generated by the compiler,
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   693
     if a construct of the form expr[idx...] is parsed.
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   694
     I.e.
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   695
        v[n]
13320
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   696
     generates
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   697
        v _at: n
13320
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   698
    "
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   699
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   700
    ^ self at:index put:value
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   701
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   702
    "Created: / 21-03-2011 / 14:10:12 / cg"
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   703
!
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   704
14705
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   705
addSlot: slotName
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   706
    "dynamically add a new slot to the receiver.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   707
     The receiver must be a real object, not nil or a smallInteger"
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   708
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   709
    |classGetter myClass anonCls newObj|
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   710
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   711
    myClass := self class.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   712
    classGetter := ('%__get_',slotName,'__') asSymbol.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   713
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   714
    anonCls := self perform:classGetter ifNotUnderstood:nil.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   715
    anonCls isNil ifTrue:[
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   716
        anonCls := myClass 
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   717
                subclass:(myClass name,'+',slotName) asSymbol 
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   718
                instanceVariableNames:slotName 
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   719
                classVariableNames:'' 
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   720
                poolDictionaries:'' category:nil 
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   721
                inEnvironment:nil.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   722
        anonCls compile:('%1 ^  %1' bindWith:slotName).
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   723
        anonCls compile:('%1:v %1 := v' bindWith:slotName).
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   724
        Class withoutUpdatingChangesDo:[
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   725
            |m|
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   726
            m := Compiler compile:('__get_',slotName,' ^ #fooBar' bindWith:slotName) forClass:myClass install:false.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   727
            m literalAt:(m literals indexOf:#fooBar) put:anonCls.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   728
            myClass addSelector:classGetter withMethod:m.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   729
        ].
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   730
    ].
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   731
    newObj := anonCls cloneFrom:self.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   732
    self become:newObj.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   733
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   734
    "
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   735
     |p1 p2 p3|
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   736
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   737
     p1 := Point x:10 y:20.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   738
     p2 := Point x:100 y:200.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   739
     Transcript show:'p1 is '; showCR:p1.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   740
     Transcript show:'p2 is '; showCR:p2.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   741
     p1 addSlot:'z'.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   742
     p1 z:30.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   743
     Transcript show:'p1 is '; showCR:p1.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   744
     Transcript show:'p2 is '; showCR:p2.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   745
     ObjectMemory dumpObject:p1.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   746
     ObjectMemory dumpObject:p2.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   747
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   748
     p1 addSlot:'t'.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   749
     p1 t:30.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   750
     Transcript show:'p1 is '; showCR:p1.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   751
     ObjectMemory dumpObject:p1.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   752
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   753
     p3 := Point x:110 y:120.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   754
     p3 addSlot:'z'.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   755
     p3 addSlot:'t'.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   756
     p1 inspect.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   757
     p2 inspect.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   758
     p3 inspect.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   759
    "
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   760
!
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   761
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   762
at:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   763
    "return the indexed instance variable with index, anInteger;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   764
     this method can be redefined in subclasses."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   765
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   766
    ^ self basicAt:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   767
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   768
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   769
at:index put:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   770
    "store the 2nd arg, anObject as indexed instvar with index, anInteger.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   771
     this method can be redefined in subclasses. Returns anObject (sigh)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   772
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   773
    ^ self basicAt:index put:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   774
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   775
    "Modified: 19.4.1996 / 11:13:29 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   776
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   777
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   778
basicAt:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   779
    "return the indexed instance variable with index, anInteger.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   780
     Trigger an error if the receiver has no indexed instance variables.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   781
     This method should NOT be redefined in any subclass (except with great care, for tuning)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   782
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   783
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   784
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   785
    REGISTER int nbytes, indx;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   786
    OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   787
    REGISTER char *pFirst;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   788
    REGISTER int n;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   789
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   790
    /*
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   791
     * notice the missing test for self being a nonNilObject -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   792
     * this can be done since basicAt: is defined both in UndefinedObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   793
     * and SmallInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   794
     */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   795
    if (__isSmallInteger(index)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   796
        myClass = __qClass(self);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   797
        indx = __intVal(index) - 1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   798
        n /* nInstVars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   799
        n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* nInstVars */);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   800
        nbytes = __qSize(self) - n /* nInstBytes */;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   801
        pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   802
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   803
        switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   804
            case __MASKSMALLINT(POINTERARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   805
            case __MASKSMALLINT(WKPOINTERARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   806
                /*
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   807
                 * pointers
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   808
                 */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   809
                if ((unsigned)indx < (__BYTES2OBJS__(nbytes))) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   810
                    OBJ *op;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   811
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   812
                    op = (OBJ *)pFirst + indx;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   813
                    RETURN ( *op );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   814
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   815
                break;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   816
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   817
            case __MASKSMALLINT(BYTEARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   818
                /*
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   819
                 * (unsigned) bytes
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   820
                 */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   821
                if ((unsigned)indx < nbytes) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   822
                    unsigned char *cp;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   823
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   824
                    cp = (unsigned char *)pFirst + indx;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   825
                    RETURN ( __mkSmallInteger( (*cp & 0xFF)) );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   826
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   827
                break;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   828
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   829
            case __MASKSMALLINT(FLOATARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   830
                /*
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   831
                 * native floats
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   832
                 */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   833
                if ((unsigned)indx < (nbytes / sizeof(float))) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   834
                    float *fp;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   835
                    float f;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   836
                    OBJ v;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   837
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   838
                    fp = (float *)pFirst + indx;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   839
                    f = *fp;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   840
                    if (f == 0.0) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   841
                        v = __float0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   842
                    } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   843
                        __qMKSFLOAT(v, f);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   844
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   845
                    RETURN (v);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   846
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   847
                break;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   848
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   849
            case __MASKSMALLINT(DOUBLEARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   850
                /*
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   851
                 * native doubles
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   852
                 */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   853
#ifdef __NEED_DOUBLE_ALIGN
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   854
                if ((INT)pFirst & (__DOUBLE_ALIGN-1)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   855
                    int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   856
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   857
                    pFirst += delta;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   858
                    nbytes -= delta;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   859
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   860
#endif
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   861
                if ((unsigned)indx < (nbytes / sizeof(double))) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   862
                    double *dp;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   863
                    double d;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   864
                    OBJ v;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   865
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   866
                    dp = (double *)pFirst + indx;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   867
                    d = *dp;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   868
                    if (d == 0.0) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   869
                        v = __float0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   870
                    } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   871
                        __qMKFLOAT(v, d);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   872
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   873
                    RETURN (v);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   874
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   875
                break;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   876
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   877
            case __MASKSMALLINT(WORDARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   878
                /*
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   879
                 * unsigned 16bit ints
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   880
                 */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   881
                /* Notice: the hard coded shifts are by purpose;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   882
                 * it makes us independent of the short-size of the machine
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   883
                 */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   884
                if ((unsigned)indx < (nbytes>>1)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   885
                    unsigned short *sp;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   886
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   887
                    sp = (unsigned short *)(pFirst + (indx<<1));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   888
                    RETURN ( __mkSmallInteger( (*sp & 0xFFFF)) );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   889
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   890
                break;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   891
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   892
            case __MASKSMALLINT(SWORDARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   893
                /*
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   894
                 * signed 16bit ints
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   895
                 */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   896
                /* Notice: the hard coded shifts are by purpose;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   897
                 * it makes us independent of the short-size of the machine
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   898
                 */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   899
                if ((unsigned)indx < (nbytes>>1)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   900
                    short *ssp;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   901
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   902
                    ssp = (short *)(pFirst + (indx<<1));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   903
                    RETURN ( __mkSmallInteger( (*ssp) ));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   904
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   905
                break;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   906
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   907
            case __MASKSMALLINT(LONGARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   908
                /*
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   909
                 * unsigned 32bit ints
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   910
                 */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   911
                /* Notice: the hard coded shifts are by purpose;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   912
                 * it makes us independent of the int-size of the machine
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   913
                 */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   914
                if ((unsigned)indx < (nbytes>>2)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   915
                    unsigned int32 ul;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   916
                    unsigned int32 *lp;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   917
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   918
                    lp = (unsigned int32 *)(pFirst + (indx<<2));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   919
                    ul = *lp;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8892
diff changeset
   920
#if __POINTER_SIZE__ == 8
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   921
                    {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   922
                        unsigned INT ull = (unsigned INT)ul;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   923
                        RETURN ( __mkSmallInteger(ull) );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   924
                    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   925
#else
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   926
                    if (ul <= _MAX_INT) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   927
                        RETURN ( __mkSmallInteger(ul) );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   928
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   929
                    RETURN ( __MKULARGEINT(ul) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   930
#endif
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   931
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   932
                break;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   933
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   934
            case __MASKSMALLINT(SLONGARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   935
                /*
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   936
                 * signed 32bit ints
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   937
                 */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   938
                /* Notice: the hard coded shifts are by purpose;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   939
                 * it makes us independent of the int-size of the machine
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   940
                 */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   941
                if ((unsigned)indx < (nbytes>>2)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   942
                    int32 *slp;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   943
                    int32 l;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   944
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   945
                    slp = (int32 *)(pFirst + (indx<<2));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   946
                    l = *slp;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8892
diff changeset
   947
#if __POINTER_SIZE__ == 8
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   948
                    {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   949
                        INT ll = (INT)l;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   950
                        RETURN ( __mkSmallInteger(ll) );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   951
                    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   952
#else
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   953
                    if (__ISVALIDINTEGER(l)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   954
                        RETURN ( __mkSmallInteger(l) );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   955
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   956
                    RETURN ( __MKLARGEINT(l) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   957
#endif
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   958
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   959
                break;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   960
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   961
            case __MASKSMALLINT(SLONGLONGARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   962
                /*
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   963
                 * signed 64bit longlongs
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   964
                 */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   965
#ifdef __NEED_LONGLONG_ALIGN
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   966
                if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   967
                    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   968
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   969
                    pFirst += delta;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   970
                    nbytes -= delta;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   971
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   972
#endif
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   973
                /* Notice: the hard coded shifts are by purpose;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   974
                 * it makes us independent of the long/longlong-size of the machine
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   975
                 */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   976
                if ((unsigned)indx < (nbytes>>3)) {
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8892
diff changeset
   977
#if __POINTER_SIZE__ == 8
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   978
                    INT *slp, ll;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   979
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   980
                    slp = (INT *)(pFirst + (indx<<3));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   981
                    ll = *slp;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   982
                    if (__ISVALIDINTEGER(ll)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   983
                        RETURN ( __mkSmallInteger(ll) );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   984
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   985
                    RETURN ( __MKLARGEINT(ll) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   986
#else
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   987
                    __int64__ *llp;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   988
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   989
                    llp = (__int64__ *)(pFirst + (indx<<3));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   990
                    RETURN (__MKINT64(llp));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   991
#endif
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   992
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   993
                break;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   994
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   995
            case __MASKSMALLINT(LONGLONGARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   996
                /*
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   997
                 * unsigned 64bit longlongs
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
   998
                 */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   999
#ifdef __NEED_LONGLONG_ALIGN
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1000
                if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1001
                    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1002
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1003
                    pFirst += delta;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1004
                    nbytes -= delta;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1005
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1006
#endif
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1007
                /* Notice: the hard coded shifts are by purpose;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1008
                 * it makes us independent of the long/longlong-size of the machine
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1009
                 */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1010
                if ((unsigned)indx < (nbytes>>3)) {
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8892
diff changeset
  1011
#if __POINTER_SIZE__ == 8
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1012
                    unsigned INT *ulp, ul;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1013
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1014
                    ulp = (unsigned INT *)(pFirst + (indx<<3));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1015
                    ul = *ulp;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1016
                    if (ul <= _MAX_INT) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1017
                        RETURN ( __mkSmallInteger(ul) );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1018
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1019
                    RETURN ( __MKULARGEINT(ul) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1020
#else
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1021
                    __uint64__ *llp;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1022
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1023
                    llp = (__uint64__ *)(pFirst + (indx<<3));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1024
                    RETURN (__MKUINT64(llp));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1025
#endif
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1026
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1027
                break;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1028
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1029
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1030
%}.
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  1031
    ^ self indexNotIntegerOrOutOfBounds:index
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1032
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1033
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1034
basicAt:index put:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1035
    "store the 2nd arg, anObject as indexed instvar with index, anInteger.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1036
     Returns anObject (sigh).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1037
     Trigger an error if the receiver has no indexed instance variables.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1038
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1039
     This method should NOT be redefined in any subclass (except with great care, for tuning)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1040
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1041
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1042
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1043
    register int nbytes, indx;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1044
    OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1045
    register char *pFirst;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1046
/*    int nInstBytes, ninstvars, flags; */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1047
    REGISTER int n;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1048
    unsigned int u;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1049
    int val;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1050
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1051
    /* notice the missing test for self being a nonNilObject -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1052
       this can be done since basicAt: is defined both in UndefinedObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1053
       and SmallInteger */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1054
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1055
    if (__isSmallInteger(index)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1056
        indx = __intVal(index) - 1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1057
        myClass = __qClass(self);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1058
        n /* ninstvars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1059
        n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* ninstvars */);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1060
        nbytes = __qSize(self) - n /* nInstBytes */;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1061
        pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1062
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1063
        switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1064
            case __MASKSMALLINT(POINTERARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1065
            case __MASKSMALLINT(WKPOINTERARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1066
                if ((unsigned)indx < (__BYTES2OBJS__(nbytes))) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1067
                    OBJ *op;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1068
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1069
                    op = (OBJ *)pFirst + indx;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1070
                    *op = anObject;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1071
                    __STORE(self, anObject);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1072
                    RETURN ( anObject );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1073
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1074
                break;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1075
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1076
            case __MASKSMALLINT(BYTEARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1077
                if (__isSmallInteger(anObject)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1078
                    val = __intVal(anObject);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1079
                    if ((val & ~0xFF) == 0 /* i.e. (val >= 0) && (val <= 255) */) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1080
                        if ((unsigned)indx < nbytes) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1081
                            char *cp;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1082
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1083
                            cp = pFirst + indx;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1084
                            *cp = val;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1085
                            RETURN ( anObject );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1086
                        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1087
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1088
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1089
                break;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1090
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1091
            case __MASKSMALLINT(FLOATARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1092
                if ((unsigned)indx < (nbytes / sizeof(float))) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1093
                    float *fp;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1094
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1095
                    fp = (float *)pFirst + indx;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1096
                    if (anObject != nil) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1097
                        if (! __isSmallInteger(anObject)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1098
                            if (__qIsFloatLike(anObject)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1099
                                *fp = (float)(__floatVal(anObject));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1100
                                RETURN ( anObject );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1101
                            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1102
                            if (__qIsShortFloat(anObject)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1103
                                *fp = __shortFloatVal(anObject);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1104
                                RETURN ( anObject );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1105
                            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1106
                        } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1107
                            *fp = (float) __intVal(anObject);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1108
                            RETURN ( anObject );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1109
                        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1110
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1111
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1112
                break;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1113
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1114
            case __MASKSMALLINT(DOUBLEARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1115
#ifdef __NEED_DOUBLE_ALIGN
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1116
                if ((INT)pFirst & (__DOUBLE_ALIGN-1)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1117
                    int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1118
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1119
                    pFirst += delta;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1120
                    nbytes -= delta;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1121
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1122
#endif
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1123
                if ((unsigned)indx < (nbytes / sizeof(double))) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1124
                    double *dp;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1125
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1126
                    dp = (double *)pFirst + indx;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1127
                    if (anObject != nil) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1128
                        if (! __isSmallInteger(anObject)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1129
                            if (__qIsFloatLike(anObject)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1130
                                *dp = __floatVal(anObject);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1131
                                RETURN ( anObject );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1132
                            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1133
                            if (__qIsShortFloat(anObject)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1134
                                *dp = (double)__shortFloatVal(anObject);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1135
                                RETURN ( anObject );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1136
                            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1137
                        } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1138
                            *dp = (double) __intVal(anObject);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1139
                            RETURN ( anObject );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1140
                        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1141
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1142
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1143
                break;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1144
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1145
            case __MASKSMALLINT(WORDARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1146
                if (__isSmallInteger(anObject)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1147
                    val = __intVal(anObject);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1148
                    if ((unsigned)val <= 0xFFFF) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1149
                        if ((unsigned)indx < (nbytes>>1)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1150
                            unsigned short *sp;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1151
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1152
                            sp = (unsigned short *)(pFirst + (indx<<1));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1153
                            *sp = val;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1154
                            RETURN ( anObject );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1155
                        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1156
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1157
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1158
                break;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1159
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1160
            case __MASKSMALLINT(SWORDARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1161
                if (__isSmallInteger(anObject)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1162
                    val = __intVal(anObject);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1163
                    if ((val >= -32768) && (val < 32768)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1164
                        if ((unsigned)indx < (nbytes>>1)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1165
                            short *ssp;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1166
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1167
                            ssp = (short *)(pFirst + (indx<<1));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1168
                            *ssp = val;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1169
                            RETURN ( anObject );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1170
                        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1171
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1172
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1173
                break;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1174
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1175
            case __MASKSMALLINT(SLONGARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1176
                if ((unsigned)indx < (nbytes>>2)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1177
                    int32 *slp;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1178
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1179
                    slp = (int32 *)(pFirst + (indx<<2));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1180
                    if (__isSmallInteger(anObject)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1181
                        *slp = __intVal(anObject);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1182
                        RETURN ( anObject );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1183
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1184
                    n = __signedLongIntVal(anObject);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1185
                    /*
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1186
                     * zero means failure for an int larger than INT-size bytes
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1187
                     * (would be a smallInteger)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1188
                     */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1189
                    if (n) {
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  1190
#if __POINTER_SIZE__ == 8
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1191
                        if ((n >= -0x80000000) && (n < 0x80000000))
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  1192
#endif
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1193
                        {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1194
                            *slp = n;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1195
                            RETURN ( anObject );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1196
                        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1197
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1198
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1199
                break;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1200
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1201
            case __MASKSMALLINT(LONGARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1202
                if ((unsigned)indx < (nbytes>>2)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1203
                    unsigned int32 *lp;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1204
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1205
                    lp = (unsigned int32 *)(pFirst + (indx<<2));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1206
                    if (anObject == __mkSmallInteger(0)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1207
                        *lp = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1208
                        RETURN ( anObject );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1209
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1210
                    u = __longIntVal(anObject);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1211
                    /*
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1212
                     * zero means failure for an int larger than 4 bytes
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1213
                     * (would be a smallInteger)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1214
                     */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1215
                    if (u) {
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  1216
#if __POINTER_SIZE__ == 8
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1217
                        if (u <= 0xFFFFFFFF)
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  1218
#endif
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1219
                        {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1220
                            *lp = u;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1221
                            RETURN ( anObject );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1222
                        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1223
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1224
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1225
                break;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1226
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1227
            case __MASKSMALLINT(SLONGLONGARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1228
#ifdef __NEED_LONGLONG_ALIGN
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1229
                if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1230
                    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1231
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1232
                    pFirst += delta;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1233
                    nbytes -= delta;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1234
                }
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  1235
#endif
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1236
                if ((unsigned)indx < (nbytes>>3)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1237
                    __int64__ ll;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1238
                    __int64__ *sllp;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1239
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1240
                    sllp = (__int64__ *)(pFirst + (indx<<3));
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  1241
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  1242
#if __POINTER_SIZE__ == 8
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1243
                    if (__isSmallInteger(anObject)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1244
                        *sllp = __intVal(anObject);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1245
                        RETURN ( anObject );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1246
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1247
                    n = __signedLongIntVal(anObject);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1248
                    if (n) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1249
                        *sllp = n;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1250
                        RETURN ( anObject );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1251
                    }
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  1252
#else
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1253
                    if (anObject == __mkSmallInteger(0)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1254
                        ll.lo = ll.hi = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1255
                        *sllp = ll;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1256
                        RETURN ( anObject );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1257
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1258
                    if (__signedLong64IntVal(anObject, &ll)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1259
                        *sllp = ll;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1260
                        RETURN ( anObject );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1261
                    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1262
#endif
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1263
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1264
                break;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1265
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1266
            case __MASKSMALLINT(LONGLONGARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1267
#ifdef __NEED_LONGLONG_ALIGN
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1268
                if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1269
                    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1270
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1271
                    pFirst += delta;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1272
                    nbytes -= delta;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1273
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1274
#endif
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1275
                if ((unsigned)indx < (nbytes>>3)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1276
                    __uint64__ ll;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1277
                    __uint64__ *llp;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1278
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1279
                    llp = (__uint64__ *)(pFirst + (indx<<3));
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  1280
#if __POINTER_SIZE__ == 8
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1281
                    if (__isSmallInteger(anObject)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1282
                        *llp = __intVal(anObject);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1283
                        RETURN ( anObject );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1284
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1285
                    ll = __longIntVal(anObject);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1286
                    if (ll) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1287
                        *llp = ll;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1288
                        RETURN ( anObject );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1289
                    }
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  1290
#else
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1291
                    if (anObject == __mkSmallInteger(0)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1292
                        ll.lo = ll.hi = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1293
                        *llp = ll;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1294
                        RETURN ( anObject );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1295
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1296
                    if (__unsignedLong64IntVal(anObject, &ll)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1297
                        *llp = ll;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1298
                        RETURN ( anObject );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1299
                    }
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  1300
#endif
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1301
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1302
                break;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1303
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1304
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1305
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1306
    index isInteger ifFalse:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1307
        "
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1308
         the index should be an integer number
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1309
        "
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1310
        ^ self indexNotInteger:index
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1311
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1312
    (index between:1 and:self size) ifFalse:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1313
        "
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1314
         the index is less than 1 or greater than the size of the
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1315
         receiver collection
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1316
        "
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1317
        ^ self subscriptBoundsError:index
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1318
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1319
    (self class isFloatsOrDoubles) ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1320
        anObject isNumber ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1321
            ^ self basicAt:index put:(anObject asFloat)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1322
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1323
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1324
    anObject isInteger ifFalse:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1325
        "
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1326
         the object to put into the receiver collection
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1327
         should be an integer number
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1328
        "
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1329
        ^ self elementNotInteger
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1330
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1331
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1332
     the object to put into the receiver collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1333
     is not an instance of the expected element class,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1334
     or the value is  not within the elements valid range.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1335
    "
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  1336
    ^ self elementBoundsError:anObject
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1337
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1338
    "Modified: 19.4.1996 / 11:14:10 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1339
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1340
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1341
byteAt:index
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1342
    "return the byte at index.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1343
     This is only allowed for non-pointer indexed objects
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1344
     (i.e. byteArrays, wordArrays, floatArrays etc.).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1345
     The receivers indexed instvars are treated as an uninterpreted
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1346
     collection of bytes.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1347
     Only useful with binary storage."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1348
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1349
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1350
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1351
    REGISTER int indx;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1352
    int nIndex;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1353
    REGISTER OBJ slf;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1354
    REGISTER OBJ cls;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1355
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1356
    if (__isSmallInteger(index)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1357
        slf = self;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1358
        if (__isNonNilObject(slf)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1359
            unsigned char *pFirst;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1360
            int nIndex;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1361
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1362
            cls = __qClass(slf);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1363
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1364
            pFirst = __byteArrayVal(slf);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1365
            pFirst += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1366
            nIndex = __byteArraySize(slf);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1367
            indx = __intVal(index) - 1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1368
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1369
            switch ((INT)(__ClassInstPtr(cls)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1370
                case __MASKSMALLINT(DOUBLEARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1371
#ifdef __NEED_DOUBLE_ALIGN
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1372
                    if ((INT)pFirst & (__DOUBLE_ALIGN-1)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1373
                        int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1374
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1375
                        pFirst += delta;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1376
                        nIndex -= delta;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1377
                    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1378
#endif
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1379
                    /* fall into */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1380
                case __MASKSMALLINT(BYTEARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1381
                case __MASKSMALLINT(WORDARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1382
                case __MASKSMALLINT(LONGARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1383
                case __MASKSMALLINT(SWORDARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1384
                case __MASKSMALLINT(SLONGARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1385
                case __MASKSMALLINT(FLOATARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1386
                    if ((unsigned)indx < (unsigned)nIndex) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1387
                        RETURN ( __mkSmallInteger( (INT)(pFirst[indx])) );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1388
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1389
                    break;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1390
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1391
                case __MASKSMALLINT(LONGLONGARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1392
                case __MASKSMALLINT(SLONGLONGARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1393
#ifdef __NEED_LONGLONG_ALIGN
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1394
                    if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1395
                        int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1396
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1397
                        pFirst += delta;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1398
                        nIndex -= delta;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1399
                    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1400
#endif
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1401
                    if ((unsigned)indx < (unsigned)nIndex) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1402
                        RETURN ( __mkSmallInteger( (INT)(pFirst[indx])) );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1403
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1404
                    break;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1405
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1406
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1407
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1408
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1409
    "/ index not integer or index out of range
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1410
    "/ or non-byte indexable receiver
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1411
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1412
    ^ self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1413
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1414
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1415
     Point new byteAt:1
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1416
     (ByteArray with:1 with:2) byteAt:2
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1417
     (WordArray with:1) byteAt:1
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1418
     (FloatArray with:1.0) byteAt:2
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1419
     'hello' byteAt:1
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1420
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1421
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1422
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1423
byteAt:index put:byteValue
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1424
    "set the byte at index.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1425
     This is only allowed for non-pointer indexed objects
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1426
     (i.e. byteArrays, wordArrays, floatArrays etc.).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1427
     The receivers indexed instvars are treated as an uninterpreted
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1428
     collection of bytes.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1429
     Only useful with binary storage."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1430
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1431
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1432
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1433
    REGISTER int indx;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1434
    int val, nIndex;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1435
    REGISTER OBJ slf;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1436
    REGISTER OBJ cls;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1437
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1438
    if (__bothSmallInteger(index, byteValue)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1439
        val = __intVal(byteValue);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1440
        if ((unsigned)(val) <= 0xFF /* i.e. (val >= 0) && (val <= 255) */) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1441
            slf = self;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1442
            if (__isNonNilObject(slf)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1443
                cls = __qClass(slf);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1444
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1445
                indx = __intVal(index) - 1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1446
                switch ((INT)(__ClassInstPtr(cls)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1447
                    case __MASKSMALLINT(BYTEARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1448
                    case __MASKSMALLINT(WORDARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1449
                    case __MASKSMALLINT(LONGARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1450
                    case __MASKSMALLINT(SWORDARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1451
                    case __MASKSMALLINT(SLONGARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1452
                    case __MASKSMALLINT(LONGLONGARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1453
                    case __MASKSMALLINT(SLONGLONGARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1454
                    case __MASKSMALLINT(FLOATARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1455
                    case __MASKSMALLINT(DOUBLEARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1456
                        indx += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1457
                        nIndex = __byteArraySize(slf);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1458
                        if ((unsigned)indx < (unsigned)nIndex) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1459
                            __ByteArrayInstPtr(slf)->ba_element[indx] = val;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1460
                            RETURN ( byteValue );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1461
                        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1462
                        break;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1463
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1464
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1465
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1466
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1467
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1468
    "/ index not integer or index out of range
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1469
    "/ or non-byte indexable receiver
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1470
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1471
    ^ self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1472
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1473
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1474
     (ByteArray with:1 with:2) byteAt:2 put:3; yourself
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1475
     'hello' copy byteAt:1 put:105; yourself
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1476
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1477
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1478
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1479
instVarAt:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1480
    "return a non-indexed instance variable;
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1481
     peeking into an object this way is not very object oriented
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1482
     - use with care (needed for copy, inspector etc.)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1483
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1484
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1485
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1486
    OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1487
    int idx, ninstvars;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1488
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1489
    if (__isSmallInteger(index)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1490
        myClass = __Class(self);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1491
        idx = __intVal(index) - 1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1492
        /*
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1493
         * do not allow returning of non-object fields.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1494
         * if subclass did not make provisions for that,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1495
         * we won't do so here ...
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1496
         */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1497
        if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1498
            if (idx == 0) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1499
                RETURN ( nil )
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1500
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1501
        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1502
        ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1503
        if ((idx >= 0) && (idx < ninstvars)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1504
            RETURN ( __InstPtr(self)->i_instvars[idx] );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1505
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1506
    }
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  1507
%}.
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  1508
    ^ self indexNotIntegerOrOutOfBounds:index
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1509
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1510
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1511
instVarAt:index put:value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1512
    "change a non-indexed instance variable;
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1513
     peeking into an object this way is not very object oriented
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1514
     - use with care (needed for copy, inspector etc.)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1515
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1516
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1517
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1518
    OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1519
    int idx, ninstvars;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1520
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1521
    if (__isSmallInteger(index)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1522
        myClass = __Class(self);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1523
        idx = __intVal(index) - 1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1524
        ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1525
        /*
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1526
         * do not allow setting of non-object fields.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1527
         * if subclass did not make provisions for that,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1528
         * we won't do so here ...
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1529
         */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1530
        if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1531
            if (idx == 0) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1532
                RETURN ( nil )
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1533
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1534
        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1535
        if ((idx >= 0) && (idx < ninstvars)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1536
            __InstPtr(self)->i_instvars[idx] = value;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1537
            __STORE(self, value);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1538
            RETURN ( value );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1539
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1540
    }
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  1541
%}.
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  1542
    ^ self indexNotIntegerOrOutOfBounds:index
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1543
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1544
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1545
instVarNamed:name
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1546
    "return a non-indexed instance variables value by name;
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1547
     peeking into an object this way is not very object oriented
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1548
     - use with care if at all (provided for inspectors and memory usage monitor).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1549
     Notice, this access is very slow (because the classes instVar-description has to be
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1550
     parsed ad runtime)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1551
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1552
    |idx|
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1553
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1554
    idx := self class instVarOffsetOf:name.
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1555
    idx isNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1556
        ^ self errorKeyNotFound:name.
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  1557
    ].
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1558
    ^ self instVarAt:idx.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1559
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1560
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1561
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1562
     |p|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1563
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1564
     p := Point x:10 y:20.
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1565
     p instVarNamed:'cx'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1566
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1567
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1568
    "Modified: 19.4.1996 / 11:12:39 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1569
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1570
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1571
instVarNamed:name ifAbsent:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1572
    "return a non-indexed instance variables value by name,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1573
     or the value of exceptionBlock, if there is no such instance variable.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1574
     peeking into an object this way is not very object oriented
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1575
     - use with care if at all (provided for inspectors and memory usage monitor).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1576
     Notice, this access is very slow (because the classes instVar-description has to be
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1577
     parsed ad runtime)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1578
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1579
    |idx|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1580
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1581
    idx := self class instVarOffsetOf:name.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1582
    idx isNil ifTrue:[^ exceptionBlock value].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1583
    ^ self instVarAt:idx
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1584
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1585
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1586
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1587
     |p|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1588
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1589
     p := Point x:10 y:20.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1590
     p instVarNamed:'x'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1591
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1592
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1593
    "Created: 6.7.1996 / 23:02:49 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1594
    "Modified: 6.7.1996 / 23:03:41 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1595
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1596
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1597
instVarNamed:name put:value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1598
    "set a non-indexed instance variable by name;
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1599
     peeking into an object this way is not very object oriented
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1600
     - if at all, use with care (provided for protocol completeness).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1601
     Notice, this access is very slow (because the classes instVar-description has to be
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1602
     parsed ad runtime)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1603
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1604
    |idx|
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1605
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1606
    idx := self class instVarOffsetOf:name.
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1607
    idx isNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1608
        ^ self errorKeyNotFound:name.
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  1609
    ].
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1610
    ^ self instVarAt:idx put:value.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1611
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1612
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1613
     |p|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1614
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1615
     p := Point x:10 y:20.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1616
     p instVarNamed:'x' put:30.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1617
     p
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1618
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1619
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1620
    "Modified: 19.4.1996 / 11:12:49 / cg"
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1621
!
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1622
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1623
instVarNamed:name put:anObject ifAbsent:exceptionBlock
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1624
    "return a non-indexed instance variables value by name,
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1625
     or the value of exceptionBlock, if there is no such instance variable.
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1626
     peeking into an object this way is not very object oriented
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1627
     - use with care if at all (provided for inspectors and memory usage monitor).
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1628
     Notice, this access is very slow (because the classes instVar-description has to be
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1629
     parsed ad runtime)"
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1630
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1631
    |idx|
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1632
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1633
    idx := self class instVarOffsetOf:name.
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1634
    idx isNil ifTrue:[^ exceptionBlock value].
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1635
    ^ self instVarAt:idx put:anObject.
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1636
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1637
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1638
    "
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1639
     |p|
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1640
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1641
     p := Point x:10 y:20.
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1642
     p instVarNamed:'x' put:4711 ifAbsent:[self halt:'no such instvar'].
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1643
     p instVarNamed:'bla' put:4712 ifAbsent:[self halt:'no such instvar'].
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1644
     p inspect.
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1645
    "
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1646
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1647
    "Created: 6.7.1996 / 23:02:49 / cg"
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1648
    "Modified: 6.7.1996 / 23:03:41 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1649
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1650
15193
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
  1651
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1652
!Object methodsFor:'attributes access'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1653
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1654
objectAttributeAt:attributeKey
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1655
    "return the attribute for a given key or nil if not found"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1656
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1657
    | attrs |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1658
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1659
    attrs := self objectAttributes.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1660
    (attrs notNil and:[attrs size > 0]) ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1661
        ^ attrs at:attributeKey ifAbsent:[]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1662
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1663
    ^ nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1664
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1665
    "Created: / 22.1.1998 / 21:29:17 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1666
    "Modified: / 3.2.1998 / 18:55:55 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1667
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1668
6323
9dbabd4270d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6321
diff changeset
  1669
objectAttributeAt:attributeKey put:anObject
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1670
    "store the attribute anObject referenced by key into the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1671
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1672
    "/ must do this save from interrupts, since the attributes collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1673
    "/ is possibly accessed from multiple threads ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1674
    [
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1675
        | attrs |
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1676
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1677
        attrs := self objectAttributes.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1678
        (attrs isNil or:[attrs size == 0]) ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1679
            attrs := WeakIdentityDictionary new.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1680
            attrs at:attributeKey put:anObject.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1681
            self objectAttributes:attrs.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1682
        ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1683
            attrs at:attributeKey put:anObject.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1684
        ].
6323
9dbabd4270d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6321
diff changeset
  1685
    ] valueUninterruptably
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1686
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1687
    "Attaching additional attributes (slots) to an arbitrary object:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1688
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1689
     |p|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1690
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1691
     p := Point new.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1692
     p objectAttributeAt:#color put:#green.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1693
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1694
     p objectAttributeAt:#color
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1695
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1696
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1697
    "Created: / 22.1.1998 / 21:29:25 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1698
    "Modified: / 3.2.1998 / 18:57:58 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1699
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1700
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1701
objectAttributes
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1702
    "return a Collection of attributes - nil if there is none.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1703
     The default implementation here uses a global WeakDictionary to store
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1704
     attributes
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1705
     This may be too slow for high frequency slot access,
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  1706
     therefore, some classes may redefine this for better performnce.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1707
     Notice the mentioning of a WeakDictionary - read the classes documentation."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1708
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1709
    ^ ObjectAttributes at:self ifAbsent:[nil]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1710
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1711
    "Created: / 22.1.1998 / 21:29:30 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1712
    "Modified: / 18.2.2000 / 11:34:16 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1713
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1714
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1715
objectAttributes:aCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1716
    "set the collection of attributes.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1717
     The default implementation here uses a global Dictionary to store
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1718
     attributes which may be too slow for high frequency change&update.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1719
     Therefore, some classes may redefine this for better performance."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1720
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1721
    "/ must do this save from interrupts, since the attributes collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1722
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1723
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1724
    (OperatingSystem blockInterrupts) ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1725
        "/ the common case - already blocked
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1726
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1727
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1728
            ObjectAttributes removeKey:self ifAbsent:nil
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1729
        ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1730
            ObjectAttributes at:self put:aCollection
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1731
        ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1732
        ^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1733
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1734
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1735
    [
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1736
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1737
            ObjectAttributes removeKey:self ifAbsent:nil
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1738
        ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1739
            ObjectAttributes at:self put:aCollection
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1740
        ].
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  1741
    ] ensure:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1742
        OperatingSystem unblockInterrupts
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1743
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1744
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1745
    "Created: / 22.1.1998 / 21:29:35 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1746
    "Modified: / 3.2.1998 / 18:58:10 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1747
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1748
6323
9dbabd4270d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6321
diff changeset
  1749
removeObjectAttribute:attributeKey
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1750
    "make the argument, anObject be no attribute of the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1751
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1752
    "/ must do this save from interrupts, since the attributes collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1753
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1754
    [
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1755
        |attrs n a|
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1756
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1757
        attrs := self objectAttributes.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1758
        attrs notNil ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1759
            attrs size == 0 ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1760
                self objectAttributes:nil
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1761
            ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1762
                attrs removeKey:attributeKey ifAbsent:nil.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1763
                attrs size == 0 ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1764
                    self objectAttributes:nil
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1765
                ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1766
            ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1767
        ]
6323
9dbabd4270d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6321
diff changeset
  1768
    ] valueUninterruptably
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1769
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1770
    "Created: / 22.1.1998 / 21:29:39 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1771
    "Modified: / 18.2.2000 / 11:32:19 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1772
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1773
13500
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  1774
15193
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
  1775
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1776
!Object methodsFor:'change & update'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1777
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1778
broadcast:aSelectorSymbol
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1779
    "send a message with selector aSelectorSymbol to all my dependents"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1780
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1781
    self dependentsDo:[:dependent |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1782
        dependent perform:aSelectorSymbol
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1783
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1784
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1785
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1786
broadcast:aSelectorSymbol with:anArgument
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1787
    "send a message with selector aSelectorSymbol with an additional
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1788
     argument anArgument to all my dependents."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1789
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1790
    self dependentsDo:[:dependent |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1791
        dependent perform:aSelectorSymbol with:anArgument
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1792
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1793
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1794
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1795
changeRequest
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1796
    "the receiver wants to change - check if all dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1797
     grant the request, and return true if so"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1798
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1799
    self dependentsDo:[:dependent |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1800
        dependent updateRequest ifFalse:[^ false].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1801
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1802
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1803
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1804
11551
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1805
changeRequest:aSymbol
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1806
    "the receiver wants to change - check if all dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1807
     grant the request, and return true if so"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1808
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1809
    self dependentsDo:[:dependent |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1810
        (dependent updateRequest:aSymbol) ifFalse:[^ false].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1811
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1812
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1813
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1814
11551
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1815
changeRequest:aSymbol from:anObject
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1816
    "the receiver wants to change - check if all dependents
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1817
     except anObject grant the request, and return true if so.
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1818
     The argument anObject is typically going to be the one who is
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1819
     about to send the change request."
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1820
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1821
    ^ self changeRequest:aSymbol with:nil from:anObject
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1822
!
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1823
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1824
changeRequest:aSymbol with:aParameter
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1825
    "the receiver wants to change - check if all dependents
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1826
     grant the request, and return true if so"
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1827
11573
cc09bff8a992 *** empty log message ***
ca
parents: 11551
diff changeset
  1828
    ^ self changeRequest:aSymbol with:aParameter from:self
11551
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1829
!
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1830
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1831
changeRequest:aSymbol with:aParameter from:anObject
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1832
    "the receiver wants to change - check if all dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1833
     except anObject grant the request, and return true if so.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1834
     The argument anObject is typically going to be the one who is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1835
     about to send the change request."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1836
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1837
    self dependentsDo:[:dependent |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1838
        dependent == anObject ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1839
            (dependent updateRequest:aSymbol with:aParameter from:anObject) ifFalse:[^ false].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1840
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1841
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1842
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1843
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1844
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1845
changeRequestFrom:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1846
    "the receiver wants to change - check if all dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1847
     except anObject grant the request, and return true if so.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1848
     The argument anObject is typically going to be the one who is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1849
     about to send the change request."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1850
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1851
    self dependentsDo:[:dependent |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1852
        dependent == anObject ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1853
            (dependent updateRequest) ifFalse:[^ false].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1854
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1855
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1856
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1857
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1858
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1859
changed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1860
    "notify all dependents that the receiver has changed.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1861
     Each dependent gets a '#update:'-message with the original
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1862
     receiver as argument."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1863
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1864
    self changed:nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1865
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1866
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1867
changed:aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1868
    "notify all dependents that the receiver has changed somehow.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1869
     Each dependent gets a '#update:'-message with aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1870
     as argument."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1871
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1872
    self changed:aParameter with:nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1873
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1874
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1875
changed:aParameter with:anArgument
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1876
    "notify all dependents that the receiver has changed somehow.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1877
     Each dependent gets a  '#update:with:from:'-message, with aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1878
     and anArgument as arguments."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1879
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1880
    self dependentsDo:[:dependent |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1881
        dependent update:aParameter with:anArgument from:self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1882
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1883
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1884
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1885
update:aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1886
    "the message is sent to a dependent, when one of the objects
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1887
     on whom the receiver depends, has changed. The argument aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1888
     is either the changed object or the argument to the #changed: message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1889
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1890
     Default behavior here is to do nothing"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1891
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1892
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1893
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1894
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1895
update:aParameter with:anArgument
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1896
    "dependent is notified of some change -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1897
     Default is to try update:"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1898
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1899
    ^ self update:aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1900
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1901
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1902
update:aParameter with:anArgument from:sender
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1903
    "dependent is notified of some change -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1904
     Default is to try update:with:"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1905
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1906
    ^ self update:aParameter with:anArgument
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1907
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1908
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1909
updateRequest
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1910
    "return true, if an update request is granted.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1911
     Default here is to grant updates - may be used
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1912
     to lock updates if someone is making other changes
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1913
     from within an update. Or if someone has locked its
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1914
     state and does not want others to change things.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1915
     However, these dependents must all honor the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1916
     changeRequest - ifTrue - change protocol. I.e. they
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1917
     must first ask all others via changeRequest, and only do the change
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1918
     it returns true. The others must decide in updateRequest and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1919
     return true if they think a change is ok."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1920
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1921
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1922
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1923
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1924
updateRequest:aSymbol
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1925
    "return true, if an update request is granted.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1926
     Default here a simple updateRequest"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1927
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1928
    ^ self updateRequest
7177
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  1929
!
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  1930
11551
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1931
updateRequest:aSymbol with:aParameter
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1932
    "return true, if an update request is granted.
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1933
     Default here a simple updateRequest"
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1934
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1935
    ^ self updateRequest:aSymbol
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1936
!
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1937
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1938
updateRequest:aSymbol with:aParameter from:sender
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1939
    "return true, if an update request is granted.
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1940
     Default here a simple updateRequest"
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1941
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1942
    ^ self updateRequest:aSymbol with:aParameter
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1943
!
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1944
7177
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  1945
withoutUpdating:someone do:aBlock
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  1946
    "evaluate a block but remove someone from my dependents temporarily"
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  1947
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  1948
    (self dependents includesIdentical:someone)
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  1949
    ifFalse:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1950
        ^ aBlock value.
7177
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  1951
    ].
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  1952
    self removeDependent:someone.
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  1953
    ^ aBlock ensure:[ self addDependent:someone ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1954
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1955
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1956
!Object methodsFor:'cleanup'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1957
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1958
lowSpaceCleanup
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1959
    "ignored here - redefined in some classes to
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1960
     cleanup in low-memory situations"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1961
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1962
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1963
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1964
15193
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
  1965
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1966
!Object methodsFor:'comparing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1967
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1968
= anObject
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1969
    "return true, if the receiver and the arg have the same structure.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1970
     Notice:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1971
        This method is partially open coded (inlined) by the compiler(s)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1972
        identical objects are always considered equal.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1973
        redefining it may not work as expected."
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1974
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1975
    ^ self == anObject
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1976
!
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1977
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1978
== anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1979
    "return true, if the receiver and the arg are the same object.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1980
     Never redefine this in any class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1981
     Notice:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1982
        This method is open coded (inlined) by the compiler(s)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  1983
        - redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1984
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1985
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1986
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1987
    RETURN ( (self == anObject) ? true : false );
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1988
%}
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1989
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1990
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1991
deepSameContentsAs:anObject
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1992
    "return true, if the receiver and the arg have the same contents
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1993
     in both the named instance vars and any indexed instVars.
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1994
     This method descends into referenced objects, where #sameContentsAs: does not descend"
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1995
5821
c11bb6c8cc8f Cleanup unused method vars
Stefan Vogel <sv@exept.de>
parents: 5814
diff changeset
  1996
    |myClass val
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1997
     sz "{ Class: SmallInteger }" |
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1998
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1999
    myClass := self class.
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2000
    myClass isVariable ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2001
        sz := self basicSize.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2002
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2003
        "compare the indexed variables"
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2004
        1 to:sz do:[:i |
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2005
            val := self basicAt:i.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2006
            val isLiteral ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2007
                val = (anObject basicAt:i) ifFalse:[^ false].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2008
            ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2009
                (val deepSameContentsAs:(anObject basicAt:i)) ifFalse:[^ false].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2010
            ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2011
        ]
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2012
    ].
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2013
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2014
    "compare the instance variables"
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2015
    sz := myClass instSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2016
    1 to:sz do:[:i |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2017
        val := self instVarAt:i.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2018
        val isLiteral ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2019
            val = (anObject instVarAt:i) ifFalse:[^ false].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2020
        ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2021
            (val deepSameContentsAs:(anObject instVarAt:i)) ifFalse:[^ false].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2022
        ]
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2023
    ].
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2024
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2025
    ^ true
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2026
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2027
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2028
     #(1 2 3 4) deepSameContentsAs:#[1 2 3 4] asArray
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2029
     (1@2) deepSameContentsAs:(1->2)
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2030
    "
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2031
!
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2032
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2033
hash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2034
    "return an Integer useful as a hash key for the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2035
     This hash should return same values for objects with same
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2036
     contents (i.e. use this to hash on structure)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2037
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2038
    ^ self identityHash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2039
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2040
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2041
identityHash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2042
    "return an Integer useful as a hash key for the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2043
     This hash should return same values for the same object (i.e. use
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2044
     this to hash on identity of objects).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2045
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2046
     We cannot use the Objects address (as other smalltalks do) since
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2047
     no object-table exists and the hashval must not change when objects
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2048
     are moved by the collector. Therefore we assign each object a unique
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2049
     Id in the object header itself as its hashed upon.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2050
     (luckily we have 11 bits spare to do this - unluckily its only 11 bits).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2051
     Time will show, if 11 bits are enough; if not, another entry in the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2052
     object header will be needed, adding 4 bytes to every object. Alternatively,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2053
     hashed-upon objects could add an instvar containing the hash value."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2054
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2055
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2056
5806
a7361ebe686a avoid warnings on alpha (int-size)
Claus Gittinger <cg@exept.de>
parents: 5769
diff changeset
  2057
    REGISTER unsigned INT hash;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2058
    static unsigned nextHash = 0;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2059
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2060
    if (__isNonNilObject(self)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2061
        hash = __GET_HASH(self);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2062
        if (hash == 0) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2063
            /* has no hash yet */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2064
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2065
            if (++nextHash > __MAX_HASH__) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2066
                nextHash = 1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2067
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2068
            hash = nextHash;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2069
            __SET_HASH(self, hash);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2070
        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2071
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2072
        /*
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2073
         * now, we got 11 bits for hashing;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2074
         * make it as large as possible; since most hashers use the returned
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2075
         * key and take it modulo some prime number, this will allow for
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2076
         * better distribution (i.e. bigger empty spaces) in hashed collection.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2077
         */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2078
        hash = __MAKE_HASH__(hash);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2079
        RETURN ( __mkSmallInteger(hash) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2080
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2081
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2082
    ^ 0 "never reached, since redefined in UndefinedObject and SmallInteger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2083
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2084
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2085
identityHashForBinaryStore
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2086
    "hash which is usable if the object does not change its class
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2087
     and does not #become something else, while the hash is used.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2088
     This is only used by the binary storage mechanism, during the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2089
     object writing phase."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2090
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2091
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2092
5806
a7361ebe686a avoid warnings on alpha (int-size)
Claus Gittinger <cg@exept.de>
parents: 5769
diff changeset
  2093
    REGISTER unsigned INT hash, hash1, hash2, sz;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2094
    OBJ o;
5806
a7361ebe686a avoid warnings on alpha (int-size)
Claus Gittinger <cg@exept.de>
parents: 5769
diff changeset
  2095
    static unsigned INT nextHash = 0;
a7361ebe686a avoid warnings on alpha (int-size)
Claus Gittinger <cg@exept.de>
parents: 5769
diff changeset
  2096
    static unsigned INT nextClassHash = 0;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2097
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2098
    if (__isNonNilObject(self)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2099
        /*
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2100
         * my own identityHash
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2101
         */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2102
        hash1 = __GET_HASH(self);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2103
        if (hash1 == 0) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2104
            /* has no hash yet */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2105
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2106
            if (++nextHash > __MAX_HASH__) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2107
                nextHash = 1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2108
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2109
            hash1 = nextHash;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2110
            __SET_HASH(self, hash1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2111
        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2112
        /*
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2113
         * my classes identityHash
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2114
         */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2115
        o = __qClass(self);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2116
        hash2 = __GET_HASH(o);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2117
        if (hash2 == 0) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2118
            /* has no hash yet */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2119
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2120
            if (++nextClassHash > __MAX_HASH__) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2121
                nextClassHash = 1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2122
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2123
            hash2 = nextClassHash;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2124
            __SET_HASH(o, hash2);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2125
        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2126
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2127
        /*
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2128
         * some bits of my size
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2129
         */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2130
        sz = __qSize(self);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2131
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2132
        /*
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2133
         * now, we got 11 + 11 + 8 bits for hashing;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2134
         * make it as large as possible; since most hashers use the returned
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2135
         * key and take it modulo some prime number, this will allow for
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2136
         * better distribution (i.e. bigger empty spaces) in hashed collection.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2137
         */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2138
        hash = (hash1 << 11) | hash2;           /* 22 bits */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2139
        hash = (hash << 8) | (sz & 0xFC);       /* 30 bits */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2140
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2141
        while ((hash & 0x20000000) == 0) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2142
            hash <<= 1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2143
        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2144
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2145
        RETURN ( __mkSmallInteger(hash) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2146
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2147
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2148
    "never reached, since UndefinedObject and SmallInteger are not hashed upon in binary storage"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2149
    ^ self identityHash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2150
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2151
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2152
sameContentsAs:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2153
    "return true, if the receiver and the arg have the same contents
7121
5ce61b826f0e sameContentsAs: comment.
Claus Gittinger <cg@exept.de>
parents: 7112
diff changeset
  2154
     in both the named instance vars and any indexed instVars.
5ce61b826f0e sameContentsAs: comment.
Claus Gittinger <cg@exept.de>
parents: 7112
diff changeset
  2155
     The code here only checks if values present in the receiver are also
5ce61b826f0e sameContentsAs: comment.
Claus Gittinger <cg@exept.de>
parents: 7112
diff changeset
  2156
     present in the arg, not vice versa.
5ce61b826f0e sameContentsAs: comment.
Claus Gittinger <cg@exept.de>
parents: 7112
diff changeset
  2157
     I.e. the argument may be bigger and/or have more instance variables."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2158
5821
c11bb6c8cc8f Cleanup unused method vars
Stefan Vogel <sv@exept.de>
parents: 5814
diff changeset
  2159
    |myClass
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2160
     sz "{ Class: SmallInteger }" |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2161
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2162
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2163
    myClass isVariable ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2164
        sz := self basicSize.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2165
        anObject basicSize >= sz ifFalse:[^ false].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2166
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2167
        "compare the indexed variables"
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2168
        1 to:sz do:[:i |
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2169
            (self basicAt:i) == (anObject basicAt:i) ifFalse:[^ false].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2170
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2171
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2172
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2173
    "compare the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2174
    sz := myClass instSize.
12997
11e3305c4a0c changed: #sameContentsAs:
sr
parents: 12841
diff changeset
  2175
    anObject class instSize >= sz ifFalse:[^ false].
7121
5ce61b826f0e sameContentsAs: comment.
Claus Gittinger <cg@exept.de>
parents: 7112
diff changeset
  2176
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2177
    1 to:sz do:[:i |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2178
        (self instVarAt:i) == (anObject instVarAt:i) ifFalse:[^ false].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2179
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2180
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2181
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2182
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2183
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2184
     #(1 2 3 4) sameContentsAs:#[1 2 3 4] asArray
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2185
     (1@2) sameContentsAs:(1->2)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2186
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2187
12997
11e3305c4a0c changed: #sameContentsAs:
sr
parents: 12841
diff changeset
  2188
    "Created: / 21-04-1998 / 15:56:40 / cg"
11e3305c4a0c changed: #sameContentsAs:
sr
parents: 12841
diff changeset
  2189
    "Modified: / 05-08-2010 / 16:44:09 / sr"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2190
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2191
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2192
~= anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2193
    "return true, if the receiver and the arg do not have the same structure.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2194
     Notice:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2195
        This method is partially open coded (inlined) by the compiler(s)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2196
        identical objects are never considered unequal.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2197
        redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2198
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2199
    ^ (self = anObject) not
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2200
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2201
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2202
~~ anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2203
    "return true, if the receiver and the arg are not the same object.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2204
     Never redefine this in any class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2205
     Notice:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2206
        This method is open coded (inlined) by the compiler(s)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2207
        - redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2208
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2209
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2210
    RETURN ( (self == anObject) ? false : true );
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2211
%}
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2212
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2213
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2214
!Object methodsFor:'converting'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2215
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2216
-> anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2217
    "return an association with the receiver as key and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2218
     the argument as value"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2219
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2220
    ^ Association key:self value:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2221
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2222
10062
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2223
as:aSimilarClass
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2224
    "If the receivers class is not aSimilarClass,
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2225
     create and return an object of class aSimilarClass that has the same contents
10062
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2226
     as the receiver.
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2227
     Otherwise, return the receiver."
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2228
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2229
    self class == aSimilarClass ifTrue:[^ self].
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2230
    ^ aSimilarClass newFrom:self
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2231
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2232
    "
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2233
     #[1 2 3 4] as:ByteArray
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2234
     #[1 2 3 4] as:Array
10539
05541b0358c2 changed #as: comment
Stefan Vogel <sv@exept.de>
parents: 10532
diff changeset
  2235
     #[81 82 83 84] as:String
05541b0358c2 changed #as: comment
Stefan Vogel <sv@exept.de>
parents: 10532
diff changeset
  2236
     #[81 82 83 84] as:Symbol
10062
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2237
    "
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2238
!
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2239
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2240
asCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2241
    "return myself as a Collection.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2242
     Redefined in collection to return themself."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2243
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2244
    ^ Array with:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2245
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2246
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2247
asSequenceableCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2248
    "return myself as a SequenceableCollection.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2249
     Redefined in SequenceableCollection"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2250
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2251
    ^ Array with:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2252
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2253
14355
b5ed6aa393f7 added: #asUnicode16String
Stefan Vogel <sv@exept.de>
parents: 14296
diff changeset
  2254
asString
b5ed6aa393f7 added: #asUnicode16String
Stefan Vogel <sv@exept.de>
parents: 14296
diff changeset
  2255
    ^ self printString
b5ed6aa393f7 added: #asUnicode16String
Stefan Vogel <sv@exept.de>
parents: 14296
diff changeset
  2256
!
b5ed6aa393f7 added: #asUnicode16String
Stefan Vogel <sv@exept.de>
parents: 14296
diff changeset
  2257
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2258
asValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2259
    "return a valueHolder for for the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2260
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2261
    ^ ValueHolder with:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2262
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2263
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2264
!Object methodsFor:'copying'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2265
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2266
cloneFrom:anObject
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2267
    "Helper for copy:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2268
     copy all instance variables from anObject into the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2269
     which should be of the same class as the argument."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2270
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2271
    self cloneFrom:anObject performing:#yourself
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2272
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2273
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2274
     |x|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2275
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2276
     x := Array new:3.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2277
     x cloneFrom:#(1 2 3).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2278
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2279
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2280
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2281
cloneFrom:anObject performing:aSymbol
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2282
    "Helper for copy:
8383
dea5311899c5 comments in copy methods
Claus Gittinger <cg@exept.de>
parents: 8377
diff changeset
  2283
     for each instance variable from anObject, send it aSymbol
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2284
     and store the result into the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2285
     which should be of the same class as the argument."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2286
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2287
    |myClass sz "{ Class: SmallInteger }" t |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2288
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2289
    myClass := self class.
14532
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2290
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2291
    "process the named instance variables"
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2292
    sz := myClass instSize.
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2293
    1 to:sz do:[:i |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2294
        t := anObject instVarAt:i.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2295
        aSymbol ~~ #yourself ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2296
            t := t perform:aSymbol
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2297
        ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2298
        self instVarAt:i put:t
14532
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2299
    ].
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2300
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2301
    myClass isVariable ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2302
        sz := self basicSize.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2303
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2304
        "process the indexed instance variables"
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2305
        1 to:sz do:[:i |
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2306
            t := anObject basicAt:i.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2307
            aSymbol ~~ #yourself ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2308
                t := t perform:aSymbol.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2309
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2310
            self basicAt:i put:t.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2311
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2312
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2313
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2314
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2315
cloneInstanceVariablesFrom:aPrototype
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2316
    "Shallow copy variables from a prototype into myself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2317
     This copies instVars by name - i.e. same-named variables are
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2318
     copied, others are not.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2319
     The variable slots are copied as available
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2320
     (i.e. the min of both indexed sizes is used)."
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2321
14676
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2322
    |myClass prototypesClass myInfo prototypesInfo|
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2323
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2324
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2325
    myClass := self class.
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2326
    prototypesClass := aPrototype class.
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2327
    (myClass == prototypesClass
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2328
    or:[ myClass isSubclassOf:prototypesClass ]) ifTrue:[
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2329
        "/ can do better, if my class is a subclass of the prototype's class
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2330
        1 to: prototypesClass instSize do:[:index |
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2331
            self instVarAt:index put:(aPrototype instVarAt:index)
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2332
        ]
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2333
    ] ifFalse:[
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2334
        "/ map instvars by name
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2335
        myInfo := myClass instanceVariableOffsets.
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2336
        prototypesInfo := prototypesClass instanceVariableOffsets.
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2337
        myInfo keysAndValuesDo:[:name :index | |varIndexAssoc|
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2338
            varIndexAssoc := prototypesInfo at:name ifAbsent:[].
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2339
            varIndexAssoc notNil ifTrue:[
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2340
                self instVarAt:index put:(aPrototype instVarAt:(varIndexAssoc value))
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2341
            ]
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2342
        ]
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2343
    ].
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2344
    myClass isVariable ifTrue:[
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2345
        prototypesClass isVariable ifTrue:[
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2346
            1 to:(self basicSize min:aPrototype basicSize) do:[:index |
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2347
                self basicAt:index put:(aPrototype basicAt:index)
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2348
            ].
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2349
        ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2350
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2351
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2352
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2353
     Class withoutUpdatingChangesDo:[
14676
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2354
        |point3D|
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2355
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2356
        point3D := Point subclass:#Point3D
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2357
           instanceVariableNames:'z'
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2358
           classVariableNames:''
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2359
           poolDictionaries:''
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2360
           category:'testing'
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2361
           inEnvironment:nil.
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2362
         (point3D new cloneInstanceVariablesFrom:1@2) inspect.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2363
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2364
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2365
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2366
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2367
     Class withoutUpdatingChangesDo:[
14676
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2368
         Point variableSubclass:#Point3D_test
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2369
           instanceVariableNames:'z'
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2370
           classVariableNames:''
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2371
           poolDictionaries:''
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2372
           category:'testing'.
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2373
         (((Smalltalk at:#Point3D_test) new:2) cloneInstanceVariablesFrom:#(1 2 3)) inspect.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2374
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2375
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2376
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2377
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2378
     |someObject|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2379
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2380
     Class withoutUpdatingChangesDo:[
14676
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2381
         Object subclass:#TestClass1
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2382
           instanceVariableNames:'foo bar'
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2383
           classVariableNames:''
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2384
           poolDictionaries:''
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2385
           category:'testing'.
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2386
         someObject := TestClass1 new.
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2387
         someObject instVarAt:1 put:'foo'; instVarAt:2 put:'bar'.
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2388
         Object subclass:#TestClass2
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2389
           instanceVariableNames:'bar foo'
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2390
           classVariableNames:''
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2391
           poolDictionaries:''
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2392
           category:'testing'.
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2393
         (TestClass2 new cloneInstanceVariablesFrom:someObject) inspect.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2394
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2395
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2396
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2397
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2398
     |top b b1|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2399
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2400
     top := StandardSystemView new.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2401
     top extent:100@100.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2402
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2403
     b := Button in:top.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2404
     b label:'hello'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2405
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2406
     b1 := ArrowButton new cloneInstanceVariablesFrom:b.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2407
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2408
     top open.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2409
     b1 inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2410
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2411
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2412
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2413
copy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2414
    "return a copy of the receiver - defaults to shallowcopy here.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2415
     Notice, that copy does not copy dependents."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2416
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2417
    ^ self shallowCopy postCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2418
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2419
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2420
copyToLevel:level
6962
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2421
    "a controlled deepCopy, where the number of levels can be specified.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2422
     Notice:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2423
         This method DOES NOT handle cycles/self-refs and does NOT preserve object identity;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2424
         i.e. identical references in the source are copied multiple times into the copy."
6962
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2425
14534
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2426
    |newObject newLevel class sz "{Class: SmallInteger}" newInst|
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2427
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2428
    newObject := self copy.
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2429
    newObject == self ifTrue: [^ self].   "copy of nil, true, false, ... is self"
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2430
    level == 1 ifTrue:[^ newObject].
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2431
    newLevel := level - 1.
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2432
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2433
    class := newObject class.
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2434
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2435
    "process the named instance variables"
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2436
    sz := class instSize.
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2437
    1 to:sz do:[:i |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2438
        newInst := newObject instVarAt:i.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2439
        newInst notNil ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2440
            newObject instVarAt:i put:(newInst copyToLevel:newLevel).
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2441
        ].
14534
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2442
    ].
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2443
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2444
    class isVariable ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2445
        sz := newObject basicSize.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2446
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2447
        "process the indexed instance variables"
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2448
        1 to:sz do:[:i |
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2449
            newInst := newObject basicAt:i.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2450
            newInst notNil ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2451
                newObject basicAt:i put:(newInst copyToLevel:newLevel).
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2452
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2453
        ]
6962
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2454
    ].
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2455
    ^ newObject
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2456
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2457
    "
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2458
     |a b|
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2459
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2460
     a := #(
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2461
            '1.1'
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2462
            '1.2'
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2463
            '1.3'
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2464
            (
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2465
                '1.41'
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2466
                '1.42'
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2467
                '1.43'
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2468
                    (
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2469
                        '1.441'
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2470
                        '1.442'
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2471
                        '1.443'
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2472
                        ( '1.4441' '1.4442' '1.4443' )
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2473
                        '1.445'
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2474
                    )
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2475
                '1.45'
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2476
            )
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2477
            '1.5'
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2478
           ).
6962
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2479
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2480
      b := a copyToLevel:1.
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2481
      self assert: ( (a at:1) == (b at:1) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2482
      self assert: ( (a at:4) == (b at:4) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2483
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2484
      b := a copyToLevel:2.
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2485
      self assert: ( (a at:1) ~~ (b at:1) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2486
      self assert: ( (a at:4) ~~ (b at:4) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2487
      self assert: ( ((a at:4) at:1) == ((b at:4) at:1) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2488
      self assert: ( ((a at:4) at:4) == ((b at:4) at:4) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2489
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2490
      b := a copyToLevel:3.
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2491
      self assert: ( (a at:1) ~~ (b at:1) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2492
      self assert: ( (a at:4) ~~ (b at:4) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2493
      self assert: ( ((a at:4) at:1) ~~ ((b at:4) at:1) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2494
      self assert: ( ((a at:4) at:4) ~~ ((b at:4) at:4) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2495
      self assert: ( (((a at:4) at:4) at:1) == (((b at:4) at:4)at:1) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2496
      self assert: ( (((a at:4) at:4) at:4) == (((b at:4) at:4)at:4) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2497
    "
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2498
!
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2499
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2500
deepCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2501
    "return a copy of the object with all subobjects also copied.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2502
     This method DOES handle cycles/self-refs and preserves object identity;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2503
     however the receivers class is not copied (to avoid the 'total' copy).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2504
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2505
     This deepCopy is a bit slower than the old (unsecure) one, since it
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2506
     keeps track of already copied objects. If you are sure, that your
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2507
     copied object does not include duplicates (or you do not care) and
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2508
     no cycles are involved, you can use the old simpleDeepCopy,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2509
     which avoids this overhead (but may run into trouble).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2510
     Notice, that deepCopy does not copy dependents."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2511
8383
dea5311899c5 comments in copy methods
Claus Gittinger <cg@exept.de>
parents: 8377
diff changeset
  2512
    ^ self deepCopyUsing:(IdentityDictionary new)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2513
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2514
    "an example which is not handled by the old deepCopy:
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2515
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2516
     |a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2517
     a := Array new:3.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2518
     a at:3 put:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2519
     a deepCopy inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2520
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2521
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2522
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2523
     |a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2524
     a := Color black onDevice:Screen current.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2525
     a deepCopy inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2526
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2527
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2528
    "Modified: 27.3.1996 / 16:31:20 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2529
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2530
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2531
deepCopyError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2532
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2533
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2534
    "raise a signal, that deepCopy is not allowed for this object"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2535
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  2536
    ^ DeepCopyError raise
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2537
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2538
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2539
deepCopyUsing:aDictionary
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2540
    "a helper for deepCopy; return a copy of the object with
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2541
     all subobjects also copied. If the to-be-copied object is in the dictionary,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2542
     use the value found there. The class of the receiver is not copied.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2543
     This method DOES handle cycles/self references."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2544
10941
f80dfc67dc51 deepCopy change
ab
parents: 10922
diff changeset
  2545
    ^ self deepCopyUsing:aDictionary postCopySelector:#postDeepCopyFrom:.
f80dfc67dc51 deepCopy change
ab
parents: 10922
diff changeset
  2546
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2547
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2548
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2549
     |a b c copyOfC|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2550
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2551
     a := Array with:'hello' with:'world' with:nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2552
     b := 99 @ 999.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2553
     a at:3 put:b.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2554
     c := Array with:a with:b with:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2555
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2556
     Transcript showCR: (c at:1) == (c at:3).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2557
     copyOfC := c deepCopy.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2558
     Transcript showCR: (copyOfC at:1) == (copyOfC at:3)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2559
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2560
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2561
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2562
deepCopyUsing:aDictionary postCopySelector:postCopySelector
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  2563
    "a helper for deepCopy; return a copy of the object with
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  2564
     all subobjects also copied. If the to-be-copied object is in the dictionary,
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2565
     use the value found there. The class of the receiver is not copied.
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2566
     This method DOES handle cycles/self references."
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2567
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2568
    |myClass aCopy
14527
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2569
     basicSize "{ Class: SmallInteger }"
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2570
     instSize  "{ Class: SmallInteger }"
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2571
     iOrig iCopy|
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2572
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2573
    myClass := self class.
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2574
    myClass isVariable ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2575
        basicSize := self basicSize.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2576
        aCopy := myClass basicNew:basicSize.
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2577
    ] ifFalse:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2578
        basicSize := 0.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2579
        aCopy := myClass basicNew
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2580
    ].
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2581
    aCopy setHashFrom:self.
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2582
    aDictionary at:self put:aCopy.
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2583
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2584
    "
14527
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2585
     copy the instance variables
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2586
    "
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2587
    instSize := myClass instSize.
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2588
    1 to:instSize do:[:i |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2589
        (self skipInstvarIndexInDeepCopy:i) ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2590
            iOrig := self instVarAt:i.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2591
            iOrig notNil ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2592
                iCopy := aDictionary at:iOrig ifAbsent:nil.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2593
                iCopy isNil ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2594
                    iCopy := iOrig deepCopyUsing:aDictionary postCopySelector:postCopySelector
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2595
                ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2596
                aCopy instVarAt:i put:iCopy
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2597
            ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2598
        ]
14527
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2599
    ].
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2600
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2601
    "
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2602
     copy indexed instvars - if any
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2603
    "
14527
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2604
    basicSize ~~ 0 ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2605
        myClass isBits ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2606
            "block-copy indexed instvars"
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2607
            aCopy replaceFrom:1 to:basicSize with:self startingAt:1
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2608
        ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2609
            "individual deep copy the indexed variables"
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2610
            1 to:basicSize do:[:i |
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2611
                iOrig := self basicAt:i.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2612
                iOrig notNil ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2613
                    "/ used to be dict-includesKey-ifTrue[dict-at:],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2614
                    "/ changed to use dict-at:ifAbsent:, to avoid double lookup in dictionary
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2615
                    iCopy := aDictionary at:iOrig ifAbsent:nil.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2616
                    iCopy isNil ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2617
                        iCopy := iOrig deepCopyUsing:aDictionary postCopySelector:postCopySelector
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2618
                    ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2619
                    aCopy basicAt:i put:iCopy
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2620
                ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2621
            ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2622
        ]
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2623
    ].
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2624
13515
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2625
    aCopy perform:postCopySelector withOptionalArgument:self and:aDictionary.
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2626
    ^ aCopy
13515
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2627
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2628
    "Modified: / 21-07-2011 / 13:30:52 / cg"
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2629
!
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2630
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2631
postCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2632
    "this is for compatibility with ST-80 code, which uses postCopy for
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2633
     cleanup after copying, while ST/X passes the original in postCopyFrom:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2634
     (see there)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2635
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2636
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2637
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2638
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2639
postDeepCopy
8930
edd42af66c0a deepCopy should not invoke postCopy
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
  2640
    "allows for cleanup after deep copying.
edd42af66c0a deepCopy should not invoke postCopy
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
  2641
     To be redefined in subclasses."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2642
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2643
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2644
postDeepCopyFrom:aSource
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2645
    "allows for cleanup after deep copying"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2646
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2647
    ^ self postDeepCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2648
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2649
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2650
setHashFrom:anObject
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2651
    "set my identity-hash key to be the same as anObjects hash key.
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2652
     This is an ST/X speciality, which is NOT available in other (especially OT based)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2653
     Smalltalks, and may not be available in future ST/X versions.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2654
     DO NEVER use this for normal application code."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2655
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2656
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2657
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2658
    REGISTER unsigned h;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2659
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2660
    if (__isNonNilObject(self) && __isNonNilObject(anObject)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2661
        h = __GET_HASH(anObject);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2662
        __SET_HASH(self, h);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2663
        RETURN (self);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2664
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2665
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2666
    self primitiveFailed    "neither receiver not arg may be nil or SmallInteger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2667
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2668
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2669
shallowCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2670
    "return a copy of the object with shared subobjects (a shallow copy)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2671
     i.e. the copy shares referenced instvars with its original."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2672
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2673
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2674
    int ninsts, spc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2675
    int sz;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2676
    OBJ theCopy;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2677
    OBJ cls;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2678
    int flags;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2679
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2680
    cls = __qClass(self);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2681
    flags = __intVal(__ClassInstPtr(cls)->c_flags);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2682
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2683
    /*
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2684
     * bail out for special objects ..
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2685
     */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2686
    if (((flags & ~ARRAYMASK) == 0)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2687
     && ((flags & ARRAYMASK) != WKPOINTERARRAY)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2688
        sz = __qSize(self);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2689
        __PROTECT__(self);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2690
        __qNew(theCopy, sz);    /* OBJECT ALLOCATION */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2691
        __UNPROTECT__(self);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2692
        if (theCopy) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2693
            cls = __qClass(self);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2694
            spc = __qSpace(theCopy);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2695
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2696
            theCopy->o_class = cls; __STORE_SPC(theCopy, cls, spc);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2697
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2698
            sz = sz - OHDR_SIZE;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2699
            if (sz) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2700
                char *src, *dst;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2701
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2702
                src = (char *)(__InstPtr(self)->i_instvars);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2703
                dst = (char *)(__InstPtr(theCopy)->i_instvars);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2704
#ifdef bcopy4
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2705
                {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2706
                    /* care for odd-number of longs */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2707
                    int nW = sz >> 2;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2708
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2709
                    if (sz & 3) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2710
                        nW++;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2711
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2712
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2713
                    bcopy4(src, dst, nW);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2714
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2715
#else
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2716
                bcopy(src, dst, sz);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2717
#endif
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2718
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2719
                flags &= ARRAYMASK;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2720
                if (flags == POINTERARRAY) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2721
                    ninsts = __BYTES2OBJS__(sz);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2722
                } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2723
                    ninsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2724
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2725
                if (ninsts) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2726
                    do {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2727
                        OBJ el;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2728
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2729
                        el = __InstPtr(theCopy)->i_instvars[ninsts-1];
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2730
                        __STORE_SPC(theCopy, el, spc);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2731
                    } while (--ninsts);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2732
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2733
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2734
            RETURN (theCopy);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2735
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2736
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2737
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2738
    "/ fallBack for special objects & memoryAllocation failure case
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2739
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2740
    ^ self slowShallowCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2741
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2742
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2743
simpleDeepCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2744
    "return a copy of the object with all subobjects also copied.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2745
     This method does NOT handle cycles - but is included to allow this
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2746
     slightly faster copy in situations where it is known that
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2747
     no recursive references occur (LargeIntegers for example).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2748
     NOTICE: you will run into trouble, when trying this with recursive
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2749
     objects (usually recursionInterrupt or memory-alert).
8383
dea5311899c5 comments in copy methods
Claus Gittinger <cg@exept.de>
parents: 8377
diff changeset
  2750
     This method corresponds to the 'traditional' deepCopy found in the Blue book."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2751
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2752
    |myClass aCopy|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2753
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2754
    (myClass := self class) isVariable ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2755
        aCopy := myClass basicNew:(self basicSize).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2756
    ] ifFalse:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2757
        aCopy := myClass basicNew
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2758
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2759
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2760
    "copy the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2761
    aCopy cloneFrom:self performing:#simpleDeepCopy.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2762
    ^ aCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2763
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2764
    "a bad example (but ST/X should survive ...)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2765
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2766
     |a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2767
     a := Array new:3.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2768
     a at:3 put:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2769
     a simpleDeepCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2770
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2771
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2772
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2773
skipInstvarIndexInDeepCopy:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2774
    "a helper for deepCopy; only indices for which this method returns
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2775
     false are copied in a deep copy.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2776
     The default is false here - which means that everything is copied.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2777
     Can be redefined in subclasses for partial copies"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2778
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2779
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2780
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2781
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2782
slowShallowCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2783
    "return a copy of the object with shared subobjects (a shallow copy)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2784
     i.e. the copy shares referenced instvars with its original.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2785
     This method is only invoked as a fallback from #shallowCopy."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2786
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2787
    |myClass aCopy|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2788
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2789
    (myClass := self class) isVariable ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2790
        aCopy := myClass basicNew:(self basicSize).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2791
    ] ifFalse:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2792
        aCopy := myClass basicNew
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2793
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2794
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2795
    "copy the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2796
    aCopy cloneFrom:self performing:#yourself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2797
    ^ aCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2798
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2799
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2800
!Object methodsFor:'debugging'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2801
7621
42fb582ea36b allow for blocks in assert
Claus Gittinger <cg@exept.de>
parents: 7600
diff changeset
  2802
assert:aBooleanOrBlock
13800
2f04da6f127e comment/format in: #assert:
Stefan Vogel <sv@exept.de>
parents: 13710
diff changeset
  2803
    "fail and report an error, if the argument does not evaluate to true"
6964
a9ecdb3f1e52 comments
Claus Gittinger <cg@exept.de>
parents: 6963
diff changeset
  2804
11662
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2805
    "{ Pragma: +optSpace }"
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2806
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  2807
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  2808
8876
dc094269db8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8872
diff changeset
  2809
    aBooleanOrBlock == true ifTrue:[^ self].
11141
b96ed3ac5825 assertions can be globally disabled
Claus Gittinger <cg@exept.de>
parents: 11132
diff changeset
  2810
    (Smalltalk at:#IgnoreAssertion ifAbsent:false) == true ifTrue:[^ self].
11044
fa13d9423e71 allow for encounteredBreakPoints to be monitored
Claus Gittinger <cg@exept.de>
parents: 11025
diff changeset
  2811
8876
dc094269db8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8872
diff changeset
  2812
    "/ could still be a block or false.
11662
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2813
    (aBooleanOrBlock value) ifFalse:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2814
        AssertionFailedError
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2815
            raiseRequestWith:self
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2816
            errorString:('Assertion failed in ',
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2817
                         thisContext sender printString,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2818
                         '[', thisContext sender lineNumber printString,']')
11662
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2819
    ].
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2820
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2821
    "
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2822
     self assert:false
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2823
    "
13039
43313704ee61 changed: #assert:
Claus Gittinger <cg@exept.de>
parents: 12997
diff changeset
  2824
43313704ee61 changed: #assert:
Claus Gittinger <cg@exept.de>
parents: 12997
diff changeset
  2825
    "Modified: / 20-08-2010 / 17:13:06 / cg"
7621
42fb582ea36b allow for blocks in assert
Claus Gittinger <cg@exept.de>
parents: 7600
diff changeset
  2826
!
42fb582ea36b allow for blocks in assert
Claus Gittinger <cg@exept.de>
parents: 7600
diff changeset
  2827
42fb582ea36b allow for blocks in assert
Claus Gittinger <cg@exept.de>
parents: 7600
diff changeset
  2828
assert:aBooleanOrBlock message:messageIfFailing
11044
fa13d9423e71 allow for encounteredBreakPoints to be monitored
Claus Gittinger <cg@exept.de>
parents: 11025
diff changeset
  2829
    "fail, if the argument does not evaluate to true and report an error"
6961
096ca5ceb662 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6954
diff changeset
  2830
096ca5ceb662 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6954
diff changeset
  2831
    "{ Pragma: +optSpace }"
096ca5ceb662 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6954
diff changeset
  2832
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  2833
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  2834
11141
b96ed3ac5825 assertions can be globally disabled
Claus Gittinger <cg@exept.de>
parents: 11132
diff changeset
  2835
    aBooleanOrBlock == true ifTrue:[^ self].
b96ed3ac5825 assertions can be globally disabled
Claus Gittinger <cg@exept.de>
parents: 11132
diff changeset
  2836
    (Smalltalk at:#IgnoreAssertion ifAbsent:false) == true ifTrue:[^ self].
b96ed3ac5825 assertions can be globally disabled
Claus Gittinger <cg@exept.de>
parents: 11132
diff changeset
  2837
7621
42fb582ea36b allow for blocks in assert
Claus Gittinger <cg@exept.de>
parents: 7600
diff changeset
  2838
    (aBooleanOrBlock value) ifFalse:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2839
        AssertionFailedError
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2840
            raiseRequestWith:self
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2841
            errorString:(messageIfFailing, ' {',thisContext sender "methodHome" printString,' }')
11662
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2842
    ].
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2843
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2844
    "
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2845
     self assert:false message:'xxx'
10651
b205dbfea7e5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10576
diff changeset
  2846
    "
14046
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2847
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2848
    "Modified (comment): / 06-03-2012 / 11:26:48 / cg"
6961
096ca5ceb662 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6954
diff changeset
  2849
!
096ca5ceb662 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6954
diff changeset
  2850
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2851
basicInspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2852
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2853
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2854
    "launch an inspector on the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2855
     this method should NOT be redefined in subclasses."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2856
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2857
    Inspector isNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2858
        "
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2859
         for systems without GUI
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2860
        "
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2861
        self warn:'No Inspector defined (Inspector is nil).'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2862
    ] ifFalse:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2863
        Inspector openOn:self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2864
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2865
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2866
    "Modified: 18.5.1996 / 15:43:25 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2867
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2868
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2869
breakPoint:someKey
6954
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2870
    "{ Pragma: +optSpace }"
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2871
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2872
    "Like halt, but disabled by default.
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2873
     Can be easily enabled.
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2874
     Can be filtered on the arguments value (typically: a symbol).
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2875
     Code with breakpoints may be even checked into the source repository"
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2876
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2877
    "Example:   nil breakPoint:#stefan"
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2878
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2879
    <resource: #skipInDebuggersWalkBack>
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2880
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2881
    "/ dont send #breakPoint:info: here - ask cg why.
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2882
    (self isBreakPointEnabled:someKey) ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2883
        ^ HaltSignal
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2884
            raiseRequestWith:someKey
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2885
            errorString:('Breakpoint encountered: %1' bindWith:someKey)
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2886
    ].
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2887
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2888
    "
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2889
     nil breakPoint:#stefan
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2890
     nil breakPoint:#stefan info:'Hello'
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2891
     Smalltalk enableBreakPoint:#stefan.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2892
     Smalltalk disableBreakPoint:#stefan.
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2893
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2894
     EncounteredBreakPoints.
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2895
     Smalltalk enableBreakPoint:#cg.
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2896
     Smalltalk disableBreakPoint:#cg.
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2897
    "
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2898
!
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2899
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2900
breakPoint:someKey info:infoString
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2901
    "{ Pragma: +optSpace }"
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2902
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2903
    "Like halt, but disabled by default.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2904
     Can be easily enabled.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2905
     Can be filtered on the arguments value (typically: a symbol).
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2906
     Code with breakpoints may be even checked into the source repository"
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2907
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2908
    "Example:   nil breakPoint:#stefan"
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2909
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2910
    <resource: #skipInDebuggersWalkBack>
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2911
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2912
    (self isBreakPointEnabled:someKey) ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2913
        ^ HaltSignal
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2914
            raiseRequestWith:someKey
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2915
            errorString:(infoString bindWith:someKey)
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2916
    ].
6954
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2917
!
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2918
5995
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2919
browse
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2920
    "open a browser on the receivers class"
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2921
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2922
    self class theNonMetaclass browse
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2923
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2924
    "
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2925
     10 browse
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2926
     Collection browse
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2927
     Collection class browse
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2928
    "
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2929
!
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2930
11244
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2931
debuggingCodeFor:someKey is:aBlock
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2932
    "{ Pragma: +optSpace }"
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2933
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2934
    "aBlock is evaluated if breakPoints for somekey are enabled.
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2935
     Allows for debugging code to be enabled/disabled via the breakpoint browser.
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2936
     Can be easily enabled.
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2937
     Can be filtered on the arguments value (typically: a symbol).
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2938
     Code with breakpoints may be even checked into the source repository"
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2939
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2940
    "Example:   nil debuggingCodeFor:#cg is:[ self halt ]"
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2941
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2942
    <resource: #skipInDebuggersWalkBack>
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2943
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2944
    (self isBreakPointEnabled:someKey) ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2945
        aBlock value
11244
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2946
    ].
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2947
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2948
    "
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2949
     Smalltalk disableBreakPoint:#cg.
12340
e9ea989ffe01 comment/format in: #debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 12328
diff changeset
  2950
     nil debuggingCodeFor:#cg is:[ Transcript showCR:'here is some debug message for cg' ].
e9ea989ffe01 comment/format in: #debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 12328
diff changeset
  2951
     nil debuggingCodeFor:#stefan is:[ Transcript showCR:'here is some debug message for sv' ].
11244
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2952
     Smalltalk enableBreakPoint:#cg.
12340
e9ea989ffe01 comment/format in: #debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 12328
diff changeset
  2953
     nil debuggingCodeFor:#cg is:[ Transcript showCR:'here is some debug message for cg' ].
e9ea989ffe01 comment/format in: #debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 12328
diff changeset
  2954
     nil debuggingCodeFor:#stefan is:[ Transcript showCR:'here is some debug message for sv' ].
11244
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2955
     Smalltalk disableBreakPoint:#cg.
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2956
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2957
    "
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2958
!
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2959
14046
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2960
disableAllBreakPoints
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2961
    "disable all parametrized breakPoints (with any key as parameter)"
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2962
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2963
    EnabledBreakPoints := nil
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2964
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2965
    "
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2966
     nil enableBreakPoint:#cg.
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2967
     nil breakPoint:#cg.
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2968
     nil disableAllBreakPoints.
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2969
     nil breakPoint:#cg.
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2970
    "
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2971
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2972
    "Created: / 06-03-2012 / 15:32:28 / cg"
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2973
!
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2974
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2975
disableBreakPoint:someKey
14046
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2976
    "disable parametrized breakPoints with someKey as parameter"
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2977
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2978
    "{ Pragma: +optSpace }"
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2979
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2980
    EnabledBreakPoints notNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2981
        EnabledBreakPoints remove:someKey ifAbsent:[].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2982
        EnabledBreakPoints isEmpty ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2983
            EnabledBreakPoints := nil
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2984
        ].
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2985
    ].
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2986
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2987
    "
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2988
     nil enableBreakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2989
     nil breakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2990
     nil disableBreakPoint:#cg
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2991
     nil breakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2992
    "
14046
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2993
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2994
    "Modified (comment): / 06-03-2012 / 15:31:51 / cg"
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2995
!
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2996
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2997
enableBreakPoint:someKey
14046
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2998
    "enable parametrized breakPoints with someKey as parameter"
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2999
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3000
    "{ Pragma: +optSpace }"
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3001
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3002
    EnabledBreakPoints isNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3003
        EnabledBreakPoints := Set new.
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3004
    ].
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3005
    EnabledBreakPoints add:someKey.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3006
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3007
    "
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3008
     nil enableBreakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3009
     nil breakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3010
     nil disableBreakPoint:#cg
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3011
     nil breakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3012
    "
14046
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3013
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3014
    "Modified (comment): / 06-03-2012 / 15:31:47 / cg"
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3015
!
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3016
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3017
halt
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3018
    "{ Pragma: +optSpace }"
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3019
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3020
    "enter debugger with halt-message.
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3021
     The error is reported by raising the HaltSignal exception."
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3022
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3023
    <resource: #skipInDebuggersWalkBack>
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3024
13136
e7d331537665 changed:
Claus Gittinger <cg@exept.de>
parents: 13099
diff changeset
  3025
    Smalltalk ignoreHalt ifTrue:[^ self].
14830
ac68533e9c43 class: Object
Claus Gittinger <cg@exept.de>
parents: 14778
diff changeset
  3026
    "/ don't send #halt: here - ask cg why.
14974
2f05d233c309 class: Object
Stefan Vogel <sv@exept.de>
parents: 14965
diff changeset
  3027
    HaltInterrupt raiseRequestWith:#halt.
2f05d233c309 class: Object
Stefan Vogel <sv@exept.de>
parents: 14965
diff changeset
  3028
    ^ self
2f05d233c309 class: Object
Stefan Vogel <sv@exept.de>
parents: 14965
diff changeset
  3029
2f05d233c309 class: Object
Stefan Vogel <sv@exept.de>
parents: 14965
diff changeset
  3030
    "
2f05d233c309 class: Object
Stefan Vogel <sv@exept.de>
parents: 14965
diff changeset
  3031
        (3 halt * 5)
2f05d233c309 class: Object
Stefan Vogel <sv@exept.de>
parents: 14965
diff changeset
  3032
    "
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3033
13136
e7d331537665 changed:
Claus Gittinger <cg@exept.de>
parents: 13099
diff changeset
  3034
    "Modified: / 02-08-1999 / 17:00:29 / stefan"
e7d331537665 changed:
Claus Gittinger <cg@exept.de>
parents: 13099
diff changeset
  3035
    "Modified: / 18-11-2010 / 11:21:51 / cg"
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3036
!
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3037
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3038
halt:aString
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3039
    "{ Pragma: +optSpace }"
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3040
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3041
    "enter debugger with halt-message.
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3042
     The error is reported by raising the HaltSignal exception."
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3043
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3044
    <resource: #skipInDebuggersWalkBack>
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3045
13136
e7d331537665 changed:
Claus Gittinger <cg@exept.de>
parents: 13099
diff changeset
  3046
    Smalltalk ignoreHalt ifTrue:[^ self].
14974
2f05d233c309 class: Object
Stefan Vogel <sv@exept.de>
parents: 14965
diff changeset
  3047
    HaltInterrupt raiseRequestWith:#halt: errorString:aString.
2f05d233c309 class: Object
Stefan Vogel <sv@exept.de>
parents: 14965
diff changeset
  3048
    ^ self
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3049
13136
e7d331537665 changed:
Claus Gittinger <cg@exept.de>
parents: 13099
diff changeset
  3050
    "Modified: / 18-11-2010 / 11:22:16 / cg"
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3051
!
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3052
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3053
isBreakPointEnabled:someKey
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3054
    "{ Pragma: +optSpace }"
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3055
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3056
    "controls which breakpoints to be enabled."
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3057
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3058
"/    something = OperatingSystem getLoginName ifTrue:[^ true].
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3059
"/    something = 'testThis' ifTrue:[^ true].
11044
fa13d9423e71 allow for encounteredBreakPoints to be monitored
Claus Gittinger <cg@exept.de>
parents: 11025
diff changeset
  3060
    EncounteredBreakPoints notNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3061
        EncounteredBreakPoints add:someKey
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  3062
    ].
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  3063
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  3064
    ^ (EnabledBreakPoints notNil and:[ EnabledBreakPoints includes:someKey ])
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3065
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3066
    "
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3067
     nil enableBreakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3068
     nil breakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3069
     nil disableBreakPoint:#cg
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3070
     nil breakPoint:#cg.
11045
85315d8893e4 allow for encounteredBreakPoints to be monitored
Claus Gittinger <cg@exept.de>
parents: 11044
diff changeset
  3071
85315d8893e4 allow for encounteredBreakPoints to be monitored
Claus Gittinger <cg@exept.de>
parents: 11044
diff changeset
  3072
     EncounteredBreakPoints := Set new.
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3073
    "
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3074
!
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3075
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3076
mustBeBoolean
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3077
    "this message is sent by the VM, if a non-Boolean receiver is encountered
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3078
     in an if* or while* message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3079
     Caveat: for now, this is only sent by the interpreter;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3080
     both the JIT and the stc compiler treat it as undefined."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3081
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  3082
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  3083
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3084
    self error:'Non boolean receiver - proceed for truth' mayProceed:true.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3085
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3086
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3087
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3088
mustBeKindOf:aClass
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3089
    "for compatibility & debugging support:
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3090
     check if the receiver isKindOf:aClass and raise an error if not.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3091
     Notice:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3092
        it is VERY questionable, if it makes sense to add manual
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3093
        type checks to a dynamically typed language like smalltalk.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3094
        It will, at least, slow down performance,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3095
        make your code less reusable and clutter your code with stupid sends
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3096
        of this selector. Also, read the comment in isKindOf:, regarding the
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3097
        use of isXXX check methods.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3098
     You see: The author does not like this at all ..."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3099
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  3100
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  3101
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3102
    (self isKindOf:aClass) ifFalse:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3103
        self error:'argument is not of expected type'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3104
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3105
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3106
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3107
obsoleteFeatureWarning
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3108
    "{ Pragma: +optSpace }"
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3109
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3110
    "in methods which are going to be changed, a send to
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3111
     this method is used to tell programmers that some feature/semantics is
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3112
     used which is going to be changed in later ST/X versions.
6963
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3113
     Hopefully, this warning message is annoying enough for you to change the code... ;-)."
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3114
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3115
    self obsoleteFeatureWarning:nil from:thisContext sender
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3116
!
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3117
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3118
obsoleteFeatureWarning:message
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3119
    "{ Pragma: +optSpace }"
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3120
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3121
    "in methods which are going to be changed, a send to
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3122
     this method is used to tell programmers that some feature/semantics is
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3123
     used which is going to be changed in later ST/X versions.
6963
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3124
     Hopefully, this warning message is annoying enough for you to change the code... ;-).
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3125
     This message is intended for application developers, so its printed as info message."
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3126
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3127
    self obsoleteFeatureWarning:message from:thisContext sender
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3128
!
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3129
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3130
obsoleteFeatureWarning:message from:aContext
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3131
    "{ Pragma: +optSpace }"
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3132
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3133
    "in methods which are going to be changed, a send to
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3134
     this method is used to tell programmers that some feature/semantics is
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3135
     used which is going to be changed in later ST/X versions.
6963
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3136
     Hopefully, this warning message is annoying enough for you to change the code... ;-).
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3137
     This message is intended for application developers, so its printed as info message."
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3138
11527
d8f1c75ee4d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11401
diff changeset
  3139
    |spec sender|
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3140
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3141
    spec := aContext methodPrintString.
11527
d8f1c75ee4d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11401
diff changeset
  3142
    sender := aContext sender.
d8f1c75ee4d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11401
diff changeset
  3143
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3144
    ('WARNING: the ''' , spec , ''' semantics will be changed.') infoPrintCR.
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3145
    ('         Its behavior may be different in future ST/X versions.') infoPrintCR.
11527
d8f1c75ee4d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11401
diff changeset
  3146
    ('         called from ' , sender printString) infoPrintCR.
d8f1c75ee4d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11401
diff changeset
  3147
    ((sender selector ? '') startsWith:'perform:') ifTrue:[
d8f1c75ee4d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11401
diff changeset
  3148
    ('         called from ' , sender sender printString) infoPrintCR.
7204
e968d9923408 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7202
diff changeset
  3149
    ].
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3150
    message notNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3151
        '------>  ' infoPrint. message infoPrintCR
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3152
    ]
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3153
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3154
    "
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3155
     Object obsoleteFeatureWarning:'foo' from:thisContext sender sender
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3156
    "
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3157
!
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3158
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3159
obsoleteMethodWarning
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3160
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3161
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3162
    "in methods which are going to be obsoleted, a self send to
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3163
     this method is used to tell programmers that a method is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3164
     used which is going to be removed in later ST/X versions.
6963
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3165
     Find all methods which will be obsolete soon by looking at senders of this message.
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3166
     Hopefully, this warning message is annoying enough for you to change the code... ;-)"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3167
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3168
    self obsoleteMethodWarning:nil from:thisContext sender
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3169
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3170
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3171
obsoleteMethodWarning:message
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3172
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3173
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3174
    "in methods which are going to be obsoleted, a self send to
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3175
     this method is used to tell programmers that a method is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3176
     used which is going to be removed in later ST/X versions.
6963
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3177
     Find all methods which will be obsolete soon by looking at senders of this message.
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3178
     Hopefully, this warning message is annoying enough for you to change the code... ;-)"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3179
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3180
    self obsoleteMethodWarning:message from:thisContext sender
8829
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3181
!
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3182
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3183
obsoleteMethodWarning:message from:aContext
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3184
    "{ Pragma: +optSpace }"
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3185
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3186
    "in methods which are going to be obsoleted, a self-send to
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3187
     this method is used to tell programmers that a method is
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3188
     used which is going to be removed in later ST/X versions.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3189
     Find all methods which will be obsolete soon by looking at senders of this message.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3190
     Hopefully, this warning message is annoying enough for you to change the code... ;-).
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3191
     This message is intended for application developers, so its printed as info message."
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3192
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3193
    |spec sender|
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3194
9509
bfb55a08130d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9442
diff changeset
  3195
    Smalltalk isSmalltalkDevelopmentSystem ifFalse:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3196
        "ignore in production systems"
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3197
        ^ self.
8829
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3198
    ].
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3199
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3200
    spec := aContext methodPrintString.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3201
    sender := aContext sender.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3202
    ('WARNING: the ''' , spec , ''' method is obsolete.') infoPrintCR.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3203
    ('         And may not be present in future ST/X versions.') infoPrintCR.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3204
    ('         called from ' , sender printString) infoPrintCR.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3205
    (sender selector startsWith:'perform:') ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3206
        sender := sender sender.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3207
        (sender selector startsWith:'perform:') ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3208
            sender := sender sender.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3209
        ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3210
        ('         called from ' , sender printString) infoPrintCR.
8829
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3211
    ].
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3212
    message notNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3213
        '------>  ' infoPrint. message infoPrintCR
8829
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3214
    ]
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3215
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3216
    "
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3217
     Object obsoleteMethodWarning:'foo' from:thisContext sender sender
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3218
    "
9509
bfb55a08130d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9442
diff changeset
  3219
bfb55a08130d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9442
diff changeset
  3220
    "Modified: / 10-08-2006 / 13:13:11 / cg"
10558
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3221
!
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3222
12341
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3223
todo
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3224
    "used to mark code pieces that have to be implemented"
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3225
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3226
    <resource: #skipInDebuggersWalkBack>
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3227
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3228
    self halt:'more work needed here'.
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3229
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3230
    "
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3231
     example:
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3232
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3233
        ...
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3234
        self todo.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3235
        ...
12341
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3236
    "
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3237
!
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3238
10558
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3239
todo:aBlock
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3240
    "used to mark code pieces that have to be implemented"
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3241
12341
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3242
    <resource: #skipInDebuggersWalkBack>
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3243
10558
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3244
"/    self halt.
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3245
"/    aBlock value.
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3246
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3247
    "
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3248
     example:
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3249
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3250
        ...
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3251
        self todo:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3252
            code which needs more work ...
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3253
        ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3254
        ...
10558
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3255
    "
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3256
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3257
    "Created: / 25-05-2007 / 21:34:39 / cg"
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3258
    "Modified: / 29-05-2007 / 12:11:33 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3259
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3260
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3261
!Object methodsFor:'dependents access'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3262
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3263
addDependent:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3264
    "make the argument, anObject be a dependent of the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3265
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3266
    |wasBlocked|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3267
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3268
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3269
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3270
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3271
    "/ faster execution.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3272
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3273
    wasBlocked := OperatingSystem blockInterrupts.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3274
    [
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3275
        |deps dep|
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3276
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3277
        deps := self dependents.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3278
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3279
        "/ to save a fair amount of memory in case of
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3280
        "/ many dependencies, we store a single dependent in
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3281
        "/ a WeakArray, and switch to a WeakSet if more dependents are
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3282
        "/ added.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3283
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3284
        (deps isNil or:[deps size == 0]) ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3285
            self dependents:(WeakArray with:anObject)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3286
        ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3287
            deps class == WeakArray ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3288
                dep := deps at:1.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3289
                dep ~~ anObject ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3290
                    (dep isNil or:[dep == 0]) ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3291
                        deps at:1 put:anObject
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3292
                    ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3293
                        self dependents:(WeakIdentitySet with:dep with:anObject)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3294
                    ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3295
                ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3296
            ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3297
                deps add:anObject
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3298
            ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3299
        ]
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3300
    ] ensure:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3301
        wasBlocked ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3302
            OperatingSystem unblockInterrupts
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3303
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3304
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3305
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3306
    "Modified: / 27.10.1997 / 19:35:52 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3307
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3308
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3309
breakDependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3310
    "remove all dependencies from the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3311
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3312
    self dependents:nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3313
    self nonWeakDependents:nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3314
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3315
    "Modified: / 19.4.1996 / 10:55:36 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3316
    "Created: / 27.2.1998 / 11:26:11 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3317
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3318
8542
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3319
breakDependentsRecursively
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3320
    "remove all dependencies from the receiver and
8542
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3321
     recursively from all objects referred to by the receiver."
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3322
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3323
    self breakDependents.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3324
    1 to:self class instSize do:[:idx |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3325
        (self instVarAt:idx) breakDependentsRecursively.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3326
    ].
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3327
    1 to:self basicSize do:[:idx |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3328
        (self basicAt:idx) breakDependentsRecursively.
8542
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3329
    ]
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3330
!
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3331
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3332
dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3333
    "return a Collection of dependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3334
     The default implementation here uses a global WeakDictionary to store
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3335
     dependents
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3336
     This may be too slow for high frequency change&update,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3337
     therefore, some classes (Model) redefine this for better performance.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3338
     Notice the mentioning of a WeakDictionary - read the classes documentation."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3339
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3340
    |deps|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3341
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3342
    (deps := Dependencies at:self ifAbsent:nil) isNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3343
        ^ #().
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3344
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3345
    ^ deps
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3346
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3347
    "Modified: / 26.1.1998 / 11:18:15 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3348
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3349
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3350
dependents:aCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3351
    "set the collection of dependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3352
     The default implementation here uses a global Dictionary to store
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3353
     dependents which may be too slow for high frequency change&update.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3354
     Therefore, some classes (Model) redefine this for better performance."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3355
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3356
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3357
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3358
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3359
    "/ faster execution (and to avoid creation of garbage blocks).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3360
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3361
    (OperatingSystem blockInterrupts) ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3362
        "/ the common case - already blocked
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3363
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3364
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3365
            Dependencies removeKey:self ifAbsent:nil
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3366
        ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3367
            Dependencies at:self put:aCollection
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3368
        ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3369
        ^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3370
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3371
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3372
    [
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3373
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3374
            Dependencies removeKey:self ifAbsent:nil
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3375
        ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3376
            Dependencies at:self put:aCollection
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3377
        ].
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3378
    ] ensure:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3379
        OperatingSystem unblockInterrupts
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3380
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3381
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3382
    "Modified: 30.1.1997 / 21:22:10 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3383
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3384
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3385
dependentsDo:aBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3386
    "evaluate aBlock for all of my dependents"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3387
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3388
    |deps nwDeps|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3389
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3390
    deps := self dependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3391
    deps size ~~ 0 ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3392
        deps do:[:d |
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3393
                    (d notNil and:[d ~~ 0]) ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3394
                        aBlock value:d
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3395
                    ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3396
                ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3397
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3398
    nwDeps := self nonWeakDependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3399
    (nwDeps ~~ deps and:[nwDeps size ~~ 0]) ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3400
        nwDeps do:aBlock
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3401
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3402
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3403
    "Modified: / 30.1.1998 / 14:03:40 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3404
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3405
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3406
myDependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3407
    "same as dependents - ST-80 compatibility"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3408
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3409
    ^ self dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3410
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3411
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3412
release
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3413
    "remove all references to objects that may refer to self.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3414
     Subclasses may redefine this method but should do a 'super release'."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3415
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3416
    self breakDependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3417
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3418
    "Modified: / 27.2.1998 / 11:29:35 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3419
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3420
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3421
removeDependent:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3422
    "make the argument, anObject be independent of the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3423
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3424
    |wasBlocked|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3425
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3426
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3427
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3428
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3429
    "/ faster execution.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3430
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3431
    wasBlocked := OperatingSystem blockInterrupts.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3432
    [
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3433
        |deps n d|
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3434
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3435
        deps := self dependents.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3436
        deps size ~~ 0 ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3437
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3438
            "/ to save a fair amount of memory in case of
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3439
            "/ many dependencies, we store a single dependent in
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3440
            "/ a WeakArray, and switch to a WeakSet if more dependents are
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3441
            "/ added. Here we have to do the inverse ...
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3442
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3443
            ((deps class == WeakArray) or:[deps class == Array]) ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3444
                ((d := deps at:1) == anObject
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3445
                or:[d isNil
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3446
                or:[d == 0]]) ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3447
                    self dependents:nil
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3448
                ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3449
            ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3450
                deps remove:anObject ifAbsent:[].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3451
                (n := deps size) == 0 ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3452
                    self dependents:nil
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3453
                ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3454
                    n == 1 ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3455
                        d := deps firstIfEmpty:nil.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3456
                        d notNil ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3457
                            deps := (deps isWeakCollection ifTrue:[WeakArray] ifFalse:[Array]) with:d
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3458
                        ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3459
                            deps := nil
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3460
                        ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3461
                        self dependents:deps.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3462
                    ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3463
                ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3464
            ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3465
        ]
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3466
    ] ensure:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3467
        wasBlocked ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3468
            OperatingSystem unblockInterrupts
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3469
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3470
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3471
13500
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3472
    "Modified: / 05-07-2011 / 22:49:31 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3473
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3474
7266
f2b64d3b43cf method category rename
Claus Gittinger <cg@exept.de>
parents: 7261
diff changeset
  3475
!Object methodsFor:'dependents access (non weak)'!
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3476
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3477
addNonWeakDependent:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3478
    "make the argument, anObject be a nonWeak dependent of the receiver.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3479
     Be careful: this nonWeakDependency will prevent the dependent from being
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3480
     garbage collected unless the dependency is removed.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3481
     This is a private mechanism, for directed dependencies."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3482
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3483
    |wasBlocked|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3484
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3485
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3486
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3487
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3488
    "/ faster execution.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3489
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3490
    wasBlocked := OperatingSystem blockInterrupts.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3491
    [
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3492
        |deps dep|
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3493
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3494
        deps := self nonWeakDependents.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3495
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3496
        "/ to save a fair amount of memory in case of
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3497
        "/ many dependencies, we store a single dependent in
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3498
        "/ an Array, and switch to a Set if more dependents are
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3499
        "/ added.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3500
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3501
        deps size == 0 ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3502
            anObject notNil ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3503
                self nonWeakDependents:(Array with:anObject).
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3504
            ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3505
                "adding nil causes problems when adding the next one
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3506
                 (see below: trying to add nil to IdentitySet)"
9442
f564054eaf6a do not add nil as dependent
Stefan Vogel <sv@exept.de>
parents: 9405
diff changeset
  3507
"/                self halt:'try to add nil to list of dependents'.
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3508
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3509
        ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3510
            deps class == Array ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3511
                dep := deps at:1.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3512
                dep ~~ anObject ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3513
                    self nonWeakDependents:(IdentitySet with:dep with:anObject)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3514
                ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3515
            ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3516
                deps add:anObject
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3517
            ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3518
        ]
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3519
    ] ensure:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3520
        wasBlocked ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3521
            OperatingSystem unblockInterrupts
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3522
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3523
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3524
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3525
    "Created: / 19.4.1996 / 10:54:08 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3526
    "Modified: / 30.1.1998 / 14:03:08 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3527
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3528
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3529
nonWeakDependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3530
    "return a Collection of nonWeakDependents - empty if there is none.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3531
     This is a private mechanism for directed dependencies."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3532
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3533
    NonWeakDependencies isNil ifTrue:[^ #()].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3534
    ^ NonWeakDependencies at:self ifAbsent:#()
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3535
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3536
    "Created: / 19.4.1996 / 10:55:06 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3537
    "Modified: / 30.1.1998 / 14:06:47 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3538
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3539
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3540
nonWeakDependents:aCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3541
    "set the collection of nonWeak dependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3542
     This is a private helper for directed dependencies."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3543
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3544
    [
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3545
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3546
            NonWeakDependencies removeKey:self ifAbsent:nil
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3547
        ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3548
            NonWeakDependencies at:self put:aCollection
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3549
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3550
    ] valueUninterruptably
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3551
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3552
    "Created: 19.4.1996 / 11:07:47 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3553
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3554
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3555
removeNonWeakDependent:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3556
    "remove a nonWeak dependency from the receiver to the argument, anObject.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3557
     (i.e. make it independent of the receiver)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3558
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3559
    |wasBlocked|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3560
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3561
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3562
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3563
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3564
    "/ faster execution.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3565
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3566
    wasBlocked := OperatingSystem blockInterrupts.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3567
    [
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3568
        |deps n|
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3569
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3570
        deps := self nonWeakDependents.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3571
        deps size ~~ 0 ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3572
            deps class == Array ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3573
                (deps at:1) == anObject ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3574
                    self nonWeakDependents:nil
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3575
                ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3576
            ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3577
                deps remove:anObject ifAbsent:[].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3578
                (n := deps size) == 0 ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3579
                    self nonWeakDependents:nil
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3580
                ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3581
                    n == 1 ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3582
                        self nonWeakDependents:(Array with:(deps first))
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3583
                    ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3584
                ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3585
            ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3586
        ]
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3587
    ] ensure:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3588
        wasBlocked ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3589
            OperatingSystem unblockInterrupts
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3590
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3591
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3592
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3593
    "Created: / 19.4.1996 / 11:44:44 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3594
    "Modified: / 30.1.1998 / 14:04:01 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3595
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3596
9279
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3597
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3598
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3599
!Object methodsFor:'displaying'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3600
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3601
ascentOn:aGC
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3602
    "when displayed via displayOn:, some objects assume that the given y coordinate
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3603
     is the baseline (strings, text etc. do), while others assume that the topY
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3604
     coordinate is given by y.
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3605
     In other words: some draw above the given y coordinate.
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3606
     This method returns the number of pixels by which the receiver will draw above
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3607
     the given y coordinate."
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3608
11065
17c01b01000f Simplify (and speed up) #ascentOn:
Stefan Vogel <sv@exept.de>
parents: 11048
diff changeset
  3609
    ^ aGC fontAscent
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3610
!
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3611
6900
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  3612
displayOn:aGCOrStream
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3613
    "Compatibility
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3614
     append a printed desription on some stream (Dolphin,  Squeak)
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3615
     OR:
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3616
     display the receiver in a graphicsContext at 0@0 (ST80).
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3617
     This method allows for any object to be displayed in some view
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3618
     (although the fallBack is to display its printString ...)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3619
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3620
    "/ what a kludge - Dolphin and Squeak mean: printOn: a stream;
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3621
    "/ ST/X (and some old ST80's) mean: draw-yourself on a GC.
14292
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
  3622
    aGCOrStream isStream ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3623
        self printOn:aGCOrStream.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3624
        ^ self
6900
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  3625
    ].
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  3626
    ^ self displayOn:aGCOrStream x:0 y:0.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3627
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3628
    "Created: 29.5.1996 / 16:28:58 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3629
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3630
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3631
displayOn:aGC at:aPoint
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3632
    "ST-80 Compatibility
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3633
     display the receiver in a graphicsContext - this method allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3634
     for any object to be displayed in a ListView - for example."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3635
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3636
    ^ self displayOn:aGC x:(aPoint x) y:(aPoint y).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3637
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3638
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3639
displayOn:aGC x:x y:y
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3640
    "display the receiver in a graphicsContext - this method allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3641
     for any object to be displayed in a ListView - for example."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3642
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3643
    self displayOn:aGC x:x y:y opaque:false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3644
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3645
    "Modified: 29.5.1996 / 16:29:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3646
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3647
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3648
displayOn:aGc x:x y:y opaque:opaque
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3649
    "display the receiver in a graphicsContext - this method allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3650
     for any object to be displayed in a ListView - for example.
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  3651
     The fallBack here shows the receivers displayString.
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  3652
     Notice, that the string is displayed on the baseLine;
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  3653
     ask using #ascentOn: if required"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3654
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3655
    |s yBaseline|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3656
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3657
    s := self displayString.
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  3658
    yBaseline := y "+ aGc font ascent".
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3659
    opaque ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3660
        aGc displayOpaqueString:s x:x y:yBaseline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3661
    ] ifFalse:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3662
        aGc displayString:s x:x y:yBaseline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3663
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3664
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3665
    "Modified: 29.5.1996 / 16:29:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3666
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3667
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3668
displayOpaqueOn:aGC x:x y:y
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3669
    "display the receiver in a graphicsContext - this method allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3670
     for any object to be displayed in a ListView - for example."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3671
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3672
    self displayOn:aGC x:x y:y opaque:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3673
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3674
    "Modified: / 29.5.1996 / 16:29:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3675
    "Created: / 26.10.1997 / 15:01:36 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3676
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3677
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3678
displayString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3679
    "return a string used when displaying the receiver in a view;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3680
     for example an Inspector. This is usually the same as printString,
14292
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
  3681
     but sometimes redefined for a better look.
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
  3682
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
  3683
     Note: the base method (used by the inspector) is #displayOn:.
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3684
           So you should implement #displayOn: instead of #displayString in subclasses."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3685
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3686
    |s|
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3687
8322
95ca965f65ed Handle unicode in #displayString
Stefan Vogel <sv@exept.de>
parents: 8300
diff changeset
  3688
    s := CharacterWriteStream on:(String new:32).
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3689
    self displayOn:s.
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3690
    ^ s contents
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3691
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3692
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3693
     #(1 2 3) printString
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3694
     #(1 2 3) displayString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3695
     #(1 2 3) storeString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3696
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3697
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3698
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3699
heightOn:aGC
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3700
    "return the height of the receiver, if it is to be displayed on aGC"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3701
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3702
    ^ (aGC font onDevice:aGC device) heightOf:(self displayString)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3703
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3704
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3705
widthFrom:startIndex to:endIndex on:aGC
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3706
    "return the width of the receiver, if it is to be displayed on aGC"
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3707
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3708
    ^ (aGC font onDevice:aGC device) widthOf:(self displayString) from:startIndex to:endIndex
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3709
!
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3710
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3711
widthOn:aGC
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3712
    "return the width of the receiver, if it is to be displayed on aGC"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3713
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3714
    ^ (aGC font onDevice:aGC device) widthOf:(self displayString)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3715
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3716
7359
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3717
!Object methodsFor:'double dispatching'!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3718
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3719
equalFromComplex:aComplex
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3720
    "adding this method here allows for any non-number to be compared to a complex
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3721
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3722
     Reason: we want to be able to put both numbers and non-numbers into a collection
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3723
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3724
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3725
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3726
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3727
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3728
equalFromFixedPoint:aFixedPoint
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3729
    "adding this method here allows for any non-number to be compared to a fixedPoint
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3730
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3731
     Reason: we want to be able to put both numbers and non-numbers into a collection
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3732
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3733
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3734
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3735
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3736
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3737
equalFromFloat:aFloat
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3738
    "adding this method here allows for any non-number to be compared to a float
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3739
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3740
     Reason: we want to be able to put both numbers and non-numbers into a collection
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3741
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3742
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3743
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3744
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3745
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3746
equalFromFraction:aFraction
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3747
    "adding this method here allows for any non-number to be compared to a fraction
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3748
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3749
     Reason: we want to be able to put both numbers and non-numbers into a collection
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3750
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3751
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3752
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3753
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3754
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3755
equalFromInteger:anInteger
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3756
    "adding this method here allows for any non-number to be compared to an integer
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3757
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3758
     Reason: we want to be able to put both numbers and non-numbers into a collection
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3759
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3760
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3761
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3762
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3763
7455
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  3764
equalFromLargeFloat:aLargeFloat
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  3765
    "adding this method here allows for any non-number to be compared to a largeFloat
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  3766
     and return false from this comparison.
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  3767
     Reason: we want to be able to put both numbers and non-numbers into a collection
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  3768
     which uses #= (i.e. a Set or Dictionary)."
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  3769
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  3770
    ^ false
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  3771
!
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  3772
7359
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3773
equalFromLongFloat:aLongFloat
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3774
    "adding this method here allows for any non-number to be compared to a longFloat
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3775
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3776
     Reason: we want to be able to put both numbers and non-numbers into a collection
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3777
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3778
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3779
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3780
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3781
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3782
equalFromShortFloat:aShortFloat
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3783
    "adding this method here allows for any non-number to be compared to a shortFloat
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3784
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3785
     Reason: we want to be able to put both numbers and non-numbers into a collection
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3786
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3787
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3788
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3789
! !
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3790
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3791
!Object methodsFor:'encoding & decoding'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3792
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3793
decodeAsLiteralArray
8832
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  3794
    "given a literalEncoding in the receiver,
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  3795
     create & return the corresponding object.
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  3796
     The inverse operation to #literalArrayEncoding."
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  3797
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3798
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3799
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3800
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3801
encodeOn:anEncoder with:aParameter
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3802
    "not used any longer. Kept for backward comaptibility"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3803
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3804
    <resource: #obsolete>
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3805
8404
c0bd2a56dc3b *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 8397
diff changeset
  3806
    self acceptVisitor:anEncoder with:aParameter
6718
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3807
!
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3808
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3809
encodingVectorForInstanceVariables
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3810
    "OBSOLETE, use elementDescriptorForInstanceVariables"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3811
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3812
    <resource: #obsolete>
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3813
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3814
    ^ self elementDescriptorForInstanceVariablesMatching:[:val | true].
6718
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3815
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3816
    "
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3817
      #(1 2 3 nil true symbol) encodingVectorForInstanceVariables
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3818
      Dictionary new encodingVectorForInstanceVariables
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3819
      (5 @ nil) encodingVectorForInstanceVariables
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3820
    "
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3821
!
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3822
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3823
encodingVectorForNonNilInstanceVariables
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3824
    "OBSOLETE, use elementDescriptorForNonNilInstanceVariables"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3825
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3826
    <resource: #obsolete>
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3827
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3828
    ^ self elementDescriptorForInstanceVariablesMatching:[:varVal | varVal notNil].
6718
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3829
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3830
    "
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3831
      #(1 2 3 nil true symbol) encodingVectorForNonNilInstanceVariables
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3832
      (5 @ nil) encodingVectorForNonNilInstanceVariables
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3833
    "
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3834
!
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3835
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3836
fromLiteralArrayEncoding:aSpecArray
8798
73676c762813 comment
Claus Gittinger <cg@exept.de>
parents: 8789
diff changeset
  3837
    "read my attributes from aSpecArray.
73676c762813 comment
Claus Gittinger <cg@exept.de>
parents: 8789
diff changeset
  3838
     Recursively decodes arguments."
73676c762813 comment
Claus Gittinger <cg@exept.de>
parents: 8789
diff changeset
  3839
73676c762813 comment
Claus Gittinger <cg@exept.de>
parents: 8789
diff changeset
  3840
    |sel litVal val
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3841
     stop   "{ Class:SmallInteger }" |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3842
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3843
    stop := aSpecArray size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3844
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3845
    2 to:stop by:2 do:[:i|
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3846
        sel := aSpecArray at:i.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3847
        litVal := aSpecArray at:i + 1.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3848
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3849
        (self respondsTo:sel) ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3850
            val := litVal decodeAsLiteralArray.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3851
            self perform:sel with:val
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3852
        ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3853
            Transcript show:self class name; show:': unhandled literalArrayEncoding attribute: '.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3854
            Transcript showCR:sel.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3855
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3856
            "/ thats a debug halt,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3857
            "/ it should probably be removed (to simply ignore unhandled attributes)...
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3858
            "/ for now, it is left in, in order to easily find incompatibilities between
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3859
            "/ VW and ST/X.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3860
            self breakPoint:#cg.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3861
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3862
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3863
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3864
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3865
literalArrayEncoding
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3866
    "generate a literalArrayEncoding array for myself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3867
     This uses #literalArrayEncodingSlotOrder which defines the slots and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3868
     order and #skippedInLiteralEncoding which defines slots to skip.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3869
     For most subclasses, there is no need to redefine those."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3870
8832
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  3871
    |names encoding cls skipped slots|
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3872
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3873
    self isLiteral ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3874
        ^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3875
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3876
8832
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  3877
    slots    := self literalArrayEncodingSlotOrder.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3878
    skipped  := self skippedInLiteralEncoding.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3879
    cls      := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3880
    names    := cls allInstVarNames.
8832
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  3881
    encoding := OrderedCollection new:(1 + (2 * (slots size - skipped size))).
8839
c4471cb2799f stefan: bitte vor Einchecken Testen !
Claus Gittinger <cg@exept.de>
parents: 8833
diff changeset
  3882
    encoding add:cls name.
8832
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  3883
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  3884
    slots do:[:instSlot |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3885
        |value nm|
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3886
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3887
        nm := names at:instSlot.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3888
        (skipped includes:nm) ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3889
            (value := self instVarAt:instSlot) notNil ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3890
                encoding add:(nm , ':') asSymbol.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3891
                encoding add:value literalArrayEncoding
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3892
            ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3893
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3894
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3895
    ^ encoding asArray
8841
d5acf50ec5a6 Comment
Stefan Vogel <sv@exept.de>
parents: 8839
diff changeset
  3896
d5acf50ec5a6 Comment
Stefan Vogel <sv@exept.de>
parents: 8839
diff changeset
  3897
    "
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3898
        (1 -> 2) literalArrayEncoding
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3899
        DebugView menuSpec decodeAsLiteralArray literalArrayEncoding  =
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3900
           DebugView menuSpec
8841
d5acf50ec5a6 Comment
Stefan Vogel <sv@exept.de>
parents: 8839
diff changeset
  3901
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3902
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3903
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3904
literalArrayEncodingSlotOrder
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3905
    "define the order in which inst-slots are saved when generating
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3906
     a literalArrayEncoding"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3907
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3908
    ^ 1 to:self class instSize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3909
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3910
7112
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  3911
postDecodeFrom:aDecoder aspect:aspectSymbol
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  3912
    "invoked by xmlDecoder (and others in the future), after an
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  3913
     object has been decoded (i.e. its instance variables have been restored)"
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  3914
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3915
    ^ self
7112
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  3916
!
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  3917
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3918
skippedInLiteralEncoding
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3919
    "return a Collection with it's elements are slots for skipping"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3920
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3921
    ^ #()
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3922
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3923
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3924
!Object methodsFor:'error handling'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3925
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3926
ambiguousMessage:aMessage
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3927
    "this message is sent by the system in case that it
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3928
     is not clear which method to execute in response to
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  3929
     aMessage.
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3930
     Such situation may occur when a current selector namespace
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  3931
     imports two namespaces and both define a method with the
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3932
     requested selector."
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3933
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3934
    <context: #return>
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3935
    <resource: #skipInDebuggersWalkBack>
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3936
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3937
    ^ AmbiguousMessage raiseRequestWith:aMessage
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3938
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3939
    "Created: / 21-07-2010 / 15:44:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  3940
    "Modified (comment): / 02-11-2012 / 10:14:42 / cg"
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3941
!
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3942
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3943
appropriateDebugger:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3944
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3945
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3946
    "return an appropriate debugger to use.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3947
     If there is already a debugger active on the stack, and it is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3948
     the DebugView, return MiniDebugger (as a last chance) otherwise abort."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3949
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3950
    |context|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3951
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3952
    "DebugView cannot run without system processes"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3953
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3954
    (Processor isNil
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3955
    or:[Processor activeProcessIsSystemProcess
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3956
    or:[Smalltalk isInitialized not]]) ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3957
        ^ MiniDebugger
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3958
    ].
6778
87e2d95ce8a4 Raise #drawingOnClosedDeviceSignal instead of #error
Stefan Vogel <sv@exept.de>
parents: 6764
diff changeset
  3959
    (Screen isNil or:[Screen default isNil or:[Screen default isOpen not]]) ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3960
        Debugger isNil ifTrue:[^ nil].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3961
        ^ MiniDebugger
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3962
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3963
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3964
    context := thisContext.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3965
    context := context findNextContextWithSelector:aSelector or:nil or:nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3966
    [context notNil] whileTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3967
        ((context receiver class == Debugger)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3968
         and:[context selector == aSelector]) ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3969
            "we are already in some Debugger"
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3970
            (Debugger == MiniDebugger) ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3971
                "we are already in the MiniDebugger"
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3972
                ErrorRecursion ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3973
                    Smalltalk fatalAbort:'recursive error ...'
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3974
                ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3975
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3976
            MiniDebugger isNil ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3977
                Smalltalk fatalAbort:'no debugger'
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3978
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3979
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3980
            "ok, an error occured while in the graphical debugger;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3981
             lets try MiniDebugger"
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3982
            ^ MiniDebugger
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3983
        ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  3984
        context := context findNextContextWithSelector:aSelector or:nil or:nil.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3985
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3986
    "not within Debugger - no problem"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3987
    ^ Debugger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3988
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3989
    "Modified: / 23.9.1996 / 12:14:52 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3990
    "Modified: / 19.5.1999 / 18:05:00 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3991
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3992
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3993
cannotSendMessage:aMessage to:someReceiver
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3994
    "this message is sent by the runtime system (VM),
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3995
     when a message is sent to some object, whose class is not
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3996
     a valid behavior (see documentation in Behavior)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3997
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  3998
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  3999
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4000
    ^ VMInternalError
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4001
          raiseWith:someReceiver
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4002
          errorString:('bad class in send of #' , aMessage selector)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4003
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4004
    "Modified: 23.1.1997 / 00:05:39 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4005
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4006
11132
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  4007
conversionErrorSignal
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  4008
    "return the signal used for conversion error handling"
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  4009
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  4010
    ^ self class conversionErrorSignal
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  4011
!
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  4012
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4013
doesNotUnderstand:aMessage
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4014
    "this message is sent by the runtime system (VM) when
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4015
     a message is not understood by some object (i.e. there
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4016
     is no method for that selector). The original message has
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4017
     been packed into aMessage (i.e. the receiver, selector and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4018
     any arguments) and the original receiver is then sent the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4019
     #doesNotUnderstand: message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4020
     Here, we raise another signal which usually enters the debugger.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4021
     You can of course redefine #doesNotUnderstand: in your classes
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4022
     to implement message delegation,
8500
10d47cede03c Speed up MessageNotUnderstood exception sending by layz computation
Stefan Vogel <sv@exept.de>
parents: 8481
diff changeset
  4023
     or handle the MessageNotUnderstood exception gracefully."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4024
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4025
    <context: #return>
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4026
    <resource: #skipInDebuggersWalkBack>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4027
8500
10d47cede03c Speed up MessageNotUnderstood exception sending by layz computation
Stefan Vogel <sv@exept.de>
parents: 8481
diff changeset
  4028
    ^ MessageNotUnderstood raiseRequestWith:aMessage
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4029
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4030
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4031
elementBoundsError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4032
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4033
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4034
    "report an error that badElement is out of bounds
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4035
     (i.e. cannot be put into that collection).
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4036
     The error is reported by raising the ElementBoundsError exception."
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4037
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4038
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4039
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4040
    ^ ElementBoundsError raise
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4041
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4042
    "Modified: 8.5.1996 / 09:12:45 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4043
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4044
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4045
elementBoundsError:aValue
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4046
    "{ Pragma: +optSpace }"
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4047
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4048
    "report an error that aValue is not valid as element
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4049
     (i.e. cannot be put into that collection).
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4050
     The error is reported by raising the ElementBoundsError exception."
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4051
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4052
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4053
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4054
    ^ ElementBoundsError raiseWith:aValue
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4055
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4056
    "Modified: 8.5.1996 / 09:12:45 / cg"
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4057
!
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4058
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4059
elementNotCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4060
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4061
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4062
    "report an error that object to be stored is no Character.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4063
     (usually when storing into Strings).
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4064
     The error is reported by raising the ElementBoundsError exception."
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4065
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4066
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4067
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4068
    ^ ElementBoundsError raise
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4069
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4070
    "Modified: 8.5.1996 / 09:12:49 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4071
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4072
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4073
elementNotInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4074
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4075
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4076
    "report an error that object to be stored is not Integer.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4077
     (in collections that store integers only).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4078
     The error is reported by raising the ElementOutOfBoundsSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4079
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4080
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4081
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4082
    ^ ElementBoundsError raise
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4083
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4084
    "Modified: 8.5.1996 / 09:12:51 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4085
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4086
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4087
error
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4088
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4089
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4090
    "report error that an error occured.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4091
     The error is reported by raising the Error exception,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4092
     which is non-proceedable.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4093
     If no handler has been setup, a debugger is entered."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4094
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4095
    <context: #return>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4096
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4097
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4098
    Error raiseWith:#error:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4099
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4100
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4101
     nil error
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4102
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4103
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4104
    "Modified: / 8.5.1996 / 09:13:01 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4105
    "Modified: / 2.8.1999 / 17:00:19 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4106
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4107
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4108
error:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4109
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4110
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4111
    "Raise an error with error message aString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4112
     The error is reported by raising the Error exception,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4113
     which is non-proceedable.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4114
     If no handler has been setup, a debugger is entered."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4115
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4116
    <context: #return>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4117
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4118
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4119
    Error raiseWith:#error: errorString:aString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4120
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4121
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4122
      nil error:' bad bad bad'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4123
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4124
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4125
    "Modified: 8.5.1996 / 09:13:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4126
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4127
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4128
error:aString mayProceed:mayProceed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4129
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4130
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4131
    "enter debugger with error-message aString.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4132
     The error is reported by raising either the
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4133
     non-proceedable Error exception,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4134
     or the ProceedableError exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4135
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4136
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4137
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4138
    mayProceed ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4139
        ^ ProceedableError raiseRequestWith:#error: errorString:aString
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4140
    ].
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4141
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4142
    Error raiseWith:#error: errorString:aString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4143
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4144
    "Modified: 8.5.1996 / 09:13:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4145
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4146
6900
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4147
errorInvalidFormat
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4148
    "{ Pragma: +optSpace }"
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4149
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4150
    "report an error that some conversion to/from string representation failed
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4151
     typically when converting numbers, date, time etc."
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4152
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4153
    <context: #return>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4154
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4155
6900
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4156
    ^ ConversionError raiseErrorString:'invalid format'
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4157
!
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4158
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4159
errorKeyNotFound:aKey
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4160
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4161
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4162
    "report an error that a key was not found in a collection.
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4163
     The error is reported by raising the KeyNotFoundError exception."
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4164
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4165
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4166
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  4167
    ^ KeyNotFoundError raiseRequestWith:aKey errorString:(' ', aKey printString)
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4168
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4169
    "
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4170
     Dictionary new at:#nonExistantElement
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4171
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4172
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4173
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4174
errorNotFound
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4175
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4176
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4177
    "report an error that no element was found in a collection.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4178
     The error is reported by raising the NotFoundSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4179
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4180
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4181
6946
905fcfc8699b signal-classVars replaced by error-class access
Claus Gittinger <cg@exept.de>
parents: 6932
diff changeset
  4182
    ^ NotFoundError raiseRequestWith:nil
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4183
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4184
    "Modified: / 8.5.1996 / 09:13:11 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4185
    "Modified: / 26.7.1999 / 10:51:50 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4186
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4187
6874
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4188
errorNotFound:errorString
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4189
    "{ Pragma: +optSpace }"
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4190
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4191
    "report an error that no element was found in a collection.
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4192
     The error is reported by raising the NotFoundSignal exception."
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4193
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4194
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4195
10837
63d19c75d762 changed #errorNotFound: raise it proceedable
Stefan Vogel <sv@exept.de>
parents: 10834
diff changeset
  4196
    ^ NotFoundError raiseRequestErrorString:errorString
6874
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4197
!
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4198
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4199
errorSignal
11132
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  4200
    "return the signal used for error/error: handling"
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  4201
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4202
    ^ self class errorSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4203
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4204
    "Created: / 19.6.1998 / 02:32:32 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4205
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4206
7322
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4207
handlerForSignal:exceptionHandler context:theContext originator:originator
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4208
    " should never be invoked for non-blocks/non-exceptions/non-signals"
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4209
7566
f691eac0f114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7562
diff changeset
  4210
    thisContext isRecursive ifTrue:[^ nil].
f691eac0f114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7562
diff changeset
  4211
7322
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4212
    'Warning: handlerForSignal invoked for: ' print. self printCR.
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4213
    '         context: ' print. theContext printCR.
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4214
    '         originator: ' print. originator printCR.
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4215
    '         sender: ' print. thisContext sender printCR.
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4216
7566
f691eac0f114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7562
diff changeset
  4217
    "/ MiniDebugger enter:thisContext withMessage:'oops' mayProceed:true.
f691eac0f114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7562
diff changeset
  4218
    self error:'this method should only be invoked for blocks, exceptions and signals'.
7322
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4219
!
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4220
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4221
implementedBySubclass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4222
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4223
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4224
    "this is sent by ST/V code - its the same as #subclassResponsibility"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4225
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4226
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4227
12322
a8a569a96301 changed:
Claus Gittinger <cg@exept.de>
parents: 12321
diff changeset
  4228
    ^ SubclassResponsibilityError raiseRequestErrorString:'method must be reimplemented in ST/V subclass'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4229
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4230
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4231
indexNotInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4232
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4233
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4234
    "report an error that index is not an Integer.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4235
     (when accessing collections indexed by an integer key).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4236
     The error is reported by raising the NonIntegerIndexSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4237
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4238
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4239
6946
905fcfc8699b signal-classVars replaced by error-class access
Claus Gittinger <cg@exept.de>
parents: 6932
diff changeset
  4240
    ^ NonIntegerIndexError raiseRequestWith:nil
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4241
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4242
    "Modified: / 8.5.1996 / 09:13:37 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4243
    "Modified: / 26.7.1999 / 10:57:43 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4244
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4245
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4246
indexNotInteger:anIndex
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4247
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4248
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4249
    "report an error that index is not an Integer.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4250
     (when accessing collections indexed by an integer key).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4251
     The error is reported by raising the NonIntegerIndexSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4252
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4253
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4254
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4255
    ^ NonIntegerIndexError raiseRequestWith:anIndex
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4256
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4257
    "Created: / 16.5.1998 / 19:39:41 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4258
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4259
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4260
indexNotIntegerOrOutOfBounds:index
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4261
    "{ Pragma: +optSpace }"
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4262
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4263
    "report an error that index is either non-integral or out of bounds"
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4264
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4265
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4266
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4267
    index isInteger ifFalse:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4268
        ^ self indexNotInteger:index
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4269
    ].
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4270
    ^ self subscriptBoundsError:index
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4271
!
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4272
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4273
integerCheckError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4274
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4275
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4276
    "generated when a variable declared with an integer type gets a bad value assigned"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4277
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4278
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4279
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4280
"/    ^ self error:'bad assign of ' , self printString ,
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4281
"/                  ' (' , self class name , ') to integer-typed variable'
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  4282
    ^ InvalidTypeError
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4283
        raiseRequestErrorString:(
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4284
            'bad assign of ' , self printString ,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4285
                  ' (' , self class name , ') to integer-typed variable')
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4286
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4287
    "Modified: / 02-11-2012 / 10:25:36 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4288
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4289
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4290
invalidCodeObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4291
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4292
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4293
    "this is sent by VM if it encounters some non-method for execution"
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4294
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4295
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4296
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4297
    "/ self error:'not an executable code object'
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  4298
    ^ ExecutionError
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4299
        raiseRequestErrorString:'not an executable code object'
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4300
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4301
    "Created: / 01-08-1997 / 00:16:44 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4302
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4303
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4304
invalidMessage
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4305
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4306
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4307
    "this is sent by ST/V code - it's the same as #shouldNotImplement"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4308
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4309
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4310
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4311
    ^ self shouldNotImplement
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4312
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4313
    "Modified (comment): / 02-11-2012 / 10:11:18 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4314
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4315
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4316
mustBeRectangle
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4317
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4318
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4319
    "report an argument-not-rectangle-error"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4320
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4321
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4322
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4323
    "/ ^ self error:'argument must be a Rectangle'
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4324
    ^ InvalidTypeError
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4325
        raiseRequestErrorString:'argument must be a Rectangle'
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4326
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4327
    "Modified: / 02-11-2012 / 10:24:53 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4328
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4329
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4330
mustBeString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4331
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4332
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4333
    "report an argument-not-string-error"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4334
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4335
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4336
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4337
    "/ ^ self error:'argument must be a String'
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4338
    ^ InvalidTypeError
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4339
        raiseRequestErrorString:'argument must be a String'
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4340
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4341
    "Modified: / 02-11-2012 / 10:24:35 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4342
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4343
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4344
notIndexed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4345
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4346
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4347
    "report an error that receiver has no indexed instance variables.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4348
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4349
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4350
    <context: #return>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4351
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4352
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4353
    ^ SubscriptOutOfBoundsError
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4354
        raiseRequestErrorString:'receiver has no indexed variables'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4355
14539
9cc7e1ad8b52 class: Object
Claus Gittinger <cg@exept.de>
parents: 14534
diff changeset
  4356
    "
9cc7e1ad8b52 class: Object
Claus Gittinger <cg@exept.de>
parents: 14534
diff changeset
  4357
     1234 at:4
9cc7e1ad8b52 class: Object
Claus Gittinger <cg@exept.de>
parents: 14534
diff changeset
  4358
    "
9cc7e1ad8b52 class: Object
Claus Gittinger <cg@exept.de>
parents: 14534
diff changeset
  4359
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4360
    "Modified: 26.7.1996 / 16:43:13 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4361
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4362
12050
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4363
notYetImplemented
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4364
    "{ Pragma: +optSpace }"
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4365
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4366
    "report an error that some functionality is not yet implemented.
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4367
     This is here only for compatibility - it has the same meaning as shouldImplement."
12050
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4368
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4369
    <resource: #skipInDebuggersWalkBack>
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4370
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4371
    "/ ^ self error:'method/functionality is not yet implemented'
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  4372
    ^ MethodNotAppropriateError
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4373
        raiseRequestErrorString:'method/functionality is not yet implemented'
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4374
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4375
    "Modified: / 02-11-2012 / 10:24:12 / cg"
12050
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4376
!
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4377
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4378
openDebuggerOnException:ex
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4379
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4380
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4381
    "enter the debugger on some unhandled exception"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4382
6884
de5e191dbfaf more standAlone support
Claus Gittinger <cg@exept.de>
parents: 6877
diff changeset
  4383
    |msgString debugger answer|
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4384
11314
0b6e06b60ebe changed the error-notifier for standAlone apps.
Claus Gittinger <cg@exept.de>
parents: 11244
diff changeset
  4385
    msgString := ex descriptionForDebugger.
11236
c196f9dedf66 exception description in debugger
Claus Gittinger <cg@exept.de>
parents: 11221
diff changeset
  4386
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4387
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4388
     if there is no debugger,
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4389
     ask for ignore or exit. Exit will terminate the application.
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4390
     ignore will raise an AbortOperationRequest.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4391
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4392
    Debugger isNil ifTrue:[
14965
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4393
        msgString := 'Error: ' , msgString.
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4394
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4395
        thisContext isRecursive ifTrue:[
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4396
            msgString errorPrintCR.
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4397
            Smalltalk fatalAbort:'recursive unhandled exception'
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4398
        ].
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4399
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4400
        Smalltalk isStandAloneApp ifTrue:[
15116
566d19a9cbbb class: Object
Claus Gittinger <cg@exept.de>
parents: 15034
diff changeset
  4401
            (ex creator == NoHandlerError and:[HaltInterrupt handles:ex exception]) ifTrue:[
14965
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4402
                "/ 'Halt ignored' infoPrintCR.
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4403
                ^ nil
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4404
            ].
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4405
            "don't output the message, if the exception is a UserInterrupt (CTRL-C)"
15116
566d19a9cbbb class: Object
Claus Gittinger <cg@exept.de>
parents: 15034
diff changeset
  4406
            (ex creator == NoHandlerError
566d19a9cbbb class: Object
Claus Gittinger <cg@exept.de>
parents: 15034
diff changeset
  4407
             and:[ex exception creator == UserInterrupt]) ifTrue:[
14965
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4408
                ex description errorPrintCR.
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4409
                OperatingSystem exit:130.
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4410
            ].
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4411
        ].
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4412
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4413
        (Dialog notNil and:[Screen default notNil]) ifTrue:[
11314
0b6e06b60ebe changed the error-notifier for standAlone apps.
Claus Gittinger <cg@exept.de>
parents: 11244
diff changeset
  4414
false "oldCode" ifTrue:[
14965
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4415
            AbortOperationRequest isHandled ifTrue:[
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4416
                answer := OptionBox
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4417
                        request:msgString
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4418
                        label:msgString
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4419
                        buttonLabels:#('Exit' 'Terminate Thread' 'Ignore' 'Abort' )
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4420
                        values:#(exit terminate ignore abort)
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4421
                        default:#abort.
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4422
            ] ifFalse:[
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4423
                answer := OptionBox
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4424
                        request:msgString
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4425
                        label:msgString
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4426
                        buttonLabels:#('Exit' 'Terminate Thread' 'Ignore' )
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4427
                        values:#(exit terminate ignore )
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4428
                        default:#terminate.
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4429
            ].
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4430
            answer isNil ifTrue:[ answer := #ignore].
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4431
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4432
            answer == #abort ifTrue:[
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4433
                ^ AbortOperationRequest raiseRequest
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4434
            ].
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4435
            answer == #ignore ifTrue:[
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4436
                ^ nil
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4437
            ].
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4438
            answer == #terminate ifTrue:[
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4439
                Processor activeProcess isSystemProcess ifTrue:[
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4440
                    (Dialog confirm:'Are you sure (this might finish the application)') ifFalse:[
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4441
                        ^ nil
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4442
                    ].
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4443
                ].
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4444
                ^ Processor activeProcess terminate.
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4445
            ].
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4446
            "asking second time here to prevent the user from accidently closing his app"
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4447
            answer == #exit ifTrue:[
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4448
                answer := OptionBox
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4449
                        request:'Do you really wish to exit this application (all changes will be lost)?'
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4450
                        label:msgString
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4451
                        buttonLabels:#('Yes' 'No' )
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4452
                        values:#(exit abort)
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4453
                        default:#abort.
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4454
            ].
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4455
            answer == #abort ifTrue:[
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4456
                ^ AbortOperationRequest raiseRequest
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4457
            ].
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4458
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4459
            (Dialog confirm:'Are you sure you want to finish the application ?') ifFalse:[
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4460
                ^ nil
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4461
            ].
11314
0b6e06b60ebe changed the error-notifier for standAlone apps.
Claus Gittinger <cg@exept.de>
parents: 11244
diff changeset
  4462
] ifFalse:[
14965
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4463
            self
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4464
                errorNotify:msgString
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4465
                from:ex suspendedContext
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4466
                allowDebug:false.
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4467
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4468
            "/ arrive here if proceeded...
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4469
            ^ nil
11314
0b6e06b60ebe changed the error-notifier for standAlone apps.
Claus Gittinger <cg@exept.de>
parents: 11244
diff changeset
  4470
].
0b6e06b60ebe changed the error-notifier for standAlone apps.
Claus Gittinger <cg@exept.de>
parents: 11244
diff changeset
  4471
14965
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4472
        ].
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4473
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4474
        "don't output the message, if the exception is a UserInterrupt (CTRL-C)"
15116
566d19a9cbbb class: Object
Claus Gittinger <cg@exept.de>
parents: 15034
diff changeset
  4475
        (ex creator == NoHandlerError
566d19a9cbbb class: Object
Claus Gittinger <cg@exept.de>
parents: 15034
diff changeset
  4476
         and:[ex exception creator == UserInterrupt]) ifTrue:[
14965
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4477
            OperatingSystem exit:130.
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4478
        ].
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4479
        msgString errorPrintCR.
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4480
        thisContext fullPrintAll.
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4481
        OperatingSystem exit:1
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4482
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4483
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4484
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4485
     find an appropriate debugger to use
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4486
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4487
    debugger := self appropriateDebugger:(thisContext selector).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4488
    debugger isNil ifTrue:[
14965
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4489
        ^ AbortOperationRequest raiseRequest
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4490
    ].
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4491
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4492
    ^ debugger enterException:ex.
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4493
"/    ^ debugger
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4494
"/        enter:ex returnableSuspendedContext
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4495
"/        withMessage:ex descriptionForDebugger
4f15190342d6 class: Object
Claus Gittinger <cg@exept.de>
parents: 14830
diff changeset
  4496
"/        mayProceed:(ex mayProceed).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4497
13849
01e27cdbf2bb changed: #openDebuggerOnException:
Claus Gittinger <cg@exept.de>
parents: 13848
diff changeset
  4498
    "Modified: / 05-12-2011 / 11:53:10 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4499
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4500
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4501
primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4502
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4503
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4504
    "report an error that some primitive code failed.
14539
9cc7e1ad8b52 class: Object
Claus Gittinger <cg@exept.de>
parents: 14534
diff changeset
  4505
     The error is reported by raising the PrimitiveFailure exception.
9cc7e1ad8b52 class: Object
Claus Gittinger <cg@exept.de>
parents: 14534
diff changeset
  4506
     Sorry for the code duplication: it avoids the extra frame in the debugger."
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4507
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4508
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4509
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4510
    |sender|
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4511
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4512
    sender := thisContext sender.
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4513
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4514
    ^ PrimitiveFailure raiseRequestWith:(Message selector:sender selector arguments:sender args)
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4515
                       in:sender.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4516
6005
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  4517
    "
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  4518
     1234 primitiveFailed
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4519
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4520
     [
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4521
        ExternalBytes new   basicAt:40
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4522
     ] on:PrimitiveFailure do:[:ex|
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4523
        ex inspect
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4524
     ]
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4525
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4526
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4527
8977
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4528
primitiveFailed:messageString
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4529
    "{ Pragma: +optSpace }"
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4530
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4531
    "report an error that some primitive code failed.
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4532
     The error is reported by raising the PrimitiveFailureSignal exception."
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4533
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4534
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4535
8977
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4536
    |sender|
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4537
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4538
    sender := thisContext sender.
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4539
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4540
    ^ PrimitiveFailure raiseRequestWith:(Message selector:sender selector arguments:sender args)
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4541
                       errorString:messageString
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4542
                       in:sender.
8977
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4543
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4544
    "
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4545
     1234 primitiveFailed:'this is a test'
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4546
    "
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4547
!
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4548
6815
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4549
shouldImplement
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4550
    "{ Pragma: +optSpace }"
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4551
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4552
    "report an error that this message/functionality should be implemented.
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4553
     This is send by automatically generated method bodies or inside as-yet-uncoded
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4554
     branches of existing methods."
6815
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4555
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4556
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4557
9216
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4558
    |sender|
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4559
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4560
    sender := thisContext sender.
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4561
12841
d804b0f27fe7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12733
diff changeset
  4562
    ^ UnimplementedFunctionalityError
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4563
        raiseRequestWith:(Message selector:sender selector arguments:sender args)
9216
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4564
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4565
     "
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4566
      self shouldImplement
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4567
     "
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4568
!
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4569
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4570
shouldImplement:what
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4571
    "{ Pragma: +optSpace }"
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4572
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4573
    "report an error that this message/functionality should be implemented.
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4574
     This is send by automatically generated method bodies or inside as-yet-uncoded
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4575
     branches of existing methods."
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4576
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4577
    <resource: #skipInDebuggersWalkBack>
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4578
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4579
    |sender|
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4580
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4581
    sender := thisContext sender.
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4582
12841
d804b0f27fe7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12733
diff changeset
  4583
    ^ UnimplementedFunctionalityError
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4584
        raiseRequestWith:(Message selector:sender selector arguments:sender args)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4585
        errorString:what
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4586
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4587
     "
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4588
      self shouldImplement:'foobar'
9216
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4589
     "
6815
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4590
!
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4591
11976
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4592
shouldNeverBeReached
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4593
    "report an error that this point may never be reached."
12841
d804b0f27fe7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12733
diff changeset
  4594
14499
6ed948158d25 class: Object
Claus Gittinger <cg@exept.de>
parents: 14478
diff changeset
  4595
    <resource: #skipInDebuggersWalkBack>
6ed948158d25 class: Object
Claus Gittinger <cg@exept.de>
parents: 14478
diff changeset
  4596
6ed948158d25 class: Object
Claus Gittinger <cg@exept.de>
parents: 14478
diff changeset
  4597
    ^ ExecutionError
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4598
        raiseRequestErrorString:'Oops, this may never reached. Something somewhere was terribly wrong.'.
11976
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4599
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4600
    "Modified: / 20-04-2005 / 18:59:28 / janfrog"
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4601
!
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4602
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4603
shouldNeverBeSent
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4604
    "report an error that this message may never be sent to the reciever"
12841
d804b0f27fe7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12733
diff changeset
  4605
14499
6ed948158d25 class: Object
Claus Gittinger <cg@exept.de>
parents: 14478
diff changeset
  4606
    <resource: #skipInDebuggersWalkBack>
6ed948158d25 class: Object
Claus Gittinger <cg@exept.de>
parents: 14478
diff changeset
  4607
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4608
    "/ ^ self error:'This message never may be sent to me!!'.
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  4609
    ^ MethodNotAppropriateError
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4610
        raiseRequestErrorString:'This message never may be sent to me!!'
11976
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4611
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4612
    "Modified: / 20-04-2005 / 18:59:28 / janfrog"
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4613
    "Modified: / 02-11-2012 / 10:10:42 / cg"
11976
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4614
!
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4615
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4616
shouldNotImplement
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4617
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4618
12841
d804b0f27fe7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12733
diff changeset
  4619
    "report an error that this message should not be implemented -
12733
48cc66ac5d52 comment/format in: #shouldNotImplement
Claus Gittinger <cg@exept.de>
parents: 12718
diff changeset
  4620
     i.e. that a method is invoked which is not appropriate for the receiver."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4621
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4622
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4623
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4624
    "/ self error:'method/functionality not appropriate for this class'
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  4625
    ^ MethodNotAppropriateError
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4626
        raiseRequestErrorString:'method/functionality not appropriate for this class'
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4627
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4628
    "Modified: / 02-11-2012 / 10:02:25 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4629
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4630
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4631
subclassResponsibility
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4632
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4633
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4634
    "report an error that this message should have been reimplemented in a subclass"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4635
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4636
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4637
10877
0666d48f91d1 show the affected method-selector in the subclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 10856
diff changeset
  4638
    ^ SubclassResponsibilityError raiseRequestWith:thisContext sender selector
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4639
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4640
6721
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4641
subclassResponsibility:msg
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4642
    "{ Pragma: +optSpace }"
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4643
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4644
    "report an error that this message should have been reimplemented in a subclass"
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4645
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4646
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4647
7334
7da368a2f0da *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 7322
diff changeset
  4648
    ^ SubclassResponsibilityError raiseRequestErrorString:msg
6721
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4649
!
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4650
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4651
subscriptBoundsError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4652
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4653
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4654
    "report an error that some index is out of bounds.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4655
     (when accessing indexable collections).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4656
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4657
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4658
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4659
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4660
    ^ SubscriptOutOfBoundsSignal raiseRequestWith:nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4661
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4662
    "Modified: / 26.7.1996 / 16:45:42 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4663
    "Modified: / 26.7.1999 / 10:58:27 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4664
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4665
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4666
subscriptBoundsError:anIndex
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4667
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4668
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4669
    "report an error that anIndex is out of bounds.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4670
     (when accessing indexable collections).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4671
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4672
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4673
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4674
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4675
    ^ SubscriptOutOfBoundsError
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4676
        raiseRequestWith:anIndex
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4677
        errorString:('subscript (' , anIndex printString , ') out of bounds')
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4678
6221
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  4679
    "Modified: / 17.11.2001 / 22:49:56 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4680
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4681
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4682
typeCheckError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4683
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4684
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4685
    "generated when a variable declared with a type hint gets a bad
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4686
     value assigned"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4687
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4688
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4689
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4690
"/    ^ self error:'bad assign of ' , self printString ,
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4691
"/                  ' (' , self class name , ') to typed variable'
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4692
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4693
    ^ InvalidTypeError
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4694
        raiseRequestErrorString:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4695
            ('bad assign of ' , self printString ,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4696
                  ' (' , self class name , ') to typed variable')
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4697
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4698
    "Modified: / 02-11-2012 / 10:19:15 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4699
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4700
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4701
!Object methodsFor:'evaluation'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4702
8690
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4703
argumentCount
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4704
    "compatibility with Blocks and Messages.
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4705
     Answer 0, since we only understand #value.
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4706
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4707
     By implementing this, you can pass any object as an exception handler."
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4708
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4709
    ^ 0
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4710
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4711
    "
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4712
        [1 // 0] on:ArithmeticError do:9999
8690
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4713
    "
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4714
!
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4715
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4716
value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4717
    "return the receiver itself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4718
     This allows every object to be used where blocks or valueHolders
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4719
     are typically used, and allows for valueHolders and blocks to be
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4720
     used interchangably in some situations.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4721
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4722
     Time will show, if this is a good idea or leads to sloppy programming
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4723
     style ... (the idea was borrowed from the Self language).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4724
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4725
     WARNING: dont 'optimize' away ifXXX: blocks
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4726
              (i.e. do NOT replace
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4727
                        foo ifTrue:[var1] ifFalse:[var2]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4728
               by:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4729
                        foo ifTrue:var1 ifFalse:var2
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4730
              )
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4731
              - the compilers will only generate inline code for the if,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4732
                iff the argument(s) are blocks - otherwise, a true send is
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4733
                generated.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4734
              This 'oprimization' will work semantically correct,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4735
              but execute SLOWER instead."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4736
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4737
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4738
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4739
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4740
     #(1 2 3 4) indexOf:5 ifAbsent:0
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4741
     #(1 2 3 4) indexOf:5 ifAbsent:[0]
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4742
     1 > 2 ifTrue:['yes'] ifFalse:['no']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4743
     1 > 2 ifTrue:'yes' ifFalse:'no'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4744
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4745
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4746
    "DO NOT DO THIS (its slower)
7458
b0ca7546cbd6 CG: comment in value
Stefan Vogel <sv@exept.de>
parents: 7455
diff changeset
  4747
     (1 > 4) ifTrue:a ifFalse:b
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4748
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4749
     USE (the compiler optimizes blocks in if/while):
7458
b0ca7546cbd6 CG: comment in value
Stefan Vogel <sv@exept.de>
parents: 7455
diff changeset
  4750
     (1 > 4) ifTrue:[a] ifFalse:[b]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4751
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4752
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4753
    "Modified: 3.5.1996 / 11:57:08 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4754
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4756
!Object methodsFor:'finalization'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4757
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4758
disposed
6439
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4759
    "OBSOLETE INTERFACE: use #finalize
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4760
     this is invoked for objects which have been registered
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4761
     in a Registry, when the original object dies.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4762
     Subclasses may redefine this method"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4763
6439
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4764
    <resource: #obsolete>
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4765
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4766
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4767
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4768
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4769
executor
6439
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4770
    "Return the object which does the finalization for me.
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4771
     This interface is also VW & Sqeak compatible,"
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4772
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4773
    "for now, send #shallowCopyForFinalization, to be compatible with
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4774
     classes designed for old ST/X versions"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4775
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4776
    ^ self shallowCopyForFinalization
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4777
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4778
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4779
finalizationLobby
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4780
    "answer a Registry used for finalization.
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4781
     Use a generic Registry for any object.
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4782
     Subclasses using their own Registry should redefine this"
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4783
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4784
    ^ FinalizationLobby
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4785
!
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4786
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4787
finalize
6439
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4788
    "this is invoked for executor objects which have been registered
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4789
     in a Registry, when the original object dies.
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4790
     Subclasses may redefine this method
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4791
     This interface is also VW-compatible"
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4792
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4793
    "send #disposed for compatibility with existing classes that still
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4794
     implement the obsolete #disposed message"
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4795
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4796
    ^ self disposed
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4797
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4798
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4799
reRegisterForFinalization
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4800
    "re-register mySelf for later finalization.
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4801
     This will create a new executor, which will receive a #finalize message when
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4802
     the receiver is garbage collected."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4803
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4804
    self finalizationLobby registerChange:self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4805
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4806
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4807
registerForFinalization
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4808
    "register mySelf for later finalization.
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4809
     Once registered, the executor of the receiver will receive a #finalize message when
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4810
     the receiver is garbage collected."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4811
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4812
    self finalizationLobby register:self
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4813
!
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4814
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4815
shallowCopyForFinalization
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4816
    "OBSOLETE INTERFACE: use #executor.
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4817
     This is used to aquire a copy to be used for finalization -
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4818
     (the copy will be sent a #finalize message; see the documentation in the Registry class)
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4819
     This method can be redefined for more efficient copying - especially for large objects."
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4820
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4821
    <resource: #obsolete>
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4822
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4823
    ^ self shallowCopy
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4824
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4825
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4826
unregisterForFinalization
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4827
    "unregister mySelf from later finalization"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4828
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4829
    self finalizationLobby unregister:self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4830
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4831
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4832
!Object methodsFor:'initialization'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4833
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4834
initialize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4835
    "just to ignore initialize to objects which do not need it"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4836
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4837
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4838
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4839
13190
1e2813b585c9 category of: #inspectorClass
Claus Gittinger <cg@exept.de>
parents: 13187
diff changeset
  4840
!Object methodsFor:'inspecting'!
1e2813b585c9 category of: #inspectorClass
Claus Gittinger <cg@exept.de>
parents: 13187
diff changeset
  4841
1e2813b585c9 category of: #inspectorClass
Claus Gittinger <cg@exept.de>
parents: 13187
diff changeset
  4842
inspectorClass
1e2813b585c9 category of: #inspectorClass
Claus Gittinger <cg@exept.de>
parents: 13187
diff changeset
  4843
    "{ Pragma: +optSpace }"
1e2813b585c9 category of: #inspectorClass
Claus Gittinger <cg@exept.de>
parents: 13187
diff changeset
  4844
1e2813b585c9 category of: #inspectorClass
Claus Gittinger <cg@exept.de>
parents: 13187
diff changeset
  4845
    "return the class to use for inspect.
1e2813b585c9 category of: #inspectorClass
Claus Gittinger <cg@exept.de>
parents: 13187
diff changeset
  4846
     Can (should) be redefined in classes for which a better inspector is available"
1e2813b585c9 category of: #inspectorClass
Claus Gittinger <cg@exept.de>
parents: 13187
diff changeset
  4847
14055
b9292728b602 changed: #inspectorClass
Claus Gittinger <cg@exept.de>
parents: 14046
diff changeset
  4848
    ^ Inspector ? InspectorView
b9292728b602 changed: #inspectorClass
Claus Gittinger <cg@exept.de>
parents: 14046
diff changeset
  4849
b9292728b602 changed: #inspectorClass
Claus Gittinger <cg@exept.de>
parents: 14046
diff changeset
  4850
    "Modified: / 08-03-2012 / 16:09:38 / cg"
13190
1e2813b585c9 category of: #inspectorClass
Claus Gittinger <cg@exept.de>
parents: 13187
diff changeset
  4851
! !
1e2813b585c9 category of: #inspectorClass
Claus Gittinger <cg@exept.de>
parents: 13187
diff changeset
  4852
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4853
!Object methodsFor:'interrupt handling'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4854
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4855
childSignalInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4856
    "death of a child process (unix process) - do nothing"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4857
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4858
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4859
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4860
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4861
customInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4862
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4863
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4864
    "a custom interrupt - but no handler has defined"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4865
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4866
    self error:'custom interrupt' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4867
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4868
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4869
errorInterrupt:errorID with:aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4870
    "subsystem error. The arguments errorID and aParameter are the values passed
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4871
     to the 'errorInterruptWithIDAndParameter(id, param)' function,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4872
     which can be called from C subsystems to raise an (asynchronous)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4873
     error exception.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4874
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4875
     Currently, this is used to map XErrors to smalltalk errors, but can be
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4876
     used from other C subsystems too, to upcast errors.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4877
     Especially, for subsystems which call errorHandler functions asynchronously.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4878
     IDs (currently) used:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4879
        #DisplayError ..... x-error interrupt
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4880
        #XtError      ..... xt-error interrupt (Xt interface is not yet published)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4881
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4882
6263
4e7a970e4cfc errorInterrupt:with: fixed (care for nil handlers in Objmem)
Claus Gittinger <cg@exept.de>
parents: 6235
diff changeset
  4883
    |handlers handler|
4e7a970e4cfc errorInterrupt:with: fixed (care for nil handlers in Objmem)
Claus Gittinger <cg@exept.de>
parents: 6235
diff changeset
  4884
4e7a970e4cfc errorInterrupt:with: fixed (care for nil handlers in Objmem)
Claus Gittinger <cg@exept.de>
parents: 6235
diff changeset
  4885
    handlers := ObjectMemory registeredErrorInterruptHandlers.
4e7a970e4cfc errorInterrupt:with: fixed (care for nil handlers in Objmem)
Claus Gittinger <cg@exept.de>
parents: 6235
diff changeset
  4886
    handlers notNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4887
        handler := handlers at:errorID ifAbsent:nil.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4888
        handler notNil ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4889
            "/
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4890
            "/ handler found; let it do whatever it wants ...
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4891
            "/
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4892
            handler errorInterrupt:errorID with:aParameter.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4893
            ^ self
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4894
        ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4895
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4896
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4897
    "/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4898
    "/ no handler - raise errorSignal passing the errorId as parameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4899
    "/
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4900
    ^ Error
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4901
        raiseRequestWith:errorID
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4902
        errorString:('Subsystem error. ErrorID = ' , errorID printString)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4903
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4904
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4905
exceptionInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4906
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4907
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4908
    "exception interrupt - enter debugger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4909
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4910
    self error:'exception Interrupt' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4911
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4912
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4913
fpExceptionInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4914
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4915
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4916
    "a floating point exception occured - this one
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4917
     has to be handled differently since it comes asynchronous
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4918
     on some machines (for example, on machines with a separate FPU
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4919
     or superscalar architectures. Also, errors from within primitive code
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4920
     (or library functions such as GL) are sent via the Unix-signal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4921
     mechanism this way."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4922
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4923
    |where rec|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4924
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4925
    where := thisContext sender.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4926
    rec := where receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4927
    rec isNumber ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4928
        ^ rec class
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4929
            raise:#domainErrorSignal
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4930
            receiver:rec
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4931
            selector:where selector
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4932
            arguments:(where args asArray)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4933
            errorString:'floating point exception'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4934
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4935
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4936
    "/ could be in some C-library ...
7402
b9d45ce2463a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7359
diff changeset
  4937
    ^ DomainError raise
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4938
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4939
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4940
internalError:msg
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4941
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4942
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4943
    "this is triggered, when VM hits some bad error,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4944
     such as corrupted class, corrupted method/selector array
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4945
     etc. The argument string gives some more information on what happened.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4946
     (for example, if you set an objects class to a non-behavior, nil etc.).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4947
     Its not guaranteed, that the system is in a working condition once
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4948
     this error occurred ...."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4949
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4950
    VMInternalError raiseWith:self errorString:msg
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4951
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4952
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4953
ioInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4954
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4955
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4956
    "I/O (SIGIO/SIGPOLL) interrupt (supposed to be sent to Processor).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4957
     If we arrive here, there is either no handler (ObjMem>>ioInterruptHandler)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4958
     or it does not understand the ioInterrupt message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4959
     In any case, this is a sign of some big trouble. Enter debugger."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4960
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4961
    self error:'I/O Interrupt - but no handler' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4962
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4963
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4964
memoryInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4965
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4966
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4967
    "out-of-memory interrupt and no handler - enter debugger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4968
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4969
    self error:'almost out of memory' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4970
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4971
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4972
recursionInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4973
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4974
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4975
    "recursion limit (actually: stack overflow) interrupt.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4976
     This interrupt is triggered, when a process stack grows above
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4977
     its stackLimit - usually, this leads into the debugger, but
6175
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  4978
     could be caught.
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  4979
     Under Unix, the stackLimit may be increased in the handler,
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  4980
     and the exception can be resumed.
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  4981
     Sorry, but under win32, the stack cannot grow, and the exception
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  4982
     is not proceedable.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4983
     At the time we arrive here, the system has still some stack
6175
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  4984
     as a reserve so we can continue to do some useful work, or cleanup,
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  4985
     or debug for a while.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4986
     If the signal is ignored, and the stack continues to grow, there
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4987
     will be a few more chances (and more interrupts) before the VM
6175
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  4988
     terminates the process."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4989
7838
4cf3d0dad430 skip recursive contexts when shwing backtrace of recursionInterrupt
Claus Gittinger <cg@exept.de>
parents: 7685
diff changeset
  4990
    |con remaining sender nSkipped|
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4991
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4992
    (con := thisContext) isRecursive ifFalse:[
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4993
"/        Processor activeProcess usedStackSize < Processor activeProcess maximumStackSize ifTrue:[
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4994
"/            "/ mhmh - it hit me, but I am not responsible ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4995
"/            'Stray recursionInterrupt ...' infoPrintCR.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4996
"/            ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4997
"/        ].
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4998
        ObjectMemory infoPrinting ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  4999
            'Object [info]: recursionInterrupt from:' printCR.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5000
            con := con sender.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5001
            remaining := 50.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5002
            [con notNil and:[remaining > 0]] whileTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5003
                sender := con sender.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5004
                '| ' print. con fullPrint.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5005
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5006
                nSkipped := 0.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5007
                [sender notNil and:[sender sender notNil
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5008
                and:[sender selector == con selector
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5009
                and:[sender sender selector == con selector
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5010
                and:[sender method == con method]]]]] whileTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5011
                    nSkipped := nSkipped + 1.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5012
                    con := sender.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5013
                    sender := con sender.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5014
                ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5015
                nSkipped > 0 ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5016
                    '| ... ***** ' print. nSkipped print. ' recursive contexts skipped *****' printCR.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5017
                ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5018
                con := sender.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5019
                remaining := remaining - 1
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5020
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5021
        ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5022
        ^ RecursionInterruptSignal raiseSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5023
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5024
6175
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  5025
    "Modified: / 10.11.2001 / 15:15:56 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5026
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5027
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5028
schedulerInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5029
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5030
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5031
    "scheduler interrupt (supposed to be sent to Processor).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5032
     If we arrive here, either the Processor does not understand it,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5033
     or it has been set to nil. In any case, this is a sign of some
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5034
     big trouble. Enter debugger."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5035
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5036
    self error:'schedulerInterrupt - but no Processor' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5037
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5038
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5039
signalInterrupt:signalNumber
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5040
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5041
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5042
    "unix signal occured - some signals are handled as Smalltalk Exceptions
10016
e174cf2d1f43 crash save refactored
Claus Gittinger <cg@exept.de>
parents: 9993
diff changeset
  5043
     (SIGPIPE), others (SIGBUS) are rather fatal...
11236
c196f9dedf66 exception description in debugger
Claus Gittinger <cg@exept.de>
parents: 11221
diff changeset
  5044
     In any case, IF a smalltalk-signal has been connected to the OS signal, that one is raised.
c196f9dedf66 exception description in debugger
Claus Gittinger <cg@exept.de>
parents: 11221
diff changeset
  5045
     Otherwise, a dialog is shown, asking the user on how to handle the signal.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5046
     TODO: add another argument, giving more detailed signal info (PC, VADDR,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5047
     exact cause etc.). This helps if segvs occur in primitive code.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5048
     Currently (temporary kludge), these are passed as global variables."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5049
6537
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5050
    |name here sig fatal titles actions badContext msg pc addr
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5051
     action title screen|
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5052
13254
5cf789a74946 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13229
diff changeset
  5053
    thisContext isRecursive ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5054
        'Severe error: signalInterrupt while processing a signalInterrupt.' errorPrintCR.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5055
        'Terminating process ' errorPrint. Processor activeProcess errorPrintCR.
13710
277f3a5697e8 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13656
diff changeset
  5056
"/        GenericException handle:[:ex |
277f3a5697e8 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13656
diff changeset
  5057
"/            "/ ignore any error during termination
277f3a5697e8 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13656
diff changeset
  5058
"/        ] do:[
277f3a5697e8 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13656
diff changeset
  5059
"/           Processor activeProcess terminate.
277f3a5697e8 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13656
diff changeset
  5060
"/        ].
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5061
        Processor activeProcess terminateNoSignal.
13254
5cf789a74946 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13229
diff changeset
  5062
    ].
5cf789a74946 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13229
diff changeset
  5063
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5064
    "if there has been an ST-signal installed, use it ..."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5065
    sig := OperatingSystem operatingSystemSignal:signalNumber.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5066
    sig notNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5067
        sig raiseSignalWith:signalNumber.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5068
        ^ self.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5069
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5070
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5071
    "/ if handled, raise OSSignalInterruptSignal
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  5072
    OSSignalInterrupt isHandled ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5073
        OSSignalInterrupt raiseRequestWith:signalNumber.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5074
        ^ self.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5075
    ].
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5076
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5077
    "
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5078
     special cases
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5079
        - SIGPWR: power failure - write a crash image and continue
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5080
        - SIGHUP: hang up - write a crash image and exit
10922
a1ff606fca18 #signalInterrupt: - comment
Stefan Vogel <sv@exept.de>
parents: 10918
diff changeset
  5081
    "
a1ff606fca18 #signalInterrupt: - comment
Stefan Vogel <sv@exept.de>
parents: 10918
diff changeset
  5082
    (signalNumber == OperatingSystem sigPWR) ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5083
        SnapshotError ignoreIn:[ObjectMemory writeCrashImage].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5084
        ^ self.
10922
a1ff606fca18 #signalInterrupt: - comment
Stefan Vogel <sv@exept.de>
parents: 10918
diff changeset
  5085
    ].
a1ff606fca18 #signalInterrupt: - comment
Stefan Vogel <sv@exept.de>
parents: 10918
diff changeset
  5086
    (signalNumber == OperatingSystem sigHUP) ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5087
        SnapshotError ignoreIn:[ObjectMemory writeCrashImage].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5088
        'Object [info]: exit due to hangup signal.' errorPrintCR.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5089
        Smalltalk exit:1.
7031
eae2df0a3ad2 Exit Smalltalk in SIGHUP
Stefan Vogel <sv@exept.de>
parents: 6964
diff changeset
  5090
    ].
5856
6d3df9ad361e save crash image when sigPWR or sigHUP arrives
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  5091
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5092
    name := OperatingSystem nameForSignal:signalNumber.
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5093
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5094
    "if there is no screen at all, bring up a mini debugger"
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5095
    (Screen isNil
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5096
     or:[(screen := Screen current) isNil
6778
87e2d95ce8a4 Raise #drawingOnClosedDeviceSignal instead of #error
Stefan Vogel <sv@exept.de>
parents: 6764
diff changeset
  5097
     or:[(screen := Screen default) isNil
87e2d95ce8a4 Raise #drawingOnClosedDeviceSignal instead of #error
Stefan Vogel <sv@exept.de>
parents: 6764
diff changeset
  5098
     or:[screen isOpen not]]]) ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5099
        ^ self startMiniDebuggerOrExit:'OS-Signal (' , name, ')'.
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5100
    ].
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5101
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5102
    "ungrab - in case it happened in a box/popupview
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5103
     otherwise display stays locked"
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5104
    screen ungrabPointer; ungrabKeyboard.
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5105
7031
eae2df0a3ad2 Exit Smalltalk in SIGHUP
Stefan Vogel <sv@exept.de>
parents: 6964
diff changeset
  5106
    here := thisContext.
eae2df0a3ad2 Exit Smalltalk in SIGHUP
Stefan Vogel <sv@exept.de>
parents: 6964
diff changeset
  5107
    badContext := here sender.          "the context, in which the signal occurred"
eae2df0a3ad2 Exit Smalltalk in SIGHUP
Stefan Vogel <sv@exept.de>
parents: 6964
diff changeset
  5108
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5109
    "there is a screen. use it to bring up a box asking for what to do ..."
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5110
    Screen currentScreenQuerySignal answer:screen do:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5111
        "
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5112
         SIGBUS, SIGSEGV and SIGILL do not make sense to ignore (i.e. continue)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5113
         since the system will retry the faulty instruction, which leads to
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5114
         another signal - to avoid frustration, better not offer this option.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5115
        "
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5116
        fatal := OperatingSystem isFatalSignal:signalNumber.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5117
        fatal ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5118
            (Debugger isNil or:[here isRecursive]) ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5119
                'Object [hard error]: signal ' errorPrint. signalNumber errorPrintCR.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5120
                ^ self startMiniDebuggerOrExit:'OS-Signal (' , name, ')'.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5121
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5122
            "
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5123
             a hard signal - go into debugger immediately
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5124
            "
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5125
            msg := 'OS-signal: ', name.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5126
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5127
            "/ the IRQ-PC is passed as low-hi, to avoid the need
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5128
            "/ to allocate a LargeInteger in the VM during signal
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5129
            "/ time. I know, this is ugly.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5130
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5131
            InterruptPcLow notNil ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5132
                pc := InterruptPcLow + (InterruptPcHi bitShift:((SmallInteger maxBits + 1) // 2)).
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5133
                pc ~~ 0 ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5134
                    msg := msg , ' PC=' , (pc printStringRadix:16)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5135
                ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5136
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5137
            InterruptAddrLow notNil ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5138
                addr := InterruptAddrLow + (InterruptAddrHi bitShift:((SmallInteger maxBits + 1) // 2)).
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5139
                addr ~~ 0 ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5140
                    msg := msg , ' ADDR=' , (addr printStringRadix:16)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5141
                ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5142
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5143
            Debugger enter:here withMessage:msg mayProceed:false.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5144
            "unreachable"
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5145
            ^ nil.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5146
        ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5147
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5148
        "if possible, open an option box asking the user what do.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5149
         Otherwise, start a debugger"
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5150
        Dialog notNil ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5151
            titles := #('save crash image' 'dump core' 'exit ST/X' 'debug').
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5152
            actions := #(save core exit debug).
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5153
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5154
            action := nil.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5155
            title := 'OS Signal caught (' , name, ')'.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5156
            title := (title , '\[in ST-process: ' , Processor activeProcess nameOrId ,']') withCRs.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5157
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5158
            "/ if cought while in the scheduler or event dispatcher,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5159
            "/ a modal dialog is not possible ...
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5160
            "/ (therefore, abort & return does not makes sense)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5161
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5162
            Processor activeProcess isSystemProcess ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5163
                titles := #('abort') , titles.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5164
                actions := #(abort), actions.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5165
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5166
                badContext canReturn ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5167
                    titles := #('return') , titles.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5168
                    actions :=  #(return), actions.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5169
                ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5170
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5171
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5172
            fatal ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5173
                titles := titles, #('ignore').
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5174
                actions := actions , #(ignore).
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5175
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5176
            action := Dialog choose:title
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5177
                             labels:titles
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5178
                             values:actions
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5179
                             default:(fatal ifTrue:[nil] ifFalse:[#ignore]).
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5180
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5181
            "Dialog may fail (if system process), default action is debug"
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5182
            action isEmptyOrNil ifTrue:[action := #debug].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5183
        ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5184
            action := #debug.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5185
        ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5186
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5187
        action == #save ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5188
            ObjectMemory writeCrashImage
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5189
        ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5190
        action == #core ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5191
            Smalltalk fatalAbort
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5192
        ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5193
        action == #exit ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5194
            Smalltalk exit
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5195
        ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5196
        action == #return ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5197
            badContext return
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5198
        ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5199
        action == #abort ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5200
            AbortOperationRequest raise.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5201
        ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5202
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5203
        action == #debug ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5204
            Debugger isNil ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5205
                ^ self startMiniDebuggerOrExit:'OS-Signal (' , name, ')'.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5206
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5207
            Debugger enter:here withMessage:('OS-Signal ', name) mayProceed:true.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5208
        ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5209
        "action == #ignore"
13261
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5210
    ].
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5211
13710
277f3a5697e8 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13656
diff changeset
  5212
    "Modified: / 15-09-2011 / 16:38:14 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5213
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5214
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5215
spyInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5216
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5217
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5218
    "spy interrupt and no handler - enter debugger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5219
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5220
    self error:'spy Interrupt - but no handler' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5221
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5222
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5223
startMiniDebuggerOrExit:text
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5224
    "some critical condition happened.
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5225
     Start a mini debugger or exit if none is present"
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5226
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5227
    MiniDebugger isNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5228
        "a system without debugging facilities (i.e. a standalone system)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5229
         output a message and exit."
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5230
        ('Object [error]: exit due to ', text, ' - and no debugger.') errorPrintCR.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5231
        OperatingSystem exit:99.
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5232
    ].
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5233
    MiniDebugger enterWithMessage:text mayProceed:true.
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5234
!
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5235
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5236
timerInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5237
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5238
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5239
    "timer interrupt and no handler - enter debugger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5240
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5241
    self error:'timer Interrupt - but no handler' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5242
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5243
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5244
userInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5245
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5246
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5247
    "user (^c) interrupt.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5248
     This is typically sent by the VM, when a ctrl-C is typed at the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5249
     controlling tty (i.e. in the xterm)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5250
6466
ae28dd895a58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6461
diff changeset
  5251
    UserInterruptSignal raiseRequest
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5252
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5253
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5254
userInterruptIn:aContext
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5255
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5256
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5257
    "user (^c) interrupt - enter debugger, but show aContext
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5258
     as top-context.
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5259
     This is used to hide any intermediate scheduler contexts,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5260
     in case of an interrupted process. Typically, this is sent by
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5261
     the WindowGroup, when a keyboardEvent for the ctrl-C key is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5262
     processed."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5263
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5264
    <context: #return>
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5265
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5266
    UserInterruptSignal raiseRequestWith:nil errorString:nil in:aContext
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5267
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5268
    "Created: / 18.10.1996 / 20:46:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5269
    "Modified: / 20.10.1996 / 13:06:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5270
    "Modified: / 26.7.1999 / 10:58:49 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5271
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5272
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5273
!Object methodsFor:'message sending'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5274
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5275
perform:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5276
    "send the message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5277
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  5278
    <resource: #skipInDebuggersWalkBack>
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  5279
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5280
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5281
    REGISTER OBJ sel = aSelector;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5282
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5283
    if (InterruptPending == nil) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5284
        struct inlineCache *pIlc;
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5285
    /* JV @ 2010-22-07: To improve performance I use 256 ILCs instead
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  5286
       of default 4. This significantly reduces ILC misses. The code
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  5287
       should be further optimized by remembering last selector index and
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  5288
       try a first shot on that index. Another option is to use kind of
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  5289
       hashing on lower bits of sel variable. However, a more detailed
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5290
       statistical data should be gathered before doing further optimizations.
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5291
    */
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5292
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5293
#define SEL_AND_ILC_INIT_1(l)   { nil , __ILCPERF0(l) }
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5294
#define SEL_AND_ILC_INIT_2(l)   SEL_AND_ILC_INIT_1(l)   , SEL_AND_ILC_INIT_1(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5295
#define SEL_AND_ILC_INIT_4(l)   SEL_AND_ILC_INIT_2(l)   , SEL_AND_ILC_INIT_2(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5296
#define SEL_AND_ILC_INIT_8(l)   SEL_AND_ILC_INIT_4(l)   , SEL_AND_ILC_INIT_4(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5297
#define SEL_AND_ILC_INIT_16(l)  SEL_AND_ILC_INIT_8(l)   , SEL_AND_ILC_INIT_8(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5298
#define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5299
#define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5300
#define SEL_AND_ILC_INIT_64(l)  SEL_AND_ILC_INIT_32(l)  , SEL_AND_ILC_INIT_32(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5301
#define SEL_AND_ILC_INIT_128(l) SEL_AND_ILC_INIT_64(l)  , SEL_AND_ILC_INIT_64(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5302
#define SEL_AND_ILC_INIT_256(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_128(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5303
#define nilcs 256
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5304
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5305
        static struct { OBJ sel; struct inlineCache ilc; } sel_and_ilc[nilcs] = { SEL_AND_ILC_INIT_256(29) };
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5306
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5307
#undef SEL_AND_ILC_INIT_1
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5308
#undef SEL_AND_ILC_INIT_2
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5309
#undef SEL_AND_ILC_INIT_4
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5310
#undef SEL_AND_ILC_INIT_8
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5311
#undef SEL_AND_ILC_INIT_16
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5312
#undef SEL_AND_ILC_INIT_32
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5313
#undef SEL_AND_ILC_INIT_64
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5314
#undef SEL_AND_ILC_INIT_128
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5315
#undef SEL_AND_ILC_INIT_256
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5316
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5317
        static flip = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5318
        int i;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5319
        for (i = 0; i < nilcs; i++) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5320
           if (sel == sel_and_ilc[i].sel) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5321
                pIlc = &sel_and_ilc[i].ilc;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5322
                goto perform0_send_and_return;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5323
           }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5324
        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5325
        /*printf("Object >> #perform: #%s --> no PIC found\n", __symbolVal(aSelector));*/
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5326
        pIlc = &sel_and_ilc[flip].ilc;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5327
        sel_and_ilc[flip].sel = sel;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5328
        flip = (flip + 1) % nilcs;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5329
        pIlc->ilc_func = __SEND0ADDR__;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5330
        if (pIlc->ilc_poly) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5331
             __flushPolyCache(pIlc->ilc_poly);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5332
            pIlc->ilc_poly = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5333
        }
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5334
perform0_send_and_return:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5335
        RETURN ( (*(pIlc->ilc_func))(self, sel, nil, pIlc) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5336
    } else {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5337
        static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5338
        RETURN (_SEND0(self, aSelector, nil, &ilc0));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5339
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5340
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5341
    ^ self perform:aSelector withArguments:#()
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5342
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5343
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5344
perform:aSelector inClass:aClass withArguments:argArray
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5345
    "send the message aSelector with all args taken from argArray
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5346
     to the receiver as a super-send message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5347
     This is actually more flexible than the normal super-send, since it allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5348
     to execute a method in ANY superclass of the receiver (not just the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5349
     immediate superclass).
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5350
     Thus, it is (theoretically) possible to do
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5351
         '5 perform:#< inClass:Magnitude withArguments:#(6)'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5352
     and evaluate Magnitudes compare method even if there was one in Number.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5353
     This method is used by the interpreter to evaluate super sends
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5354
     and could be used for very special behavior (language extension ?).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5355
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5356
     WARNING: this is an ST/X feature - probably not found in other smalltalks."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5357
5769
8f874be55bc9 lookup-class check in #perform:inClass was too strong.
Claus Gittinger <cg@exept.de>
parents: 5755
diff changeset
  5358
    |numberOfArgs a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 myClass|
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5359
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5360
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5361
     check, if aClass is really a superclass of the receiver
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5362
    "
5769
8f874be55bc9 lookup-class check in #perform:inClass was too strong.
Claus Gittinger <cg@exept.de>
parents: 5755
diff changeset
  5363
    myClass := self class.
8f874be55bc9 lookup-class check in #perform:inClass was too strong.
Claus Gittinger <cg@exept.de>
parents: 5755
diff changeset
  5364
    (myClass == aClass or:[myClass isSubclassOf:aClass]) ifFalse:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5365
        self error:'lookup-class argument is not a superclass of the receiver'.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5366
        ^ nil
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5367
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5368
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5369
    REGISTER OBJ *argP;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5370
    int nargs, i;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5371
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8930
diff changeset
  5372
    if (__isArrayLike(argArray)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5373
        nargs = __arraySize(argArray);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5374
        argP = __arrayVal(argArray);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5375
    } else {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5376
        if (__isNonNilObject(argArray)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5377
            static struct inlineCache ilcSize = __ILC0(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5378
            numberOfArgs = (*ilcSize.ilc_func)(argArray, @symbol(size), nil, &ilcSize);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5379
            if (!__isSmallInteger(numberOfArgs))
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5380
                goto bad;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5381
            nargs = __intVal(numberOfArgs);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5382
            argP = (OBJ *)(&a1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5383
            for (i=1; i <= nargs; i++) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5384
                *argP++ = __AT_(argArray, __mkSmallInteger(i));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5385
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5386
            argP = (OBJ *)(&a1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5387
        } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5388
            nargs = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5389
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5390
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5391
    switch (nargs) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5392
        case 0:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5393
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5394
                static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5395
                RETURN ( _SEND0(self, aSelector, aClass, &ilc0));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5396
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5397
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5398
        case 1:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5399
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5400
                static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5401
                RETURN ( _SEND1(self, aSelector, aClass, &ilc1, argP[0]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5402
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5403
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5404
        case 2:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5405
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5406
                static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5407
                RETURN ( _SEND2(self, aSelector, aClass, &ilc2, argP[0], argP[1]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5408
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5409
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5410
        case 3:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5411
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5412
                static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5413
                RETURN ( _SEND3(self, aSelector, aClass, &ilc3,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5414
                                argP[0], argP[1], argP[2]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5415
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5416
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5417
        case 4:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5418
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5419
                static struct inlineCache ilc4 = __DUMMYILCSELF4(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5420
                RETURN ( _SEND4(self, aSelector, aClass, &ilc4,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5421
                                argP[0], argP[1], argP[2], argP[3]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5422
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5423
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5424
        case 5:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5425
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5426
                static struct inlineCache ilc5 = __DUMMYILCSELF5(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5427
                RETURN ( _SEND5(self, aSelector, aClass, &ilc5,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5428
                                argP[0], argP[1], argP[2], argP[3], argP[4]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5429
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5430
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5431
        case 6:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5432
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5433
                static struct inlineCache ilc6 = __DUMMYILCSELF6(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5434
                RETURN ( _SEND6(self, aSelector, aClass, &ilc6,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5435
                                argP[0], argP[1], argP[2], argP[3], argP[4], argP[5]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5436
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5437
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5438
        case 7:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5439
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5440
                static struct inlineCache ilc7 = __DUMMYILCSELF7(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5441
                RETURN ( _SEND7(self, aSelector, aClass, &ilc7,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5442
                                argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5443
                                argP[6]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5444
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5445
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5446
        case 8:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5447
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5448
                static struct inlineCache ilc8 = __DUMMYILCSELF8(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5449
                RETURN ( _SEND8(self, aSelector, aClass, &ilc8,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5450
                                argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5451
                                argP[6], argP[7]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5452
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5453
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5454
        case 9:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5455
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5456
                static struct inlineCache ilc9 = __DUMMYILCSELF9(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5457
                RETURN ( _SEND9(self, aSelector, aClass, &ilc9,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5458
                                argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5459
                                argP[6], argP[7], argP[8]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5460
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5461
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5462
        case 10:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5463
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5464
                static struct inlineCache ilc10 = __DUMMYILCSELF10(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5465
                RETURN ( _SEND10(self, aSelector, aClass, &ilc10,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5466
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5467
                                 argP[6], argP[7], argP[8], argP[9]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5468
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5469
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5470
        case 11:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5471
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5472
                static struct inlineCache ilc11 = __DUMMYILCSELF11(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5473
                RETURN ( _SEND11(self, aSelector, aClass, &ilc11,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5474
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5475
                                 argP[6], argP[7], argP[8], argP[9], argP[10]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5476
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5477
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5478
        case 12:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5479
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5480
                static struct inlineCache ilc12 = __DUMMYILCSELF12(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5481
                RETURN ( _SEND12(self, aSelector, aClass, &ilc12,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5482
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5483
                                 argP[6], argP[7], argP[8], argP[9], argP[10],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5484
                                 argP[11]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5485
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5486
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5487
        case 13:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5488
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5489
                static struct inlineCache ilc13 = __DUMMYILCSELF13(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5490
                RETURN ( _SEND13(self, aSelector, aClass, &ilc13,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5491
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5492
                                 argP[6], argP[7], argP[8], argP[9], argP[10],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5493
                                 argP[11], argP[12]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5494
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5495
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5496
        case 14:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5497
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5498
                static struct inlineCache ilc14 = __DUMMYILCSELF14(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5499
                RETURN ( _SEND14(self, aSelector, aClass, &ilc14,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5500
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5501
                                 argP[6], argP[7], argP[8], argP[9], argP[10],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5502
                                 argP[11], argP[12], argP[13]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5503
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5504
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5505
        case 15:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5506
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5507
                static struct inlineCache ilc15 = __DUMMYILCSELF15(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5508
                RETURN ( _SEND15(self, aSelector, aClass, &ilc15,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5509
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5510
                                 argP[6], argP[7], argP[8], argP[9], argP[10],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5511
                                 argP[11], argP[12], argP[13], argP[14]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5512
            }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5513
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5514
#ifdef _SEND16
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5515
        case 16:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5516
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5517
                static struct inlineCache ilc16 = __DUMMYILCSELF16(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5518
                RETURN ( _SEND16(self, aSelector, aClass, &ilc15,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5519
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5520
                                 argP[6], argP[7], argP[8], argP[9], argP[10],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5521
                                 argP[11], argP[12], argP[13], argP[14], argP[15]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5522
            }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5523
#endif
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5524
#ifdef _SEND17
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5525
        case 17:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5526
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5527
                static struct inlineCache ilc17 = __DUMMYILCSELF17(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5528
                RETURN ( _SEND17(self, aSelector, aClass, &ilc15,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5529
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5530
                                 argP[6], argP[7], argP[8], argP[9], argP[10],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5531
                                 argP[11], argP[12], argP[13], argP[14], argP[15], argP[16]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5532
            }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5533
#endif
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5534
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5535
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5536
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5537
bad:;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5538
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5539
    "/ arrive here, if bad number of arguments (too many)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5540
    "/ ST/X (currently) only allows up to 15 method arguments
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5541
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5542
    ^ self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5543
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5544
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5545
perform:aSelector with:arg
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5546
    "send the one-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5547
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5548
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5549
    REGISTER OBJ sel = aSelector;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5550
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5551
    if (InterruptPending == nil) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5552
        struct inlineCache *pIlc;
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5553
    /* JV @ 2010-22-07: To improve performance I use 256 ILCs instead
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5554
       of default 4. For details, see comment in perform: */
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5555
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5556
#define SEL_AND_ILC_INIT_1(l)   { nil , __ILCPERF1(l) }
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5557
#define SEL_AND_ILC_INIT_2(l)   SEL_AND_ILC_INIT_1(l)   , SEL_AND_ILC_INIT_1(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5558
#define SEL_AND_ILC_INIT_4(l)   SEL_AND_ILC_INIT_2(l)   , SEL_AND_ILC_INIT_2(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5559
#define SEL_AND_ILC_INIT_8(l)   SEL_AND_ILC_INIT_4(l)   , SEL_AND_ILC_INIT_4(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5560
#define SEL_AND_ILC_INIT_16(l)  SEL_AND_ILC_INIT_8(l)   , SEL_AND_ILC_INIT_8(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5561
#define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5562
#define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5563
#define SEL_AND_ILC_INIT_64(l)  SEL_AND_ILC_INIT_32(l)  , SEL_AND_ILC_INIT_32(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5564
#define SEL_AND_ILC_INIT_128(l) SEL_AND_ILC_INIT_64(l)  , SEL_AND_ILC_INIT_64(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5565
#define SEL_AND_ILC_INIT_256(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_128(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5566
#define nilcs 256
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5567
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5568
        static struct { OBJ sel; struct inlineCache ilc; } sel_and_ilc[nilcs] = { SEL_AND_ILC_INIT_256(29) };
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5569
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5570
#undef SEL_AND_ILC_INIT_1
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5571
#undef SEL_AND_ILC_INIT_2
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5572
#undef SEL_AND_ILC_INIT_4
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5573
#undef SEL_AND_ILC_INIT_8
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5574
#undef SEL_AND_ILC_INIT_16
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5575
#undef SEL_AND_ILC_INIT_32
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5576
#undef SEL_AND_ILC_INIT_64
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5577
#undef SEL_AND_ILC_INIT_128
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5578
#undef SEL_AND_ILC_INIT_256
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5579
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5580
        static flip = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5581
        int i;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5582
        for (i = 0; i < nilcs; i++) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5583
           if (sel == sel_and_ilc[i].sel) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5584
                pIlc = &sel_and_ilc[i].ilc;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5585
                goto perform1_send_and_return;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5586
           }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5587
        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5588
        /*printf("Object >> #perform: #%s with: arg --> no PIC found\n", __symbolVal(aSelector));*/
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5589
        pIlc = &sel_and_ilc[flip].ilc;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5590
        sel_and_ilc[flip].sel = sel;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5591
        flip = (flip + 1) % nilcs;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5592
        pIlc->ilc_func = __SEND1ADDR__;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5593
        if (pIlc->ilc_poly) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5594
             __flushPolyCache(pIlc->ilc_poly);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5595
            pIlc->ilc_poly = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5596
        }
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5597
perform1_send_and_return:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5598
        RETURN ( (*(pIlc->ilc_func))(self, sel, nil, pIlc, arg) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5599
    } else {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5600
        static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5601
        RETURN (_SEND1(self, aSelector, nil, &ilc1, arg));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5602
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5603
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5604
    ^ self perform:aSelector withArguments:(Array with:arg)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5605
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5606
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5607
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5608
perform:aSelector with:arg1 with:arg2
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5609
    "send the two-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5610
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5611
%{
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5612
    REGISTER OBJ sel = aSelector;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5613
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5614
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5615
    if (InterruptPending == nil) {
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5616
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5617
    /* JV @ 2010-22-07: To improve performance I use 256 ILCs instead
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5618
       of default 4. For details, see comment in perform: */
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5619
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5620
#define SEL_AND_ILC_INIT_1(l)   { nil , __ILCPERF2(l) }
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5621
#define SEL_AND_ILC_INIT_2(l)   SEL_AND_ILC_INIT_1(l)   , SEL_AND_ILC_INIT_1(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5622
#define SEL_AND_ILC_INIT_4(l)   SEL_AND_ILC_INIT_2(l)   , SEL_AND_ILC_INIT_2(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5623
#define SEL_AND_ILC_INIT_8(l)   SEL_AND_ILC_INIT_4(l)   , SEL_AND_ILC_INIT_4(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5624
#define SEL_AND_ILC_INIT_16(l)  SEL_AND_ILC_INIT_8(l)   , SEL_AND_ILC_INIT_8(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5625
#define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5626
#define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5627
#define SEL_AND_ILC_INIT_64(l)  SEL_AND_ILC_INIT_32(l)  , SEL_AND_ILC_INIT_32(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5628
#define SEL_AND_ILC_INIT_128(l) SEL_AND_ILC_INIT_64(l)  , SEL_AND_ILC_INIT_64(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5629
#define SEL_AND_ILC_INIT_256(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_128(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5630
#define nilcs 256
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5631
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5632
        static struct { OBJ sel; struct inlineCache ilc; } sel_and_ilc[nilcs] = { SEL_AND_ILC_INIT_256(29) };
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5633
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5634
#undef SEL_AND_ILC_INIT_1
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5635
#undef SEL_AND_ILC_INIT_2
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5636
#undef SEL_AND_ILC_INIT_4
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5637
#undef SEL_AND_ILC_INIT_8
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5638
#undef SEL_AND_ILC_INIT_16
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5639
#undef SEL_AND_ILC_INIT_32
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5640
#undef SEL_AND_ILC_INIT_64
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5641
#undef SEL_AND_ILC_INIT_128
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5642
#undef SEL_AND_ILC_INIT_256
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5643
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5644
        static flip = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5645
        int i;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5646
        for (i = 0; i < nilcs; i++) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5647
           if (sel == sel_and_ilc[i].sel) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5648
                pIlc = &sel_and_ilc[i].ilc;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5649
                goto perform2_send_and_return;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5650
           }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5651
        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5652
        /*printf("Object >> #perform: #%s with: with: --> no PIC found\n", __symbolVal(aSelector));*/
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5653
        pIlc = &sel_and_ilc[flip].ilc;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5654
        sel_and_ilc[flip].sel = sel;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5655
        flip = (flip + 1) % nilcs;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5656
        pIlc->ilc_func = __SEND2ADDR__;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5657
        if (pIlc->ilc_poly) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5658
             __flushPolyCache(pIlc->ilc_poly);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5659
            pIlc->ilc_poly = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5660
        }
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5661
perform2_send_and_return:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5662
        RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, arg1, arg2) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5663
    } else {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5664
        static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5665
        RETURN (_SEND2(self, aSelector, nil, &ilc2, arg1, arg2));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5666
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5667
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5668
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5669
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5670
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5671
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5672
perform:aSelector with:arg1 with:arg2 with:arg3
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5673
    "send the three-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5674
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5675
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5676
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5677
    static struct inlineCache ilc_0 = __ILCPERF3(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5678
    static struct inlineCache ilc_1 = __ILCPERF3(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5679
    static OBJ last_0 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5680
    static OBJ last_1 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5681
    static flip = 0;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5682
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5683
    if (InterruptPending == nil) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5684
        if (aSelector != last_0) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5685
            if (aSelector != last_1) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5686
                if (flip) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5687
                    pIlc = &ilc_0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5688
                    flip = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5689
                    last_0 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5690
                } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5691
                    pIlc = &ilc_1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5692
                    flip = 1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5693
                    last_1 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5694
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5695
                pIlc->ilc_func = __SEND3ADDR__;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5696
                if (pIlc->ilc_poly) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5697
                    __flushPolyCache(pIlc->ilc_poly);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5698
                    pIlc->ilc_poly = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5699
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5700
            } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5701
                pIlc = &ilc_1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5702
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5703
        } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5704
            pIlc = &ilc_0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5705
        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5706
        RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, arg1, arg2, arg3) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5707
    } else {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5708
        static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5709
        RETURN (_SEND3(self, aSelector, nil, &ilc3, arg1, arg2, arg3));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5710
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5711
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5712
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2 with:arg3)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5713
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5714
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5715
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5716
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5717
    "send the four-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5718
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5719
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5720
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5721
    static struct inlineCache ilc_0 = __ILCPERF4(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5722
    static struct inlineCache ilc_1 = __ILCPERF4(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5723
    static OBJ last_0 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5724
    static OBJ last_1 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5725
    static flip = 0;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5726
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5727
    if (InterruptPending == nil) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5728
        if (aSelector != last_0) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5729
            if (aSelector != last_1) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5730
                if (flip) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5731
                    pIlc = &ilc_0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5732
                    flip = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5733
                    last_0 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5734
                } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5735
                    pIlc = &ilc_1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5736
                    flip = 1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5737
                    last_1 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5738
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5739
                pIlc->ilc_func = __SEND4ADDR__;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5740
                if (pIlc->ilc_poly) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5741
                    __flushPolyCache(pIlc->ilc_poly);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5742
                    pIlc->ilc_poly = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5743
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5744
            } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5745
                pIlc = &ilc_1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5746
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5747
        } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5748
            pIlc = &ilc_0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5749
        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5750
        RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5751
                                     arg1, arg2, arg3, arg4) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5752
    } else {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5753
        static struct inlineCache ilc4 = __DUMMYILCSELF4(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5754
        RETURN (_SEND4(self, aSelector, nil, &ilc4,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5755
                       arg1, arg2, arg3, arg4));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5756
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5757
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5758
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5759
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5760
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5761
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5762
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4 with:arg5
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5763
    "send the five-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5764
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5765
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5766
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5767
    static struct inlineCache ilc_0 = __ILCPERF5(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5768
    static struct inlineCache ilc_1 = __ILCPERF5(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5769
    static OBJ last_0 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5770
    static OBJ last_1 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5771
    static flip = 0;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5772
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5773
    if (InterruptPending == nil) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5774
        if (aSelector != last_0) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5775
            if (aSelector != last_1) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5776
                if (flip) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5777
                    pIlc = &ilc_0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5778
                    flip = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5779
                    last_0 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5780
                } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5781
                    pIlc = &ilc_1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5782
                    flip = 1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5783
                    last_1 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5784
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5785
                pIlc->ilc_func = __SEND5ADDR__;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5786
                if (pIlc->ilc_poly) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5787
                    __flushPolyCache(pIlc->ilc_poly);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5788
                    pIlc->ilc_poly = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5789
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5790
            } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5791
                pIlc = &ilc_1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5792
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5793
        } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5794
            pIlc = &ilc_0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5795
        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5796
        RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5797
                                     arg1, arg2, arg3, arg4, arg5) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5798
    } else {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5799
        static struct inlineCache ilc5 = __DUMMYILCSELF5(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5800
        RETURN (_SEND5(self, aSelector, nil, &ilc5,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5801
                       arg1, arg2, arg3, arg4, arg5));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5802
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5803
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5804
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5805
                                                  with:arg5)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5806
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5807
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5808
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5809
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4 with:arg5 with:arg6
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5810
    "send the six-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5811
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5812
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5813
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5814
    static struct inlineCache ilc_0 = __ILCPERF6(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5815
    static struct inlineCache ilc_1 = __ILCPERF6(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5816
    static OBJ last_0 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5817
    static OBJ last_1 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5818
    static flip = 0;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5819
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5820
    if (InterruptPending == nil) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5821
        if (aSelector != last_0) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5822
            if (aSelector != last_1) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5823
                if (flip) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5824
                    pIlc = &ilc_0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5825
                    flip = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5826
                    last_0 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5827
                } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5828
                    pIlc = &ilc_1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5829
                    flip = 1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5830
                    last_1 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5831
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5832
                pIlc->ilc_func = __SEND6ADDR__;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5833
                if (pIlc->ilc_poly) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5834
                    __flushPolyCache(pIlc->ilc_poly);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5835
                    pIlc->ilc_poly = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5836
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5837
            } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5838
                pIlc = &ilc_1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5839
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5840
        } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5841
            pIlc = &ilc_0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5842
        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5843
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5844
        RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5845
                                     arg1, arg2, arg3, arg4, arg5, arg6) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5846
    } else {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5847
        static struct inlineCache ilc6 = __DUMMYILCSELF6(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5848
        RETURN (_SEND6(self, aSelector, nil, &ilc6,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5849
                       arg1, arg2, arg3, arg4, arg5, arg6));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5850
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5851
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5852
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5853
                                                  with:arg5 with:arg6)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5854
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5855
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5856
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5857
perform:aSelector withArguments:argArray
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5858
    "send the message aSelector with all args taken from argArray
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5859
     to the receiver."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5860
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5861
    |numberOfArgs a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5862
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5863
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5864
    REGISTER OBJ *argP;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5865
    int nargs;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5866
    OBJ l;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5867
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8930
diff changeset
  5868
    if (__isArrayLike(argArray)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5869
        nargs = __arraySize(argArray);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5870
        argP = __arrayVal(argArray);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5871
    } else {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5872
        if (__isNonNilObject(argArray)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5873
            static struct inlineCache ilcSize = __ILC0(@line);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5874
            int i;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5875
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5876
            numberOfArgs = (*ilcSize.ilc_func)(argArray, @symbol(size), nil, &ilcSize);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5877
            if (!__isSmallInteger(numberOfArgs))
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5878
                goto bad;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5879
            nargs = __intVal(numberOfArgs);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5880
            argP = (OBJ *)(&a1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5881
            for (i=1; i <= nargs; i++) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5882
                *argP++ = __AT_(argArray, __mkSmallInteger(i));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5883
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5884
            argP = (OBJ *)(&a1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5885
        } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5886
            nargs = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5887
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5888
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5889
    switch (nargs) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5890
        case 0:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5891
            if (InterruptPending == nil) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5892
                static OBJ last0_0 = nil; static struct inlineCache ilc0_0 = __ILCPERF0(@line);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5893
                static OBJ last0_1 = nil; static struct inlineCache ilc0_1 = __ILCPERF0(@line);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5894
                static OBJ last0_2 = nil; static struct inlineCache ilc0_2 = __ILCPERF0(@line);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5895
                static OBJ last0_3 = nil; static struct inlineCache ilc0_3 = __ILCPERF0(@line);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5896
                static int flip0 = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5897
                struct inlineCache *pIlc;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5898
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5899
                if (aSelector == last0_0) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5900
                    pIlc = &ilc0_0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5901
                } else if (aSelector == last0_1) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5902
                    pIlc = &ilc0_1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5903
                } else if (aSelector == last0_2) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5904
                    pIlc = &ilc0_2;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5905
                } else if (aSelector == last0_3) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5906
                    pIlc = &ilc0_3;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5907
                } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5908
                    if (flip0 == 0) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5909
                        pIlc = &ilc0_0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5910
                        flip0 = 1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5911
                        last0_0 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5912
                    } else if (flip0 == 1) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5913
                        pIlc = &ilc0_1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5914
                        flip0 = 2;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5915
                        last0_1 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5916
                    } else if (flip0 == 2) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5917
                        pIlc = &ilc0_2;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5918
                        flip0 = 3;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5919
                        last0_2 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5920
                    } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5921
                        pIlc = &ilc0_3;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5922
                        flip0 = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5923
                        last0_3 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5924
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5925
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5926
                    pIlc->ilc_func = __SEND0ADDR__;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5927
                    if (pIlc->ilc_poly) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5928
                        __flushPolyCache(pIlc->ilc_poly);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5929
                        pIlc->ilc_poly = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5930
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5931
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5932
                RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5933
            } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5934
                static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5935
                RETURN (_SEND0(self, aSelector, nil, &ilc0));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5936
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5937
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5938
        case 1:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5939
            if (InterruptPending == nil) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5940
                static OBJ last1_0 = nil; static struct inlineCache ilc1_0 = __ILCPERF1(@line);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5941
                static OBJ last1_1 = nil; static struct inlineCache ilc1_1 = __ILCPERF1(@line);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5942
                static OBJ last1_2 = nil; static struct inlineCache ilc1_2 = __ILCPERF1(@line);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5943
                static OBJ last1_3 = nil; static struct inlineCache ilc1_3 = __ILCPERF1(@line);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5944
                static int flip1 = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5945
                struct inlineCache *pIlc;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5946
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5947
                if (aSelector == last1_0) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5948
                    pIlc = &ilc1_0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5949
                } else if (aSelector == last1_1) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5950
                    pIlc = &ilc1_1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5951
                } else if (aSelector == last1_2) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5952
                    pIlc = &ilc1_2;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5953
                } else if (aSelector == last1_3) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5954
                    pIlc = &ilc1_3;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5955
                } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5956
                    if (flip1 == 0) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5957
                        pIlc = &ilc1_0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5958
                        flip1 = 1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5959
                        last1_0 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5960
                    } else if (flip1 == 1) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5961
                        pIlc = &ilc1_1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5962
                        flip1 = 2;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5963
                        last1_1 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5964
                    } else if (flip1 == 2) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5965
                        pIlc = &ilc1_2;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5966
                        flip1 = 3;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5967
                        last1_2 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5968
                    } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5969
                        pIlc = &ilc1_3;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5970
                        flip1 = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5971
                        last1_3 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5972
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5973
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5974
                    pIlc->ilc_func = __SEND1ADDR__;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5975
                    if (pIlc->ilc_poly) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5976
                        __flushPolyCache(pIlc->ilc_poly);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5977
                        pIlc->ilc_poly = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5978
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5979
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5980
                RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5981
            } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5982
                static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5983
                RETURN (_SEND1(self, aSelector, nil, &ilc1, argP[0]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5984
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5985
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5986
        case 2:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5987
            if (InterruptPending == nil) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5988
                static OBJ last2_0 = nil; static struct inlineCache ilc2_0 = __ILCPERF2(@line);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5989
                static OBJ last2_1 = nil; static struct inlineCache ilc2_1 = __ILCPERF2(@line);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5990
                static int flip2 = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5991
                struct inlineCache *pIlc;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5992
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5993
                if (aSelector == last2_0) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5994
                    pIlc = &ilc2_0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5995
                } else if (aSelector == last2_1) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5996
                    pIlc = &ilc2_1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5997
                } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5998
                    if (flip2 == 0) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  5999
                        pIlc = &ilc2_0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6000
                        flip2 = 1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6001
                        last2_0 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6002
                    } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6003
                        pIlc = &ilc2_1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6004
                        flip2 = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6005
                        last2_1 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6006
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6007
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6008
                    pIlc->ilc_func = __SEND2ADDR__;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6009
                    if (pIlc->ilc_poly) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6010
                        __flushPolyCache(pIlc->ilc_poly);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6011
                        pIlc->ilc_poly = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6012
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6013
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6014
                RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0], argP[1]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6015
            } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6016
                static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6017
                RETURN (_SEND2(self, aSelector, nil, &ilc2, argP[0], argP[1]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6018
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6019
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6020
        case 3:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6021
            if (InterruptPending == nil) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6022
                static OBJ last3_0 = nil; static struct inlineCache ilc3_0 = __ILCPERF3(@line);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6023
                static OBJ last3_1 = nil; static struct inlineCache ilc3_1 = __ILCPERF3(@line);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6024
                static int flip3 = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6025
                struct inlineCache *pIlc;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6026
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6027
                if (aSelector == last3_0) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6028
                    pIlc = &ilc3_0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6029
                } else if (aSelector == last3_1) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6030
                    pIlc = &ilc3_1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6031
                } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6032
                    if (flip3 == 0) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6033
                        pIlc = &ilc3_0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6034
                        flip3 = 1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6035
                        last3_0 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6036
                    } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6037
                        pIlc = &ilc3_1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6038
                        flip3 = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6039
                        last3_1 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6040
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6041
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6042
                    pIlc->ilc_func = __SEND3ADDR__;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6043
                    if (pIlc->ilc_poly) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6044
                        __flushPolyCache(pIlc->ilc_poly);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6045
                        pIlc->ilc_poly = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6046
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6047
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6048
                RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0], argP[1], argP[2]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6049
            } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6050
                static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6051
                RETURN (_SEND3(self, aSelector, nil, &ilc3, argP[0], argP[1], argP[2]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6052
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6053
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6054
        case 4:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6055
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6056
                static OBJ last4 = nil; static struct inlineCache ilc4 = __ILCPERF4(@line);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6057
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6058
                if ((InterruptPending != nil) || (aSelector != last4)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6059
                    ilc4.ilc_func = __SEND4ADDR__;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6060
                    if (ilc4.ilc_poly) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6061
                        __flushPolyCache(ilc4.ilc_poly);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6062
                        ilc4.ilc_poly = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6063
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6064
                    last4 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6065
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6066
                RETURN ( (*ilc4.ilc_func)(self, aSelector, nil, &ilc4,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6067
                                                argP[0], argP[1], argP[2], argP[3]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6068
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6069
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6070
        case 5:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6071
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6072
                static OBJ last5 = nil; static struct inlineCache ilc5 = __ILCPERF5(@line);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6073
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6074
                if ((InterruptPending != nil) || (aSelector != last5)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6075
                    ilc5.ilc_func = __SEND5ADDR__;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6076
                    if (ilc5.ilc_poly) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6077
                        __flushPolyCache(ilc5.ilc_poly);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6078
                        ilc5.ilc_poly = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6079
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6080
                    last5 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6081
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6082
                RETURN ( (*ilc5.ilc_func)(self, aSelector, nil, &ilc5,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6083
                                                argP[0], argP[1], argP[2], argP[3], argP[4]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6084
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6085
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6086
        case 6:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6087
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6088
                static OBJ last6 = nil; static struct inlineCache ilc6 = __ILCPERF6(@line);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6089
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6090
                if ((InterruptPending != nil) || (aSelector != last6)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6091
                    ilc6.ilc_func = __SEND6ADDR__;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6092
                    if (ilc6.ilc_poly) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6093
                        __flushPolyCache(ilc6.ilc_poly);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6094
                        ilc6.ilc_poly = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6095
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6096
                    last6 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6097
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6098
                RETURN ( (*ilc6.ilc_func)(self, aSelector, nil, &ilc6,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6099
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6100
                                                argP[5]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6101
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6102
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6103
        case 7:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6104
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6105
                static OBJ last7 = nil; static struct inlineCache ilc7 = __ILCPERF7(@line);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6106
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6107
                if ((InterruptPending != nil) || (aSelector != last7)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6108
                    ilc7.ilc_func = __SEND7ADDR__;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6109
                    if (ilc7.ilc_poly) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6110
                        __flushPolyCache(ilc7.ilc_poly);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6111
                        ilc7.ilc_poly = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6112
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6113
                    last7 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6114
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6115
                RETURN ( (*ilc7.ilc_func)(self, aSelector, nil, &ilc7,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6116
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6117
                                                argP[5], argP[6]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6118
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6119
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6120
        case 8:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6121
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6122
                static OBJ last8 = nil; static struct inlineCache ilc8 = __ILCPERF8(@line);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6123
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6124
                if ((InterruptPending != nil) || (aSelector != last8)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6125
                    ilc8.ilc_func = __SEND8ADDR__;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6126
                    if (ilc8.ilc_poly) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6127
                        __flushPolyCache(ilc8.ilc_poly);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6128
                        ilc8.ilc_poly = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6129
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6130
                    last8 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6131
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6132
                RETURN ( (*ilc8.ilc_func)(self, aSelector, nil, &ilc8,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6133
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6134
                                                argP[5], argP[6], argP[7]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6135
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6136
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6137
        case 9:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6138
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6139
                static OBJ last9 = nil; static struct inlineCache ilc9 = __ILCPERF9(@line);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6140
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6141
                if ((InterruptPending != nil) || (aSelector != last9)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6142
                    ilc9.ilc_func = __SEND9ADDR__;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6143
                    if (ilc9.ilc_poly) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6144
                        __flushPolyCache(ilc9.ilc_poly);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6145
                        ilc9.ilc_poly = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6146
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6147
                    last9 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6148
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6149
                RETURN ( (*ilc9.ilc_func)(self, aSelector, nil, &ilc9,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6150
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6151
                                                argP[5], argP[6], argP[7], argP[8]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6152
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6153
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6154
        case 10:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6155
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6156
                static OBJ last10 = nil; static struct inlineCache ilc10 = __ILCPERF10(@line);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6157
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6158
                if ((InterruptPending != nil) || (aSelector != last10)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6159
                    ilc10.ilc_func = __SEND10ADDR__;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6160
                    if (ilc10.ilc_poly) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6161
                        __flushPolyCache(ilc10.ilc_poly);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6162
                        ilc10.ilc_poly = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6163
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6164
                    last10 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6165
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6166
                RETURN ( (*ilc10.ilc_func)(self, aSelector, nil, &ilc10,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6167
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6168
                                                argP[5], argP[6], argP[7], argP[8], argP[9]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6169
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6170
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6171
        case 11:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6172
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6173
                static OBJ last11 = nil; static struct inlineCache ilc11 = __ILCPERF11(@line);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6174
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6175
                if ((InterruptPending != nil) || (aSelector != last11)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6176
                    ilc11.ilc_func = __SEND11ADDR__;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6177
                    if (ilc11.ilc_poly) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6178
                        __flushPolyCache(ilc11.ilc_poly);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6179
                        ilc11.ilc_poly = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6180
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6181
                    last11 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6182
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6183
                RETURN ( (*ilc11.ilc_func)(self, aSelector, nil, &ilc11,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6184
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6185
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6186
                                                argP[10]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6187
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6188
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6189
        case 12:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6190
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6191
                static OBJ last12 = nil; static struct inlineCache ilc12 = __ILCPERF12(@line);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6192
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6193
                if ((InterruptPending != nil) || (aSelector != last12)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6194
                    ilc12.ilc_func = __SEND12ADDR__;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6195
                    if (ilc12.ilc_poly) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6196
                        __flushPolyCache(ilc12.ilc_poly);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6197
                        ilc12.ilc_poly = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6198
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6199
                    last12 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6200
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6201
                RETURN ( (*ilc12.ilc_func)(self, aSelector, nil, &ilc12,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6202
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6203
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6204
                                                argP[10], argP[11]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6205
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6206
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6207
        case 13:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6208
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6209
                static OBJ last13 = nil; static struct inlineCache ilc13 = __ILCPERF13(@line);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6210
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6211
                if ((InterruptPending != nil) || (aSelector != last13)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6212
                    ilc13.ilc_func = __SEND13ADDR__;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6213
                    if (ilc13.ilc_poly) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6214
                        __flushPolyCache(ilc13.ilc_poly);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6215
                        ilc13.ilc_poly = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6216
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6217
                    last13 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6218
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6219
                RETURN ( (*ilc13.ilc_func)(self, aSelector, nil, &ilc13,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6220
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6221
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6222
                                                argP[10], argP[11], argP[12]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6223
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6224
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6225
        case 14:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6226
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6227
                static OBJ last14 = nil; static struct inlineCache ilc14 = __ILCPERF14(@line);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6228
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6229
                if ((InterruptPending != nil) || (aSelector != last14)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6230
                    ilc14.ilc_func = __SEND14ADDR__;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6231
                    if (ilc14.ilc_poly) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6232
                        __flushPolyCache(ilc14.ilc_poly);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6233
                        ilc14.ilc_poly = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6234
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6235
                    last14 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6236
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6237
                RETURN ( (*ilc14.ilc_func)(self, aSelector, nil, &ilc14,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6238
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6239
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6240
                                                argP[10], argP[11], argP[12], argP[13]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6241
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6242
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6243
        case 15:
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6244
            {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6245
                static OBJ last15 = nil; static struct inlineCache ilc15 = __ILCPERF15(@line);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6246
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6247
                if ((InterruptPending != nil) || (aSelector != last15)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6248
                    ilc15.ilc_func = __SEND15ADDR__;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6249
                    if (ilc15.ilc_poly) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6250
                        __flushPolyCache(ilc15.ilc_poly);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6251
                        ilc15.ilc_poly = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6252
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6253
                    last15 = aSelector;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6254
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6255
                RETURN ( (*ilc15.ilc_func)(self, aSelector, nil, &ilc15,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6256
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6257
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6258
                                                argP[10], argP[11], argP[12], argP[13],
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6259
                                                argP[14]));
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6260
            }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6261
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6262
bad:;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6263
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6264
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6265
    "/ arrive here, if bad number of arguments (too many)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6266
    "/ ST/X (currently) only allows up to 15 method arguments
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6267
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6268
    ^ self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6269
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6270
6316
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6271
perform:aSelector withOptionalArgument:arg
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6272
    "send aSelector-message to the receiver.
6318
3677d346113a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  6273
     If the message expects an argument, pass arg."
6316
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6274
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6275
    aSelector numArgs == 1 ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6276
        ^ self perform:aSelector with:arg
6316
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6277
    ].
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6278
    ^ self perform:aSelector
6319
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6279
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6280
    "
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6281
     |rec sel|
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6282
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6283
     rec := -1.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6284
     sel := #abs.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6285
     rec perform:sel withOptionalArgument:2.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6286
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6287
     sel := #max:.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6288
     rec perform:sel withOptionalArgument:2.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6289
    "
6316
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6290
!
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6291
6321
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6292
perform:aSelector withOptionalArgument:optionalArg1 and:optionalArg2
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6293
    "send aSelector-message to the receiver.
6728
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6294
     Depending on the number of arguments the message expects,
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6295
     pass either none, 1, or 2 arguments."
6321
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6296
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6297
    |numArgs|
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6298
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6299
    numArgs := aSelector numArgs.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6300
    numArgs == 0 ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6301
        ^ self perform:aSelector
6321
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6302
    ].
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6303
    numArgs == 1 ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6304
        ^ self perform:aSelector with:optionalArg1
6321
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6305
    ].
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6306
    ^ self perform:aSelector with:optionalArg1 with:optionalArg2.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6307
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6308
    "
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6309
     |rec sel|
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6310
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6311
     rec := -1.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6312
     sel := #abs.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6313
     rec perform:sel withOptionalArgument:2.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6314
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6315
     sel := #max:.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6316
     rec perform:sel withOptionalArgument:2.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6317
    "
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6318
!
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6319
6728
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6320
perform:aSelector withOptionalArgument:optionalArg1 and:optionalArg2 and:optionalArg3
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6321
    "send aSelector-message to the receiver.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6322
     Depending on the number of arguments the message expects,
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6323
     pass either none, 1, 2 or 3 arguments."
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6324
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6325
    |numArgs|
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6326
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6327
    numArgs := aSelector numArgs.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6328
    numArgs == 0 ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6329
        ^ self perform:aSelector
6728
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6330
    ].
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6331
    numArgs == 1 ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6332
        ^ self perform:aSelector with:optionalArg1
6728
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6333
    ].
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6334
    numArgs == 2 ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6335
        ^ self perform:aSelector with:optionalArg1 with:optionalArg2
6728
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6336
    ].
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6337
    ^ self perform:aSelector with:optionalArg1 with:optionalArg2 with:optionalArg3.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6338
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6339
    "
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6340
     |rec sel|
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6341
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6342
     rec := -1.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6343
     sel := #abs.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6344
     rec perform:sel withOptionalArgument:2.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6345
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6346
     sel := #max:.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6347
     rec perform:sel withOptionalArgument:2.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6348
    "
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6349
!
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6350
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6351
perform:aSelector withOptionalArgument:optionalArg1 and:optionalArg2 and:optionalArg3 and:optionalArg4
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6352
    "send aSelector-message to the receiver.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6353
     Depending on the number of arguments the message expects,
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6354
     pass either none, 1, 2, 3 or 4 arguments."
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6355
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6356
    |numArgs|
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6357
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6358
    numArgs := aSelector numArgs.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6359
    numArgs == 0 ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6360
        ^ self perform:aSelector
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6361
    ].
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6362
    numArgs == 1 ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6363
        ^ self perform:aSelector with:optionalArg1
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6364
    ].
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6365
    numArgs == 2 ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6366
        ^ self perform:aSelector with:optionalArg1 with:optionalArg2
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6367
    ].
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6368
    numArgs == 3 ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6369
        ^ self perform:aSelector with:optionalArg1 with:optionalArg2 with:optionalArg3
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6370
    ].
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6371
    ^ self perform:aSelector with:optionalArg1 with:optionalArg2 with:optionalArg3 with:optionalArg4.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6372
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6373
    "
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6374
     |rec sel|
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6375
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6376
     rec := -1.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6377
     sel := #abs.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6378
     rec perform:sel withOptionalArgument:2.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6379
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6380
     sel := #max:.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6381
     rec perform:sel withOptionalArgument:2.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6382
    "
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6383
!
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6384
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6385
performMethod:aMethod
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6386
    "invoke aMethod on the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6387
     The method should be a zero-argument method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6388
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6389
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6390
     Warning:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6391
         Take care for the method to be appropriate for the
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6392
         receiver - no checking is done by the VM."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6393
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6394
    ^ aMethod valueWithReceiver:self arguments:#()
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6395
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6396
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6397
     |mthd|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6398
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6399
     mthd := SmallInteger compiledMethodAt:#negated.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6400
     Transcript showCR:(1 performMethod:mthd)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6401
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6402
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6403
    "BAD USE example:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6404
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6405
     |mthd|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6406
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6407
     mthd := Point compiledMethodAt:#x.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6408
     Transcript showCR:((1->2) performMethod:mthd)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6409
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6410
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6411
    "Modified: 31.7.1997 / 17:41:50 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6412
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6413
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6414
performMethod:aMethod arguments:argumentArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6415
    "invoke aMethod on the receiver, passing an argumentArray.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6416
     The size of the argumentArray should match the number of args
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6417
     expected by the method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6418
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6419
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6420
     Warning:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6421
         Take care for the method to be appropriate for the
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6422
         receiver - no checking is done by the VM."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6423
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6424
    ^ aMethod valueWithReceiver:self arguments:argumentArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6425
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6426
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6427
     |mthd|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6428
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6429
     mthd := SmallInteger compiledMethodAt:#+.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6430
     Transcript showCR:(1 performMethod:mthd arguments:#(2))
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6431
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6432
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6433
    "Created: 31.7.1997 / 17:46:31 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6434
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6435
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6436
performMethod:aMethod with:arg
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6437
    "invoke aMethod on the receiver, passing an argument.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6438
     The method should be a one-argument method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6439
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6440
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6441
     Warning:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6442
         Take care for the method to be appropriate for the
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6443
         receiver - no checking is done by the VM."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6444
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6445
    ^ aMethod valueWithReceiver:self arguments:(Array with:arg)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6446
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6447
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6448
     |mthd|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6449
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6450
     mthd := SmallInteger compiledMethodAt:#+.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6451
     Transcript showCR:(1 performMethod:mthd with:2)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6452
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6453
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6454
    "Modified: 31.7.1997 / 17:42:32 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6455
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6456
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6457
performMethod:aMethod with:arg1 with:arg2
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6458
    "invoke aMethod on the receiver, passing two arguments.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6459
     The method should be a two-argument method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6460
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6461
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6462
     Warning:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6463
         Take care for the method to be appropriate for the
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6464
         receiver - no checking is done by the VM."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6465
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6466
    ^ aMethod valueWithReceiver:self arguments:(Array with:arg1 with:arg2)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6467
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6468
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6469
     |mthd arr|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6470
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6471
     arr := Array new:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6472
     mthd := Array compiledMethodAt:#basicAt:put:.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6473
     arr performMethod:mthd with:1 with:'foo'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6474
     Transcript showCR:arr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6475
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6476
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6477
    "Modified: 31.7.1997 / 17:44:54 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6478
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6479
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6480
performMethod:aMethod with:arg1 with:arg2 with:arg3
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6481
    "invoke aMethod on the receiver, passing three arguments.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6482
     The method should be a three-argument method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6483
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6484
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6485
     Warning:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6486
         Take care for the method to be appropriate for the
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6487
         receiver - no checking is done by the VM."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6488
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6489
    ^ aMethod valueWithReceiver:self arguments:(Array with:arg1 with:arg2 with:arg3)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6490
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6491
    "Created: 31.7.1997 / 17:45:20 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6492
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6493
10834
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6494
!Object methodsFor:'object persistency'!
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6495
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6496
elementDescriptorFor:anAspectSymbol
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6497
    "support for persistency:
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6498
     answer a collection of associations containing the
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6499
     objects state to be encoded for aspect.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6500
     Association key is the instance variable name or access selector,
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6501
     association value is the contents of the instance variable.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6502
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6503
     The default is to return the contents of all non-nil instance variables"
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6504
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6505
    |ret|
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6506
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6507
    ret := 0.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6508
    anAspectSymbol notNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6509
        ret := self perform:anAspectSymbol ifNotUnderstood:[0].
10834
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6510
    ].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6511
    ret == 0 ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6512
        ^ self elementDescriptorForNonNilInstanceVariables
10834
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6513
    ].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6514
    ^ ret.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6515
!
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6516
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6517
elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6518
    "return all instance variables for visiting/encoding"
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6519
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6520
    ^ self elementDescriptorForInstanceVariablesMatching:[:val | true].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6521
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6522
    "
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6523
      #(1 2 3 nil true symbol) elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6524
      Dictionary new elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6525
      (5 @ nil) elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6526
    "
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6527
!
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6528
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6529
elementDescriptorForInstanceVariablesMatching:aBlock
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6530
    "return all instance variables which conform to aBlock, for encoding/visiting.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6531
     Indexed vars are all included."
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6532
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6533
    |instVarNames theClass children
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6534
     instSize "{ Class: SmallInteger }"
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6535
     varSize "{ Class: SmallInteger }"|
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6536
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6537
    theClass := self class.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6538
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6539
    instSize := theClass instSize.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6540
    varSize := theClass isVariable ifTrue:[self basicSize] ifFalse:[0].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6541
    children := OrderedCollection new:(instSize + varSize).
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6542
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6543
    instVarNames := theClass allInstVarNames.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6544
    1 to:instSize do:[:i | |var|
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6545
        var := self instVarAt:i.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6546
        (aBlock value:var) ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6547
            children add:((instVarNames at:i) -> var)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6548
        ]
10834
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6549
    ].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6550
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6551
    varSize ~~ 0 ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6552
        1 to:varSize do:[:i |
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6553
            children add:(i -> (self basicAt:i))
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6554
        ]
10834
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6555
    ].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6556
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6557
    ^ children.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6558
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6559
    "
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6560
      #(1 2 3 nil true symbol) elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6561
      Dictionary new elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6562
      (5 @ nil) elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6563
    "
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6564
!
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6565
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6566
elementDescriptorForNonNilInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6567
    "return all non-nil instance variables for visiting/encoding"
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6568
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6569
    ^ self elementDescriptorForInstanceVariablesMatching:[:val | val notNil].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6570
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6571
    "
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6572
      #(1 2 3 nil true symbol) elementDescriptorForNonNilInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6573
      Dictionary new elementDescriptorForNonNilInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6574
      (5 @ nil) elementDescriptorForNonNilInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6575
    "
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6576
! !
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6577
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6578
!Object methodsFor:'printing & storing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6579
6235
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6580
basicPrintOn:aStream
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6581
    "append the receivers className with an articel to the argument, aStream"
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6582
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6583
    aStream nextPutAll:self classNameWithArticle
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6584
!
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6585
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6586
className
14368
deb662b4664b comment/format in: #className
Claus Gittinger <cg@exept.de>
parents: 14355
diff changeset
  6587
    "return the classname of the receiver's class"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6588
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6589
    ^ self class name
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6590
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6591
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6592
     1 className
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6593
     1 class className
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6594
     $a className
9105
1666cb465e3f comments
Stefan Vogel <sv@exept.de>
parents: 9071
diff changeset
  6595
     $a class className
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6596
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6597
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6598
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6599
classNameWithArticle
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6600
    "return a string consisting of classname preceeded by an article.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6601
     (dont expect me to write national variants for this ... :-)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6602
     If you have special preferences, redefine it ..."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6603
6829
db28715efb4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6815
diff changeset
  6604
    | cls|
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6605
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6606
    (cls := self class) == self ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6607
        ^ 'a funny object'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6608
    ].
14368
deb662b4664b comment/format in: #className
Claus Gittinger <cg@exept.de>
parents: 14355
diff changeset
  6609
    cls isNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6610
        ^ 'a nil-classes object'        "/ cannot happen
14368
deb662b4664b comment/format in: #className
Claus Gittinger <cg@exept.de>
parents: 14355
diff changeset
  6611
    ].
6829
db28715efb4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6815
diff changeset
  6612
    ^ cls nameWithArticle
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6613
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6614
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6615
     1 classNameWithArticle
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6616
     (1->2) classNameWithArticle
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6617
     XWorkstation basicNew classNameWithArticle
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6618
     XWorkstation classNameWithArticle
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6619
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6620
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6621
    "Modified: 13.5.1996 / 12:16:14 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6622
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6623
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6624
errorPrint
12703
b87cc4993193 changed:
sr
parents: 12566
diff changeset
  6625
    "print the receiver on the Transcript and Stderr.
10530
0f3d3ddd3837 #errorPrint* and #infoPrint* print to Transcript.
Stefan Vogel <sv@exept.de>
parents: 10527
diff changeset
  6626
     The Transcript is directed to the standard error stream on
0f3d3ddd3837 #errorPrint* and #infoPrint* print to Transcript.
Stefan Vogel <sv@exept.de>
parents: 10527
diff changeset
  6627
     headless applications."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6628
14165
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  6629
    Stderr isNil ifTrue:[
14661
2a5c79daa934 class: Object
Stefan Vogel <sv@exept.de>
parents: 14632
diff changeset
  6630
        "/ the following allows errorPrint to be used during
2a5c79daa934 class: Object
Stefan Vogel <sv@exept.de>
parents: 14632
diff changeset
  6631
        "/ the early init-phase, when no Stderr has been set up.
2a5c79daa934 class: Object
Stefan Vogel <sv@exept.de>
parents: 14632
diff changeset
  6632
        "/ (depends on string to respond to #errorPrint)
2a5c79daa934 class: Object
Stefan Vogel <sv@exept.de>
parents: 14632
diff changeset
  6633
        self printString utf8Encoded errorPrint.
2a5c79daa934 class: Object
Stefan Vogel <sv@exept.de>
parents: 14632
diff changeset
  6634
        ^ self.
14165
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  6635
    ].
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  6636
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  6637
    self withErrorStreamDo:[:s | self printOn:s].
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  6638
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  6639
    "Modified: / 21-04-2011 / 12:46:42 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6640
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6641
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6642
errorPrintCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6643
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6644
12703
b87cc4993193 changed:
sr
parents: 12566
diff changeset
  6645
    "print the receiver followed by a cr on the error stream(s).
10530
0f3d3ddd3837 #errorPrint* and #infoPrint* print to Transcript.
Stefan Vogel <sv@exept.de>
parents: 10527
diff changeset
  6646
     The Transcript is directed to the standard error stream on
0f3d3ddd3837 #errorPrint* and #infoPrint* print to Transcript.
Stefan Vogel <sv@exept.de>
parents: 10527
diff changeset
  6647
     headless applications."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6648
14165
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  6649
    Stderr isNil ifTrue:[
14661
2a5c79daa934 class: Object
Stefan Vogel <sv@exept.de>
parents: 14632
diff changeset
  6650
        "/ the following allows errorPrintCR to be used during
2a5c79daa934 class: Object
Stefan Vogel <sv@exept.de>
parents: 14632
diff changeset
  6651
        "/ the early init-phase, when no Stderr has been set up.
2a5c79daa934 class: Object
Stefan Vogel <sv@exept.de>
parents: 14632
diff changeset
  6652
        "/ (depends on string to respond to #errorPrintCR)
2a5c79daa934 class: Object
Stefan Vogel <sv@exept.de>
parents: 14632
diff changeset
  6653
        self printString utf8Encoded errorPrintCR.
2a5c79daa934 class: Object
Stefan Vogel <sv@exept.de>
parents: 14632
diff changeset
  6654
        ^ self.
14165
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  6655
    ].
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  6656
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  6657
    self withErrorStreamDo:[:s | self printOn:s. s cr].
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  6658
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  6659
    "
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  6660
     'hello' errorPrintCR
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  6661
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6662
10564
7d25403688ba dont errorPrint on Transcript when I am a system process.
Claus Gittinger <cg@exept.de>
parents: 10558
diff changeset
  6663
    "Created: / 20-05-1996 / 10:20:41 / cg"
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  6664
    "Modified: / 21-04-2011 / 12:47:13 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6665
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6666
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6667
errorPrintNL
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6668
    "{ Pragma: +optSpace }"
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6669
    <resource:#obsolete>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6670
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6671
    "print the receiver followed by a cr on the standard error stream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6672
     Please use #errorPrintCR - this method exists for backward compatibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6673
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6674
    ^ self errorPrintCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6675
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6676
    "Modified: 20.5.1996 / 10:24:45 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6677
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6678
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6679
errorPrintNewline
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6680
    "{ Pragma: +optSpace }"
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6681
    <resource:#obsolete>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6682
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6683
    "print the receiver followed by a cr on the standard error stream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6684
     Please use #errorPrintCR - this method exists for backward compatibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6685
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6686
    self errorPrintCR.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6687
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6688
    "Modified: 20.5.1996 / 10:24:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6689
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6690
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6691
infoPrint
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6692
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6693
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6694
    "print the receiver on the standard error stream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6695
     This is meant for information messages which are not warnings
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6696
     or fatal messages.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6697
     These messages can be turned on/off by 'Object infoPrinting:true/false'"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6698
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6699
    InfoPrinting == true ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6700
        self errorPrint
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6701
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6702
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6703
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6704
infoPrintCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6705
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6706
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6707
    "print the receiver followed by a cr on the standard error stream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6708
     This is meant for information messages which are not warnings
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6709
     or fatal messages.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6710
     These messages can be turned on/off by 'Object infoPrinting:true/false'"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6711
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6712
    InfoPrinting == true ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6713
        self errorPrintCR
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6714
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6715
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6716
    "Created: 20.5.1996 / 10:21:28 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6717
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6718
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6719
infoPrintNL
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6720
    "{ Pragma: +optSpace }"
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6721
    <resource:#obsolete>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6722
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6723
    "print the receiver followed by a cr on the standard error stream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6724
     Please use #infoPrintCR - this method exists for backward compatibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6725
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6726
    ^ self infoPrintCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6727
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6728
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6729
print
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6730
    "print the receiver on the standard output stream (which is not the Transcript)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6731
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6732
    "/ the following allows printCR to be used during
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6733
    "/ the early init-phase, when no Stdout has been set up.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6734
    "/ (depends on string to respond to #print)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6735
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6736
    Stdout isNil ifTrue:[
14661
2a5c79daa934 class: Object
Stefan Vogel <sv@exept.de>
parents: 14632
diff changeset
  6737
        self printString utf8Encoded print.
2a5c79daa934 class: Object
Stefan Vogel <sv@exept.de>
parents: 14632
diff changeset
  6738
        ^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6739
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6740
    self printOn:Stdout
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6741
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6742
    "Modified: 4.11.1996 / 23:36:58 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6743
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6744
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6745
printCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6746
    "print the receiver followed by a cr on the standard output stream (which is not the Transcript)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6747
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6748
    "/ the following allows printCR to be used during
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6749
    "/ the early init-phase, when no Stdout has been set up.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6750
    "/ (depends on string to respond to #printCR)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6751
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6752
    Stdout isNil ifTrue:[
14661
2a5c79daa934 class: Object
Stefan Vogel <sv@exept.de>
parents: 14632
diff changeset
  6753
        self printString utf8Encoded printCR.
2a5c79daa934 class: Object
Stefan Vogel <sv@exept.de>
parents: 14632
diff changeset
  6754
        ^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6755
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6756
    self printOn:Stdout.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6757
    Stdout cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6758
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6759
    "Created: 20.5.1996 / 10:21:37 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6760
    "Modified: 4.11.1996 / 23:37:06 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6761
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6762
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6763
printNL
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6764
    "print the receiver followed by a cr on the standard output stream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6765
     This exists for GNU Smalltalk compatibility - please use #printCR."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6766
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6767
    <resource:#obsolete>
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6768
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6769
    ^ self printCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6770
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6771
    "Modified: 20.5.1996 / 10:25:31 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6772
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6773
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6774
printNewline
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6775
    "print the receiver followed by a cr on the standard output stream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6776
     This exists for backward compatibility - please use #printCR."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6777
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6778
    <resource:#obsolete>
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6779
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6780
    self printCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6781
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6782
    "Modified: 20.5.1996 / 10:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6783
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6784
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6785
printOn:aStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6786
    "append a user printed representation of the receiver to aStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6787
     The format is suitable for a human - not meant to be read back.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6788
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6789
     The default here is to output the receivers class name.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6790
     BUT: this method is heavily redefined for objects which
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6791
     can print prettier."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6792
6235
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6793
    self basicPrintOn:aStream.
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6794
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6795
   "
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6796
    (1@2) printOn:Transcript
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6797
    (1@2) basicPrintOn:Transcript
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6798
   "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6799
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6800
11068
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6801
printOn:aStream format:format
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  6802
    "this may be redefined in subclasses.
11068
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6803
     Defined here for compatibility with subclasses"
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6804
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6805
    self printOn:aStream.
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6806
!
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6807
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6808
printOn:aStream leftPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6809
    "print the receiver on aStream, padding with spaces up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6810
     padding is done on the left."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6811
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6812
    self printOn:aStream leftPaddedTo:size with:(Character space)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6813
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6814
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6815
     123 printOn:Transcript leftPaddedTo:10. Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6816
     123 printOn:Transcript leftPaddedTo:2. Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6817
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6818
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6819
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6820
printOn:aStream leftPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6821
    "print the receiver on aStream, padding with padCharacters up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6822
     padding is done on the left."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6823
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6824
    aStream nextPutAll:(self printStringLeftPaddedTo:size with:padCharacter)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6825
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6826
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6827
     123 printOn:Transcript leftPaddedTo:10 with:$_ . Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6828
     123 printOn:Transcript leftPaddedTo:10 with:$. . Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6829
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6830
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6831
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6832
printOn:aStream paddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6833
    "print the receiver on aStream, padding with spaces up to size."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6834
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6835
    self printOn:aStream paddedTo:size with:(Character space)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6836
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6837
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6838
     123.0 printOn:Transcript paddedTo:10. Transcript nextPut:$|. Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6839
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6840
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6841
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6842
printOn:aStream paddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6843
    "print the receiver on aStream, padding with padCharacter up to size"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6844
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6845
    aStream nextPutAll:(self printStringPaddedTo:size with:padCharacter).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6846
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6847
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6848
     123 printOn:Transcript paddedTo:10 with:$_ . Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6849
     123 printOn:Transcript paddedTo:10 with:$. . Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6850
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6851
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6852
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6853
printOn:aStream zeroPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6854
    "print the receiver on aStream, padding with zeros up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6855
     Usually used with float numbers."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6856
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6857
    self printOn:aStream paddedTo:size with:$0.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6858
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6859
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6860
     123.0 printOn:Transcript zeroPaddedTo:10
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6861
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6862
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6863
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6864
printRightAdjustLen:size
11068
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6865
    <resource: #obsolete>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6866
    "obsolete - just a name confusion.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6867
     This method will go away ..."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6868
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6869
    (self printStringLeftPaddedTo:size) printOn:Stdout
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6870
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6871
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6872
printString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6873
    "return a string for printing the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6874
     Since we now use printOn: as the basic print mechanism,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6875
     we have to create a stream and print into it."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6876
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6877
    |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6878
11790
6dcd44bc2ff9 Larger default for #printString
Stefan Vogel <sv@exept.de>
parents: 11738
diff changeset
  6879
    s := CharacterWriteStream on:(String basicNew:40).     "allocate at least 46 bytes for fast UUID conversion"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6880
    self printOn:s.
8300
d15ead94361f Use CharacterWriteStream in #printString (speedup)
Stefan Vogel <sv@exept.de>
parents: 8287
diff changeset
  6881
    ^ s contents.
7978
4ce7575e1cfc care for 16bit chars in #printString
Claus Gittinger <cg@exept.de>
parents: 7838
diff changeset
  6882
4ce7575e1cfc care for 16bit chars in #printString
Claus Gittinger <cg@exept.de>
parents: 7838
diff changeset
  6883
    "
4ce7575e1cfc care for 16bit chars in #printString
Claus Gittinger <cg@exept.de>
parents: 7838
diff changeset
  6884
     Date today printString.
4ce7575e1cfc care for 16bit chars in #printString
Claus Gittinger <cg@exept.de>
parents: 7838
diff changeset
  6885
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6886
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6887
11068
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6888
printStringFormat:orintFormat
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6889
    "subclasses may redefine this.
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6890
     Defined here to avoid type checks"
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6891
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6892
    ^ self printString
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6893
!
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6894
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6895
printStringLeftPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6896
    "return my printString as a right-adjusted string of length size;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6897
     characters on the left are filled with spaces.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6898
     If the printString is longer than size,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6899
     it is returned unchanged (i.e. not truncated)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6900
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6901
    ^ self printStringLeftPaddedTo:size with:(Character space)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6902
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6903
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6904
     10 printStringLeftPaddedTo:10
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6905
     1 printStringLeftPaddedTo:10
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6906
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6907
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6908
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6909
printStringLeftPaddedTo:size ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6910
    "return my printString as a right-adjusted string of length size;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6911
     characters on the left are filled with spaces.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6912
     If the printString is larger than size,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6913
     return the result from evaluating alternative."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6914
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6915
    ^ self printStringLeftPaddedTo:size with:(Character space) ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6916
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6917
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6918
     12   printStringLeftPaddedTo:3 ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6919
     123  printStringLeftPaddedTo:3 ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6920
     1234 printStringLeftPaddedTo:3 ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6921
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6922
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6923
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6924
printStringLeftPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6925
    "return my printString as a right-adjusted string of length size;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6926
     characters on the left are filled with padCharacter.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6927
     If the printString is longer than size,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6928
     it is returned unchanged (i.e. not truncated)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6929
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6930
    ^ (self printString) leftPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6931
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6932
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6933
     123 printStringLeftPaddedTo:10 with:$.
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6934
     1 printStringLeftPaddedTo:10 with:$.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6935
     (Float pi) printStringLeftPaddedTo:20 with:$*
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6936
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6937
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6938
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6939
printStringLeftPaddedTo:size with:padCharacter ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6940
    "return my printString as a right-adjusted string of length size;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6941
     characters on the left are filled with padCharacter.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6942
     If the printString is larger than size,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6943
     return the result from evaluating alternative."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6944
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6945
    |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6946
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6947
    s := self printString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6948
    s size > size ifTrue:[^ alternative value].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6949
    ^ s leftPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6950
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6951
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6952
     12   printStringLeftPaddedTo:3 with:$. ifLarger:['***']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6953
     123  printStringLeftPaddedTo:3 with:$. ifLarger:['***']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6954
     1234 printStringLeftPaddedTo:3 with:$. ifLarger:['***']
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6955
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6956
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6957
8576
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6958
printStringLimitedTo:sizeLimit
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6959
    "return a string for printing the receiver, but limit the result string in its size."
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6960
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6961
    |s|
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6962
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6963
    s := CharacterWriteStream on:(String basicNew:30).
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6964
    s writeLimit:sizeLimit.
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6965
    self printOn:s.
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6966
    ^ s contents.
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6967
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6968
    "
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6969
     Date today printStringLimitedTo:5.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6970
     '12345678901234567890' printStringLimitedTo:5.
8576
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6971
    "
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6972
!
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6973
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6974
printStringOnError:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6975
    "return a string for printing the receiver; if any error occurs, return the result from
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6976
     evaluating exceptionBlock. Useful to print something in an exceptionHandler or other
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6977
     cleanup code."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6978
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6979
    |rslt|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6980
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6981
    Error handle:[:ex |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6982
        rslt := exceptionBlock value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6983
    ] do:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  6984
        rslt := self printString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6985
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6986
    ^ rslt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6987
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6988
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6989
printStringPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6990
    "return a printed representation of the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6991
     padded with spaces (at the right) up to size.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6992
     If the printString is longer than size,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6993
     it is returned unchanged (i.e. not truncated)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6994
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6995
    ^ self printStringPaddedTo:size with:(Character space)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6996
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6997
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6998
     123 printStringPaddedTo:10
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6999
     1234567890123456 printStringPaddedTo:10
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7000
     'hello' printStringPaddedTo:10
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7001
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7002
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7003
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7004
printStringPaddedTo:size ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7005
    "return a printed representation of the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7006
     padded with spaces (at the right) up to size.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7007
     If the resulting printString is too large,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7008
     return the result from evaluating alternative."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7009
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7010
    ^ self printStringPaddedTo:size with:(Character space) ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7011
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7012
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7013
     12   printStringPaddedTo:3 ifLarger:['***']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7014
     123  printStringPaddedTo:3 ifLarger:['***']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7015
     1234 printStringPaddedTo:3 ifLarger:['***']
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7016
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7017
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7018
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7019
printStringPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7020
    "return a printed representation of the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7021
     padded with padCharacter (at the right) up to size.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7022
     If the printString is longer than size,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7023
     it is returned unchanged (i.e. not truncated)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7024
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7025
    ^ (self printString) paddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7026
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7027
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7028
     123  printStringPaddedTo:10 with:$.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7029
     123  printStringPaddedTo:10 with:$*
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7030
     123  printStringPaddedTo:3 with:$*
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7031
     1234 printStringPaddedTo:3 with:$*
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7032
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7033
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7034
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7035
printStringPaddedTo:size with:padCharacter ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7036
    "return a printed representation of the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7037
     padded with padCharacter (at the right) up to size.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7038
     If the resulting printString is too large,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7039
     return the result from evaluating alternative."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7040
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7041
    |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7042
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7043
    s := self printString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7044
    s size > size ifTrue:[^ alternative value].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7045
    ^ s paddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7046
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7047
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7048
     123   printStringPaddedTo:3 with:$. ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7049
     12345 printStringPaddedTo:3 with:$. ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7050
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7051
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7052
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7053
printStringRightAdjustLen:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7054
    "obsolete - just a name confusion.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7055
     This method will go away ..."
11068
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7056
    <resource: #obsolete>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7057
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7058
    ^ self printStringLeftPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7059
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7060
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7061
printStringZeroPaddedTo:size
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7062
    "return a printed representation of the receiver,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7063
     padded with zero (at the right) characters up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7064
     Usually used with float numbers."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7065
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7066
    ^ self printStringPaddedTo:size with:$0
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7067
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7068
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7069
     123.0 printStringZeroPaddedTo:10
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7070
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7071
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7072
8287
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  7073
printfPrintString:ignoredFormat
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  7074
    "fallback to default printString
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  7075
     (for compatibility with float and integer-printing)"
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  7076
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  7077
    ^ self printString
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  7078
!
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  7079
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7080
store
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7081
    "store the receiver on standard output.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7082
     this method is useless, but included for compatibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7083
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7084
    self storeOn:Stdout
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7085
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7086
7600
5a3fee21c032 #storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents: 7576
diff changeset
  7087
storeArrayElementOn:aStream
5a3fee21c032 #storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents: 7576
diff changeset
  7088
    "store an object as an Array element.
5a3fee21c032 #storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents: 7576
diff changeset
  7089
     Subclasses may redefine this to omit a leading '#'"
5a3fee21c032 #storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents: 7576
diff changeset
  7090
5a3fee21c032 #storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents: 7576
diff changeset
  7091
    ^ self storeOn:aStream
5a3fee21c032 #storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents: 7576
diff changeset
  7092
!
5a3fee21c032 #storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents: 7576
diff changeset
  7093
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7094
storeCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7095
    "store the receiver on standard output; append a carriage return."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7096
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7097
    self store.
11068
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7098
    Stdout cr.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7099
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7100
    "Created: 20.5.1996 / 10:26:01 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7101
    "Modified: 20.5.1996 / 10:26:57 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7102
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7103
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7104
storeNl
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7105
    "store the receiver on standard output; append a newline.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7106
     This method is included for backward compatibility-  use #storeCR."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7107
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  7108
    <resource:#obsolete>
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  7109
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7110
    self storeCR.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7111
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7112
    "Modified: 20.5.1996 / 10:26:49 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7113
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7114
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7115
storeOn:aStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7116
    "store the receiver on aStream; i.e. print an expression which will
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7117
     reconstruct the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7118
     Notice, that no self referencing or cyclic objects can be represented
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7119
     in this format.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7120
     Use storeBinaryOn:, which handles these cases correctly."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7121
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7122
    |myClass hasSemi sz "{ Class: SmallInteger }" |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7123
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7124
    thisContext isRecursive ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7125
        Object recursiveStoreStringSignal raiseRequestWith:self.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7126
        'Object [error]: storeString of self referencing object (' errorPrint.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7127
        self class name errorPrint.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7128
        ')' errorPrintCR.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7129
        aStream nextPutAll:'#("recursive")'.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7130
        ^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7131
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7132
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7133
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7134
    aStream nextPut:$(.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7135
    aStream nextPutAll:self class name.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7136
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7137
    hasSemi := false.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7138
    myClass isVariable ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7139
        aStream nextPutAll:' basicNew:'.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7140
        self basicSize printOn:aStream
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7141
    ] ifFalse:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7142
        aStream nextPutAll:' basicNew'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7143
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7144
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7145
    sz := myClass instSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7146
    1 to:sz do:[:i |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7147
        aStream nextPutAll:' instVarAt:'.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7148
        i printOn:aStream.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7149
        aStream nextPutAll:' put:'.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7150
        (self instVarAt:i) storeOn:aStream.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7151
        aStream nextPut:$;.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7152
        hasSemi := true
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7153
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7154
    myClass isVariable ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7155
        sz := self basicSize.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7156
        1 to:sz do:[:i |
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7157
            aStream nextPutAll:' basicAt:'.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7158
            i printOn:aStream.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7159
            aStream nextPutAll:' put:'.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7160
            (self basicAt:i) storeOn:aStream.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7161
            aStream nextPut:$;.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7162
            hasSemi := true
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7163
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7164
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7165
    hasSemi ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7166
        aStream nextPutAll:' yourself'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7167
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7168
    aStream nextPut:$).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7169
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7170
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7171
     |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7172
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7173
     s := WriteStream on:(String new).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7174
     ('hello' -> 'world') storeOn:s.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7175
     s := ReadStream on:(s contents).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7176
     (Object readFrom:s) inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7177
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7178
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7179
     |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7180
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7181
     s := 'data' asFilename writeStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7182
     ('hello' -> 'world') storeOn:s.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7183
     s close.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7184
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7185
     s := 'data' asFilename readStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7186
     (Object readFrom:s) inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7187
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7188
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7189
    "does not work example:"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7190
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7191
     |s a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7192
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7193
     a := Array new:2.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7194
     a at:1 put:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7195
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7196
     s := 'data' asFilename writeStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7197
     a storeOn:s.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7198
     s close.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7199
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7200
     s := 'data' asFilename readStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7201
     (Object readFrom:s) inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7202
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7203
13162
dd688290df14 changed: #storeOn:
Claus Gittinger <cg@exept.de>
parents: 13140
diff changeset
  7204
    "Modified: / 03-12-2010 / 13:27:51 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7205
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7206
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7207
storeString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7208
    "return a string representing an expression to reconstruct the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7209
     Notice, that no self referencing or cyclic objects can be represented
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7210
     in this format.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7211
     Use storeBinaryOn:, which handles these cases correctly."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7212
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7213
    |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7214
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7215
    s := WriteStream on:(String new:50).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7216
    self storeOn:s.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7217
    ^ s contents
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7218
!
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7219
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7220
withErrorStreamDo:aBlock
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7221
    "{ Pragma: +optSpace }"
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7222
14162
79def684ccac changed: #withErrorStreamDo:
Stefan Vogel <sv@exept.de>
parents: 14079
diff changeset
  7223
    "helper for error messages - evaluate aBlock, passing it a stream on which to put
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7224
     error messages."
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7225
13578
aa9827cafc2c signalInterrupt: - tell which process was killed
Claus Gittinger <cg@exept.de>
parents: 13566
diff changeset
  7226
    |stream|
aa9827cafc2c signalInterrupt: - tell which process was killed
Claus Gittinger <cg@exept.de>
parents: 13566
diff changeset
  7227
aa9827cafc2c signalInterrupt: - tell which process was killed
Claus Gittinger <cg@exept.de>
parents: 13566
diff changeset
  7228
    stream := Processor activeProcess isSystemProcess
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7229
                        ifTrue:[Stderr]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7230
                        ifFalse:[Transcript].
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7231
    StreamError catch:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7232
        aBlock value:stream.
13578
aa9827cafc2c signalInterrupt: - tell which process was killed
Claus Gittinger <cg@exept.de>
parents: 13566
diff changeset
  7233
    ].
14162
79def684ccac changed: #withErrorStreamDo:
Stefan Vogel <sv@exept.de>
parents: 14079
diff changeset
  7234
    stream ~~ Stderr ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7235
        aBlock value:Stderr.
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7236
    ].
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7237
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7238
    "Created: / 21-04-2011 / 12:46:21 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7239
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7240
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7241
!Object methodsFor:'queries'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7242
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7243
basicSize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7244
    "return the number of the receivers indexed instance variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7245
     0 if it has none.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7246
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7247
     This method should NOT be redefined in any subclass (except with great care, for tuning)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7248
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7249
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7250
8909
485a8e3153e0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7251
    REGISTER INT nbytes;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7252
    REGISTER OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7253
    int nInstBytes;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7254
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7255
    /*
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7256
     * notice the missing test for self being a nonNilObject -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7257
     * this can be done since basicSize is defined both in UndefinedObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7258
     * and SmallInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7259
     */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7260
    myClass = __qClass(self);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7261
    nbytes = __qSize(self);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7262
    nInstBytes = OHDR_SIZE + __OBJS2BYTES__( __intVal(__ClassInstPtr(myClass)->c_ninstvars) );
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7263
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7264
    switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7265
        case __MASKSMALLINT(POINTERARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7266
        case __MASKSMALLINT(WKPOINTERARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7267
            nbytes -= nInstBytes;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7268
            RETURN ( __mkSmallInteger(__BYTES2OBJS__(nbytes)) );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7269
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7270
        case __MASKSMALLINT(BYTEARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7271
            nbytes -= nInstBytes;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7272
            RETURN ( __mkSmallInteger(nbytes / sizeof(char)) );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7273
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7274
        case __MASKSMALLINT(FLOATARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7275
            nbytes -= nInstBytes;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7276
            RETURN ( __mkSmallInteger(nbytes / sizeof(float)) );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7277
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7278
        case __MASKSMALLINT(DOUBLEARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7279
#ifdef __NEED_DOUBLE_ALIGN
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7280
            nInstBytes = (nInstBytes-1+__DOUBLE_ALIGN) &~ (__DOUBLE_ALIGN-1);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7281
#endif
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7282
            nbytes -= nInstBytes;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7283
            RETURN ( __mkSmallInteger(nbytes / sizeof(double)) );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7284
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7285
        case __MASKSMALLINT(WORDARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7286
        case __MASKSMALLINT(SWORDARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7287
            nbytes -= nInstBytes;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7288
            RETURN ( __mkSmallInteger(nbytes>>1) ); /* notice the hardcoded 2 here - not sizeof(short) */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7289
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7290
        case __MASKSMALLINT(LONGARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7291
        case __MASKSMALLINT(SLONGARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7292
            nbytes -= nInstBytes;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7293
            RETURN ( __mkSmallInteger(nbytes>>2) ); /* notice the hardcoded 4 here - not sizeof(int) */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7294
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7295
        case __MASKSMALLINT(LONGLONGARRAY):
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7296
        case __MASKSMALLINT(SLONGLONGARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7297
#ifdef __NEED_LONGLONG_ALIGN
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7298
            nInstBytes = (nInstBytes-1+__LONGLONG_ALIGN) &~ (__LONGLONG_ALIGN-1);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7299
#endif
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7300
            nbytes -= nInstBytes;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7301
            RETURN ( __mkSmallInteger(nbytes>>3) ); /* notice the hardcoded 8 here - not sizeof(long long) */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7302
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7303
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7304
    ^ 0
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7305
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7306
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7307
byteSize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7308
    "return the number of bytes in the receivers indexed instance variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7309
     0 if it has none. This only returns non-zero for non-pointer indexed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7310
     instvars i.e. byteArrays, wordArrays etc.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7311
     Notice: for Strings the returned size may look strange.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7312
     Only useful with binary storage."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7313
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7314
    |myClass|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7315
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7316
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7317
    myClass isVariable ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7318
        myClass isPointers ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7319
            myClass isBytes ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7320
                ^ self basicSize.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7321
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7322
            myClass isWords ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7323
                ^ self basicSize * 2.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7324
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7325
            myClass isSignedWords ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7326
                ^ self basicSize * 2.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7327
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7328
            myClass isLongs ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7329
                ^ self basicSize * 4.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7330
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7331
            myClass isSignedLongs ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7332
                ^ self basicSize * 4.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7333
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7334
            myClass isLongLongs ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7335
                ^ self basicSize * 8.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7336
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7337
            myClass isSignedLongLongs ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7338
                ^ self basicSize * 8.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7339
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7340
            myClass isFloats ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7341
                ^ self basicSize * (ExternalBytes sizeofFloat)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7342
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7343
            myClass isDoubles ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7344
                ^ self basicSize * (ExternalBytes sizeofDouble)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7345
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7346
            self error:'unknown variable size class species'.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7347
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7348
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7349
    ^ 0
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7350
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7351
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7352
     Point new byteSize
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  7353
     'hello' byteSize
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  7354
     'hello' asUnicode16String byteSize
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7355
     (ByteArray with:1 with:2) byteSize
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7356
     (FloatArray with:1.5) byteSize
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7357
     (DoubleArray with:1.5) byteSize
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7358
     (WordArray with:1 with:2) byteSize
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7359
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7360
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7361
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7362
class
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7363
    "return the receivers class"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7364
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7365
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7366
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7367
    RETURN ( __Class(self) );
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7368
%}
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7369
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7370
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7371
respondsTo:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7372
    "return true, if the receiver implements a method with selector equal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7373
     to aSelector; i.e. if there is a method for aSelector in either the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7374
     receivers class or one of its superclasses.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7375
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7376
     Notice, that this does not imply, that such a message can be sent without
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7377
     an error being raised. For example, an implementation could send
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7378
     #shouldNotImplement or #subclassResponsibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7379
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7380
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7381
     should we go via the cache, or search (by class) ?
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7382
     The first is faster, most of the time; while the 2nd fills
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7383
     the cache with useless data if this is sent in a loop over all objects.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7384
     For now, use the cache ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7385
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7386
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7387
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7388
    if (__lookup(__Class(self), aSelector) == nil) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7389
        RETURN ( false );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7390
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7391
    RETURN ( true );
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7392
%}
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7393
.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7394
    ^ self class canUnderstand:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7395
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7396
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7397
    "'aString' respondsTo:#+"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7398
    "'aString' respondsTo:#,"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7399
    "'aString' respondsTo:#collect:"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7400
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7401
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7402
respondsToArithmetic
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7403
    "return true, if the receiver responds to arithmetic messages.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7404
     false is returned here - the method is redefined in ArithmeticValue."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7405
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7406
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7407
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7408
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7409
size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7410
    "return the number of the receivers indexed instance variables;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7411
     this method may be redefined in subclasses"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7412
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7413
    ^ self basicSize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7414
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7415
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7416
species
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7417
    "return a class which is similar to (or the same as) the receivers class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7418
     This is used to create an appropriate object when creating derived
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7419
     copies in the collection classes (sometimes redefined)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7420
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7421
    ^ self class
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7422
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7423
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7424
yourself
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7425
    "return the receiver - used for cascades to return self at the end"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7426
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7427
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7428
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7429
15193
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
  7430
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7431
!Object methodsFor:'secure message sending'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7432
13099
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7433
?: selector
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7434
    "try to send a message to the receiver;
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7435
     if understood, return the value;
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7436
     if not, return nil."
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7437
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7438
    ^ self perform:selector ifNotUnderstood:nil
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7439
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7440
    "
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7441
     ApplicationModel new masterApplication resources first             - error
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7442
     ApplicationModel new ?: #masterApplication ?: #resources ?: #first - nil
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7443
    "
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7444
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7445
    "Modified: / 20-10-2010 / 10:45:21 / cg"
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7446
!
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7447
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7448
askFor:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7449
    "try to send the receiver the message, aSelector.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7450
     If it does not understand it, return false.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7451
     Otherwise the real value returned.
11398
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  7452
     Useful to send messages such as: #isColor to unknown receivers."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7453
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7454
    ^ self perform:aSelector ifNotUnderstood:[false]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7455
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7456
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7457
     1 askFor:#isColor
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7458
     Color red askFor:#isColor
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7459
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7460
     1 askFor:#isFoo
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7461
     Color red askFor:#isFoo
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7462
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7463
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7464
11398
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  7465
askFor:aSelector with:argument
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  7466
    "try to send the receiver the message, aSelector.
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  7467
     If it does not understand it, return false.
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  7468
     Otherwise the real value returned.
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  7469
     Useful to send messages such as: #isXXX: to unknown receivers."
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  7470
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  7471
    ^ self perform:aSelector with:argument ifNotUnderstood:[false]
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  7472
!
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  7473
11401
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  7474
askFor:aSelector with:arg1 with:arg2
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  7475
    "try to send the receiver the message, aSelector.
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  7476
     If it does not understand it, return false.
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  7477
     Otherwise the real value returned.
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  7478
     Useful to send messages such as: #isXXX: to unknown receivers."
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  7479
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  7480
    ^ self perform:aSelector with:arg1 with:arg2 ifNotUnderstood:[false]
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  7481
!
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  7482
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7483
perform:aSelector ifNotUnderstood:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7484
    "try to send message aSelector to the receiver.
12157
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7485
     If its understood, return the method's returned value,
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7486
     otherwise return the value of the exceptionBlock.
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7487
     Read this:
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7488
     Many programmers do an Error-handle to perform a similar
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7489
     checked-message send. However, this method is more specific,
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7490
     in that only errors for the given selector are cought - not any other
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7491
     doesNotUnderstand, and especially not any other error."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7492
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7493
    |val ok|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7494
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  7495
    MessageNotUnderstood handle:[:ex |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7496
        "/ reject, if the bad message is not the one
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7497
        "/ we have sent originally
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7498
        (ex selector == aSelector and:[ex receiver == self]) ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7499
            ex reject
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7500
        ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7501
    ] do:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7502
        val := self perform:aSelector.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7503
        ok := true.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7504
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7505
    ok isNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7506
        ^ exceptionBlock value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7507
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7508
    ^ val
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7509
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7510
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7511
     1.2345 perform:#foo ifNotUnderstood:['sorry']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7512
     1.2345 perform:#sqrt ifNotUnderstood:['sorry']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7513
     12345 perform:#sqrt ifNotUnderstood:['sorry']
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7514
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7515
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7516
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7517
perform:aSelector with:argument ifNotUnderstood:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7518
    "try to send message aSelector to the receiver.
12157
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7519
     If its understood, return the method's returned value,
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7520
     otherwise return the value of the exceptionBlock.
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7521
     Read this:
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7522
     Many programmers do an Error-handle to perform a similar
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7523
     checked-message send. However, this method is more specific,
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7524
     in that only errors for the given selector are cought - not any other
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7525
     doesNotUnderstand, and especially not any other error."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7526
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7527
    |val ok|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7528
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7529
    MessageNotUnderstood handle:[:ex |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7530
        "/ reject, if the bad message is not the one
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7531
        "/ we have sent originally
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7532
        (ex selector == aSelector and:[ex receiver == self]) ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7533
            ex reject
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7534
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7535
    ] do:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7536
        val := self perform:aSelector with:argument.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7537
        ok := true.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7538
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7539
    ok isNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7540
        ^ exceptionBlock value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7541
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7542
    ^ val
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7543
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7544
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7545
     |unknown|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7546
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7547
     unknown := 4.
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7548
     (unknown perform:#- with:2 ifNotUnderstood:['sorry']) printNewline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7549
     unknown := 'high there'.
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7550
     (unknown perform:#- with:2 ifNotUnderstood:['sorry']) printNewline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7551
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7552
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7553
5926
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7554
perform:aSelector with:arg1 with:arg2 ifNotUnderstood:exceptionBlock
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7555
    "try to send message aSelector to the receiver.
12157
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7556
     If its understood, return the method's returned value,
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7557
     otherwise return the value of the exceptionBlock.
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7558
     Read this:
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7559
     Many programmers do an Error-handle to perform a similar
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7560
     checked-message send. However, this method is more specific,
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7561
     in that only errors for the given selector are cought - not any other
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7562
     doesNotUnderstand, and especially not any other error."
5926
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7563
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7564
    |val ok|
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7565
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7566
    MessageNotUnderstood handle:[:ex |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7567
        "/ reject, if the bad message is not the one
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7568
        "/ we have sent originally
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7569
        (ex selector == aSelector and:[ex receiver == self]) ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7570
            ex reject
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7571
        ]
5926
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7572
    ] do:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7573
        val := self perform:aSelector with:arg1 with:arg2.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7574
        ok := true.
5926
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7575
    ].
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7576
    ok isNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7577
        ^ exceptionBlock value
5926
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7578
    ].
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7579
    ^ val
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7580
!
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7581
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7582
perform:aSelector withArguments:argumentArray ifNotUnderstood:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7583
    "try to send message aSelector to the receiver.
12157
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7584
     If its understood, return the method's returned value,
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7585
     otherwise return the value of the exceptionBlock.
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7586
     Read this:
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7587
     Many programmers do an Error-handle to perform a similar
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7588
     checked-message send. However, this method is more specific,
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7589
     in that only errors for the given selector are cought - not any other
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7590
     doesNotUnderstand, and especially not any other error."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7591
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7592
    |val ok|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7593
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7594
    MessageNotUnderstood handle:[:ex |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7595
        "/ reject, if the bad message is not the one
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7596
        "/ we have sent originally.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7597
        (ex selector == aSelector and:[ex receiver == self]) ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7598
            ex reject
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7599
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7600
    ] do:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7601
        val := self perform:aSelector withArguments:argumentArray.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7602
        ok := true.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7603
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7604
    ok isNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7605
        ^ exceptionBlock value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7606
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7607
    ^ val
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7608
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7609
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7610
     |unknown|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7611
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7612
     unknown := 4.
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7613
     (unknown perform:#- withArguments:#(2) ifNotUnderstood:['sorry']) printNewline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7614
     unknown := 'high there'.
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7615
     (unknown perform:#- withArguments:#(2) ifNotUnderstood:['sorry']) printNewline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7616
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7617
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7618
    "Modified: 27.3.1997 / 14:13:16 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7619
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7620
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7621
!Object methodsFor:'signal constants'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7622
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7623
messageNotUnderstoodSignal
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  7624
    ^ MessageNotUnderstood
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7625
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7626
    "Created: 6.3.1997 / 15:46:52 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7627
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7628
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7629
!Object methodsFor:'special queries'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7630
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7631
allOwners
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7632
    "return a collection of all objects referencing the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7633
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7634
    ^ ObjectMemory whoReferences:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7635
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7636
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7637
references:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7638
    "return true, if the receiver refers to the argument, anObject.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7639
     - for debugging only"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7640
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7641
    ^ self referencesObject:anObject
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7642
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7643
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7644
     |v|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7645
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7646
     v := View new initialize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7647
     v references:Display.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7648
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7649
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7650
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7651
referencesAny:aCollection
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7652
    "return true, if the receiver refers to any object from
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7653
     the argument, aCollection.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7654
     - for debugging only"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7655
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7656
%{
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7657
    OBJ cls, flags;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7658
    int nInsts, inst;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7659
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7660
    if (! __isNonNilObject(self)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7661
        RETURN (false);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7662
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7663
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8930
diff changeset
  7664
    if (__isArrayLike(aCollection)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7665
        int nObjs = __arraySize(aCollection);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7666
        char *minAddr = 0, *maxAddr = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7667
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7668
        if (nObjs == 0) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7669
            RETURN (false);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7670
        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7671
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7672
        /*
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7673
         * a little optimization: use the fact that all old objects
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7674
         * refering to a new object are on the remSet; if I am not,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7675
         * a trivial reject is possible, if all objects are newbees.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7676
         * as a side effect, gather min/max addresses
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7677
         */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7678
        if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7679
            int allNewBees = 1;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7680
            int i;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7681
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7682
            minAddr = (char *)(__ArrayInstPtr(aCollection)->a_element[0]);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7683
            maxAddr = minAddr;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7684
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7685
            for (i=0; i<nObjs; i++) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7686
                OBJ anObject;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7687
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7688
                anObject = __ArrayInstPtr(aCollection)->a_element[i];
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7689
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7690
                if (__isNonNilObject(anObject)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7691
                    int spc;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7692
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7693
                    if (((spc = __qSpace(anObject)) != NEWSPACE) && (spc != SURVSPACE)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7694
                        allNewBees = 0;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7695
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7696
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7697
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7698
                if ((char *)anObject < minAddr) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7699
                    minAddr = (char *)anObject;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7700
                } else if ((char *)anObject > maxAddr) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7701
                    maxAddr = (char *)anObject;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7702
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7703
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7704
            if (allNewBees) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7705
                RETURN (false);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7706
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7707
        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7708
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7709
        /*
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7710
         * fetch min/max in searchList (if not already done)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7711
         */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7712
        if (minAddr == 0) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7713
            int i;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7714
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7715
            for (i=0; i<nObjs; i++) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7716
                OBJ anObject;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7717
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7718
                anObject = __ArrayInstPtr(aCollection)->a_element[i];
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7719
                if ((char *)anObject < minAddr) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7720
                    minAddr = (char *)anObject;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7721
                } else if ((char *)anObject > maxAddr) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7722
                    maxAddr = (char *)anObject;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7723
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7724
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7725
        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7726
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7727
        cls = __qClass(self);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7728
        if (((char *)cls >= minAddr) && ((char *)cls <= maxAddr)) {
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7729
#if defined(memsrch4)
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7730
            if (memsrch4(__arrayVal(aCollection), (INT)cls, nObjs)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7731
                RETURN (true);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7732
            }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7733
#else
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7734
            int i;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7735
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7736
            for (i=0; i<nObjs; i++) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7737
                OBJ anObject;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7738
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7739
                anObject = __ArrayInstPtr(aCollection)->a_element[i];
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7740
                if (cls == anObject) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7741
                    RETURN (true);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7742
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7743
            }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7744
#endif /* memsrch4 */
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7745
        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7746
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7747
        flags = __ClassInstPtr(cls)->c_flags;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7748
        if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7749
            nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7750
        } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7751
            nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7752
        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7753
        if (! nInsts) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7754
            RETURN (false);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7755
        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7756
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7757
        if (nObjs == 1) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7758
            /* better reverse the loop */
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7759
            OBJ anObject;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7760
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7761
            anObject = __ArrayInstPtr(aCollection)->a_element[0];
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7762
#if defined(memsrch4)
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7763
            if (memsrch4(__InstPtr(self)->i_instvars, (INT)anObject, nInsts)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7764
                RETURN (true);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7765
            }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7766
#else
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7767
            for (inst=0; inst<nInsts; inst++) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7768
                if ((__InstPtr(self)->i_instvars[inst]) == anObject) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7769
                    RETURN (true);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7770
                }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7771
            }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7772
#endif
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7773
            RETURN (false);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7774
        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7775
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7776
        for (inst=0; inst<nInsts; inst++) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7777
            OBJ instVar = __InstPtr(self)->i_instvars[inst];
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7778
            int i;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7779
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7780
            if (((char *)instVar >= minAddr) && ((char *)instVar <= maxAddr)) {
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7781
#if defined(memsrch4)
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7782
                if (memsrch4(__arrayVal(aCollection), (INT)instVar, nObjs)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7783
                    RETURN (true);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7784
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7785
#else
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7786
                for (i=0; i<nObjs; i++) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7787
                    OBJ anObject;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7788
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7789
                    anObject = __ArrayInstPtr(aCollection)->a_element[i];
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7790
                    if (instVar == anObject) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7791
                        RETURN (true);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7792
                    }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7793
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7794
#endif /* memsrch4 */
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7795
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7796
        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7797
        RETURN (false);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7798
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7799
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7800
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7801
    aCollection do:[:el |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7802
        (self referencesObject:el) ifTrue:[^ true].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7803
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7804
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7805
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7806
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7807
referencesDerivedInstanceOf:aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7808
    "return true, if the receiver refers to an instance of
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7809
     the argument, aClass or its subclass. This method exists
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7810
     to support searching for users of a class."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7811
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7812
    |myClass
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7813
     numInst "{ Class: SmallInteger }" |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7814
6631
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  7815
    "check the class"
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  7816
    (self isKindOf:aClass) ifTrue:[^ true].
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  7817
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7818
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7819
    "check the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7820
    numInst := myClass instSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7821
    1 to:numInst do:[:i |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7822
        ((self instVarAt:i) isKindOf:aClass) ifTrue:[^ true]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7823
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7824
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7825
    "check the indexed variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7826
    myClass isVariable ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7827
        myClass isPointers ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7828
            "no need to search in non pointer fields"
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7829
            ((aClass == Number) or:[aClass isSubclassOf:Number]) ifFalse:[^ false].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7830
        ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7831
        numInst := self basicSize.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7832
        1 to:numInst do:[:i |
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7833
            ((self basicAt:i) isKindOf:aClass) ifTrue:[^ true]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7834
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7835
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7836
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7837
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7838
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7839
     (1 @ 3.4) referencesDerivedInstanceOf:Number
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7840
     (1 @ 3.4) referencesDerivedInstanceOf:Array
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7841
     View new initialize referencesDerivedInstanceOf:DeviceWorkstation
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7842
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7843
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7844
9279
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7845
referencesForWhich:checkBlock do:actionBlock
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7846
    |myClass inst
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7847
     numInst "{ Class: SmallInteger }" |
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7848
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7849
    myClass := self class.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7850
    "check the instance variables"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7851
    numInst := myClass instSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7852
    1 to:numInst do:[:i |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7853
        inst := self instVarAt:i.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7854
        (checkBlock value:inst) ifTrue:[actionBlock value:inst].
9279
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7855
    ].
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7856
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7857
    "check the indexed variables"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7858
    myClass isVariable ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7859
        myClass isPointers ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7860
            "no need to search in non pointer fields"
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7861
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7862
            numInst := self basicSize.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7863
            1 to:numInst do:[:i |
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7864
                inst := self basicAt:i.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7865
                (checkBlock value:inst) ifTrue:[actionBlock value:inst].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7866
            ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7867
        ]
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7868
    ].
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7869
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7870
    "
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7871
     (1 @ 3.4) referencesForWhich:[:i | i isFloat] do:[:i | Transcript showCR:i]
9279
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7872
    "
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7873
!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7874
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7875
referencesInstanceOf:aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7876
    "return true, if the receiver refers to an instance of
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7877
     the argument, aClass.This method exists
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7878
     to support searching for users of a class."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7879
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7880
    |myClass
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7881
     numInst "{ Class: SmallInteger }" |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7882
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7883
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7884
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7885
    "check the class"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7886
    (myClass isMemberOf:aClass) ifTrue:[^ true].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7887
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7888
    "check the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7889
    numInst := myClass instSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7890
    1 to:numInst do:[:i |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7891
        ((self instVarAt:i) isMemberOf:aClass) ifTrue:[^ true]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7892
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7893
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7894
    "check the indexed variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7895
    myClass isVariable ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7896
        myClass isPointers ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7897
            "no need to search in non-pointer indexed fields"
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7898
            myClass isLongs ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7899
                (aClass == SmallInteger or:[aClass == LargeInteger]) ifFalse:[^ false].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7900
            ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7901
                myClass isFloatsOrDoubles ifTrue:[^ aClass == Float].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7902
                ^ aClass == SmallInteger
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7903
            ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7904
        ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7905
        numInst := self basicSize.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7906
        1 to:numInst do:[:i |
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7907
            ((self basicAt:i) isMemberOf:aClass) ifTrue:[^ true]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7908
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7909
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7910
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7911
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7912
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7913
     (1 @ 3.4) referencesInstanceOf:Float
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7914
     (1 @ 3.4) referencesInstanceOf:Fraction
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7915
     View new initialize referencesInstanceOf:(Display class)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7916
    "
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7917
!
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7918
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7919
referencesObject:anObject
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7920
    "return true, if the receiver refers to the argument, anObject.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7921
     - for debugging only"
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7922
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7923
%{  /* NOCONTEXT */
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7924
    OBJ cls, flags;
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7925
    int nInsts, i;
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7926
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7927
    if (! __isNonNilObject(self)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7928
        RETURN (false);
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7929
    }
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7930
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7931
    /*
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7932
     * a little optimization: use the fact that all old objects
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7933
     * refering to a new object are on the remSet; if I am not,
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7934
     * a trivial reject is possible, if anObject is a newbee
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7935
     */
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7936
    if (__isNonNilObject(anObject)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7937
        if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7938
            int spc;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7939
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7940
            if (((spc = __qSpace(anObject)) == NEWSPACE) || (spc == SURVSPACE)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7941
                RETURN (false);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7942
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7943
        }
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7944
    }
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7945
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7946
    cls = __qClass(self);
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7947
    if (cls == anObject) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7948
        RETURN (true);
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7949
    }
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7950
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7951
    flags = __ClassInstPtr(cls)->c_flags;
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7952
    if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7953
        nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7954
    } else {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7955
        nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7956
    }
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7957
    if (! nInsts) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7958
        RETURN (false);
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7959
    }
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7960
#if defined(memsrch4)
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7961
    if (memsrch4(__InstPtr(self)->i_instvars, (INT)anObject, nInsts)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7962
        RETURN (true);
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7963
    }
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7964
#else
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7965
    for (i=0; i<nInsts; i++) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7966
        if (__InstPtr(self)->i_instvars[i] == anObject) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7967
            RETURN (true);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  7968
        }
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7969
    }
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7970
#endif /* memsrch4 */
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7971
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7972
%}.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7973
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7974
"/    |myClass
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7975
"/     numInst "{ Class: SmallInteger }" |
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7976
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7977
"/    myClass := self class.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7978
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7979
"/    "check the class"
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7980
"/    (myClass == anObject) ifTrue:[^ true].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7981
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7982
"/    "check the instance variables"
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7983
"/    numInst := myClass instSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7984
"/    1 to:numInst do:[:i |
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7985
"/      ((self instVarAt:i) == anObject) ifTrue:[^ true]
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7986
"/    ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7987
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7988
"/    "check the indexed variables"
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7989
"/    myClass isVariable ifTrue:[
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7990
"/      myClass isPointers ifFalse:[
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7991
"/          "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7992
"/          "/ we could argue about the following unconditional return:
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7993
"/          "/ it says that a non pointer array never has a reference to the
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7994
"/          "/ corresponding object - not mimicing a reference to a copy of the
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7995
"/          "/ integer. However, it avoids useless searches in huge byteArray
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7996
"/          "/ like objects when searching for owners. If in doubt, remove it.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7997
"/          "/ A consequence of the return below is that #[1 2 3] will say that it
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7998
"/          "/ does not refer to the number 2 (think of keeping a copy instead)
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7999
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8000
"/          ^ false.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8001
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8002
"/          "/ alternative:
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8003
"/          "/  anObject isNumber ifFalse:[^ false].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8004
"/      ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8005
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8006
"/      "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8007
"/      "/ because arrays are so common, and those have a highly tuned
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8008
"/      "/ idenitytIndex method, use it
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8009
"/      "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8010
"/      myClass == Array ifTrue:[
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8011
"/          ^ (self identityIndexOf:anObject) ~~ 0
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8012
"/      ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8013
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8014
"/      "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8015
"/      "/ otherwise, do it the slow way
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8016
"/      "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8017
"/      numInst := self basicSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8018
"/      1 to:numInst do:[:i |
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8019
"/          ((self basicAt:i) == anObject) ifTrue:[^ true]
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8020
"/      ]
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8021
"/    ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8022
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8023
    ^ false
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8024
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8025
    "
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8026
     |v|
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8027
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8028
     v := View new initialize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8029
     v references:Display.
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8030
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8031
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8032
15193
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
  8033
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8034
!Object methodsFor:'synchronized evaluation'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8035
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8036
freeSynchronizationSemaphore
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8037
    "free synchronizationSemaphore. May be used, to save memory when
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8038
     an object is no longer used synchronized."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8039
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8040
    |sema|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8041
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8042
    sema := self synchronizationSemaphore.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8043
    sema notNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8044
        sema wait.              "/ get lock
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8045
        self synchronizationSemaphore:nil.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8046
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8047
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8048
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8049
     self synchronized:[].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8050
     self synchronizationSemaphore.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8051
     self freeSynchronizationSemaphore.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8052
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8053
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8054
    "Created: 28.1.1997 / 19:31:20 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8055
    "Modified: 28.1.1997 / 19:47:55 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8056
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8057
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8058
synchronizationSemaphore
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8059
    "return the synchronization semaphore for myself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8060
     subclasses may redefine"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8061
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8062
    ^ SynchronizationSemaphores at:self ifAbsent:[].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8063
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8064
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8065
      self synchronizationSemaphore
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8066
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8067
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8068
    "Modified: 28.1.1997 / 19:47:09 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8069
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8070
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8071
synchronizationSemaphore:aSemaphore
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8072
    "set the synchronisationSemaphore for myself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8073
     subclasses may redefine this method"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8074
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8075
    aSemaphore isNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8076
        "/ remove Semaphore
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8077
        SynchronizationSemaphores removeKey:self ifAbsent:nil.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8078
    ] ifFalse:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8079
        SynchronizationSemaphores at:self put:aSemaphore.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8080
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8081
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8082
    "Modified: 28.1.1997 / 19:37:48 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8083
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8084
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8085
synchronized:aBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8086
    "evaluate aBlock synchronized, i.e. use a monitor for this object"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8087
6600
9c85adf293dd Simplify #synchronized:
Stefan Vogel <sv@exept.de>
parents: 6572
diff changeset
  8088
    |sema wasBlocked|
9c85adf293dd Simplify #synchronized:
Stefan Vogel <sv@exept.de>
parents: 6572
diff changeset
  8089
9c85adf293dd Simplify #synchronized:
Stefan Vogel <sv@exept.de>
parents: 6572
diff changeset
  8090
    wasBlocked := OperatingSystem blockInterrupts.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8091
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8092
    sema := self synchronizationSemaphore.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8093
    sema isNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8094
        sema := RecursionLock new name:self className.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8095
        self synchronizationSemaphore:sema.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8096
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8097
6600
9c85adf293dd Simplify #synchronized:
Stefan Vogel <sv@exept.de>
parents: 6572
diff changeset
  8098
    wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
7211
87f5d25b5c3d Make synchronizationSemaphore a recursionLock
Stefan Vogel <sv@exept.de>
parents: 7208
diff changeset
  8099
    sema critical:aBlock.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8100
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8101
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8102
       [Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'1']] fork.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8103
       [Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'2']] fork.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8104
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8105
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8106
    "Created: 28.1.1997 / 17:52:56 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8107
    "Modified: 30.1.1997 / 13:38:54 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8108
    "Modified: 20.2.1997 / 09:43:35 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8109
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8110
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8111
!Object methodsFor:'system primitives'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8112
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8113
asOop
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8114
    "ST-80 compatibility:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8115
     ST-80 returns an OOP-identity based number here (I guess: its address
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8116
     or index); since ST/X has no such thing, and the objects address cannot
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8117
     be used (since its changing over time), we return the objects identityHash
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8118
     key, which provides (at least) some identity indication.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8119
     However, notice that (in contrast to ST-80's #asOop), the identityHash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8120
     key of two non-identical objects may be the same.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8121
     You'd better not use it - especially do not misuse it."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8122
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8123
    ^ self identityHash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8124
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8125
    "Created: 9.11.1996 / 19:09:56 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8126
    "Modified: 9.11.1996 / 19:16:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8127
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8128
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8129
beImmutable
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8130
    "experimental - not yet usable; do not use"
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8131
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8132
%{  /* NOCONTEXT */
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8133
    if (! __isNonNilObject(self)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8134
        RETURN (self);
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8135
    }
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8136
    __beImmutable(self);
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8137
%}
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8138
!
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8139
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8140
beMutable
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8141
    "experimental - not yet usable; do not use"
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8142
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8143
%{  /* NOCONTEXT */
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8144
    if (! __isNonNilObject(self)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8145
        RETURN (self);
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8146
    }
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8147
    __beMutable(self);
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8148
%}
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8149
!
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8150
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8151
become:anotherObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8152
    "make all references to the receiver become references to anotherObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8153
     and vice-versa. Notice the vice-versa; see #becomeSameAs: for a one-way become.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8154
     This can be a very dangerous operation - be warned.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8155
     In general, using #become: should be avoided if possible, since it may
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8156
     produce many strange effects (think of hashing in Sets, Dictionaries etc.).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8157
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8158
     This may also be an expensive (i.e. slow) operation,
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8159
     since in the worst case, the whole memory has to be searched for
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8160
     references to the two objects (although the primitive tries hard to
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8161
     limit the search, for acceptable performance in most cases).
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8162
     This method fails, if the receiver or the argument is a SmallInteger
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8163
     or nil, or is a context of a living method (i.e. one that has not already
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8164
     returned).
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8165
     (notice that #become: is not used heavily by the system
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8166
      - the Collection-classes have been rewritten to not use it.)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8167
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8168
    if (__primBecome(self, anotherObject)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8169
        RETURN ( self );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8170
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8171
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8172
    self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8173
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8174
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8175
becomeNil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8176
    "make all references to the receiver become nil - effectively getting
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8177
     rid of the receiver.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8178
     This can be a very dangerous operation - be warned.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8179
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8180
     This may be an expensive (i.e. slow) operation.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8181
     The receiver may not be a SmallInteger or a context of a living method."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8182
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8183
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8184
    if (__primBecomeNil(self)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8185
        RETURN ( nil );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8186
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8187
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8188
    self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8189
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8190
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8191
becomeSameAs:anotherObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8192
    "make all references to the receiver become references to anotherObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8193
     but NOT vice versa (as done in #become:).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8194
     This can be a very dangerous operation - be warned.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8195
     In general, using #become: should be avoided if possible, since it may
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8196
     produce many strange effects (think of hashing in Sets, Dictionaries etc.).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8197
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8198
     This may also be an expensive (i.e. slow) operation,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8199
     since in the worst case, the whole memory has to be searched for
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8200
     references to the two objects (although the primitive tries hard to
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8201
     limit the search, for acceptable performance in most cases).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8202
     This method fails, if the receiver or the argument is a SmallInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8203
     or nil, or is a context of a living method (i.e. one that has not already returned)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8204
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8205
    if (__primBecomeSameAs(self, anotherObject)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8206
        RETURN ( self );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8207
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8208
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8209
    self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8210
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8211
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8212
changeClassTo:otherClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8213
    "changes the class of the receiver to the argument, otherClass.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8214
     This is only allowed (possible), if the receivers class and the argument
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8215
     have the same structure (i.e. number of named instance variables and
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8216
     type of indexed instance variables).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8217
     If the structures do not match, or any of the original class or new class
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8218
     is UndefinedObject or a Smallinteger, a primitive error is triggered."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8219
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8220
    |myClass ok|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8221
9405
cdeae08708cd comments
Stefan Vogel <sv@exept.de>
parents: 9375
diff changeset
  8222
    otherClass autoload.
cdeae08708cd comments
Stefan Vogel <sv@exept.de>
parents: 9375
diff changeset
  8223
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8224
    "check for UndefinedObject/SmallInteger receiver or newClass"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8225
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8226
    {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8227
        OBJ other = otherClass;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8228
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8229
        if (__isNonNilObject(self)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8230
         && __isNonNilObject(other)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8231
         && (other != UndefinedObject)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8232
         && (other != SmallInteger)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8233
            ok = true;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8234
        } else {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8235
            ok = false;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8236
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8237
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8238
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8239
    ok ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8240
        ok := false.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8241
        myClass := self class.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8242
        myClass flags == otherClass flags ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8243
            myClass instSize == otherClass instSize ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8244
                "same instance layout and types: its ok to do it"
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8245
                ok := true.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8246
            ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8247
                myClass isPointers ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8248
                    myClass isVariable ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8249
                        ok := true
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8250
                    ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8251
                ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8252
            ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8253
        ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8254
            myClass isPointers ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8255
                "if newClass is a variable class, with instSize <= my instsize,
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8256
                 we can do it (effectively mapping additional instvars into the
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8257
                 variable part) - usefulness is questionable, though"
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8258
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8259
                otherClass isPointers ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8260
                    otherClass isVariable ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8261
                        otherClass instSize <= (myClass instSize + self basicSize)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8262
                        ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8263
                            ok := true
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8264
                        ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8265
                    ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8266
                        otherClass instSize == (myClass instSize + self basicSize)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8267
                        ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8268
                            ok := true
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8269
                        ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8270
                    ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8271
                ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8272
                    "it does not make sense to convert pointers to bytes ..."
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8273
                ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8274
            ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8275
                "does it make sense, to convert bits ?"
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8276
                "could allow byteArray->wordArray->longArray->floatArray->doubleArray here ..."
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8277
                (myClass isBitsExtended and:[otherClass isBitsExtended]) ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8278
                    ok := true
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8279
                ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8280
            ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8281
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8282
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8283
    ok ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8284
        "now, change the receivers class ..."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8285
%{
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8286
        {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8287
            OBJ me = self;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8288
15128
c29df15418db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15116
diff changeset
  8289
	    // gcc4.4 does not like this:
c29df15418db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15116
diff changeset
  8290
            // __qClass(me) = otherClass;
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8291
            __objPtr(me)->o_class = (CLASS_OBJ)otherClass;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8292
            __STORE(me, otherClass);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8293
            RETURN (me);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8294
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8295
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8296
    ].
9405
cdeae08708cd comments
Stefan Vogel <sv@exept.de>
parents: 9375
diff changeset
  8297
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8298
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8299
     the receiver cannot be represented as a instance of
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8300
     the desired class.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8301
     For example, you cannot change a bitInstance (byteArray etc.)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8302
     into a pointer object and vice versa.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8303
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8304
    self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8305
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8306
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8307
changeClassToThatOf:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8308
    "changes the class of the receiver to that of the argument, anObject.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8309
     This is only allowed (possible), if the receivers class and the arguments
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8310
     class have the same structure (i.e. number of named instance variables and
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8311
     type of indexed instance variables). If the structures do not match, or any
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8312
     of the objects is nil or a Smallinteger, a primitive error is triggered."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8313
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8314
    self changeClassTo:(anObject class)
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8315
!
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8316
8935
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8317
isImmutable
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8318
    "experimental - not yet usable; do not use"
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8319
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8320
%{  /* NOCONTEXT */
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8321
    if (! __isNonNilObject(self)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8322
        RETURN (true);
8935
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8323
    }
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8324
    RETURN (__isImmutable(self) ? true : false);
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8325
%}
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8326
!
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8327
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8328
replaceReferencesTo:anObject with:newRef
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8329
    "if the receiver refers to the argument, anObject, replace this reference with newRef.
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8330
     Return true, if any reference was changed.
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8331
     Notice: this does not change the class-reference."
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8332
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8333
%{  /* NOCONTEXT */
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8334
    OBJ cls, flags, anyChange;
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8335
    int nInsts, i;
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8336
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8337
    if (! __isNonNilObject(self)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8338
        RETURN (false);
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8339
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8340
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8341
    /*
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8342
     * a little optimization: use the fact that all old objects
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8343
     * refering to a new object are on the remSet; if I am not,
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8344
     * a trivial reject is possible, if anObject is a newbee
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8345
     */
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8346
    if (__isNonNilObject(anObject)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8347
        if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8348
            int spc;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8349
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8350
            if (((spc = __qSpace(anObject)) == NEWSPACE) || (spc == SURVSPACE)) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8351
                RETURN (false);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8352
            }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8353
        }
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8354
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8355
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8356
    cls = __qClass(self);
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8357
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8358
    flags = __ClassInstPtr(cls)->c_flags;
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8359
    if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8360
        nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8361
    } else {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8362
        nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8363
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8364
    if (! nInsts) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8365
        RETURN (false);
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8366
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8367
    anyChange = false;
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8368
    for (i=0; i<nInsts; i++) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8369
        if (__InstPtr(self)->i_instvars[i] == anObject) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8370
            __InstPtr(self)->i_instvars[i] = newRef;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8371
            __STORE(self, newRef);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8372
            anyChange = true;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8373
        }
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8374
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8375
    RETURN (anyChange);
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8376
%}.
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8377
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8378
    "
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8379
     |v|
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8380
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8381
     v := Array with:1234 with:'hello' with:Array.
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8382
     v replaceReferencesTo:Array with:ByteArray.
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8383
     v inspect
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8384
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8385
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8386
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8387
!Object methodsFor:'testing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8388
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8389
? defaultValue
11634
657c12384132 Fix spelling
Stefan Vogel <sv@exept.de>
parents: 11573
diff changeset
  8390
     "a syntactic sugar-piece:
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8391
      if the receiver is nil, return the defaultValue;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8392
      otherwise, return the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8393
      This method is only redefined in UndefinedObject - therefore,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8394
      the recevier is retuned here.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8395
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8396
      Thus, if foo and bar are simple variables or constants,
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8397
          foo ? bar
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8398
      is the same as:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8399
          (foo isNil ifTrue:[bar] ifFalse:[foo])
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8400
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8401
      if they are message sends, the equivalent code is:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8402
          [
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8403
              |t1 t2|
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8404
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8405
              t1 := foo.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8406
              t2 := bar.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8407
              t1 isNil ifTrue:[t2] ifFalse:[t1]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8408
          ] value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8409
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8410
      Can be used to provide defaultValues to variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8411
      as in:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8412
          foo := arg ? #defaultValue
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8413
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8414
      Note: this method should never be redefined in classes other than UndefinedObject.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8415
      Notice:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8416
         This method is open coded (inlined) by the compiler(s)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8417
         - redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8418
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8419
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8420
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8421
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8422
     1 ? #default
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8423
     nil ? #default
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8424
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8425
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8426
    "Created: / 4.11.1996 / 20:36:19 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8427
    "Modified: / 19.5.1998 / 17:39:56 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8428
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8429
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8430
?? defaultValue
11634
657c12384132 Fix spelling
Stefan Vogel <sv@exept.de>
parents: 11573
diff changeset
  8431
     "a syntactic sugar-piece:
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8432
      much like ?, but sends #value to the argument if required.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8433
      (i.e. its the same as #ifNil:)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8434
      If the receiver is nil, return the defaultValues value;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8435
      otherwise, return the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8436
      This method is only redefined in UndefinedObject - therefore,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8437
      the recevier is retuned here.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8438
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8439
      Thus, if foo and bar are simple variables or constants,
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8440
          foo ?? bar
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8441
      is the same as:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8442
          (foo isNil ifTrue:[bar value] ifFalse:[foo])
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8443
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8444
      if they are message sends, the equivalent code is:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8445
          [
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8446
              |t t2|
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8447
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8448
              t := foo.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8449
              t isNil ifTrue:[bar value] ifFalse:[t]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8450
          ] value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8451
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8452
      Can be used to provide defaultValues to variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8453
      as in:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8454
          foo := arg ?? [ self computeDefault ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8455
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8456
      Note: this method should never be redefined in classes other than UndefinedObject.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8457
     "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8458
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8459
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8460
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8461
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8462
     1 ?? #default
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8463
     nil ?? #default
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8464
     1 ?? [ self halt. 1 + 2 ]
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8465
     nil ?? [ self halt. 1 + 2 ]
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8466
     1 ?? [Date today]
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8467
     nil ?? [Date today]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8468
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8469
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8470
    "Created: / 4.11.1996 / 20:36:19 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8471
    "Modified: / 19.5.1998 / 17:42:56 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8472
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8473
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8474
ifNil:aBlockOrValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8475
    "return myself, or the result from evaluating the argument, if I am nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8476
     This is much like #?, but sends #value to the argument in case of a nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8477
     receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8478
     Notice:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8479
        This method is open coded (inlined) by the compiler(s)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8480
        - redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8481
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8482
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8483
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8484
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8485
ifNil:nilBlockOrValue ifNotNil:notNilBlockOrValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8486
    "return the value of the first arg, if I am nil,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8487
     the result from evaluating the 2nd argument, if I am not nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8488
     Notice:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8489
        This method is open coded (inlined) by the compiler(s)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8490
        - redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8491
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8492
    ^ notNilBlockOrValue value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8493
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8494
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8495
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8496
ifNotNil:aBlockOrValue
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8497
    "return myself if nil, or the result from evaluating the argument,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8498
     if I am not nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8499
     Notice:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8500
        This method is open coded (inlined) by the compiler(s)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8501
        - redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8502
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8503
    ^ aBlockOrValue value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8504
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8505
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8506
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8507
ifNotNil:notNilBlockOrValue ifNil:nilBlockOrValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8508
    "return the value of the 2nd arg, if I am nil,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8509
     the result from evaluating the 1st argument, if I am not nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8510
     Notice:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8511
        This method is open coded (inlined) by the compiler(s)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8512
        - redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8513
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8514
    ^ notNilBlockOrValue value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8515
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8516
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8517
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8518
8574
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  8519
ifNotNilDo:aBlock
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  8520
    "if the reciever is non-nil, return the value of aBlock, passing myself as argument.
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  8521
     Otherwise do nothing and return nil."
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  8522
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  8523
    ^ aBlock value:self
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  8524
!
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  8525
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8526
isArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8527
    "return true, if the receiver is some kind of array (or weakArray etc);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8528
     false is returned here - the method is only redefined in Array."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8529
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8530
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8531
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8532
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8533
isAssociation
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8534
    "return true, if the receiver is some kind of association;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8535
     false is returned here - the method is only redefined in Association."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8536
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8537
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8538
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8539
    "Created: 14.5.1996 / 17:03:45 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8540
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8541
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8542
isBehavior
9221
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  8543
    "return true, if the receiver is describing another objects behavior.
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  8544
     False is returned here - the method is only redefined in Behavior."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8545
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8546
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8547
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8548
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8549
isBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8550
    "return true, if the receiver is some kind of block;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8551
     false returned here - the method is only redefined in Block."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8552
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8553
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8554
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8555
5824
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  8556
isBoolean
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  8557
    "return true, if the receiver is a boolean;
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  8558
     false is returned here - the method is only redefined in Boolean."
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  8559
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  8560
    ^ false
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  8561
!
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  8562
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8563
isByteArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8564
    "return true, if the receiver is some kind of bytearray;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8565
     false is returned here - the method is only redefined in ByteArray."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8566
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8567
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8568
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8569
8986
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  8570
isByteCollection
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  8571
    "return true, if the receiver is some kind of byte collection,
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8572
     i.e. #at: and #at:put: accesses a byte. This is different from 'self class isBytes',
8986
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  8573
     since e.g. in BitArray single bits are accessed, but it is implemented as variableBytes class.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8574
8986
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  8575
     false is returned here - the method is only redefined in UninterpretedBytes."
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  8576
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  8577
    ^ false
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  8578
!
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  8579
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8580
isCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8581
    "return true, if the receiver is some kind of character;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8582
     false is returned here - the method is only redefined in Character."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8583
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8584
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8585
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8586
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8587
isClass
9405
cdeae08708cd comments
Stefan Vogel <sv@exept.de>
parents: 9375
diff changeset
  8588
    "return true, if the receiver is some kind of class
cdeae08708cd comments
Stefan Vogel <sv@exept.de>
parents: 9375
diff changeset
  8589
     (real class, not just behavior);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8590
     false is returned here - the method is only redefined in Class."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8591
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8592
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8593
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8594
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8595
isCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8596
    "return true, if the receiver is some kind of collection;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8597
     false is returned here - the method is only redefined in Collection."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8598
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8599
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8600
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8601
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8602
isColor
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8603
    "return true, if the receiver is some kind of color;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8604
     false is returned here - the method is only redefined in Color."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8605
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8606
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8607
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8608
6567
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8609
isCons
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8610
    "return true, if the receiver is a cons (pair);
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8611
     false is returned here - the method is only redefined in Cons."
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8612
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8613
    ^ false
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8614
!
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8615
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8616
isContext
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8617
    "return true, if the receiver is some kind of context;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8618
     false returned here - the method is only redefined in Context."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8619
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8620
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8621
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8622
6181
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  8623
isEmptyOrNil
8833
717b01292d0e comments
Stefan Vogel <sv@exept.de>
parents: 8832
diff changeset
  8624
    "return true if I am nil or an empty collection - return false here.
717b01292d0e comments
Stefan Vogel <sv@exept.de>
parents: 8832
diff changeset
  8625
     (from Squeak)"
6181
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  8626
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  8627
    ^ false
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  8628
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  8629
    "Created: / 13.11.2001 / 13:17:04 / cg"
6182
2b992cf865bc comment
Claus Gittinger <cg@exept.de>
parents: 6181
diff changeset
  8630
    "Modified: / 13.11.2001 / 13:28:40 / cg"
6181
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  8631
!
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  8632
6221
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  8633
isException
6631
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8634
    "answer true, if this ia an Exception, that may be queried about its type"
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8635
6221
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  8636
    ^ false
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  8637
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  8638
    "Created: / 17.11.2001 / 18:37:44 / cg"
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  8639
!
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  8640
6631
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8641
isExceptionCreator
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8642
    "return true, if the receiver can create exceptions,
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8643
     this includes #raise, #raiseRequest as well as the behavior of
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8644
     an exception handler, such as the #accepts: and #handles: messages"
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8645
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8646
    ^ false
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8647
!
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8648
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8649
isExceptionHandler
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8650
    "return true, if the receiver responds to the exception handler protocol,
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8651
     especially to the #accepts: and #handles: messages"
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8652
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8653
    ^ false
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8654
!
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8655
13187
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  8656
isExternalAddress
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  8657
    "return true, if the receiver is some kind of externalAddress;
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  8658
     false is returned here - the method is only redefined in ExternalAddress."
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  8659
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  8660
    ^ false
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  8661
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  8662
    "Created: / 22-12-2010 / 17:20:36 / cg"
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  8663
!
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  8664
14079
4568576f2690 added: #isExternalBytes
Stefan Vogel <sv@exept.de>
parents: 14078
diff changeset
  8665
isExternalBytes
4568576f2690 added: #isExternalBytes
Stefan Vogel <sv@exept.de>
parents: 14078
diff changeset
  8666
    ^ false
4568576f2690 added: #isExternalBytes
Stefan Vogel <sv@exept.de>
parents: 14078
diff changeset
  8667
!
4568576f2690 added: #isExternalBytes
Stefan Vogel <sv@exept.de>
parents: 14078
diff changeset
  8668
10480
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
  8669
isExternalLibraryFunction
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
  8670
    "return true, if the receiver is some kind of externalLibrary function;
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
  8671
     false is returned here - the method is only redefined in ExternalLibraryFunction."
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
  8672
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
  8673
    ^false
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
  8674
!
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
  8675
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8676
isExternalStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8677
    "return true, if the receiver is some kind of externalStream;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8678
     false is returned here - the method is only redefined in ExternalStream."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8679
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8680
    ^false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8681
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8682
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8683
isFileStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8684
    "return true, if the receiver is some kind of fileStream;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8685
     false is returned here - the method is only redefined in FileStream."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8686
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8687
    ^false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8688
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8689
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8690
isFilename
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8691
    "return true, if the receiver is some kind of filename;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8692
     false is returned here - the method is only redefined in Filename."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8693
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8694
    ^false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8695
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8696
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8697
isFixedPoint
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8698
    "return true, if the receiver is some kind of fixedPoint number;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8699
     false is returned here - the method is only redefined in FixedPoint."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8700
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8701
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8702
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8703
    "Created: 5.11.1996 / 19:23:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8704
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8705
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8706
isFixedSize
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8707
    "return true if the receiver cannot grow easily
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8708
     (i.e. a grow may be expensive, since it involves a become:)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8709
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8710
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8711
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8712
6185
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8713
isFloat
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8714
    "return true, if the receiver is some kind of floating point number;
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8715
     false is returned here.
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8716
     Same as #isLimitedPrecisionReal, but a better name ;-)"
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8717
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8718
    ^ false
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8719
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8720
    "Modified: / 14.11.2001 / 14:57:46 / cg"
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8721
!
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8722
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8723
isForm
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8724
    "return true, if the receiver is some kind of form;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8725
     false is returned here - the method is only redefined in Form."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8726
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8727
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8728
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8729
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8730
isFraction
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8731
    "return true, if the receiver is some kind of fraction;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8732
     false is returned here - the method is only redefined in Fraction."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8733
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8734
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8735
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8736
9293
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
  8737
isHierarchicalItem
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
  8738
    "used to decide if the parent is a hierarchical item or the model"
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
  8739
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
  8740
    ^ false
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
  8741
!
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
  8742
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8743
isImage
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8744
    "return true, if the receiver is some kind of image;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8745
     false is returned here - the method is only redefined in Image."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8746
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8747
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8748
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8749
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8750
isImageOrForm
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8751
    "return true, if the receiver is some kind of image or form;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8752
     false is returned here - the method is only redefined in Image and Form."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8753
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8754
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8755
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8756
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8757
isImmediate
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8758
    "return true if I am an immediate object
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8759
     i.e. I am represented in the pointer itself and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8760
     no real object header/storage is used me.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8761
     (currently, only SmallIntegers, some characters and nil return true)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8762
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8763
    ^ self class hasImmediateInstances
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8764
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8765
    "Created: 3.6.1997 / 12:00:18 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8766
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8767
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8768
isInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8769
    "return true, if the receiver is some kind of integer number;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8770
     false is returned here - the method is only redefined in Integer."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8771
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8772
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8773
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8774
9279
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8775
isInterestConverter
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8776
    "return true if I am a kind of interest forwarder"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8777
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8778
    ^ false
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8779
!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8780
10576
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
  8781
isInternalByteStream
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
  8782
    "return true, if the receiver is some kind of Stream for reading bytes;
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
  8783
     false is returned here - the method is only redefined in PeekableStream."
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
  8784
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
  8785
    ^false
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
  8786
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
  8787
    "Created: / 30-05-2007 / 16:15:33 / cg"
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
  8788
!
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
  8789
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8790
isJavaClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8791
    "return true, if this is a javaClass.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8792
     false is returned here - the method is only redefined in JavaClass."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8793
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8794
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8795
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8796
    "Created: / 26.3.1997 / 13:34:54 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8797
    "Modified: / 8.5.1998 / 21:25:21 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8798
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8799
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8800
isJavaClassRef
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8801
    "return true, if this is a JavaClassRef.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8802
     false is returned here - the method is only redefined in JavaClassRef."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8803
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8804
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8805
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8806
    "Modified: / 8.5.1998 / 21:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8807
    "Created: / 24.12.1999 / 01:46:28 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8808
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8809
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8810
isJavaContext
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8811
    "return true, if this is a javaContext.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8812
     false is returned here - the method is only redefined in JavaContext."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8813
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8814
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8815
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8816
    "Created: / 8.5.1998 / 21:24:27 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8817
    "Modified: / 8.5.1998 / 21:25:35 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8818
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8819
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8820
isJavaMethod
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8821
    "return true, if this is a JavaMethod.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8822
     false is returned here - the method is only redefined in JavaMethod."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8823
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8824
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8825
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8826
    "Modified: / 8.5.1998 / 21:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8827
    "Created: / 25.9.1999 / 23:26:12 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8828
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8829
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8830
isJavaMethodRef
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8831
    "return true, if this is a JavaMethodRef.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8832
     false is returned here - the method is only redefined in JavaMethodRef."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8833
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8834
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8835
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8836
    "Modified: / 8.5.1998 / 21:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8837
    "Created: / 23.12.1999 / 19:44:51 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8838
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8839
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8840
isJavaObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8841
    "return true, if this is a javaObject.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8842
     false is returned here - the method is only redefined in JavaObject."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8843
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8844
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8845
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8846
    "Created: / 26.3.1997 / 13:34:48 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8847
    "Modified: / 8.5.1998 / 21:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8848
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8849
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8850
isJavaScriptClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8851
    "return true, if this is a javaScriptClass.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8852
     false is returned here - the method is only redefined in JavaScriptClass."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8853
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8854
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8855
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8856
8935
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8857
isJavaScriptMetaclass
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8858
    "return true, if this is a javaScript Metaclass.
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8859
     false is returned here - the method is only redefined in JavaScriptMetaclass."
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8860
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8861
    ^ false
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8862
!
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8863
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8864
isKindOf:aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8865
    "return true, if the receiver is an instance of aClass or one of its
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8866
     subclasses, false otherwise.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8867
     Advice:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8868
        use of this to check objects for certain attributes/protocoll should
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8869
        be avoided; it limits the reusability of your classes by limiting use
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8870
        to instances of certain classes and fences you into a specific inheritance
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8871
        hierarchy.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8872
        Use check-methods to check an object for a certain attributes/protocol
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8873
        (such as #isXXXX, #respondsTo: or #isNumber).
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8874
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8875
        Using #isKindOf: is considered BAD STYLE.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8876
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8877
     Advice2:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8878
        Be aware, that using an #isXXX method is usually much faster than
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8879
        using #isKindOf:; because isKindOf: has to walk up all the superclass
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8880
        hierarchy, comparing every class on the way.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8881
        Due to caching in the VM, a call to #isXXX is normally reached via
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8882
        a single function call.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8883
     "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8884
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8885
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8886
    register OBJ thisClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8887
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8888
    thisClass = __Class(self);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8889
    while (thisClass != nil) {
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8890
        if (thisClass == aClass) {
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8891
            RETURN ( true );
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8892
        }
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8893
        thisClass = __ClassInstPtr(thisClass)->c_superclass;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8894
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8895
    RETURN ( false );
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8896
%}
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8897
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8898
"/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8899
"/  the above code is equivalent to:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8900
"/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8901
"/  thisClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8902
"/  [thisClass notNil] whileTrue:[
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8903
"/      thisClass == aClass ifTrue:[^ true].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8904
"/      thisClass := thisClass superclass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8905
"/  ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8906
"/  ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8907
"/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8908
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8909
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8910
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8911
isLayout
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8912
    "return true, if the receiver is some kind of layout;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8913
     false is returned here - the method is only redefined in Layout."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8914
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8915
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8916
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8917
6567
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8918
isLazyValue
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8919
    ^ false
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8920
!
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8921
6086
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8922
isLimitedPrecisionReal
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8923
    "return true, if the receiver is some kind of floating point number;
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8924
     false is returned here - the method is only redefined in LimitedPrecisionReal."
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8925
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8926
    ^ false
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8927
!
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8928
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8929
isList
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8930
    "return true, if the receiver is some kind of list collection;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8931
     false is returned here - the method is only redefined in List."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8932
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8933
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8934
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8935
    "Created: / 11.2.2000 / 01:37:05 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8936
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8937
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8938
isLiteral
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8939
    "return true, if the receiver can be represented as a literal constant in ST syntax;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8940
     false is returned here - the method is redefined in some classes."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8941
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8942
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8943
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8944
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8945
isMemberOf:aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8946
    "return true, if the receiver is an instance of aClass, false otherwise.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8947
     Advice:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8948
        use of this to check objects for certain attributes/protocol should
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8949
        be avoided; it limits the reusability of your classes by limiting use
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8950
        to instances of a certain class.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8951
        Use check-methods to check an object for a certain attributes/protocol
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8952
        (such as #isXXX, #respondsTo: or #isNumber);
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8953
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8954
        Using #isMemberOf: is considered BAD STYLE.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8955
     Notice:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8956
        This method is open coded (inlined) by the compiler(s)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  8957
        - redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8958
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8959
    ^ (self class) == aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8960
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8961
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8962
isMeta
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8963
    "return true, if the receiver is some kind of metaclass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8964
     false is returned here - the method is only redefined in Metaclass."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8965
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8966
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8967
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8968
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8969
isMethod
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8970
    "return true, if the receiver is some kind of method;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8971
     false returned here - the method is only redefined in Method."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8972
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8973
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8974
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8975
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8976
isMorph
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8977
    "return true, if the receiver is some kind of morph;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8978
     false is returned here - the method is only redefined in Morph."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8979
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8980
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8981
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8982
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8983
isNameSpace
9221
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  8984
    "return true, if the receiver is a nameSpace.
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  8985
     False is returned here - the method is only redefined in Namespace."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8986
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8987
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8988
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8989
    "Created: / 11.10.1996 / 18:08:56 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8990
    "Modified: / 8.5.1998 / 21:26:05 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8991
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8992
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8993
isNamespace
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8994
    "return true, if this is a nameSpace.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8995
     false is returned here - the method is only redefined in Namespace."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8996
5869
362be80efcb9 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5856
diff changeset
  8997
    <resource:#obsolete>
362be80efcb9 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5856
diff changeset
  8998
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8999
    self obsoleteMethodWarning:'use #isNameSpace'.
6805
f95ad1a82775 *** empty log message ***
ca
parents: 6800
diff changeset
  9000
    ^ self isNameSpace
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9001
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9002
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9003
isNil
9221
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  9004
    "Return true, if the receiver is nil.
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  9005
     Because isNil is redefined in UndefinedObject,
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  9006
     the receiver is definitely not nil here, so unconditionally return false.
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9007
     Notice:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9008
        This method is open coded (inlined) by the compiler(s)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9009
        - redefining it may not work as expected."
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9010
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9011
    ^ false
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9012
!
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9013
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9014
isNilOrEmptyCollection
6182
2b992cf865bc comment
Claus Gittinger <cg@exept.de>
parents: 6181
diff changeset
  9015
    "return true if I am nil or an empty collection - false here.
8833
717b01292d0e comments
Stefan Vogel <sv@exept.de>
parents: 8832
diff changeset
  9016
     Obsolete, use isEmptyOrNil."
717b01292d0e comments
Stefan Vogel <sv@exept.de>
parents: 8832
diff changeset
  9017
717b01292d0e comments
Stefan Vogel <sv@exept.de>
parents: 8832
diff changeset
  9018
    <resource:#obsolete>
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9019
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9020
    ^ false
6182
2b992cf865bc comment
Claus Gittinger <cg@exept.de>
parents: 6181
diff changeset
  9021
2b992cf865bc comment
Claus Gittinger <cg@exept.de>
parents: 6181
diff changeset
  9022
    "Modified: / 13.11.2001 / 13:28:06 / cg"
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9023
!
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9024
9005
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  9025
isNonByteCollection
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  9026
    "return true, if the receiver is some kind of collection, but not a String, ByteArray etc.;
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  9027
     false is returned here - the method is redefined in Collection and UninterpretedBytes."
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  9028
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  9029
    ^ false
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  9030
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  9031
    "
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9032
        21 isNonByteCollection
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9033
        'abc' isNonByteCollection
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9034
        #'abc' isNonByteCollection
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9035
        #[1 2 3] isNonByteCollection
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9036
        #(1 2 3) isNonByteCollection
9005
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  9037
    "
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  9038
!
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  9039
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9040
isNumber
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9041
    "return true, if the receiver is some kind of number;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9042
     false is returned here - the method is only redefined in Number."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9043
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9044
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9045
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9046
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9047
isOrderedCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9048
    "return true, if the receiver is some kind of ordered collection (or list etc);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9049
     false is returned here - the method is only redefined in OrderedCollection."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9050
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9051
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9052
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9053
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9054
isPoint
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9055
    "return true, if the receiver is some kind of point;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9056
     false is returned here - the method is only redefined in Point."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9057
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9058
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9059
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9060
10532
36237807e16a + #isPrinterContext
fm
parents: 10530
diff changeset
  9061
isPrinterContext
36237807e16a + #isPrinterContext
fm
parents: 10530
diff changeset
  9062
36237807e16a + #isPrinterContext
fm
parents: 10530
diff changeset
  9063
    ^false
36237807e16a + #isPrinterContext
fm
parents: 10530
diff changeset
  9064
!
36237807e16a + #isPrinterContext
fm
parents: 10530
diff changeset
  9065
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  9066
isProgrammingLanguage
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  9067
    "return true, if the receiver is a programming language.
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  9068
     False is returned here - the method is only redefined in
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  9069
     ProgrammingLanguage."
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  9070
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  9071
    ^ false
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  9072
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  9073
    "Created: / 21-07-2010 / 15:13:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  9074
!
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  9075
9515
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  9076
isProjectDefinition
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  9077
    "return true, if the receiver is a projectDefinition.
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  9078
     False is returned here - the method is only redefined in ProjectDefinition."
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  9079
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  9080
    ^ false
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  9081
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  9082
    "Created: / 10-08-2006 / 16:24:53 / cg"
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  9083
!
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  9084
13140
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
  9085
isProxy
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
  9086
    "return true, if the receiver is a proxy for another (lazy loaded) object.
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
  9087
     False is returned here."
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
  9088
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
  9089
    ^ false
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
  9090
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
  9091
    "Created: / 21-11-2010 / 11:15:46 / cg"
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
  9092
!
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
  9093
10171
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
  9094
isRealNameSpace
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
  9095
    "return true, if the receiver is really a nameSpace (i.e. a NameSpace, but not Smalltalk).
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
  9096
     False is returned here - the method is only redefined in Namespace."
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
  9097
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
  9098
    ^ false
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
  9099
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
  9100
    "Created: / 10-11-2006 / 17:05:43 / cg"
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
  9101
!
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
  9102
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9103
isRectangle
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9104
    "return true, if the receiver is some kind of rectangle;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9105
     false is returned here - the method is only redefined in Rectangle."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9106
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9107
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9108
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9109
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9110
isRemoteObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9111
    "return true, if the receiver is some kind of remoteObject,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9112
     false if its local - the method is only redefined in RemoteObject."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9113
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9114
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9115
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9116
    "Created: 28.10.1996 / 15:18:45 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9117
    "Modified: 28.10.1996 / 15:20:57 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9118
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9119
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9120
isSequenceable
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9121
    "return true, if the receiver is some kind of sequenceable collection;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9122
     false is returned here - the method is only redefined in SequenceableCollection."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9123
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9124
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9125
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9126
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9127
isSequenceableCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9128
    "OBSOLETE: use isSequenceable for ST-80 compatibility.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9129
     This method is a historic leftover and will be removed soon ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9130
     (although its name is much better than #isSequenceable - sigh)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9131
5869
362be80efcb9 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5856
diff changeset
  9132
    <resource:#obsolete>
362be80efcb9 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5856
diff changeset
  9133
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9134
    self obsoleteMethodWarning:'use #isSequenceable'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9135
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9136
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9137
10856
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
  9138
isSharedPool
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
  9139
    "return true, if the receiver is a sharedPool.
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
  9140
     False is returned here - the method is only redefined in SharedPool."
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
  9141
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
  9142
    ^ false
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
  9143
!
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
  9144
13565
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9145
isSpecialInstrumentationInfoLiteral
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9146
    "return true, if the receiver is a special instrumentation info
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9147
     object as placed into the literal array of instrumented methods"
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9148
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9149
    ^ false
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9150
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9151
    "Created: / 07-08-2011 / 17:03:41 / cg"
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9152
!
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9153
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9154
isStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9155
    "return true, if the receiver is some kind of stream;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9156
     false is returned here - the method is only redefined in Stream."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9157
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9158
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9159
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9160
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9161
isString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9162
    "return true, if the receiver is some kind of string;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9163
     false is returned here - the method is only redefined in CharacterArray."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9164
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9165
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9166
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9167
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9168
isStringCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9169
    "return true, if the receiver is some kind of stringCollection;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9170
     false is returned here - the method is only redefined in StringCollection."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9171
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9172
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9173
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9174
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9175
isSymbol
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9176
    "return true, if the receiver is some kind of symbol;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9177
     false is returned here - the method is only redefined in Symbol."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9178
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9179
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9180
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9181
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9182
isText
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9183
    "return true, if the receiver is some kind of text object;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9184
     false is returned here - the method is only redefined in Text."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9185
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9186
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9187
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9188
    "Created: 12.5.1996 / 10:56:50 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9189
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9190
13656
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9191
isTextView
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9192
    "return true, if the receiver is some kind of textView;
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9193
     false is returned here - the method is only redefined in TextViews."
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9194
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9195
    ^ false
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9196
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9197
    "Modified (comment): / 08-09-2011 / 05:12:37 / cg"
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9198
!
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9199
13229
187ab17bc43d added: #isTimestamp
Stefan Vogel <sv@exept.de>
parents: 13190
diff changeset
  9200
isTimestamp
187ab17bc43d added: #isTimestamp
Stefan Vogel <sv@exept.de>
parents: 13190
diff changeset
  9201
    ^ false
187ab17bc43d added: #isTimestamp
Stefan Vogel <sv@exept.de>
parents: 13190
diff changeset
  9202
!
187ab17bc43d added: #isTimestamp
Stefan Vogel <sv@exept.de>
parents: 13190
diff changeset
  9203
13626
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9204
isTrait
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9205
    "Return true if the receiver is a trait.
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9206
     Note: Do not override in any class except TraitBehavior."
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9207
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9208
    ^ false
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9209
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9210
    "Created: / 04-09-2011 / 20:04:43 / cg"
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9211
!
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9212
14296
fe82bc5091f9 added: #isUUID
Stefan Vogel <sv@exept.de>
parents: 14292
diff changeset
  9213
isUUID
fe82bc5091f9 added: #isUUID
Stefan Vogel <sv@exept.de>
parents: 14292
diff changeset
  9214
    ^ false
fe82bc5091f9 added: #isUUID
Stefan Vogel <sv@exept.de>
parents: 14292
diff changeset
  9215
!
fe82bc5091f9 added: #isUUID
Stefan Vogel <sv@exept.de>
parents: 14292
diff changeset
  9216
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9217
isValueModel
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9218
    "return true, if the receiver is some kind of valueModel;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9219
     false is returned here - the method is only redefined in ValueModel."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9220
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9221
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9222
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9223
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9224
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9225
isVariable
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9226
    "return true if the receiver has indexed instance variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9227
     false otherwise."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9228
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9229
    ^ self class isVariable
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9230
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9231
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9232
isVariableBinding
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9233
    "return true, if this is a binding for a variable.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9234
     false is returned here - the method is only redefined in Binding."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9235
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9236
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9237
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9238
    "Created: / 19.6.1997 / 17:38:44 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9239
    "Modified: / 8.5.1998 / 21:26:55 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9240
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9241
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9242
isView
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9243
    "return true, if the receiver is some kind of view;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9244
     false is returned here - the method is only redefined in View."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9245
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9246
    ^ false
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9247
!
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9248
6932
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  9249
notEmptyOrNil
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  9250
    "Squeak compatibility:
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  9251
     return true if I am neither nil nor an empty collection.
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  9252
     Return true here."
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  9253
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  9254
    ^ true
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  9255
!
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  9256
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9257
notNil
9221
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  9258
    "Return true, if the receiver is not nil.
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  9259
     Because notNil is redefined in UndefinedObject,
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  9260
     the receiver is definitely not nil here, so unconditionally return true.
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9261
     Notice:
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9262
        This method is open coded (inlined) by the compiler(s)
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9263
        - redefining it may not work as expected."
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9264
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9265
    ^ true
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9266
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9267
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9268
!Object methodsFor:'tracing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9269
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9270
traceInto:aRequestor level:level from:referrer
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9271
    "double dispatch into tracer, passing my type implicitely in the selector"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9272
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9273
    ^ aRequestor traceObject:self level:level from:referrer
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9274
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9275
    "Created: / 2.9.1999 / 09:05:17 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9276
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9277
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9278
!Object methodsFor:'user interaction & notifications'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9279
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9280
activityNotification:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9281
    "this can be sent from deeply nested methods, which are going to perform
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9282
     some long-time activity.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9283
     If there is a handler for the ActivityNotificationSignal signal, that one is raised,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9284
     passing the argument. The handler should show this message whereever it likes,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9285
     and proceed. If there is no handler, this is simply ignored.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9286
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9287
     This is very useful to pass busy messages up to some higher level (typically a view)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9288
     which likes to display that message in its label or a busy-box.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9289
     It could also be put into some logfile or printed on the standard output/error."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9290
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  9291
    ActivityNotification isHandled ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9292
        ^ ActivityNotification raiseRequestWith:self errorString:aString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9293
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9294
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9295
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9296
     nil activityNotification:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9297
     self activityNotification:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9298
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9299
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9300
    "
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  9301
     ActivityNotification handle:[:ex |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9302
        ex errorString printCR.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9303
        ex proceed.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9304
     ] do:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9305
        'hello' printCR.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9306
        self activityNotification:'doing some long time computation'.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9307
        'world' printCR.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9308
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9309
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9310
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9311
    "Modified: 16.12.1995 / 18:23:42 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9312
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9313
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9314
confirm:aString
9694
64f6face84d5 comment
Claus Gittinger <cg@exept.de>
parents: 9657
diff changeset
  9315
    "open a modal yes-no dialog.
64f6face84d5 comment
Claus Gittinger <cg@exept.de>
parents: 9657
diff changeset
  9316
     Return true for yes, false for no.
10527
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
  9317
     If no GUI is present (headless applications), true is returned.
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
  9318
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
  9319
     Someone in the sender chain may redefine the confirmation handler
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
  9320
     by handling the UserConfirmation."
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
  9321
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
  9322
    ^ UserConfirmation raiseRequestErrorString:aString
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9323
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9324
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9325
     nil confirm:'hello'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9326
     self confirm:'hello'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9327
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9328
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9329
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9330
confirm:aString orCancel:cancelBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9331
    "launch a confirmer, which allows user to enter yes, no or cancel.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9332
     return true for yes, false for no, or the value from cancelBlock for cancel.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9333
     If no GUI is present (headless applications), cancelBlock is returned."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9334
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9335
    |answer|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9336
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9337
    answer := self confirmWithCancel:aString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9338
    answer isNil ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9339
        ^ cancelBlock value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9340
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9341
    ^ answer
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9342
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9343
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9344
     self confirm:'hello' orCancel:[self halt]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9345
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9346
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9347
    "Modified: 20.5.1996 / 10:28:40 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9348
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9349
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9350
confirmWithCancel:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9351
    "launch a confirmer, which allows user to enter yes, no or cancel.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9352
     return true for yes, false for no, nil for cancel.
10527
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
  9353
     If no GUI is present (headless applications), nil is returned.
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
  9354
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
  9355
     Someone in the sender chain may redefine the confirmation handler
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
  9356
     by handling the UserConfirmation."
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
  9357
11366
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9358
    ^ self confirmWithCancel:aString defaultAnswer:nil
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9359
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9360
    "
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9361
     nil confirmWithCancel:'hello'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9362
     self confirmWithCancel:'hello'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9363
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9364
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9365
11366
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9366
confirmWithCancel:aString defaultAnswer:defaultAnswerOrNil
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9367
    "launch a confirmer, which allows user to enter yes, no or cancel.
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9368
     return true for yes, false for no, nil for cancel.
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9369
     If no GUI is present (headless applications), nil is returned.
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9370
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9371
     Someone in the sender chain may redefine the confirmation handler
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9372
     by handling the UserConfirmation."
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9373
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9374
    ^ UserConfirmation new
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9375
        defaultAnswer:defaultAnswerOrNil;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9376
        canCancel:true;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9377
        errorString:aString;
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9378
        raiseRequest
11366
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9379
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9380
    "
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9381
     nil confirmWithCancel:'hello' defaultAnswer:true
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9382
     self confirmWithCancel:'hello' defaultAnswer:false
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9383
    "
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9384
!
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9385
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9386
errorNotify:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9387
    "launch a Notifier, showing top stack, telling user something
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9388
     and give user a chance to enter debugger."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9389
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9390
    ^ self
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9391
        errorNotify:aString
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9392
        from:thisContext sender
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9393
        allowDebug:true
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9394
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9395
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9396
     nil errorNotify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9397
     self errorNotify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9398
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9399
6199
5fcf06f17cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6196
diff changeset
  9400
    "Modified: / 16.11.2001 / 15:36:49 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9401
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9402
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9403
errorNotify:aString from:aContext
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9404
    "launch a Notifier, showing top stack (above aContext),
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9405
     telling user something and give user a chance to enter debugger."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9406
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9407
    ^ self errorNotify:aString from:aContext allowDebug:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9408
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9409
    "Modified: / 17.8.1998 / 10:09:27 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9410
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9411
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9412
errorNotify:aString from:aContext allowDebug:allowDebug
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9413
    "launch a Notifier, showing top stack (above aContext),
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9414
     telling user something and optionally give the user a chance to enter debugger."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9415
11314
0b6e06b60ebe changed the error-notifier for standAlone apps.
Claus Gittinger <cg@exept.de>
parents: 11244
diff changeset
  9416
    |currentScreen con sender action boxLabels boxValues default s|
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9417
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9418
    Smalltalk isInitialized ifFalse:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9419
        'errorNotification: ' print. aString printCR.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9420
        aContext sender printAllLevels:10.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9421
        ^ nil
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9422
    ].
11531
30f1ba816a81 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11530
diff changeset
  9423
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9424
    (Dialog isNil
6647
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9425
     or:[Screen isNil
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9426
     or:[(currentScreen := Screen current) isNil
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9427
     or:[currentScreen isOpen not]]]) ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9428
        "
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9429
         on systems without GUI, simply show
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9430
         the message on the Transcript and abort.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9431
        "
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9432
        Transcript showCR:aString.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9433
        AbortOperationRequest raise.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9434
        "not reached"
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9435
        ^ nil
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9436
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9437
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9438
    Processor activeProcessIsSystemProcess ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9439
        action := #debug.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9440
        sender := aContext.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9441
        Debugger isNil ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9442
            '****************** Cought Error while in SystemProcess ****************' errorPrintCR.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9443
            aString errorPrintCR.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9444
            Exception handle:[:ex |
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9445
                'Cought recursive error while printing backtrace:' errorPrintCR.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9446
                ex description errorPrintCR.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9447
            ] do:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9448
                thisContext fullPrintAll.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9449
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9450
            action := #abort.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9451
        ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9452
    ] ifFalse:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9453
        Dialog autoload.        "in case it's autoloaded"
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9454
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9455
        Error handle:[:ex |
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9456
            "/ a recursive error - quickly enter debugger
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9457
            "/ this happened, when I corrupted the Dialog class ...
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9458
            ('Object [error]: ' , ex description , ' caught in errorNotification') errorPrintCR.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9459
            action := #debug.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9460
            ex return.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9461
        ] do:[ |s|
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9462
            sender := aContext.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9463
            sender isNil ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9464
                sender := thisContext sender.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9465
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9466
            con := sender.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9467
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9468
            "/ skip intermediate (signal & exception) contexts
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9469
            DebugView notNil ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9470
                con := DebugView interestingContextFrom:sender
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9471
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9472
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9473
            "/ show the first few contexts
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9474
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9475
            s := WriteStream with:aString.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9476
            s cr; cr.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9477
            s nextPutLine:'Calling Chain:'.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9478
            s nextPutLine:'--------------------------------------------------------------'.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9479
            1 to:25 do:[:n |
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9480
                con notNil ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9481
                    con printOn:s.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9482
                    s cr.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9483
                    con := con sender
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9484
                ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9485
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9486
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9487
            boxLabels := #('Proceed').
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9488
            boxValues := #(#proceed).
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9489
            default := #proceed.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9490
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9491
            AbortOperationRequest isHandled ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9492
                default := #abort.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9493
                boxLabels := boxLabels , #('Abort').
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9494
                boxValues := boxValues , #(#abort).
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9495
                true "allowDebug" ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9496
                    boxLabels := boxLabels , #('Copy Trace and Abort').
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9497
                    boxValues := boxValues , #(#copyAndAbort).
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9498
                ]
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9499
            ] ifFalse:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9500
                true "allowDebug" ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9501
                    boxLabels := boxLabels , #('Copy Trace and Proceed').
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9502
                    boxValues := boxValues , #(#copyAndProceed).
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9503
                ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9504
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9505
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9506
            (allowDebug and:[Debugger notNil]) ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9507
                boxLabels := boxLabels , #('Debug').
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9508
                boxValues := boxValues , #(#debug).
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9509
                default := #debug.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9510
            ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9511
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9512
            action := Dialog
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9513
                    choose:s contents
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9514
                    label:('Exception [' , Processor activeProcess nameOrId , ']')
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9515
                    image:WarningBox errorIconBitmap
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9516
                    labels:boxLabels
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9517
                    values:boxValues
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9518
                    default:default
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9519
                    onCancel:nil.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9520
        ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9521
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9522
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9523
    action == #debug ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9524
        ^ Debugger enter:sender withMessage:aString mayProceed:true
11236
c196f9dedf66 exception description in debugger
Claus Gittinger <cg@exept.de>
parents: 11221
diff changeset
  9525
    ].
c196f9dedf66 exception description in debugger
Claus Gittinger <cg@exept.de>
parents: 11221
diff changeset
  9526
    action == #proceed ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9527
        ^ nil.
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  9528
    ].
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  9529
    (action == #copyAndProceed
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  9530
    or:[action == #copyAndAbort]) ifTrue:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9531
        s := '' writeStream.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9532
        Exception handle:[:ex |
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9533
            'Cought recursive error while printing backtrace' errorPrintCR.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9534
        ] do:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9535
            sender fullPrintAllOn:s.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9536
        ].
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9537
        currentScreen rootView setClipboardText:s contents.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9538
        action == #copyAndProceed ifTrue:[
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9539
            ^ nil
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9540
        ].
11314
0b6e06b60ebe changed the error-notifier for standAlone apps.
Claus Gittinger <cg@exept.de>
parents: 11244
diff changeset
  9541
    ].
0b6e06b60ebe changed the error-notifier for standAlone apps.
Claus Gittinger <cg@exept.de>
parents: 11244
diff changeset
  9542
11236
c196f9dedf66 exception description in debugger
Claus Gittinger <cg@exept.de>
parents: 11221
diff changeset
  9543
    AbortOperationRequest raise.
c196f9dedf66 exception description in debugger
Claus Gittinger <cg@exept.de>
parents: 11221
diff changeset
  9544
    "not reached"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9545
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9546
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9547
     nil errorNotify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9548
     self errorNotify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9549
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9550
13165
66a6b37405d1 changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13162
diff changeset
  9551
    "Created: / 17-08-1998 / 10:09:26 / cg"
13566
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9552
    "Modified: / 08-08-2011 / 11:26:17 / sr"
13844
f03a655457f4 changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13812
diff changeset
  9553
    "Modified: / 05-12-2011 / 03:50:59 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9554
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9555
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9556
information:aString
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9557
    "launch an InfoBox, telling user something.
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9558
     These info-boxes can be suppressed by handling
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9559
     UserNotification or InformationSignal and proceeding in the handler.
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9560
     Use #notify: for more important messages.
8371
4493f5ac7405 *** empty log message ***
ca
parents: 8330
diff changeset
  9561
     If nobody handles the exception, the default action of UserNotification
10527
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
  9562
     pops up an info dialog."
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9563
7035
1d049fb7ae5a Make UserInformation a class based exception
Stefan Vogel <sv@exept.de>
parents: 7033
diff changeset
  9564
    UserInformation raiseRequestWith:self errorString:aString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9565
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9566
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9567
     nil information:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9568
     self information:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9569
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9570
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9571
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9572
     InformationSignal handle:[:ex |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9573
        'no box popped' printCR.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9574
        ex proceed.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9575
     ] do:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9576
        'hello' printCR.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9577
        self information:'some info'.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9578
        'world' printCR.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9579
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9580
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9581
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9582
    "Modified: 24.11.1995 / 22:29:49 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9583
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9584
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9585
notify:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9586
    "launch a Notifier, telling user something.
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9587
     Use #information: for ignorable messages.
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9588
     If nobody handles the exception, the dafault action of UserNotification
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9589
     pops up a warn dialog."
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9590
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9591
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9592
    Smalltalk isInitialized ifFalse:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9593
        "/ thisContext fullPrintAll.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9594
        'information: ' print. aString printCR.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9595
        ^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9596
    ].
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9597
    UserNotification raiseRequestWith:self errorString:aString.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9598
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9599
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9600
     nil notify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9601
     self notify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9602
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9603
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9604
    "Modified: 20.5.1996 / 10:28:48 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9605
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9606
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9607
warn:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9608
    "launch a WarningBox, telling user something.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9609
     These warn-boxes can be suppressed by handling the
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9610
     UserNotification- or WarningSignal and proceeding in the handler.
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9611
     If nobody handles the exception, the dafault action of Warning
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9612
     pops up a warn dialog."
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9613
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9614
    Warning raiseRequestWith:self errorString:aString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9615
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9616
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9617
     nil warn:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9618
     self warn:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9619
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9620
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9621
    "
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9622
     Warning handle:[:ex |
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9623
        Transcript showCR:ex description.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9624
        ex proceed.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9625
     ] do:[
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9626
        'hello' printCR.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9627
        self warn:'some info'.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  9628
        'world' printCR.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9629
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9630
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9631
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9632
    "Modified: 20.5.1996 / 10:28:53 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9633
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9634
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9635
!Object methodsFor:'visiting'!
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9636
8426
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
  9637
acceptVisitor:aVisitor
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
  9638
    "double-dispatch onto a Visitor."
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
  9639
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
  9640
    ^ self acceptVisitor:aVisitor with:nil
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
  9641
!
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
  9642
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9643
acceptVisitor:aVisitor with:aParameter
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9644
    "double-dispatch onto a Visitor.
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9645
     Subclasses redefine this"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9646
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9647
    ^ aVisitor visitObject:self with:aParameter
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9648
! !
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9649
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9650
!Object class methodsFor:'documentation'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9651
14056
24d7f7bf46c7 inspector2TabForBasicInspect
Claus Gittinger <cg@exept.de>
parents: 14055
diff changeset
  9652
version
15193
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
  9653
    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.718 2013-04-27 13:07:08 cg Exp $'
14056
24d7f7bf46c7 inspector2TabForBasicInspect
Claus Gittinger <cg@exept.de>
parents: 14055
diff changeset
  9654
!
24d7f7bf46c7 inspector2TabForBasicInspect
Claus Gittinger <cg@exept.de>
parents: 14055
diff changeset
  9655
12050
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  9656
version_CVS
15193
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
  9657
    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.718 2013-04-27 13:07:08 cg Exp $'
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  9658
!
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  9659
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  9660
version_SVN
13487
bc1f569fcf4f changed: #inspect
Claus Gittinger <cg@exept.de>
parents: 13416
diff changeset
  9661
    ^ '§ Id: Object.st 10643 2011-06-08 21:53:07Z vranyj1  §'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9662
! !
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  9663
14661
2a5c79daa934 class: Object
Stefan Vogel <sv@exept.de>
parents: 14632
diff changeset
  9664
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9665
Object initialize!