ExceptionHandlerSet.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 13 Jun 2018 14:39:23 +0000
branchjv
changeset 23108 77cd6e1625e1
parent 20206 51652e7f46dd
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4466
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4464
diff changeset
     1
"
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4464
diff changeset
     2
 COPYRIGHT (c) 1999 by eXept Software AG
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4464
diff changeset
     3
              All Rights Reserved
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4464
diff changeset
     4
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4464
diff changeset
     5
 This software is furnished under a license and may be used
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4464
diff changeset
     6
 only in accordance with the terms of that license and with the
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4464
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4464
diff changeset
     8
 be provided or otherwise made available to, or used by, any
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4464
diff changeset
     9
 other person.  No title to or ownership of the software is
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4464
diff changeset
    10
 hereby transferred.
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4464
diff changeset
    11
"
6206
59d1ec1e1ed5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4546
diff changeset
    12
"{ Package: 'stx:libbasic' }"
59d1ec1e1ed5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4546
diff changeset
    13
19444
70d035d69cf1 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 15063
diff changeset
    14
"{ NameSpace: Smalltalk }"
70d035d69cf1 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 15063
diff changeset
    15
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    16
IdentityDictionary subclass:#ExceptionHandlerSet
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    17
	instanceVariableNames:''
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    18
	classVariableNames:''
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    19
	poolDictionaries:''
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    20
	category:'Kernel-Exceptions'
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    21
!
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    22
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    23
!ExceptionHandlerSet class methodsFor:'documentation'!
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    24
4466
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4464
diff changeset
    25
copyright
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4464
diff changeset
    26
"
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4464
diff changeset
    27
 COPYRIGHT (c) 1999 by eXept Software AG
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4464
diff changeset
    28
              All Rights Reserved
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4464
diff changeset
    29
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4464
diff changeset
    30
 This software is furnished under a license and may be used
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4464
diff changeset
    31
 only in accordance with the terms of that license and with the
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4464
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4464
diff changeset
    33
 be provided or otherwise made available to, or used by, any
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4464
diff changeset
    34
 other person.  No title to or ownership of the software is
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4464
diff changeset
    35
 hereby transferred.
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4464
diff changeset
    36
"
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4464
diff changeset
    37
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4464
diff changeset
    38
!
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4464
diff changeset
    39
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    40
documentation
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    41
"
20203
21227fea15dc #OTHER by mawalch
mawalch
parents: 19444
diff changeset
    42
    An ExceptionHandlerSet allows a group of unrelated signals to be handled
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    43
    by individual handlers - their evaluation is equivalent to a corresponding
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    44
    number of nested signal handlers, but more efficient and
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    45
    somwehat easier to program.
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    46
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    47
    [author:]
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    48
        Stefan Vogel
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    49
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    50
    [see also:]
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    51
        Exception Signal SignalSet
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    52
"
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    53
!
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    54
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    55
examples
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    56
"
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    57
                                                                [exBegin]
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    58
         |h num|
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    59
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    60
         h := ExceptionHandlerSet new.
8290
520c27f8cae2 examples
Stefan Vogel <sv@exept.de>
parents: 8237
diff changeset
    61
         h on:ZeroDivide
520c27f8cae2 examples
Stefan Vogel <sv@exept.de>
parents: 8237
diff changeset
    62
           do:[:ex | 'division by zero' printCR. ex proceed].
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    63
8290
520c27f8cae2 examples
Stefan Vogel <sv@exept.de>
parents: 8237
diff changeset
    64
         h on:HaltInterrupt
520c27f8cae2 examples
Stefan Vogel <sv@exept.de>
parents: 8237
diff changeset
    65
           do:[:ex | 'halt encountered ' printCR. ex proceed].
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    66
8290
520c27f8cae2 examples
Stefan Vogel <sv@exept.de>
parents: 8237
diff changeset
    67
         h on:DomainError
