Signal.st
author Claus Gittinger <cg@exept.de>
Tue, 03 Aug 1999 14:55:02 +0200
changeset 4513 b16770982c62
parent 4506 731d94912596
child 4518 4716c8d7cb4c
permissions -rw-r--r--
tuning
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
a27a279701f8 Initial revision
claus
parents:
diff changeset
    13
Object subclass:#Signal
4506
731d94912596 Fix signal text
Stefan Vogel <sv@exept.de>
parents: 4502
diff changeset
    14
	instanceVariableNames:'mayProceed notifierString nameClass message handlerBlock parent'
731d94912596 Fix signal text
Stefan Vogel <sv@exept.de>
parents: 4502
diff changeset
    15
	classVariableNames:'NoHandlerSignal GenericSignal ProceedErrorSignal
731d94912596 Fix signal text
Stefan Vogel <sv@exept.de>
parents: 4502
diff changeset
    16
		WrongProceedabilitySignal'
731d94912596 Fix signal text
Stefan Vogel <sv@exept.de>
parents: 4502
diff changeset
    17
	poolDictionaries:''
731d94912596 Fix signal text
Stefan Vogel <sv@exept.de>
parents: 4502
diff changeset
    18
	category:'Kernel-Exceptions'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    19
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    20
2207
ee6d4213b9df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
    21
!Signal class methodsFor:'documentation'!
44
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
    22
88
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    23
copyright
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    24
"
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    25
 COPYRIGHT (c) 1993 by Claus Gittinger
4502
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
    26
              All Rights Reserved
88
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    27
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    28
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    29
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    31
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    32
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    33
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    34
"
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    35
!
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    36
44
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
    37
documentation
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
    38
"
70
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    39
    Signal and Exception provide a framework for exception handling.
44
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
    40
70
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    41
    A Signal object is usually defined somewhere up in the calling chain
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    42
    and associated with some abnormal event. Many signals are also
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    43
    created at startup time and reused.
44
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
    44
70
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    45
    When the event is raised (by Signal>>raise) the control will be either 
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    46
    given to a debugger or - if a handler was defined - to the handler. 
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    47
    The handler will get a description of what (and where) happened in an 
120
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    48
    Exception object and can decide how to react on the situation (i.e. 
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    49
    proceed, return or restart).
70
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    50
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    51
    There is also a companion class called SignalSet, which allows handling
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    52
    multiple signals with one handler (for example all arithmetic signals).
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    53
    And, finally there is a very special SignalSet which allows catching
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    54
    any signal (SignalSet>>anySignal).
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    55
171
129f0e2e23df handling now in Exception
claus
parents: 159
diff changeset
    56
    Since there is no official documentation on signal handling (i.e. none
129f0e2e23df handling now in Exception
claus
parents: 159
diff changeset
    57
    of the books describes it), this Signal implementation has been modeled
129f0e2e23df handling now in Exception
claus
parents: 159
diff changeset
    58
    after what some PD programs seem to expect and what alpha/beta testers told
129f0e2e23df handling now in Exception
claus
parents: 159
diff changeset
    59
    me it should look like.
129f0e2e23df handling now in Exception
claus
parents: 159
diff changeset
    60
    It may not be perfect and undergo minor changes.
44
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
    61
120
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    62
    special:
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    63
70
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    64
    In addition to the nested catch & throw mechanism, signals can also be
120
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    65
    used when no such handler scope exists. To support this, signals can be 
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    66
    assigned a handlerBlock, which gets evaluated with the exception as argument 
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    67
    in case no handler was found (on the stack).
70
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    68
171
129f0e2e23df handling now in Exception
claus
parents: 159
diff changeset
    69
    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
    70
    a static handler block), the NoHandlerSignal will be raised instead,
120
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    71
    passing it the original exception in its exception-parameter.
171
129f0e2e23df handling now in Exception
claus
parents: 159
diff changeset
    72
    This NoHandlerSignal can be handled just like any other signal.
