Signal.st
author Claus Gittinger <cg@exept.de>
Thu, 07 Jul 2005 19:36:41 +0200
changeset 8903 4e15c297fadc
parent 8732 8807a0254968
child 9079 1d9020d87c86
permissions -rw-r--r--
initial checkin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     1
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1993 by Claus Gittinger
4502
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
     3
              All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     4
a27a279701f8 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    12
5515
4adb4b3a7475 category only
Claus Gittinger <cg@exept.de>
parents: 5300
diff changeset
    13
"{ Package: 'stx:libbasic' }"
4adb4b3a7475 category only
Claus Gittinger <cg@exept.de>
parents: 5300
diff changeset
    14
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    15
Object subclass:#Signal
4564
5401b0d1a6e3 NoHandlerSignal proceedability
Stefan Vogel <sv@exept.de>
parents: 4563
diff changeset
    16
	instanceVariableNames:'mayProceed notifierString nameClass message handlerBlock parent'
5401b0d1a6e3 NoHandlerSignal proceedability
Stefan Vogel <sv@exept.de>
parents: 4563
diff changeset
    17
	classVariableNames:''
5401b0d1a6e3 NoHandlerSignal proceedability
Stefan Vogel <sv@exept.de>
parents: 4563
diff changeset
    18
	poolDictionaries:''
5401b0d1a6e3 NoHandlerSignal proceedability
Stefan Vogel <sv@exept.de>
parents: 4563
diff changeset
    19
	category:'Kernel-Exceptions'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    20
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    21
2207
ee6d4213b9df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
    22
!Signal class methodsFor:'documentation'!
44
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
    23
88
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    24
copyright
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    25
"
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    26
 COPYRIGHT (c) 1993 by Claus Gittinger
4502
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
    27
              All Rights Reserved
88
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    28
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    29
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    30
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    32
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    33
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    34
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    35
"
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    36
!
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    37
44
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
    38
documentation
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
    39
"
6429
d0a5a78e6227 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6396
diff changeset
    40
    Note: 
8384
8b1ae350bcc1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8292
diff changeset
    41
        The instance based Signal framework is being replaced by class based exceptions.
6429
d0a5a78e6227 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6396
diff changeset
    42
        I.e. what used to be instances of Signal/QuerySignal is beeing
d0a5a78e6227 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6396
diff changeset
    43
        rewritten into subclasses of Exception/Error/Query and Warning.
8384
8b1ae350bcc1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8292
diff changeset
    44
6429
d0a5a78e6227 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6396
diff changeset
    45
        Although the functionality is basically unchanged, the new
d0a5a78e6227 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6396
diff changeset
    46
        class based exceptions are easier to instanciate (no need for
d0a5a78e6227 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6396
diff changeset
    47
        creation in a classes initialize method), easier to use (no real
8384
8b1ae350bcc1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8292
diff changeset
    48
        need for Signal-constant accessors) and allow for easier parameter
6429
d0a5a78e6227 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6396
diff changeset
    49
        passing (not only a single parameter, but allows for individual
d0a5a78e6227 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6396
diff changeset
    50
        exception subclasses to add additional state).
d0a5a78e6227 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6396
diff changeset
    51
8384
8b1ae350bcc1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8292
diff changeset
    52
        However, the old Signal hierarchy will remain in existance, since it allows
8b1ae350bcc1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8292
diff changeset
    53
        funny instance-specific and anonymous exception handling schemes to be
8b1ae350bcc1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8292
diff changeset
    54
        implemented, which are hard to built using class-based exceptions.
6429
d0a5a78e6227 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6396
diff changeset
    55
70
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    56
    Signal and Exception provide a framework for exception handling.
44
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
    57
70
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    58
    A Signal object is usually defined somewhere up in the calling chain
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    59
    and associated with some abnormal event. Many signals are also
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    60
    created at startup time and reused.
44
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
    61
70
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    62
    When the event is raised (by Signal>>raise) the control will be either 
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    63
    given to a debugger or - if a handler was defined - to the handler. 
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    64
    The handler will get a description of what (and where) happened in an 
120
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    65
    Exception object and can decide how to react on the situation (i.e. 
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    66
    proceed, return or restart).
70
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    67
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    68
    There is also a companion class called SignalSet, which allows handling
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    69
    multiple signals with one handler (for example all arithmetic signals).
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    70
    And, finally there is a very special SignalSet which allows catching
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    71
    any signal (SignalSet>>anySignal).
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    72
171
129f0e2e23df handling now in Exception
claus
parents: 159
diff changeset
    73
    Since there is no official documentation on signal handling (i.e. none
129f0e2e23df handling now in Exception
claus
parents: 159
diff changeset
    74
    of the books describes it), this Signal implementation has been modeled
129f0e2e23df handling now in Exception
claus
parents: 159
diff changeset
    75
    after what some PD programs seem to expect and what alpha/beta testers told
129f0e2e23df handling now in Exception
claus
parents: 159
diff changeset
    76
    me it should look like.
129f0e2e23df handling now in Exception
claus
parents: 159
diff changeset
    77
    It may not be perfect and undergo minor changes.
44
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
    78
120
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    79
    special:
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    80
70
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    81
    In addition to the nested catch & throw mechanism, signals can also be
120
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    82
    used when no such handler scope exists. To support this, signals can be 
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    83
    assigned a handlerBlock, which gets evaluated with the exception as argument 
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    84
    in case no handler was found (on the stack).
70
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    85
171
129f0e2e23df handling now in Exception
claus
parents: 159
diff changeset
    86
    If no handler was found (i.e. neither a handler context on the stack, nor
129f0e2e23df handling now in Exception
claus
parents: 159
diff changeset
    87
    a static handler block), the NoHandlerSignal will be raised instead,
120
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    88
    passing it the original exception in its exception-parameter.
171
129f0e2e23df handling now in Exception
claus
parents: 159
diff changeset
    89
    This NoHandlerSignal can be handled just like any other signal.