520c27f8cae2 examples
Stefan Vogel <sv@exept.de>
parents: 8237
diff changeset
    68
           do:[:ex | 'domain error  ' printCR. ex proceed].
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    69
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    70
         h handleDo:[
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    71
            num := 0.
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    72
8290
520c27f8cae2 examples
Stefan Vogel <sv@exept.de>
parents: 8237
diff changeset
    73
            'now dividing' printCR.
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    74
            1 // num.
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    75
8290
520c27f8cae2 examples
Stefan Vogel <sv@exept.de>
parents: 8237
diff changeset
    76
            'now doing bad arcSin' printCR.
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    77
            num := 50.
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    78
            num arcSin.
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    79
8290
520c27f8cae2 examples
Stefan Vogel <sv@exept.de>
parents: 8237
diff changeset
    80
            'now halting' printCR.
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    81
            self halt.
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    82
         ]
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    83
                                                                [exEnd]
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    84
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    85
                                                                [exBegin]
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    86
         |h num|
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    87
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    88
         h := ExceptionHandlerSet new.
8290
520c27f8cae2 examples
Stefan Vogel <sv@exept.de>
parents: 8237
diff changeset
    89
         h on:ZeroDivide
520c27f8cae2 examples
Stefan Vogel <sv@exept.de>
parents: 8237
diff changeset
    90
           do:[:ex | 'division by zero' printCR. ex proceed].
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    91
8290
520c27f8cae2 examples
Stefan Vogel <sv@exept.de>
parents: 8237
diff changeset
    92
         h on:HaltInterrupt
520c27f8cae2 examples
Stefan Vogel <sv@exept.de>
parents: 8237
diff changeset
    93
           do:[:ex | 'halt encountered ' printCR. ex proceed].
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    94
8290
520c27f8cae2 examples
Stefan Vogel <sv@exept.de>
parents: 8237
diff changeset
    95
         h on:DomainError
520c27f8cae2 examples
Stefan Vogel <sv@exept.de>
parents: 8237
diff changeset
    96
           do:[:ex | 'domain error ' printCR. ex proceed].
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    97
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    98
         [
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    99
            num := 0.
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   100
8290
520c27f8cae2 examples
Stefan Vogel <sv@exept.de>
parents: 8237
diff changeset
   101
            'now dividing' printCR.
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   102
            1 // num.
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   103
8290
520c27f8cae2 examples
Stefan Vogel <sv@exept.de>
parents: 8237
diff changeset
   104
            'now doing bad arcSin' printCR.
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   105
            num := 50.
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   106
            num arcSin.
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   107
8290
520c27f8cae2 examples
Stefan Vogel <sv@exept.de>
parents: 8237
diff changeset
   108
            'now halting' printCR.
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   109
            self halt.
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   110
         ] valueWithExceptionHandler:h
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   111
                                                                [exEnd]
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   112
"
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   113
! !
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   114
18045
c0c600e0d3b3 Merged d5a532ec3746 and 40a747a170c5 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17911 15063
diff changeset
   115
8478
100e53cacce4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8290
diff changeset
   116
!ExceptionHandlerSet methodsFor:'Compatibility-VW5.4'!
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   117
8478
100e53cacce4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8290
diff changeset
   118
on:aSignalOrException handle:aHandler
8237
afaad9c5cad2 Add #on:do: as synonym for #on:handle:
Stefan Vogel <sv@exept.de>
parents: 6629
diff changeset
   119
    "add a handler for aSignal to the set"
afaad9c5cad2 Add #on:do: as synonym for #on:handle:
Stefan Vogel <sv@exept.de>
parents: 6629
diff changeset
   120
8478
100e53cacce4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8290
diff changeset
   121
    self on:aSignalOrException do:aHandler
8237
afaad9c5cad2 Add #on:do: as synonym for #on:handle:
Stefan Vogel <sv@exept.de>
parents: 6629
diff changeset
   122
8478
100e53cacce4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8290
diff changeset
   123
    "Created: / 26.7.1999 / 09:51:37 / stefan"
100e53cacce4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8290
diff changeset
   124
! !
100e53cacce4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8290
diff changeset
   125
18045
c0c600e0d3b3 Merged d5a532ec3746 and 40a747a170c5 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17911 15063
diff changeset
   126
8478
100e53cacce4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8290
diff changeset
   127