129f0e2e23df handling now in Exception
claus
parents: 159
diff changeset
    73
    (therefore, it is possible to catch any error by catching NoHandlerSignal.
70
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    74
120
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    75
    When the NoHandler signal is raised, and neither a handler-context, nor 
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    76
    a handler block is defined for it, an emergencyHandler(-block) is evaluated.
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    77
    This block is either provided by the current process 
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    78
    (see Process>>emergencySignalHandler) or as a global default by the Exception
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    79
    class (see Exception>>emergencyHandler).
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    80
    The default emergencyHandlerBlock (from Exception) will bring up a debugger.
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    81
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    82
    HandlerBlocks allow a global (if its the EmergencyHandler in Exception)
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    83
    or per-process signal handling to be added. Even to code which was never
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
    84
    planned to handle signals.
70
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    85
171
129f0e2e23df handling now in Exception
claus
parents: 159
diff changeset
    86
    See samples in 'doc/coding' and actual raise code in Exception.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    87
1275
2079f4776628 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
    88
    [Instance variables:]
70
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    89
4502
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
    90
        mayProceed      <Boolean>       hint for the debugger - program may 
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
    91
                                        proceed (currently not honored by the
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
    92
                                        debugger)
1275
2079f4776628 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
    93
4502
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
    94
        notifierString  <String>        error message to be output 
70
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
    95
4502
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
    96
        nameClass       <Class>         for the printOn-implementation; nameClass
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
    97
                                        is the class, to which message (below) 
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
    98
                                        should be sent to create the receiver.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    99
4502
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   100
        message         <Symbol>        for the printOn-implementation; message
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   101
                                        is the selector, which should be sent to 
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   102
                                        nameClass (above) to create the receiver.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   103
4502
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   104
        handlerBlock    <Block>         if nonNil, a 1-arg block to be 
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   105
                                        evaluated when no handler context is 
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   106
                                        found. The block gets the exception
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   107
                                        object as argument. This will play the role
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   108
                                        of an on-stack handler.
1275
2079f4776628 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
   109
2079f4776628 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
   110
    [Class variables:]
70
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
   111
4502
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   112
        NoHandlerSignal <Signal>        signal raised when no handler for a signal
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   113
                                        was found in raise.
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   114
                                        If this one is not handled either,
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   115
                                        Exceptions emergencyHandler will be evaluated
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   116
                                        instead (or a per-proces handler, if there
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   117
                                        is one).
1292
89497fff7f87 documentation
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   118
89497fff7f87 documentation
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   119
    [author:]
4502
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   120
        Claus Gittinger
1292
89497fff7f87 documentation
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   121
1275
2079f4776628 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
   122
    [see also:]
4502
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   123
        Exception 
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   124
        SignalSet QuerySignal
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   125
        Object
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   126
        (``Exception handling and signals'': programming/exceptions.html)
44
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
   127
"
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
   128
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   129
2207
ee6d4213b9df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
   130
!Signal class methodsFor:'initialization'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   131
3004
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   132
initGenericSignal 
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   133
    "setup the parent of all signals."
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   134
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   135
    GenericSignal isNil ifTrue:[
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   136
        GenericSignal := self basicNew notifierString: 'unknown Signal with: '.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   137
        GenericSignal nameClass:self message:#genericSignal.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   138
        GenericSignal mayProceed:true.
3004
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   139
    ].
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   140
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   141
    "Modified: / 8.10.1997 / 11:58:01 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   142
    "Modified: / 27.2.1998 / 14:17:20 / stefan"
3004
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   143
!
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   144
159
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   145
initialize 
44
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
   146
    "setup the signal used to handle unhandled signals"
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
   147
3004
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   148
    GenericSignal isNil ifTrue:[
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   149
        self initGenericSignal.
3010
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
   150
    ].
3004
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   151
3010
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
   152
    NoHandlerSignal isNil ifTrue:[
4506
731d94912596 Fix signal text
Stefan Vogel <sv@exept.de>
parents: 4502
diff changeset
   153
        NoHandlerSignal := ErrorSignal newSignal
731d94912596 Fix signal text
Stefan Vogel <sv@exept.de>
parents: 4502
diff changeset
   154
            nameClass:self message:#noHandlerSignal;
731d94912596 Fix signal text
Stefan Vogel <sv@exept.de>
parents: 4502
diff changeset
   155
            notifierString:'unhandled exception'.
731d94912596 Fix signal text
Stefan Vogel <sv@exept.de>
parents: 4502
diff changeset
   156
        ProceedErrorSignal := ErrorSignal newSignal
731d94912596 Fix signal text
Stefan Vogel <sv@exept.de>
parents: 4502
diff changeset
   157
            nameClass:self message:#proceedErrorSignal;
731d94912596 Fix signal text
Stefan Vogel <sv@exept.de>
parents: 4502
diff changeset
   158
            notifierString:'handler tried to proceed from nonproceedable exception'.
731d94912596 Fix signal text
Stefan Vogel <sv@exept.de>
parents: 4502
diff changeset
   159
        WrongProceedabilitySignal := ErrorSignal newSignal
731d94912596 Fix signal text
Stefan Vogel <sv@exept.de>
parents: 4502
diff changeset
   160
            nameClass:self message:#wrongProceedabilitySignal;
731d94912596 Fix signal text
Stefan Vogel <sv@exept.de>
parents: 4502
diff changeset
   161
            notifierString:'attempt to raise a nonproceedable signal proceedable'.
61
claus
parents: 44
diff changeset
   162
    ]
3004
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   163
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   164
    "Modified: / 8.10.1997 / 11:48:40 / cg"
4506
731d94912596 Fix signal text
Stefan Vogel <sv@exept.de>
parents: 4502
diff changeset
   165
    "Modified: / 3.8.1999 / 13:44:42 / stefan"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   166
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   167
2207
ee6d4213b9df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
   168
!Signal class methodsFor:'instance creation'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   169
a27a279701f8 Initial revision
claus
parents:
diff changeset
   170
new
a27a279701f8 Initial revision
claus
parents:
diff changeset
   171
    "return a new signal"
a27a279701f8 Initial revision
claus
parents:
diff changeset
   172
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   173
    ^ (self basicNew) notifierString:'signal'; mayProceed:true
3004
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   174
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   175
    "
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   176
     Signal new
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   177
    "
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   178
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   179
    "Modified: 8.10.1997 / 11:51:39 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   180
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   181
2207
ee6d4213b9df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
   182
!Signal class methodsFor:'Signal constants'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   183
3004
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   184
genericSignal
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   185
    "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
   186
     in the system."
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   187
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   188
    ^ GenericSignal
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   189
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   190
    "Created: 8.10.1997 / 11:46:28 / cg"
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   191
    "Modified: 8.10.1997 / 11:47:08 / cg"
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   192
!
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   193
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   194
noHandlerSignal
44
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
   195
    "return the signal used to handle unhandled signals"
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
   196
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   197
    ^ NoHandlerSignal
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   198
!
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   199
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   200
proceedErrorSignal
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   201
    "return the signal used to indicate that a handler tried to
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   202
     proceed a signal marked as nonproceedable.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   203
     The parameter for the exception raised by this signal is
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   204
     the exception which tried to proceed."
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   205
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   206
    ^ ProceedErrorSignal
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   207
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   208
    "Modified: / 27.2.1998 / 14:22:13 / stefan"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   209
    "Created: / 27.2.1998 / 14:36:15 / stefan"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   210
!
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   211
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   212
wrongProceedabilitySignal
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   213
    "return the signal used to indicate that a signaler wants
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   214
     to raise a nonproceedable signal proceedable.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   215
     The parameter for the exception raised by this signal is
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   216
     the unproceedable signal."
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   217
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   218
    ^ WrongProceedabilitySignal
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   219
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   220
    "Created: / 27.2.1998 / 14:24:19 / stefan"
4502
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   221
    "Modified: / 2.8.1999 / 12:15:21 / stefan"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   222
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   223
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   224
!Signal methodsFor:'accessing'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   225
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   226
errorString
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   227
    "return the notifier string.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   228
     If the notifier string starts with space, prepend
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   229
     the parents notifier string"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   230
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   231
    notifierString isNil ifTrue:[
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   232
        ^ parent errorString
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   233
    ] ifFalse:[
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   234
        (notifierString size > 0 
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   235
         and:[notifierString first == (Character space)]) ifTrue:[
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   236
            ^ parent errorString, notifierString
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   237
        ] ifFalse:[
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   238
            ^ notifierString
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   239
        ].
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   240
    ]
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   241
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   242
    "
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   243
      Object errorSignal errorString
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   244
    "
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   245
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   246
    "Modified: / 12.3.1998 / 15:04:41 / stefan"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   247
!
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   248
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   249
errorStringExtra:extraString with:aParameter
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   250
    "used when raising with a given error string and/or parameter; 
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   251
     if the errorString starts with a space, it is appended to the receivers
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   252
     notifier string; if it ends with a space, it is prepended.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   253
     Otherwise, the extraString is returned.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   254
     If no extraString is given, use the signals default errorString."
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   255
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   256
    |t|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   257
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   258
    (self inheritsFrom:Object userNotificationSignal) ifTrue:[
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   259
        "/ all userNotifications pass the extraString unchanged.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   260
        ^ extraString
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   261
    ].
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   262
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   263
    extraString isNil ifTrue:[
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   264
        t := self errorString
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   265
    ] ifFalse:[
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   266
        t := extraString.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   267
        (extraString endsWith:Character space) ifTrue:[
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   268
            t := extraString, self errorString
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   269
        ] ifFalse:[
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   270
            (extraString startsWith:Character space) ifTrue:[
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   271
                t := self errorString, extraString
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   272
            ]
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   273
        ].
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   274
    ].
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   275
    ^ t.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   276
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   277
"/    aParameter isNil ifTrue:[
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   278
"/        ^ t
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   279
"/    ].
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   280
"/
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   281
"/    (t startsWith:' ') ifTrue:[
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   282
"/        ^ aParameter printString , t
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   283
"/    ].
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   284
"/    (t endsWith:' ') ifTrue:[
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   285
"/        ^ t , aParameter printString
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   286
"/    ].
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   287
"/    ^ t
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   288
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   289
    "Modified: / 25.3.1997 / 12:12:37 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   290
    "Created: / 12.3.1998 / 15:11:31 / stefan"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   291
!
159
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   292
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   293
handlerBlock
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   294
    "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
   295
     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
   296
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   297
    ^ handlerBlock
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   298
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   299
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   300
handlerBlock:aOneArgBlock
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   301
    "set the handlerblock - this will be evaluated with the exception 
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   302
     object as argument, if no #handle:do: context was found on the stack."
159
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   303
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   304
    handlerBlock := aOneArgBlock
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   305
!
159
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   306
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   307
mayProceed
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   308
    "return the signals ability to proceed.
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   309
     This flag is (currently) not checked by the system;
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   310
     be prepared for changes here, to eventually have nonProceedable
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   311
     signals refuse to let you continue execution."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   312
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   313
    ^ mayProceed
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   314
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   315
a27a279701f8 Initial revision
claus
parents:
diff changeset
   316
mayProceed:aBoolean
44
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
   317
    "set/clear the signals ability to proceed.
419
62f39bdfe99d *** empty log message ***
claus
parents: 406
diff changeset
   318
     This flag is (currently) not checked by the system;
62f39bdfe99d *** empty log message ***
claus
parents: 406
diff changeset
   319
     be prepared for changes here, to eventually have nonProceedable
62f39bdfe99d *** empty log message ***
claus
parents: 406
diff changeset
   320
     signals refuse to let you continue execution."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   321
a27a279701f8 Initial revision
claus
parents:
diff changeset
   322
    mayProceed := aBoolean
a27a279701f8 Initial revision
claus
parents:
diff changeset
   323
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   324
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   325
nameClass:aClass message:aSelector
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   326
    "this sets the class & selector of a method which returns
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   327
     that signal - this is simply for documentation purposes -
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   328
     see Signal>>printOn: implementation.
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   329
     (took me a while to find that one out ;-)"
419
62f39bdfe99d *** empty log message ***
claus
parents: 406
diff changeset
   330
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   331
    nameClass := aClass.
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   332
    message := aSelector
419
62f39bdfe99d *** empty log message ***
claus
parents: 406
diff changeset
   333
!
62f39bdfe99d *** empty log message ***
claus
parents: 406
diff changeset
   334
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   335
notifierString
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   336
    "return the notifier string"
159
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   337
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   338
    ^ notifierString
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   339
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   340
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   341
notifierString:aString
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   342
    "set the notifier string"
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   343
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   344
    notifierString := aString
159
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   345
!
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   346
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   347
parent
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   348
    "return the parent-signal of the receiver"
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   349
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   350
    ^ parent
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   351
!
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   352
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   353
parent:aSignal 
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   354
    "set the parent-signal of the receiver."
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   355
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   356
    parent := aSignal
3004
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   357
!
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   358
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   359
parent:aSignal mayProceed:aBoolean
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   360
    "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
   361
3010
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
   362
    parent := aSignal.
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
   363
    mayProceed := aBoolean.
3004
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   364
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   365
    "Modified: 8.10.1997 / 11:56:11 / cg"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   366
! !
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   367
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   368
!Signal methodsFor:'copying'!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   369
3348
37b0481be091 must catch #deppCopyUsing: instead of #deepCopy.
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
   370
deepCopyUsing:aDictionary
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   371
    "raise an error - deepCopy is not allowed for signals"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   372
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   373
    ^ self deepCopyError
3348
37b0481be091 must catch #deppCopyUsing: instead of #deepCopy.
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
   374
37b0481be091 must catch #deppCopyUsing: instead of #deepCopy.
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
   375
    "Created: / 31.3.1998 / 15:43:01 / cg"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   376
! !
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   377
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   378
!Signal methodsFor:'instance creation'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   379
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   380
newSignal
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   381
    "create a new signal, using the receiver as a prototype and
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   382
     setting the parent of the new signal to the receiver."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   383
3010
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
   384
    ^ (self copy) parent:self
3004
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   385
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   386
    "Modified: 8.10.1997 / 11:53:06 / cg"
70
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
   387
!
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
   388
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   389
newSignalMayProceed:aBoolean
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   390
    "create a new signal, using the receiver as a prototype and
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   391
     setting the parent of the new signal to the receiver."
362
claus
parents: 345
diff changeset
   392
3010
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
   393
    ^ (self copy) parent:self mayProceed:aBoolean
70
73055652dd21 *** empty log message ***
claus
parents: 61
diff changeset
   394
3004
220af5090ec2 added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents: 2893
diff changeset
   395
    "Modified: 8.10.1997 / 11:57:13 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   396
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   397
159
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   398
!Signal methodsFor:'printing'!
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   399
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   400
printOn:aStream
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   401
    "append a printed representation of the receiver on aStream"
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   402
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   403
    nameClass notNil ifTrue:[
4502
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   404
        aStream nextPutAll:nameClass name.
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   405
        aStream space.
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   406
        aStream nextPutAll:message.
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   407
        ^ self
159
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   408
    ].
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   409
    ^ super printOn:aStream
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   410
! !
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   411
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   412
!Signal methodsFor:'queries'!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   413
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   414
accepts:aSignal
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   415
    "return true, if the receiver accepts the argument, aSignal.
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   416
     (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
   417
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   418
    |s|
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   419
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   420
    aSignal isQuerySignal ifTrue:[^ false].
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   421
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   422
    s := aSignal.
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   423
    [s notNil] whileTrue:[
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   424
        self == s ifTrue:[^ true].
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   425
        s := s parent
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   426
    ].
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   427
    ^ false
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   428
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   429
    "Modified: / 22.3.1999 / 12:45:42 / stefan"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   430
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   431
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   432
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
   433
    "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
   434
     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
   435
     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
   436
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   437
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   438
    (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
   439
     or:[(theContext argAt:2) == originator]) ifTrue:[
4513
Claus Gittinger <cg@exept.de>
parents: 4506
diff changeset
   440
        (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
   441
            ^ theContext argAt:1
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   442
        ]
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   443
    ].
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   444
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   445
    ^ nil
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   446
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   447
    "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
   448
!
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   449
4476
696ac99f2a52 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4473
diff changeset
   450
handlingExceptionInContext:theContext
4473
793078981f01 added #handlingSignalInContext:
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
   451
    "answer the handling signal from aContext."
793078981f01 added #handlingSignalInContext:
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
   452
793078981f01 added #handlingSignalInContext:
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
   453
    ^ self
793078981f01 added #handlingSignalInContext:
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
   454
!
793078981f01 added #handlingSignalInContext:
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
   455
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   456
inheritsFrom:anotherSignal
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   457
    "return true, if the receiver is a child of anotherSignal
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   458
     (i.e. if handling anotherSignal also handles the receiver)
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   459
     This is almost the same as accepts, but returns false, if
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   460
     the receiver is identical to anotherSignal."
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   461
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   462
    self == anotherSignal ifTrue:[^ false].
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   463
    ^ anotherSignal accepts:self
3521
4d83701cfc28 care for nil receiver in #isHandledIn:
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   464
4d83701cfc28 care for nil receiver in #isHandledIn:
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   465
    "Modified: / 6.6.1998 / 20:37:47 / cg"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   466
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   467
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   468
isHandled
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   469
    "return true, if there is a handler for the receiver signal.
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   470
     Raising an unhandled signal will usually lead into the debugger,
2689
ada9b102abcf typo fix
Claus Gittinger <cg@exept.de>
parents: 2497
diff changeset
   471
     but can be caught globally by setting Exceptions EmergencyHandler."
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   472
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   473
    ^ self isHandledIn:(thisContext sender).
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   474
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   475
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   476
isHandledIn:aContext
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   477
    "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
   478
     contextChain starting with aContext."
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   479
3521
4d83701cfc28 care for nil receiver in #isHandledIn:
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   480
    |con r|
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   481
4493
f5f8400d0219 tined #isHandledIn:
Claus Gittinger <cg@exept.de>
parents: 4491
diff changeset
   482
    con := Context findFirstSpecialHandle:true raise:false.
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   483
    [con notNil] whileTrue:[
4493
f5f8400d0219 tined #isHandledIn:
Claus Gittinger <cg@exept.de>
parents: 4491
diff changeset
   484
        ((r := con receiver) notNil
f5f8400d0219 tined #isHandledIn:
Claus Gittinger <cg@exept.de>
parents: 4491
diff changeset
   485
         and:[(r handlerForSignal:self context:con originator:nil) notNil]
f5f8400d0219 tined #isHandledIn:
Claus Gittinger <cg@exept.de>
parents: 4491
diff changeset
   486
        ) ifTrue:[
f5f8400d0219 tined #isHandledIn:
Claus Gittinger <cg@exept.de>
parents: 4491
diff changeset
   487
            "found a handler context"
f5f8400d0219 tined #isHandledIn:
Claus Gittinger <cg@exept.de>
parents: 4491
diff changeset
   488
            ^ true
f5f8400d0219 tined #isHandledIn:
Claus Gittinger <cg@exept.de>
parents: 4491
diff changeset
   489
        ].
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   490
        con := con findSpecialHandle:true raise:false.
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   491
    ].
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   492
    ^ false
2207
ee6d4213b9df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
   493
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   494
    "Created: / 23.7.1999 / 14:03:34 / stefan"
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   495
    "Modified: / 26.7.1999 / 15:24:34 / stefan"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   496
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   497
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   498
isQuerySignal
1249
2d5d0edd3359 commentary
Claus Gittinger <cg@exept.de>
parents: 854
diff changeset
   499
    "return true, if this is a querySignal - always return false here"
2d5d0edd3359 commentary
Claus Gittinger <cg@exept.de>
parents: 854
diff changeset
   500
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   501
    ^ false
1249
2d5d0edd3359 commentary
Claus Gittinger <cg@exept.de>
parents: 854
diff changeset
   502
2d5d0edd3359 commentary
Claus Gittinger <cg@exept.de>
parents: 854
diff changeset
   503
    "Modified: 22.4.1996 / 13:45:06 / cg"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   504
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   505
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   506
isSignal
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   507
    "return true, if the receiver is some kind of signal;
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   508
     true returned here - the method is redefined from Object."
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
    ^ true
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   511
! !
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   512
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   513
!Signal methodsFor:'raising'!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   514
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   515
newException
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   516
    "answer a new exception object for this signal.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   517
     Subclasses may redefine this method"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   518
4440
88843a1c2700 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 4438
diff changeset
   519
    ^ Exception signal:self originator:nil
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   520
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   521
    "Created: / 26.2.1998 / 19:53:56 / stefan"
4440
88843a1c2700 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 4438
diff changeset
   522
    "Modified: / 23.7.1999 / 13:41:00 / stefan"
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   523
!
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   524
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   525
newExceptionFrom:originator
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   526
    "answer a new exception object for this signal.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   527
     Set the originator.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   528
     Subclasses may redefine this method"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   529
4440
88843a1c2700 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 4438
diff changeset
   530
    ^ Exception signal:self originator:originator
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   531
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   532
    "Created: / 27.2.1998 / 09:17:00 / stefan"
4440
88843a1c2700 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 4438
diff changeset
   533
    "Modified: / 23.7.1999 / 13:41:15 / stefan"
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   534
!
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   535
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   536
raise
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   537
    "raise a signal nonproceedable.
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   538
     The signals notifierString is used as errorString."
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   539
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   540
    ^ self newException raise
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   541
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   542
    "Modified: / 2.5.1996 / 16:36:23 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   543
    "Modified: / 5.3.1998 / 16:44:36 / stefan"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   544
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   545
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   546
raiseErrorString:aString
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   547
    "raise a signal nonproceedable.
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   548
     The argument is used as errorString."
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   549
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   550
    ^ (self newException errorString:aString) raise.
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   551
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   552
    "Modified: / 9.5.1996 / 15:17:59 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   553
    "Modified: / 12.3.1998 / 15:15:22 / 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
1610
2c076ee64e11 added #raiseErrorString:in:
Claus Gittinger <cg@exept.de>
parents: 1608
diff changeset
   556
raiseErrorString:aString in:aContext
2c076ee64e11 added #raiseErrorString:in:
Claus Gittinger <cg@exept.de>
parents: 1608
diff changeset
   557
    "raise a signal nonproceedable.
2c076ee64e11 added #raiseErrorString:in:
Claus Gittinger <cg@exept.de>
parents: 1608
diff changeset
   558
     The argument is used as errorString.
2c076ee64e11 added #raiseErrorString:in:
Claus Gittinger <cg@exept.de>
parents: 1608
diff changeset
   559
     The additional context is passed as the context responsible for the raise,
2c076ee64e11 added #raiseErrorString:in:
Claus Gittinger <cg@exept.de>
parents: 1608
diff changeset
   560
     allowing a raise to mimicri the exception happened somewhere else."
2c076ee64e11 added #raiseErrorString:in:
Claus Gittinger <cg@exept.de>
parents: 1608
diff changeset
   561
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   562
    ^ (self newException   
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   563
              signal:self
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   564
              parameter:nil 
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   565
              errorString:aString
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   566
              suspendedContext:aContext
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   567
              originator:nil) raise.
1610
2c076ee64e11 added #raiseErrorString:in:
Claus Gittinger <cg@exept.de>
parents: 1608
diff changeset
   568
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   569
    "Created: / 26.7.1996 / 16:42:32 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   570
    "Modified: / 26.7.1996 / 16:42:47 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   571
    "Modified: / 12.3.1998 / 15:43:43 / stefan"
1610
2c076ee64e11 added #raiseErrorString:in:
Claus Gittinger <cg@exept.de>
parents: 1608
diff changeset
   572
!
2c076ee64e11 added #raiseErrorString:in:
Claus Gittinger <cg@exept.de>
parents: 1608
diff changeset
   573
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   574
raiseFrom:something
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   575
    "raise a signal nonproceedable.
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   576
     The argument, something is passed both as parameter and originator."
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   577
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   578
    ^ ((self newExceptionFrom:something) parameter:something) raise
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   579
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   580
    "Modified: / 2.5.1996 / 16:36:38 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   581
    "Modified: / 5.3.1998 / 16:49:55 / stefan"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   582
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   583
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   584
raiseIn:aContext
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   585
    "raise a signal nonproceedable.
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   586
     The signals notifierString is used as errorString.
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   587
     The additional context is passed as the context responsible for the raise,
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   588
     allowing a raise to mimicri the exception happened somewhere else."
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   589
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   590
    ^ (self newException suspendedContext:aContext) raise.
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   591
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   592
    "Modified: / 2.5.1996 / 16:36:44 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   593
    "Modified: / 5.3.1998 / 16:50:21 / stefan"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   594
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   595
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   596
raiseRequest
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   597
    "raise a signal proceedable.
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   598
     The signals notifierString is used as errorString."
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   599
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   600
    ^ self newException raiseRequest.
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   601
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   602
    "Modified: / 2.5.1996 / 16:36:52 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   603
    "Modified: / 5.3.1998 / 16:50:46 / stefan"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   604
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   605
3103
a53892ec3492 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3010
diff changeset
   606
raiseRequestFrom:something
a53892ec3492 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3010
diff changeset
   607
    "raise a signal proceedable.
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   608
     The argument, something is passed both as parameter and originator."
3103
a53892ec3492 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3010
diff changeset
   609
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   610
    ^ ((self newExceptionFrom:something) parameter:something) raiseRequest.
3103
a53892ec3492 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3010
diff changeset
   611
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   612
    "Modified: / 2.5.1996 / 16:36:38 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   613
    "Modified: / 5.3.1998 / 16:52:46 / stefan"
3103
a53892ec3492 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3010
diff changeset
   614
!
a53892ec3492 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3010
diff changeset
   615
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   616
raiseRequestWith:aParameter
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   617
    "raise a signal proceedable.
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   618
     The signals notifierString is used as errorString."
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   619
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   620
    ^ (self newException parameter:aParameter) raiseRequest.
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   621
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   622
    "Modified: / 9.5.1996 / 15:13:20 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   623
    "Modified: / 12.3.1998 / 15:16:57 / stefan"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   624
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   625
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   626
raiseRequestWith:aParameter errorString:aString
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   627
    "raise a signal proceedable.
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   628
     The argument, aString is used as errorString."
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   629
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   630
    ^ (self newException 
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   631
              parameter:aParameter; 
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   632
              errorString:aString
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   633
      ) raiseRequest
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   634
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   635
    "Modified: / 9.5.1996 / 15:13:35 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   636
    "Modified: / 12.3.1998 / 15:17:52 / stefan"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   637
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   638
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   639
raiseRequestWith:aParameter errorString:aString in:aContext
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   640
    "raise a signal proceedable.
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   641
     The argument, aString is used as errorString.
1608
440faca45e37 comment
Claus Gittinger <cg@exept.de>
parents: 1362
diff changeset
   642
     The additional context is passed as the context responsible for the raise,
440faca45e37 comment
Claus Gittinger <cg@exept.de>
parents: 1362
diff changeset
   643
     allowing a raise to mimicri the exception happened somewhere else."
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   644
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   645
    ^ (self newException 
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   646
              parameter:aParameter; 
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   647
              errorString:aString;
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   648
              suspendedContext:aContext) raiseRequest
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   649
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   650
    "Modified: / 26.7.1996 / 16:29:27 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   651
    "Modified: / 12.3.1998 / 15:18:34 / stefan"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   652
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   653
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   654
raiseRequestWith:aParameter in:aContext
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   655
    "raise a signal proceedable.
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   656
     The signals notifierString is used as errorString.
1608
440faca45e37 comment
Claus Gittinger <cg@exept.de>
parents: 1362
diff changeset
   657
     The additional context is passed as the context responsible for the raise,
440faca45e37 comment
Claus Gittinger <cg@exept.de>
parents: 1362
diff changeset
   658
     allowing a raise to mimicri the exception happened somewhere else."
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   659
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   660
    ^ (self newException 
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   661
              parameter:aParameter; 
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   662
              suspendedContext:aContext) raiseRequest.
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   663
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   664
    "Modified: / 26.7.1996 / 16:29:33 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   665
    "Modified: / 12.3.1998 / 15:18:55 / stefan"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   666
!
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
raiseWith:aParameter
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   669
    "raise a signal nonproceedable.
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   670
     The argument, aParameter is passed as parameter."
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   671
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   672
    ^ (self newException parameter:aParameter) raise.
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   673
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   674
    "Modified: / 9.5.1996 / 15:14:24 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   675
    "Modified: / 12.3.1998 / 15:19:11 / stefan"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   676
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   677
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   678
raiseWith:aParameter errorString:aString
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   679
    "raise a signal nonproceedable.
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   680
     The argument, aString is used as errorString, aParameter is passed
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   681
     as exception parameter."
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   682
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   683
    ^ (self newException 
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   684
              parameter:aParameter;
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   685
              errorString:aString) raise.
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   686
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   687
    "Modified: / 9.5.1996 / 15:14:32 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   688
    "Modified: / 12.3.1998 / 15:19:40 / stefan"
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   689
!
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   690
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   691
raiseWith:aParameter errorString:aString in:aContext
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   692
    "raise a signal nonproceedable.
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   693
     The argument, aString is used as errorString, aParameter is passed
1608
440faca45e37 comment
Claus Gittinger <cg@exept.de>
parents: 1362
diff changeset
   694
     as exception parameter.
440faca45e37 comment
Claus Gittinger <cg@exept.de>
parents: 1362
diff changeset
   695
     The additional context is passed as the context responsible for the raise,
440faca45e37 comment
Claus Gittinger <cg@exept.de>
parents: 1362
diff changeset
   696
     allowing a raise to mimicri the exception happened somewhere else."
440faca45e37 comment
Claus Gittinger <cg@exept.de>
parents: 1362
diff changeset
   697
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   698
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   699
    ^ (self newException 
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   700
              parameter:aParameter; 
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   701
              errorString:aString;
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   702
              suspendedContext:aContext) raise.
1326
60ea3687ee49 commentary
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   703
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   704
    "Created: / 2.5.1996 / 16:37:25 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   705
    "Modified: / 26.7.1996 / 16:29:42 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   706
    "Modified: / 12.3.1998 / 15:20:12 / stefan"
3157
b8dd7d5fedd2 added #raiseWith:in:
Claus Gittinger <cg@exept.de>
parents: 3103
diff changeset
   707
!
b8dd7d5fedd2 added #raiseWith:in:
Claus Gittinger <cg@exept.de>
parents: 3103
diff changeset
   708
b8dd7d5fedd2 added #raiseWith:in:
Claus Gittinger <cg@exept.de>
parents: 3103
diff changeset
   709
raiseWith:aParameter in:aContext
b8dd7d5fedd2 added #raiseWith:in:
Claus Gittinger <cg@exept.de>
parents: 3103
diff changeset
   710
    "raise a signal nonproceedable.
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   711
     The argument, aParameter is passed as parameter."
3157
b8dd7d5fedd2 added #raiseWith:in:
Claus Gittinger <cg@exept.de>
parents: 3103
diff changeset
   712
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   713
    ^ (self newException parameter:aParameter;
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   714
                         suspendedContext:aContext) raise.
3157
b8dd7d5fedd2 added #raiseWith:in:
Claus Gittinger <cg@exept.de>
parents: 3103
diff changeset
   715
b8dd7d5fedd2 added #raiseWith:in:
Claus Gittinger <cg@exept.de>
parents: 3103
diff changeset
   716
    "Modified: / 9.5.1996 / 15:14:24 / cg"
b8dd7d5fedd2 added #raiseWith:in:
Claus Gittinger <cg@exept.de>
parents: 3103
diff changeset
   717
    "Created: / 4.1.1998 / 14:38:15 / cg"
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   718
    "Modified: / 12.3.1998 / 15:34:51 / stefan"
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   719
! !
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   720
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   721
!Signal methodsFor:'save evaluation'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   722
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   723
catch:aBlock
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   724
     "evaluate the argument, aBlock.
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   725
      If the receiver-signal is raised during evaluation, abort
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   726
      the evaluation and return true; otherwise return false. 
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   727
      This is the catch & throw mechanism found in other languages,
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   728
      where the returned value indicates if an exception occured."
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   729
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   730
      |raiseOccurred|
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   731
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   732
      raiseOccurred := false.
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   733
      self handle:[:ex | raiseOccurred := true. ex return] do:aBlock.
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   734
      ^ raiseOccurred
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   735
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   736
      "
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   737
       Object messageNotUnderstoodSignal catch:[
4502
097d717941d3 Fix typo
Stefan Vogel <sv@exept.de>
parents: 4493
diff changeset
   738
          123 size open   
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   739
       ]
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   740
      "
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   741
!
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   742
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   743
handle:handleBlock do:aBlock
a27a279701f8 Initial revision
claus
parents:
diff changeset
   744
    "evaluate the argument, aBlock.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   745
     If the receiver-signal is raised during evaluation,
a27a279701f8 Initial revision
claus
parents:
diff changeset
   746
     evaluate the handleBlock passing it an Exception argument.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   747
     The handler may decide how to react to the signal by sending
a27a279701f8 Initial revision
claus
parents:
diff changeset
   748
     a corresponding message to the exception (see there).
a27a279701f8 Initial revision
claus
parents:
diff changeset
   749
     If the signal is not raised, return the value of evaluating
a27a279701f8 Initial revision
claus
parents:
diff changeset
   750
     aBlock."
a27a279701f8 Initial revision
claus
parents:
diff changeset
   751
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   752
    <exception: #handle>
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
   753
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   754
    "/ thisContext markForHandle. -- same as above pragma
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   755
    ^ aBlock value  "the real logic is in Exception>>doRaise"
120
9a2e74ed2f81 added per-process handler
claus
parents: 95
diff changeset
   756
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   757
    "
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   758
     Object messageNotUnderstoodSignal handle:[:ex |
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   759
        'oops' printNL.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   760
        ex return
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   761
     ] do:[
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   762
        123 size open   
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   763
     ]
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   764
    "
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
   765
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   766
    "
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   767
     |num|
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   768
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   769
     num := 0.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   770
     Number divisionByZeroSignal handle:[:ex |
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   771
        'oops' printNL.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   772
        ex return
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   773
     ] do:[
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   774
        123 / num   
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   775
     ]
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   776
    "
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   777
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   778
    "Modified: / 25.7.1999 / 19:43:01 / stefan"
44
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
   779
!
b262907c93ea *** empty log message ***
claus
parents: 27
diff changeset
   780
362
claus
parents: 345
diff changeset
   781
handle:handleBlock from:anObject do:aBlock
claus
parents: 345
diff changeset
   782
    "evaluate the argument, aBlock.
claus
parents: 345
diff changeset
   783
     If the receiver-signal is raised during evaluation,
claus
parents: 345
diff changeset
   784
     and the exception originated from anObject,
claus
parents: 345
diff changeset
   785
     evaluate the handleBlock passing it an Exception argument.
claus
parents: 345
diff changeset
   786
     The handler may decide how to react to the signal by sending
claus
parents: 345
diff changeset
   787
     a corresponding message to the exception (see there).
claus
parents: 345
diff changeset
   788
     If the signal is not raised, return the value of evaluating
claus
parents: 345
diff changeset
   789
     aBlock."
claus
parents: 345
diff changeset
   790
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   791
    <exception: #handle>
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   792
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   793
    "/ thisContext markForHandle. -- same as above pragma
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   794
    ^ aBlock value  "the real logic is in Exception>>doRaise"
362
claus
parents: 345
diff changeset
   795
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   796
    "
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   797
     the first open will be caught; the second not:
362
claus
parents: 345
diff changeset
   798
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   799
     |o1 o2|
362
claus
parents: 345
diff changeset
   800
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   801
     o1 := 123.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   802
     o2 := nil.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   803
     Object messageNotUnderstoodSignal 
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   804
         handle:
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   805
              [:ex |
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   806
                  'oops' printNL.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   807
                  ex proceed
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   808
              ] 
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   809
         from:o1
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   810
         do:
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   811
              [
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   812
                  o1 open.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   813
                  o2 open
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   814
              ]
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4486
diff changeset
   815
    "
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3521
diff changeset
   816
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents: 4440
diff changeset
   817
    "Modified: / 25.7.1999 / 19:43:40 / stefan"
362
claus
parents: 345
diff changeset
   818
!
claus
parents: 345
diff changeset
   819
419
62f39bdfe99d *** empty log message ***
claus
parents: 406
diff changeset
   820
ignoreIn:aBlock
159
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   821
     "evaluate the argument, aBlock.
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   822
      Ignore the receiver-signal during evaluation - i.e. simply
419
62f39bdfe99d *** empty log message ***
claus
parents: 406
diff changeset
   823
      continue. 
62f39bdfe99d *** empty log message ***
claus
parents: 406
diff changeset
   824
      This makes only sense for some signals, such as UserInterrupt
62f39bdfe99d *** empty log message ***
claus
parents: 406
diff changeset
   825
      or AbortSignal, because continuing after an exception without any cleanup
62f39bdfe99d *** empty log message ***
claus
parents: 406
diff changeset
   826
      often leads to followup-errors."
159
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   827
4486
f84def7aaf3f replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   828
      ^ self handle:[:ex | ex proceedWith:nil] do:aBlock.
159
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   829
514c749165c3 *** empty log message ***
claus
parents: 145
diff changeset
   830
      "
419
62f39bdfe99d *** empty log message ***
claus
parents: 406
diff changeset
   831
       Object messageNotUnderstoodSignal ignoreIn:[
4486
f84def7aaf3f replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   832
          123 size open   
61
claus
parents: 44
diff changeset
   833
       ]
claus
parents: 44
diff changeset
   834
      "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   835
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   836
2207
ee6d4213b9df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
   837
!Signal class methodsFor:'documentation'!
1249
2d5d0edd3359 commentary
Claus Gittinger <cg@exept.de>
parents: 854
diff changeset
   838
2d5d0edd3359 commentary
Claus Gittinger <cg@exept.de>
parents: 854
diff changeset
   839
version
4513
Claus Gittinger <cg@exept.de>
parents: 4506
diff changeset
   840
    ^ '$Header: /cvs/stx/stx/libbasic/Signal.st,v 1.63 1999-08-03 12:52:45 cg Exp $'
1249
2d5d0edd3359 commentary
Claus Gittinger <cg@exept.de>
parents: 854
diff changeset
   841
! !
622
a17084b7ac06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   842
Signal initialize!