129f0e2e23df handling now in Exception
claus
parents: 159
diff changeset
    90
    (therefore, it is possible to catch any error by catching NoHandlerSignal.
70
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    91
120
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    92
    When the NoHandler signal is raised, and neither a handler-context, nor 
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    93
    a handler block is defined for it, an emergencyHandler(-block) is evaluated.
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    94
    This block is either provided by the current process 
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    95
    (see Process>>emergencySignalHandler) or as a global default by the Exception
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    96
    class (see Exception>>emergencyHandler).
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    97
    The default emergencyHandlerBlock (from Exception) will bring up a debugger.
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    98
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    99
    HandlerBlocks allow a global (if its the EmergencyHandler in Exception)
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
   100
    or per-process signal handling to be added. Even to code which was never
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
   101
    planned to handle signals.
70
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
   102
171
129f0e2e23df handling now in Exception
claus
parents: 159
diff changeset
   103
    See samples in 'doc/coding' and actual raise code in Exception.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   104
1275
2079f4776628 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
   105
    [Instance variables:]
70
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
   106
4502
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   107
        mayProceed      <Boolean>       hint for the debugger - program may 
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   108
                                        proceed (currently not honored by the
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   109
                                        debugger)
1275
2079f4776628 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
   110
4502
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   111
        notifierString  <String>        error message to be output 
70
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
   112
4502
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   113
        nameClass       <Class>         for the printOn-implementation; nameClass
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   114
                                        is the class, to which message (below) 
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   115
                                        should be sent to create the receiver.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   116
4502
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   117
        message         <Symbol>        for the printOn-implementation; message
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   118
                                        is the selector, which should be sent to 
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   119
                                        nameClass (above) to create the receiver.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   120
4502
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   121
        handlerBlock    <Block>         if nonNil, a 1-arg block to be 
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   122
                                        evaluated when no handler context is 
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   123
                                        found. The block gets the exception
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   124
                                        object as argument. This will play the role
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   125
                                        of an on-stack handler.
1275
2079f4776628 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
   126
1292
89497fff7f87 documentation
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   127
    [author:]
4502
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   128
        Claus Gittinger
1292
89497fff7f87 documentation
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   129
1275
2079f4776628 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
   130
    [see also:]
4554
db264efac2c0 Add copyright.
Stefan Vogel <sv@exept.de>
parents: 4553
diff changeset
   131
        GenericException 
4502
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   132
        SignalSet QuerySignal
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   133
        Object
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   134
        (``Exception handling and signals'': programming/exceptions.html)
44
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
   135
"
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
   136
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   137
2207
ee6d4213b9df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
   138
!Signal class methodsFor:'instance creation'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   139
a27a279701f8 Initial revision
claus
parents:
diff changeset
   140
new
a27a279701f8 Initial revision
claus
parents:
diff changeset
   141
    "return a new signal"
a27a279701f8 Initial revision
claus
parents:
diff changeset
   142
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   143
    ^ (self basicNew) notifierString:'signal'; mayProceed:true
3004
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   144
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   145
    "
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   146
     Signal new
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   147
    "
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   148
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   149
    "Modified: 8.10.1997 / 11:51:39 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   150
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   151
2207
ee6d4213b9df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
   152
!Signal class methodsFor:'Signal constants'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   153
3004
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   154
genericSignal
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   155
    "return the generic signal - thats the parent of all signals
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   156
     in the system."
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   157
4518
4716c8d7cb4c Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   158
    ^ GenericException
3004
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   159
4518
4716c8d7cb4c Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   160
    "Created: / 8.10.1997 / 11:46:28 / cg"
4716c8d7cb4c Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   161
    "Modified: / 8.10.1997 / 11:47:08 / cg"
4716c8d7cb4c Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   162
    "Modified: / 4.8.1999 / 08:54:33 / stefan"
3004
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   163
!
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   164
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   165
noHandlerSignal
44
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
   166
    "return the signal used to handle unhandled signals"
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
   167
4527
2ddbe34bab87 Make error classes public.
Stefan Vogel <sv@exept.de>
parents: 4518
diff changeset
   168
    ^ NoHandlerError
4518
4716c8d7cb4c Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   169
4716c8d7cb4c Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   170
    "Modified: / 4.8.1999 / 08:10:09 / stefan"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   171
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   172
7261
f35fc9cee675 method category rename
Claus Gittinger <cg@exept.de>
parents: 7206
diff changeset
   173
!Signal methodsFor:'Compatibility-VW'!
5300
a66fa98a839a compatibility stuff: #new, #messageText: and #raiseSignal
Claus Gittinger <cg@exept.de>
parents: 4759
diff changeset
   174
a66fa98a839a compatibility stuff: #new, #messageText: and #raiseSignal
Claus Gittinger <cg@exept.de>
parents: 4759
diff changeset
   175
messageText:aString
a66fa98a839a compatibility stuff: #new, #messageText: and #raiseSignal
Claus Gittinger <cg@exept.de>
parents: 4759
diff changeset
   176
    ^ self notifierString:aString
a66fa98a839a compatibility stuff: #new, #messageText: and #raiseSignal
Claus Gittinger <cg@exept.de>
parents: 4759
diff changeset
   177
!
a66fa98a839a compatibility stuff: #new, #messageText: and #raiseSignal
Claus Gittinger <cg@exept.de>
parents: 4759
diff changeset
   178
a66fa98a839a compatibility stuff: #new, #messageText: and #raiseSignal
Claus Gittinger <cg@exept.de>
parents: 4759
diff changeset
   179
new
a66fa98a839a compatibility stuff: #new, #messageText: and #raiseSignal
Claus Gittinger <cg@exept.de>
parents: 4759
diff changeset
   180
    "create a new signal, using the receiver as a prototype and
a66fa98a839a compatibility stuff: #new, #messageText: and #raiseSignal
Claus Gittinger <cg@exept.de>
parents: 4759
diff changeset
   181
     setting the parent of the new signal to the receiver."
a66fa98a839a compatibility stuff: #new, #messageText: and #raiseSignal
Claus Gittinger <cg@exept.de>
parents: 4759
diff changeset
   182
a66fa98a839a compatibility stuff: #new, #messageText: and #raiseSignal
Claus Gittinger <cg@exept.de>
parents: 4759
diff changeset
   183
    ^ self newSignal
a66fa98a839a compatibility stuff: #new, #messageText: and #raiseSignal
Claus Gittinger <cg@exept.de>
parents: 4759
diff changeset
   184
! !
a66fa98a839a compatibility stuff: #new, #messageText: and #raiseSignal
Claus Gittinger <cg@exept.de>
parents: 4759
diff changeset
   185
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   186
!Signal methodsFor:'accessing'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   187
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   188
errorString
7206
adcf244acd07 #errorSignal -> #description
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
   189
    "errorString is deprecated, use description instead"
adcf244acd07 #errorSignal -> #description
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
   190
adcf244acd07 #errorSignal -> #description
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
   191
    <resource:#obsolete>
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   192
4563
a436888f8514 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4555
diff changeset
   193
    ^ self description
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   194
!
159
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   195
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   196
handlerBlock
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   197
    "return the handlerblock - if non-nil, this will be evaluated with the exception 
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   198
     object as argument, if no #handle:do: context was found on the stack."
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   199
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   200
    ^ handlerBlock
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   201
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   202
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   203
handlerBlock:aOneArgBlock
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   204
    "set the handlerblock - this will be evaluated with the exception 
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   205
     object as argument, if no #handle:do: context was found on the stack."
159
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   206
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   207
    handlerBlock := aOneArgBlock
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   208
!
159
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   209
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   210
mayProceed
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   211
    "return the signals ability to proceed.
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   212
     This flag is (currently) not checked by the system;
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   213
     be prepared for changes here, to eventually have nonProceedable
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   214
     signals refuse to let you continue execution."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   215
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   216
    ^ mayProceed
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   217
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   218
a27a279701f8 Initial revision
claus
parents:
diff changeset
   219
mayProceed:aBoolean
44
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
   220
    "set/clear the signals ability to proceed.
419
62f39bdfe99d *** empty log message ***
claus
parents: 406
diff changeset
   221
     This flag is (currently) not checked by the system;
62f39bdfe99d *** empty log message ***
claus
parents: 406
diff changeset
   222
     be prepared for changes here, to eventually have nonProceedable
62f39bdfe99d *** empty log message ***
claus
parents: 406
diff changeset
   223
     signals refuse to let you continue execution."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   224
a27a279701f8 Initial revision
claus
parents:
diff changeset
   225
    mayProceed := aBoolean
a27a279701f8 Initial revision
claus
parents:
diff changeset
   226
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   227
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   228
nameClass:aClass message:aSelector
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   229
    "this sets the class & selector of a method which returns
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   230
     that signal - this is simply for documentation purposes -
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   231
     see Signal>>printOn: implementation.
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   232
     (took me a while to find that one out ;-)"
419
62f39bdfe99d *** empty log message ***
claus
parents: 406
diff changeset
   233
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   234
    nameClass := aClass.
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   235
    message := aSelector
419
62f39bdfe99d *** empty log message ***
claus
parents: 406
diff changeset
   236
!
62f39bdfe99d *** empty log message ***
claus
parents: 406
diff changeset
   237
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   238
notifierString
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   239
    "return the notifier string"
159
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   240
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   241
    ^ notifierString
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   242
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   243
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   244
notifierString:aString
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   245
    "set the notifier string"
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   246
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   247
    notifierString := aString
159
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   248
!
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   249
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   250
parent
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   251
    "return the parent-signal of the receiver"
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   252
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   253
    ^ parent
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   254
!
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   255
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   256
parent:aSignal 
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   257
    "set the parent-signal of the receiver."
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   258
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   259
    parent := aSignal
3004
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   260
!
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   261
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   262
parent:aSignal mayProceed:aBoolean
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   263
    "set the parent-signal and the mayProceed flag of the receiver."
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   264
3010
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
   265
    parent := aSignal.
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
   266
    mayProceed := aBoolean.
3004
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   267
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   268
    "Modified: 8.10.1997 / 11:56:11 / cg"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   269
! !
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   270
5835
1db1b70603b6 Create SignalSets with #,
Stefan Vogel <sv@exept.de>
parents: 5697
diff changeset
   271
!Signal methodsFor:'converting'!
1db1b70603b6 Create SignalSets with #,
Stefan Vogel <sv@exept.de>
parents: 5697
diff changeset
   272
8239
23e8064adc69 comment
Stefan Vogel <sv@exept.de>
parents: 7722
diff changeset
   273
, anExceptionHandler
23e8064adc69 comment
Stefan Vogel <sv@exept.de>
parents: 7722
diff changeset
   274
    "return a SignalSet with myself and anExceptionHandler"
5835
1db1b70603b6 Create SignalSets with #,
Stefan Vogel <sv@exept.de>
parents: 5697
diff changeset
   275
8239
23e8064adc69 comment
Stefan Vogel <sv@exept.de>
parents: 7722
diff changeset
   276
    ^ SignalSet with:self with:anExceptionHandler
5835
1db1b70603b6 Create SignalSets with #,
Stefan Vogel <sv@exept.de>
parents: 5697
diff changeset
   277
! !
1db1b70603b6 Create SignalSets with #,
Stefan Vogel <sv@exept.de>
parents: 5697
diff changeset
   278
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   279
!Signal methodsFor:'copying'!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   280
3348
37b0481be091 must catch #deppCopyUsing: instead of #deepCopy.
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
   281
deepCopyUsing:aDictionary
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   282
    "raise an error - deepCopy is not allowed for signals"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   283
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   284
    ^ self deepCopyError
3348
37b0481be091 must catch #deppCopyUsing: instead of #deepCopy.
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
   285
37b0481be091 must catch #deppCopyUsing: instead of #deepCopy.
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
   286
    "Created: / 31.3.1998 / 15:43:01 / cg"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   287
! !
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   288
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   289
!Signal methodsFor:'exception creation'!
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   290
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   291
newException
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   292
    "{ Pragma: +inlineNew }"
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   293
    "answer a new exception object for this signal.
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   294
     Subclasses may redefine this method"
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   295
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   296
    ^ Exception basicNew setSignal:self
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   297
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   298
    "Created: / 26.2.1998 / 19:53:56 / stefan"
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   299
    "Modified: / 23.7.1999 / 13:41:00 / stefan"
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   300
! !
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   301
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   302
!Signal methodsFor:'instance creation'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   303
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   304
newSignal
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   305
    "create a new signal, using the receiver as a prototype and
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   306
     setting the parent of the new signal to the receiver."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   307
3010
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
   308
    ^ (self copy) parent:self
3004
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   309
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   310
    "Modified: 8.10.1997 / 11:53:06 / cg"
70
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
   311
!
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
   312
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   313
newSignalMayProceed:aBoolean
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   314
    "create a new signal, using the receiver as a prototype and
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   315
     setting the parent of the new signal to the receiver."
362
claus
parents: 345
diff changeset
   316
3010
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
   317
    ^ (self copy) parent:self mayProceed:aBoolean
70
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
   318
3004
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   319
    "Modified: 8.10.1997 / 11:57:13 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   320
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   321
5570
e6e14f50d721 category change
Claus Gittinger <cg@exept.de>
parents: 5515
diff changeset
   322
!Signal methodsFor:'printing & storing'!
159
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   323
4563
a436888f8514 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4555
diff changeset
   324
description
a436888f8514 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4555
diff changeset
   325
    "return the notifier string.
a436888f8514 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4555
diff changeset
   326
     If the notifier string starts with space, prepend
a436888f8514 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4555
diff changeset
   327
     the parents notifier string"
a436888f8514 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4555
diff changeset
   328
6116
8c0d1f68d61a care for text-errorstring
Claus Gittinger <cg@exept.de>
parents: 5965
diff changeset
   329
    |s|
8c0d1f68d61a care for text-errorstring
Claus Gittinger <cg@exept.de>
parents: 5965
diff changeset
   330
4563
a436888f8514 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4555
diff changeset
   331
    notifierString isNil ifTrue:[
8292
c61c01e7d6e5 Use #description
Stefan Vogel <sv@exept.de>
parents: 8239
diff changeset
   332
        ^ parent description
5949
f261d27904f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5835
diff changeset
   333
    ].
6116
8c0d1f68d61a care for text-errorstring
Claus Gittinger <cg@exept.de>
parents: 5965
diff changeset
   334
    s := notifierString asString.
8c0d1f68d61a care for text-errorstring
Claus Gittinger <cg@exept.de>
parents: 5965
diff changeset
   335
    (s startsWith:Character space) ifTrue:[
8c0d1f68d61a care for text-errorstring
Claus Gittinger <cg@exept.de>
parents: 5965
diff changeset
   336
        ^ parent description, s
5949
f261d27904f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5835
diff changeset
   337
    ].
6116
8c0d1f68d61a care for text-errorstring
Claus Gittinger <cg@exept.de>
parents: 5965
diff changeset
   338
    ^ s
4563
a436888f8514 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4555
diff changeset
   339
a436888f8514 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4555
diff changeset
   340
    "
8292
c61c01e7d6e5 Use #description
Stefan Vogel <sv@exept.de>
parents: 8239
diff changeset
   341
     Error description
4563
a436888f8514 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4555
diff changeset
   342
    "
a436888f8514 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4555
diff changeset
   343
a436888f8514 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4555
diff changeset
   344
    "Modified: / 12.3.1998 / 15:04:41 / stefan"
a436888f8514 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4555
diff changeset
   345
!
a436888f8514 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4555
diff changeset
   346
159
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   347
printOn:aStream
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   348
    "append a printed representation of the receiver on aStream"
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   349
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   350
    nameClass notNil ifTrue:[
4622
905b21c17057 care for non-class nameClass in printOn:
Claus Gittinger <cg@exept.de>
parents: 4564
diff changeset
   351
        nameClass isBehavior ifTrue:[
905b21c17057 care for non-class nameClass in printOn:
Claus Gittinger <cg@exept.de>
parents: 4564
diff changeset
   352
            aStream nextPutAll:nameClass name.
905b21c17057 care for non-class nameClass in printOn:
Claus Gittinger <cg@exept.de>
parents: 4564
diff changeset
   353
        ] ifFalse:[
905b21c17057 care for non-class nameClass in printOn:
Claus Gittinger <cg@exept.de>
parents: 4564
diff changeset
   354
            nameClass printOn:aStream.
905b21c17057 care for non-class nameClass in printOn:
Claus Gittinger <cg@exept.de>
parents: 4564
diff changeset
   355
        ].
4502
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   356
        aStream space.
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   357
        aStream nextPutAll:message.
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   358
        ^ self
159
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   359
    ].
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   360
    ^ super printOn:aStream
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   361
! !
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   362
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   363
!Signal methodsFor:'queries'!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   364
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   365
accepts:aSignal
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   366
    "return true, if the receiver accepts the argument, aSignal.
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   367
     (i.e. the receiver is aSignal or a parent of it). False otherwise."
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   368
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   369
    |s|
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   370
4527
2ddbe34bab87 Make error classes public.
Stefan Vogel <sv@exept.de>
parents: 4518
diff changeset
   371
    self == aSignal ifTrue:[^ true].
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   372
    aSignal isQuerySignal ifTrue:[^ false].
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   373
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   374
    s := aSignal parent.
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   375
    [s notNil] whileTrue:[
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   376
        self == s ifTrue:[^ true].
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   377
        s := s parent
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   378
    ].
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   379
    ^ false
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   380
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   381
    "Modified: / 22.3.1999 / 12:45:42 / stefan"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   382
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   383
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   384
exceptionHandlerFor:anException in:aContext
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   385
    "answer the exceptionHandler for anException from aContext."
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   386
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   387
    ^ self
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   388
!
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   389
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   390
handlerForSignal:signal context:theContext originator:originator
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   391
    "answer the handler block for the signal from originator.
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   392
     The block is retrieved from aContext.
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   393
     Answer nil if the signal is not handled"
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   394
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   395
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   396
    (theContext selector ~~ #'handle:from:do:'
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   397
     or:[(theContext argAt:2) == originator]) ifTrue:[
4513
Claus Gittinger <cg@exept.de>
parents: 4506
diff changeset
   398
        (self == signal or:[self accepts:signal]) ifTrue:[
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   399
            ^ theContext argAt:1
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   400
        ]
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   401
    ].
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   402
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   403
    ^ nil
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   404
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   405
    "Created: / 25.7.1999 / 19:55:43 / stefan"
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   406
!
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   407
4547
082a2f7d9d8e Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4540
diff changeset
   408
handlerProtectedBlock:doBlock inContext:context
082a2f7d9d8e Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4540
diff changeset
   409
    "set the handlerProtectedBlock in context"
082a2f7d9d8e Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4540
diff changeset
   410
082a2f7d9d8e Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4540
diff changeset
   411
    context selector == #handle:do: ifTrue:[
082a2f7d9d8e Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4540
diff changeset
   412
        context argAt:2 put:doBlock.
082a2f7d9d8e Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4540
diff changeset
   413
    ] ifFalse:[context selector == #handle:from:do: ifTrue:[
082a2f7d9d8e Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4540
diff changeset
   414
        context argAt:3 put:doBlock.
082a2f7d9d8e Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4540
diff changeset
   415
    ]].