!ExceptionHandlerSet methodsFor:'adding'!
100e53cacce4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8290
diff changeset
   128
15063
5f491d49189d class: ExceptionHandlerSet
Stefan Vogel <sv@exept.de>
parents: 11636
diff changeset
   129
on:anExceptionHandler do:aHandlerBlock
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   130
    "add a handler for aSignal to the set"
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   131
15063
5f491d49189d class: ExceptionHandlerSet
Stefan Vogel <sv@exept.de>
parents: 11636
diff changeset
   132
    anExceptionHandler isBehavior ifTrue:[
8700
c416a3fb7e2f comments/category
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   133
        "load class, if not yet loaded"
15063
5f491d49189d class: ExceptionHandlerSet
Stefan Vogel <sv@exept.de>
parents: 11636
diff changeset
   134
        anExceptionHandler autoload.
8478
100e53cacce4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8290
diff changeset
   135
    ].
15063
5f491d49189d class: ExceptionHandlerSet
Stefan Vogel <sv@exept.de>
parents: 11636
diff changeset
   136
    anExceptionHandler isExceptionHandler ifFalse:[
5f491d49189d class: ExceptionHandlerSet
Stefan Vogel <sv@exept.de>
parents: 11636
diff changeset
   137
        SignalError raiseWith:anExceptionHandler errorString:' - trying to add a non-exceptionHandler to a SignalSet'.
5f491d49189d class: ExceptionHandlerSet
Stefan Vogel <sv@exept.de>
parents: 11636
diff changeset
   138
    ].
5f491d49189d class: ExceptionHandlerSet
Stefan Vogel <sv@exept.de>
parents: 11636
diff changeset
   139
    self at:anExceptionHandler put:aHandlerBlock
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   140
! !
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   141
18045
c0c600e0d3b3 Merged d5a532ec3746 and 40a747a170c5 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17911 15063
diff changeset
   142
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   143
!ExceptionHandlerSet methodsFor:'queries'!
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   144
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8589
diff changeset
   145
accepts:anExceptionHandler
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   146
    "return true, if the receiver accepts the argument, aSignal.