082a2f7d9d8e Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4540
diff changeset
   416
082a2f7d9d8e Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4540
diff changeset
   417
082a2f7d9d8e Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4540
diff changeset
   418
082a2f7d9d8e Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4540
diff changeset
   419
!
082a2f7d9d8e Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4540
diff changeset
   420
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   421
handles:anException
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   422
    "return true, if the receiver handles the argument, anException.
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   423
     (i.e. the receiver is anExceptions signal or a parent of it)"
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   424
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   425
    |signal|
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   426
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   427
    signal := anException signal.
4473
793078981f01 added #handlingSignalInContext:
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
   428
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   429
    self == signal ifTrue:[^ true].               "quick check"
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   430
    anException isNotification ifTrue:[^ false].  "speed up queries by not traversing the parent chain"
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   431
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   432
    [(signal := signal parent) notNil] whileTrue:[
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   433
        self == signal ifTrue:[^ true].
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   434
    ].
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8384
diff changeset
   435
    ^ false
4473
793078981f01 added #handlingSignalInContext:
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
   436
!
793078981f01 added #handlingSignalInContext:
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
   437
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   438
inheritsFrom:anotherSignal
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   439
    "return true, if the receiver is a child of anotherSignal
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   440
     (i.e. if handling anotherSignal also handles the receiver)
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   441
     This is almost the same as accepts, but returns false, if
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   442
     the receiver is identical to anotherSignal."
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   443
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   444
    self == anotherSignal ifTrue:[^ false].
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   445
    ^ anotherSignal accepts:self
3521
4d83701cfc28 care for nil receiver in #isHandledIn:
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   446
4d83701cfc28 care for nil receiver in #isHandledIn:
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   447
    "Modified: / 6.6.1998 / 20:37:47 / cg"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   448
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   449
6200
65f0631e5221 added #isControlInterrupt
Claus Gittinger <cg@exept.de>
parents: 6116
diff changeset
   450
isControlInterrupt
65f0631e5221 added #isControlInterrupt
Claus Gittinger <cg@exept.de>
parents: 6116
diff changeset
   451
    ^ false
65f0631e5221 added #isControlInterrupt
Claus Gittinger <cg@exept.de>
parents: 6116
diff changeset
   452
65f0631e5221 added #isControlInterrupt
Claus Gittinger <cg@exept.de>
parents: 6116
diff changeset
   453
    "Created: / 16.11.2001 / 16:12:20 / cg"
65f0631e5221 added #isControlInterrupt
Claus Gittinger <cg@exept.de>
parents: 6116
diff changeset
   454
!
65f0631e5221 added #isControlInterrupt
Claus Gittinger <cg@exept.de>
parents: 6116
diff changeset
   455
6631
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6518
diff changeset
   456
isExceptionCreator
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6518
diff changeset
   457
    "return true, if the receiver can create exceptions,
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6518
diff changeset
   458
     this includes #raise, #raiseRequest as well as the behavior of
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6518
diff changeset
   459
     an exception handler, such as the #accepts: and #handles: messages"
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6518
diff changeset
   460
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6518
diff changeset
   461
    ^ true
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6518
diff changeset
   462