19444
70d035d69cf1 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 15063
diff changeset
   147
     (i.e. if any of the receiver's elements is aSignal or a parent of it)."
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   148
20203
21227fea15dc #OTHER by mawalch
mawalch
parents: 19444
diff changeset
   149
    self keysDo:[:eachExceptionHandler |
21227fea15dc #OTHER by mawalch
mawalch
parents: 19444
diff changeset
   150
        (eachExceptionHandler==anExceptionHandler
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8589
diff changeset
   151
         or:[eachExceptionHandler accepts:anExceptionHandler]) ifTrue:[^ true].
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8589
diff changeset
   152
    ].
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   153
    ^ false
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   154
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   155
    "Created: / 26.7.1999 / 09:53:09 / stefan"
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   156
!
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   157
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8589
diff changeset
   158
exceptionHandlerFor:anException in:aContext
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8589
diff changeset
   159
    "answer the exceptionHandler for anException from aContext."
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8589
diff changeset
   160
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8589
diff changeset
   161
    ^ self
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8589
diff changeset
   162
!
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8589
diff changeset
   163
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   164
handlerForSignal:signal
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   165
    "answer the handler block for signal"
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   166
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   167
    self keysAndValuesDo:[:sig :handler|
4513
Claus Gittinger <cg@exept.de>
parents: 4491
diff changeset
   168
        (sig == signal or:[sig accepts:signal]) ifTrue:[
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   169
            ^ handler.
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   170
        ].
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   171
    ].
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   172
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   173
    ^ nil
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   174
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   175
    "Modified: / 26.7.1999 / 09:59:43 / stefan"
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   176
    "Created: / 26.7.1999 / 11:29:29 / stefan"
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   177
!
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   178
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   179
handlerForSignal:signal context:theContext originator:originator
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   180
    "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:
diff changeset
   181
     The block is retrieved from aContext.
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   182
     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:
diff changeset
   183
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   184
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   185
    (theContext selector ~~ #'handleDo:from:'
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   186
     or:[(theContext argAt:2) == originator]) ifTrue:[
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   187
        self keysAndValuesDo:[:sig :handler|
4513
Claus Gittinger <cg@exept.de>
parents: 4491
diff changeset
   188
            (sig == signal or:[sig accepts:signal]) ifTrue:[
11636
2a4feb56ca70 changed #handlerForSignal:context:originator:
Stefan Vogel <sv@exept.de>
parents: 8700
diff changeset
   189
                ^ handler ? [nil].
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   190
            ].
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   191
        ].
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   192
    ].
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   193
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   194
    ^ nil
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   195
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   196
    "Created: / 26.7.1999 / 09:53:28 / stefan"
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   197
    "Modified: / 26.7.1999 / 09:59:43 / stefan"
4473
793078981f01 added #handlingSignalInContext:
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
   198
!
793078981f01 added #handlingSignalInContext:
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
   199
4546
ecd03e12cce3 Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   200
handlerProtectedBlock:doBlock inContext:context
ecd03e12cce3 Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   201
    "set the handlerProtectedBlock in context"
ecd03e12cce3 Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   202
ecd03e12cce3 Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   203
    context argAt:1 put:doBlock.
ecd03e12cce3 Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   204
ecd03e12cce3 Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   205
    "
ecd03e12cce3 Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   206
      |s|
ecd03e12cce3 Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   207
ecd03e12cce3 Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   208
      s := ExceptionHandlerSet new.
ecd03e12cce3 Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   209
      s at:Error put:[:ex| ex restartDo:[55]].
ecd03e12cce3 Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   210
ecd03e12cce3 Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   211
      s handleDo:[1 // 0]
ecd03e12cce3 Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   212
    "
ecd03e12cce3 Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   213
ecd03e12cce3 Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   214
!
ecd03e12cce3 Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   215
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8589
diff changeset
   216
handles:anException
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8589
diff changeset
   217
    "return true, if the receiver handles the argument, anException.
19444
70d035d69cf1 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 15063
diff changeset
   218
     (i.e. if any of the receiver's elements handles anException)."
4473
793078981f01 added #handlingSignalInContext:
Claus Gittinger <cg@exept.de>
parents: 4466
diff changeset
   219
20203
21227fea15dc #OTHER by mawalch
mawalch
parents: 19444
diff changeset
   220
    self keysDo:[:eachExceptionHandler|
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8589
diff changeset
   221
        (eachExceptionHandler handles:anException) ifTrue:[^ true]
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8589
diff changeset
   222
    ].
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8589
diff changeset
   223
    ^ false
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   224
! !
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   225
18045
c0c600e0d3b3 Merged d5a532ec3746 and 40a747a170c5 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17911 15063
diff changeset
   226
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   227
!ExceptionHandlerSet methodsFor:'save evaluation'!
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   228
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   229
handleDo:aBlock
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   230
    "evaluate the argument, aBlock.
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   231
     If any of the signals in the receiver is raised during evaluation,
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   232
     evaluate the handleBlock passing it an Exception argument.
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   233
     The handler may decide how to react to the signal by sending
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   234
     a corresponding message to the exception (see there).
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   235
     If the signal is not raised, return the value of evaluating
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   236
     aBlock."
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   237
4546
ecd03e12cce3 Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   238
    <context: #return>
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   239
    <exception: #handle>
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   240
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   241
    "/ thisContext markForHandle. -- same as above pragma
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   242
    ^ aBlock value  "the real logic is in Exception>>doRaise"
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   243
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   244
   "
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   245
    |h num|
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   246
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   247
    h := ExceptionHandlerSet new.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   248
    h on:(Number divisionByZeroSignal)
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   249
      handle:[:ex | 'division by zero' printNL. ex proceed].
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   250
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   251
    h on:(Object haltSignal)
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   252
      handle:[:ex | 'halt encountered ' printNL. ex proceed].
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   253
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   254
    h on:(Float domainErrorSignal)
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   255
      handle:[:ex | 'domain error  ' printNL. ex proceed].
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   256
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   257
    h handleDo:[
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   258
       num := 0.
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   259
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   260
       'now dividing' printNL.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   261
       1 // num.
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   262
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   263
       'now doing bad arcSin' printNL.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   264
       num := 50.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   265
       num arcSin.
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   266
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   267
       'now halting' printNL.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   268
       self halt.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   269
    ]
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   270
    "
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   271
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   272
    "Created: / 26.7.1999 / 09:56:44 / stefan"
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   273
    "Modified: / 26.7.1999 / 11:01:53 / stefan"
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   274
!
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   275
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   276
handleDo:aBlock from:originator
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   277
    "evaluate the argument, aBlock.
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   278
     If any of the signals in the receiver is raised during evaluation,
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   279
     evaluate the handleBlock passing it an Exception argument.
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   280
     The handler may decide how to react to the signal by sending
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   281
     a corresponding message to the exception (see there).
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   282
     If the signal is not raised, return the value of evaluating
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   283
     aBlock."
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   284
4546
ecd03e12cce3 Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   285
    <context: #return>
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   286
    <exception: #handle>
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   287
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   288
    "/ thisContext markForHandle. -- same as above pragma
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   289
    ^ aBlock value  "the real logic is in Exception>>doRaise"
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   290
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   291
   "
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   292
    |h num|
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   293
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   294
    h := ExceptionHandlerSet new.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   295
    h on:(Number divisionByZeroSignal)
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   296
      handle:[:ex | 'division by zero' printNL. ex proceed].
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   297
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   298
    h on:(Object haltSignal)
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   299
      handle:[:ex | 'halt encountered ' printNL. ex proceed].
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   300
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   301
    h on:(Float domainErrorSignal)
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   302
      handle:[:ex | 'domain error  ' printNL. ex proceed].
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   303
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   304
    h handleDo:[
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   305
       'now halting' printNL.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   306
       self halt.
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   307
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   308
       'the following exceptions are not handled.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   309
        A debugger is opened' printNL.
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   310
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   311
       'now dividing' printNL.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   312
       num := 0.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   313
       1 // num.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   314
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   315
       'now doing bad arcSin' printNL.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   316
       num := 50.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   317
       num arcSin.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4476
diff changeset
   318
    ] from:self
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   319
    "
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   320
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   321
    "Created: / 26.7.1999 / 09:56:44 / stefan"
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   322
    "Modified: / 26.7.1999 / 11:36:47 / stefan"
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   323
! !
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   324
18045
c0c600e0d3b3 Merged d5a532ec3746 and 40a747a170c5 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17911 15063
diff changeset
   325
8700
c416a3fb7e2f comments/category
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   326
!ExceptionHandlerSet methodsFor:'testing'!
c416a3fb7e2f comments/category
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   327
c416a3fb7e2f comments/category
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   328
isExceptionHandler
c416a3fb7e2f comments/category
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   329
    "return true, if the receiver responds to the exception handler protocol,
c416a3fb7e2f comments/category
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   330
     especially to the #accepts: and #handles: messages"
c416a3fb7e2f comments/category
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   331
c416a3fb7e2f comments/category
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   332
    ^ true
c416a3fb7e2f comments/category
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   333
! !
c416a3fb7e2f comments/category
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   334
18045
c0c600e0d3b3 Merged d5a532ec3746 and 40a747a170c5 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17911 15063
diff changeset
   335
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   336
!ExceptionHandlerSet class methodsFor:'documentation'!
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   337
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   338
version
19444
70d035d69cf1 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 15063
diff changeset
   339
    ^ '$Header$'
17865
598963c6ff8e Recommited from itself
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17846
diff changeset
   340
!
598963c6ff8e Recommited from itself
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17846
diff changeset
   341
598963c6ff8e Recommited from itself
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17846
diff changeset
   342
version_SVN
17911
a99f15c5efa5 Updated with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17910
diff changeset
   343
    ^ '$Id: ExceptionHandlerSet.st 10761 2012-01-19 11:46:00Z vranyj1 $'
4464
cec93c942c14 Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   344
! !
15063
5f491d49189d class: ExceptionHandlerSet
Stefan Vogel <sv@exept.de>
parents: 11636
diff changeset
   345