!
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6518
diff changeset
   463
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6518
diff changeset
   464
isExceptionHandler
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6518
diff changeset
   465
    "return true, if the receiver responds to the exception handler protocol,
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6518
diff changeset
   466
     especially to the #accepts: and #handles: messages"
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6518
diff changeset
   467
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6518
diff changeset
   468
    ^ true
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6518
diff changeset
   469
!
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6518
diff changeset
   470
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   471
isHandled
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   472
    "return true, if there is a handler for the receiver signal.
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   473
     Raising an unhandled signal will usually lead into the debugger,
2689
ada9b102abcf typo fix
Claus Gittinger <cg@exept.de>
parents: 2497
diff changeset
   474
     but can be caught globally by setting Exceptions EmergencyHandler."
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   475
4676
5d469e2da40a common code for isHandled
Claus Gittinger <cg@exept.de>
parents: 4622
diff changeset
   476
    ^ GenericException exception:self isHandledIn:(thisContext sender).
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   477
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   478
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   479
isHandledIn:aContext
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   480
    "return true, if there is a handler for the receiver signal in the 
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   481
     contextChain starting with aContext."
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   482
4676
5d469e2da40a common code for isHandled
Claus Gittinger <cg@exept.de>
parents: 4622
diff changeset
   483
    ^ GenericException exception:self isHandledIn:aContext
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   484
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   485
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   486
isQuerySignal
1249
2d5d0edd3359 commentary
Claus Gittinger <cg@exept.de>
parents: 854
diff changeset
   487
    "return true, if this is a querySignal - always return false here"
2d5d0edd3359 commentary
Claus Gittinger <cg@exept.de>
parents: 854
diff changeset
   488
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   489
    ^ false
1249
2d5d0edd3359 commentary
Claus Gittinger <cg@exept.de>
parents: 854
diff changeset
   490
2d5d0edd3359 commentary
Claus Gittinger <cg@exept.de>
parents: 854
diff changeset
   491
    "Modified: 22.4.1996 / 13:45:06 / cg"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   492
! !
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   493
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   494
!Signal methodsFor:'raising'!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   495
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   496
raise
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   497
    "raise a signal nonproceedable.
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   498
     The signals notifierString is used as messageText."
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   499
4555
892c4529acf2 cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   500
    <context: #return>
892c4529acf2 cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   501
8730
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   502
    ^ (self newException
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   503
        suspendedContext:thisContext sender)
4540
4b99a82fe85a suspendedContext setup explicit
Claus Gittinger <cg@exept.de>
parents: 4527
diff changeset
   504
        raise
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   505
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   506
    "Modified: / 2.5.1996 / 16:36:23 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   507
    "Modified: / 5.3.1998 / 16:44:36 / stefan"
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   508
    "Created: / 23.7.1999 / 14:07:17 / stefan"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   509
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   510
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   511
raiseErrorString:aString
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   512
    "raise a signal nonproceedable.
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   513
     The argument is used as messageText."
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   514
4555
892c4529acf2 cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   515
    <context: #return>
892c4529acf2 cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   516
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   517
    ^ (self newException
8730
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   518
        suspendedContext:(thisContext sender) errorString:aString)
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   519
            raise.
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   520
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   521
    "Modified: / 9.5.1996 / 15:17:59 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   522
    "Modified: / 12.3.1998 / 15:15:22 / stefan"
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   523
    "Created: / 23.7.1999 / 14:07:33 / stefan"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   524
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   525
5685
b7fe093174aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   526
raiseErrorString:aString in:aContext
b7fe093174aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   527
    "raise a signal nonproceedable.
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   528
     The argument is used as messageText."
5685
b7fe093174aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   529
b7fe093174aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   530
    <context: #return>
b7fe093174aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   531
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   532
    ^ (self newException
8730
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   533
        suspendedContext:aContext errorString:aString)
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   534
            raise.
5685
b7fe093174aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   535
b7fe093174aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   536
    "Modified: / 9.5.1996 / 15:17:59 / cg"
b7fe093174aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   537
    "Modified: / 12.3.1998 / 15:15:22 / stefan"
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   538
    "Created: / 23.7.1999 / 14:07:33 / stefan"
5685
b7fe093174aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   539
!
b7fe093174aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   540
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   541
raiseFrom:something 
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   542
    "raise a signal nonproceedable.
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   543
     The argument, something is passed both as parameter and originator."
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   544
    
4555
892c4529acf2 cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   545
    <context: #return>
892c4529acf2 cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   546
8730
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   547
    ^ (self newException
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   548
        suspendedContext:(thisContext sender) parameter:something originator:something)
4540
4b99a82fe85a suspendedContext setup explicit
Claus Gittinger <cg@exept.de>
parents: 4527
diff changeset
   549
        raise
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   550
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   551
    "Modified: / 2.5.1996 / 16:36:38 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   552
    "Modified: / 5.3.1998 / 16:49:55 / stefan"
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   553
    "Created: / 23.7.1999 / 14:07:59 / stefan"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   554
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   555
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   556
raiseRequest
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   557
    "raise a signal proceedable.
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   558
     The signals notifierString is used as messageText."
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   559
4555
892c4529acf2 cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   560
    <context: #return>
892c4529acf2 cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   561
8730
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   562
    ^ (self newException
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   563
        suspendedContext:thisContext sender)
4555
892c4529acf2 cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   564
        raiseRequest.
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   565
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   566
    "Modified: / 2.5.1996 / 16:36:52 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   567
    "Modified: / 5.3.1998 / 16:50:46 / stefan"
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   568
    "Created: / 23.7.1999 / 14:08:24 / stefan"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   569
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   570
4759
99d883e67ec9 added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents: 4676
diff changeset
   571
raiseRequestErrorString:aString
99d883e67ec9 added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents: 4676
diff changeset
   572
    "raise a signal proceedable.
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   573
     The argument, aString is used as messageText."
4759
99d883e67ec9 added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents: 4676
diff changeset
   574
99d883e67ec9 added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents: 4676
diff changeset
   575
    <context: #return>
99d883e67ec9 added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents: 4676
diff changeset
   576
8730
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   577
    ^ (self newException
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   578
        suspendedContext:(thisContext sender) errorString:aString)
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   579
        raiseRequest
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   580
!
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   581
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   582
raiseRequestFrom:something 
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   583
    "raise a signal proceedable.
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   584
     The argument, something is passed both as parameter and originator."
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   585
    
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   586
    <context: #return>
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   587
8730
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   588
    ^ (self newException
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   589
        suspendedContext:(thisContext sender) parameter:something originator:something)
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   590
        raiseRequest
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   591
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   592
    "Modified: / 2.5.1996 / 16:36:38 / cg"
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   593
    "Modified: / 5.3.1998 / 16:52:46 / stefan"
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   594
    "Created: / 23.7.1999 / 14:08:36 / stefan"
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   595
!
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   596
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   597
raiseRequestWith:aParameter
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   598
    "raise a signal proceedable.
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   599
     The signals notifierString is used as messageText."
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   600
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   601
    <context: #return>
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   602
8730
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   603
    ^ (self newException
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   604
        suspendedContext:(thisContext sender) parameter:aParameter)
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   605
        raiseRequest.
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   606
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   607
    "Modified: / 9.5.1996 / 15:13:20 / cg"
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   608
    "Modified: / 12.3.1998 / 15:16:57 / stefan"
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   609
    "Created: / 23.7.1999 / 14:08:48 / stefan"
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   610
!
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   611
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   612
raiseRequestWith:aParameter errorString:aString
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   613
    "raise a signal proceedable.
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   614
     The argument, aString is used as messageText."
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   615
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   616
    <context: #return>
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   617
8730
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   618
    ^ (self newException
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   619
        suspendedContext:(thisContext sender) parameter:aParameter errorString:aString)
4759
99d883e67ec9 added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents: 4676
diff changeset
   620
        raiseRequest
99d883e67ec9 added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents: 4676
diff changeset
   621
99d883e67ec9 added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents: 4676
diff changeset
   622
    "Modified: / 9.5.1996 / 15:13:35 / cg"
99d883e67ec9 added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents: 4676
diff changeset
   623
    "Modified: / 12.3.1998 / 15:17:52 / stefan"
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   624
    "Created: / 23.7.1999 / 14:08:57 / stefan"
4759
99d883e67ec9 added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents: 4676
diff changeset
   625
!
99d883e67ec9 added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents: 4676
diff changeset
   626
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   627
raiseRequestWith:aParameter errorString:aString in:aContext
3103
a53892ec3492 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3010
diff changeset
   628
    "raise a signal proceedable.
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   629
     The argument, aString is used as messageText.
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   630
     The additional context is passed as the context responsible for the raise,
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   631
     allowing a raise to mimicri the exception happened somewhere else."
4555
892c4529acf2 cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   632
8732
8807a0254968 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8730
diff changeset
   633
    <context: #return>
8807a0254968 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8730
diff changeset
   634
8730
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   635
    ^ (self newException
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   636
        suspendedContext:aContext parameter:aParameter errorString:aString)
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   637
        raiseRequest
3103
a53892ec3492 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3010
diff changeset
   638
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   639
    "Modified: / 26.7.1996 / 16:29:27 / cg"
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   640
    "Modified: / 12.3.1998 / 15:18:34 / stefan"
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   641
    "Created: / 23.7.1999 / 14:09:07 / stefan"
3103
a53892ec3492 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3010
diff changeset
   642
!
a53892ec3492 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3010
diff changeset
   643
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   644
raiseRequestWith:aParameter in:aContext
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   645
    "raise a signal proceedable.
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   646
     The additional context is passed as the context responsible for the raise,
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   647
     allowing a raise to mimicri the exception happened somewhere else."
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   648
8732
8807a0254968 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8730
diff changeset
   649
    <context: #return>
8807a0254968 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8730
diff changeset
   650
8730
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   651
    ^ (self newException
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   652
        suspendedContext:aContext parameter:aParameter)
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   653
        raiseRequest
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   654
!
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   655
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   656
raiseSignal
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   657
    "raise a signal (proceedable or not, whatever the proceedability is).
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   658
     The signals notifierString is used as messageText."
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   659
4555
892c4529acf2 cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   660
    <context: #return>
892c4529acf2 cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   661
8730
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   662
    ^ (self newException
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   663
        suspendedContext:thisContext sender)
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   664
        raiseSignal
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   665
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   666
    "Modified: / 10.11.2001 / 15:13:34 / cg"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   667
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   668
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   669
raiseSignal:errorMessage
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   670
    "ANSI: raise a signal (proceedable or not, whatever the proceedability is).
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   671
     The argument, errorMessage is used as messageText."
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   672
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   673
    <context: #return>
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   674
8730
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   675
    ^ (self newException
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   676
        suspendedContext:(thisContext sender) errorString:errorMessage)
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   677
        raiseSignal.
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   678
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   679
    "Modified: / 07-08-2004 / 19:24:00 / stefan"
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   680
!
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   681
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   682
raiseSignal:errorMessage with:aParameter
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   683
    "ANSI: raise a signal (proceedable or not, whatever the proceedability is).
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   684
     The argument, errorMessage is used as messageText."
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   685
4555
892c4529acf2 cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   686
    <context: #return>
892c4529acf2 cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   687
8730
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   688
    ^ (self newException
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   689
        suspendedContext:(thisContext sender) parameter:aParameter errorString:errorMessage) 
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   690
        raiseSignal.
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   691
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   692
    "Modified: / 07-08-2004 / 19:10:40 / stefan"
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   693
!
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   694
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   695
raiseSignalErrorString:aString
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   696
    "raise a signal (proceedable or not, whatever the proceedability is).
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   697
     The argument, aString is used as messageText."
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   698
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   699
    <context: #return>
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   700
8730
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   701
    ^ (self newException
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   702
        suspendedContext:(thisContext sender) errorString:aString)
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   703
        raiseSignal.
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   704
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   705
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   706
raiseSignalWith:aParameter
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   707
    "raise a signal (proceedable or not, whatever the proceedability is).
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   708
     The argument, aParameter is passed as parameter."
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   709
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   710
    <context: #return>
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   711
8730
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   712
    ^ (self newException
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   713
        suspendedContext:(thisContext sender) parameter:aParameter)
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   714
        raiseSignal.
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   715
!
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   716
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   717
raiseSignalWith:aParameter errorString:aString
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   718
    "raise a signal (proceedable or not, whatever the proceedability is).
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   719
     The argument, aString is used as messageText,
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   720
     aParameter is passed as exception parameter."
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   721
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   722
    <context: #return>
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   723
8730
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   724
    ^ (self newException
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   725
        suspendedContext:(thisContext sender) parameter:aParameter errorString:aString)
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   726
        raiseSignal.
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   727
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   728
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   729
raiseWith:aParameter
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   730
    "raise a signal nonproceedable.
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   731
     The argument, aParameter is passed as parameter."
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   732
4555
892c4529acf2 cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   733
    <context: #return>
892c4529acf2 cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   734
8730
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   735
    ^ (self newException
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   736
        suspendedContext:(thisContext sender) parameter:aParameter)
4540
4b99a82fe85a suspendedContext setup explicit
Claus Gittinger <cg@exept.de>
parents: 4527
diff changeset
   737
        raise.
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   738
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   739
    "Modified: / 9.5.1996 / 15:14:24 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   740
    "Modified: / 12.3.1998 / 15:19:11 / stefan"
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   741
    "Created: / 23.7.1999 / 14:09:27 / stefan"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   742
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   743
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   744
raiseWith:aParameter errorString:aString
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   745
    "raise a signal nonproceedable.
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   746
     The argument, aString is used as messageText,
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   747
     aParameter is passed as exception parameter."
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   748
4555
892c4529acf2 cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   749
    <context: #return>
892c4529acf2 cleaned up suspendedContext passing.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   750
8730
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   751
    ^ (self newException
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   752
        suspendedContext:(thisContext sender) parameter:aParameter errorString:aString)
4540
4b99a82fe85a suspendedContext setup explicit
Claus Gittinger <cg@exept.de>
parents: 4527
diff changeset
   753
        raise.
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   754
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   755
    "Modified: / 9.5.1996 / 15:14:32 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   756
    "Modified: / 12.3.1998 / 15:19:40 / stefan"
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   757
    "Created: / 23.7.1999 / 14:09:36 / stefan"
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   758
!
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   759
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   760
raiseWith:aParameter errorString:aString in:aContext
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   761
    "raise a signal nonproceedable.
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   762
     The argument, aString is used as messageText, aParameter is passed
1608
440faca45e37 comment
Claus Gittinger <cg@exept.de>
parents: 1362
diff changeset
   763
     as exception parameter.
440faca45e37 comment
Claus Gittinger <cg@exept.de>
parents: 1362
diff changeset
   764
     The additional context is passed as the context responsible for the raise,
440faca45e37 comment
Claus Gittinger <cg@exept.de>
parents: 1362
diff changeset
   765
     allowing a raise to mimicri the exception happened somewhere else."
440faca45e37 comment
Claus Gittinger <cg@exept.de>
parents: 1362
diff changeset
   766
8732
8807a0254968 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8730
diff changeset
   767
    <context: #return>
8807a0254968 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8730
diff changeset
   768
8730
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   769
    ^ (self newException
9d369e8854e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8685
diff changeset
   770
          suspendedContext:aContext parameter:aParameter errorString:aString)
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   771
          raise.
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   772
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   773
    "Modified: / 26.7.1996 / 16:29:42 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   774
    "Modified: / 12.3.1998 / 15:20:12 / stefan"
8685
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   775
    "Created: / 23.7.1999 / 14:09:46 / stefan"
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   776
!
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   777
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   778
signalWith:messageText
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   779
    "ANSI compatibility"
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   780
06c1d82512f5 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   781
    self raiseErrorString:messageText
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   782
! !
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   783
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   784
!Signal methodsFor:'save evaluation'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   785
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   786
catch:aBlock
6396
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   787
    "evaluate the argument, aBlock.
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   788
     If the receiver-signal is raised during evaluation, abort
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   789
     the evaluation and return true; otherwise return false. 
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   790
     This is the catch & throw mechanism found in other languages,
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   791
     where the returned value indicates if an exception occured."
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   792
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   793
     |raiseOccurred|
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   794
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   795
     raiseOccurred := false.
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   796
     self handle:[:ex | raiseOccurred := true. ex return] do:aBlock.
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   797
     ^ raiseOccurred
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   798
6396
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   799
     "
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   800
      Object messageNotUnderstoodSignal catch:[
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   801
         123 size open   
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   802
      ]
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   803
     "
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   804
!
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   805
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   806
deferAfter:aBlock
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   807
    "evaluate the argument, aBlock.
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   808
     Ignore the receiver-signal during evaluation - i.e. simply continue,
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   809
     but remember if the signal was raised.
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   810
     After the block evaluation, finally raise the signal - if it was raised in the block.
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   811
     If the signal is raised multiple times, only the first raises parameter is remembered,
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   812
     and only a single raise is performed after the blocks evaluation.
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   813
6396
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   814
     Deferring makes sense for some signals, such as UserInterrupt or AbortSignal, 
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   815
     which must occasionally be delayed temprarily until a save place is reached 
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   816
     (especially when packages are sent across a communication channel, and you dont want
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   817
      partial packages to be generated by user interruptions)."
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   818
6429
d0a5a78e6227 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6396
diff changeset
   819
    |coughtException result|
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   820
6396
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   821
    self handle:[:ex |
6429
d0a5a78e6227 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6396
diff changeset
   822
        coughtException isNil ifTrue:[
d0a5a78e6227 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6396
diff changeset
   823
            coughtException := ex.
6396
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   824
        ].
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   825
        ex proceedWith:nil
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   826
    ] do:[
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   827
        result := aBlock value.
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   828
    ].
6429
d0a5a78e6227 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6396
diff changeset
   829
    coughtException notNil ifTrue:[
d0a5a78e6227 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6396
diff changeset
   830
        coughtException suspendedContext:thisContext.
d0a5a78e6227 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6396
diff changeset
   831
d0a5a78e6227 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6396
diff changeset
   832
        "/ the signal was raised during the execution of aBlock above. 
d0a5a78e6227 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6396
diff changeset
   833
        "/ Raise it now (delayed).
d0a5a78e6227 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6396
diff changeset
   834
        coughtException raiseSignal
6396
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   835
    ].
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   836
    ^ result
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   837
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   838
     "
6429
d0a5a78e6227 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6396
diff changeset
   839
      |s|
d0a5a78e6227 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6396
diff changeset
   840
d0a5a78e6227 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6396
diff changeset
   841
      s := Signal new mayProceed:true.
d0a5a78e6227 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6396
diff changeset
   842
      s deferAfter:[
d0a5a78e6227 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6396
diff changeset
   843
         s raiseRequestWith:'hello' errorString:'eeee'
6396
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   844
      ]
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   845
     "
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   846
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   847
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   848
handle:handleBlock do:aBlock
a27a279701f8 Initial revision
claus
parents:
diff changeset
   849
    "evaluate the argument, aBlock.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   850
     If the receiver-signal is raised during evaluation,
a27a279701f8 Initial revision
claus
parents:
diff changeset
   851
     evaluate the handleBlock passing it an Exception argument.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   852
     The handler may decide how to react to the signal by sending
a27a279701f8 Initial revision
claus
parents:
diff changeset
   853
     a corresponding message to the exception (see there).
a27a279701f8 Initial revision
claus
parents:
diff changeset
   854
     If the signal is not raised, return the value of evaluating
a27a279701f8 Initial revision
claus
parents:
diff changeset
   855
     aBlock."
a27a279701f8 Initial revision
claus
parents:
diff changeset
   856
4547
082a2f7d9d8e Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4540
diff changeset
   857
    <context: #return>
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   858
    <exception: #handle>
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
   859
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   860
    "/ thisContext markForHandle. -- same as above pragma
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   861
    ^ aBlock value  "the real logic is in Exception>>doRaise"
120
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
   862
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   863
    "
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   864
     Object messageNotUnderstoodSignal handle:[:ex |
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   865
        'oops' printNL.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   866
        ex return
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   867
     ] do:[
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   868
        123 size open   
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   869
     ]
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   870
    "
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
   871
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   872
    "
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   873
     |num|
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   874
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   875
     num := 0.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   876
     Number divisionByZeroSignal handle:[:ex |
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   877
        'oops' printNL.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   878
        ex return
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   879
     ] do:[
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   880
        123 / num   
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   881
     ]
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   882
    "
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   883
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   884
    "Modified: / 25.7.1999 / 19:43:01 / stefan"
44
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
   885
!
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
   886
362
claus
parents: 345
diff changeset
   887
handle:handleBlock from:anObject do:aBlock
claus
parents: 345
diff changeset
   888
    "evaluate the argument, aBlock.
claus
parents: 345
diff changeset
   889
     If the receiver-signal is raised during evaluation,
claus
parents: 345
diff changeset
   890
     and the exception originated from anObject,
claus
parents: 345
diff changeset
   891
     evaluate the handleBlock passing it an Exception argument.
claus
parents: 345
diff changeset
   892
     The handler may decide how to react to the signal by sending
claus
parents: 345
diff changeset
   893
     a corresponding message to the exception (see there).
claus
parents: 345
diff changeset
   894
     If the signal is not raised, return the value of evaluating
claus
parents: 345
diff changeset
   895
     aBlock."
claus
parents: 345
diff changeset
   896
4547
082a2f7d9d8e Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4540
diff changeset
   897
    <context: #return>
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   898
    <exception: #handle>
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   899
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   900
    "/ thisContext markForHandle. -- same as above pragma
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   901
    ^ aBlock value  "the real logic is in Exception>>doRaise"
362
claus
parents: 345
diff changeset
   902
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   903
    "
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   904
     the first open will be caught; the second not:
362
claus
parents: 345
diff changeset
   905
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   906
     |o1 o2|
362
claus
parents: 345
diff changeset
   907
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   908
     o1 := 123.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   909
     o2 := nil.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   910
     Object messageNotUnderstoodSignal 
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   911
         handle:
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   912
              [:ex |
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   913
                  'oops' printNL.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   914
                  ex proceed
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   915
              ] 
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   916
         from:o1
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   917
         do:
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   918
              [
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   919
                  o1 open.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   920
                  o2 open
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   921
              ]
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   922
    "
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   923
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   924
    "Modified: / 25.7.1999 / 19:43:40 / stefan"
362
claus
parents: 345
diff changeset
   925
!
claus
parents: 345
diff changeset
   926
419
62f39bdfe99d *** empty log message ***
claus
parents: 406
diff changeset
   927
ignoreIn:aBlock
6396
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   928
    "evaluate the argument, aBlock.
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   929
     Ignore the receiver-signal during evaluation - i.e. simply continue. 
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   930
     This makes only sense for some signals, such as UserInterrupt
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   931
     or AbortSignal, because continuing after an exception without any cleanup
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   932
     often leads to followup-errors."
159
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   933
6396
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   934
     ^ self handle:[:ex | ex proceedWith:nil] do:aBlock.
159
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   935
6396
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   936
     "
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   937
      Object messageNotUnderstoodSignal ignoreIn:[
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   938
         123 size open   
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   939
      ]
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
   940
     "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   941
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   942
2207
ee6d4213b9df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
   943
!Signal class methodsFor:'documentation'!
1249
2d5d0edd3359 commentary
Claus Gittinger <cg@exept.de>
parents: 854
diff changeset
   944
2d5d0edd3359 commentary
Claus Gittinger <cg@exept.de>
parents: 854
diff changeset
   945
version
8732
8807a0254968 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8730
diff changeset
   946
    ^ '$Header: /cvs/stx/stx/libbasic/Signal.st,v 1.99 2005-02-03 09:01:56 cg Exp $'
1249
2d5d0edd3359 commentary
Claus Gittinger <cg@exept.de>
parents: 854
diff changeset
   947
! !