author | Merge Script |
Mon, 08 Jun 2015 06:58:54 +0200 | |
branch | jv |
changeset 18461 | bc3d3101c493 |
parent 18017 | 7fef9e17913f |
child 20578 | 39641ba8d6e0 |
permissions | -rw-r--r-- |
7585 | 1 |
" |
2 |
COPYRIGHT (c) 2001 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
5947 | 12 |
"{ Package: 'stx:libbasic' }" |
13 |
||
14 |
DomainError subclass:#ZeroDivide |
|
15 |
instanceVariableNames:'' |
|
16 |
classVariableNames:'' |
|
17 |
poolDictionaries:'' |
|
6218 | 18 |
category:'Kernel-Exceptions-Errors' |
5947 | 19 |
! |
20 |
||
6218 | 21 |
!ZeroDivide class methodsFor:'documentation'! |
22 |
||
7585 | 23 |
copyright |
24 |
" |
|
25 |
COPYRIGHT (c) 2001 by eXept Software AG |
|
26 |
All Rights Reserved |
|
27 |
||
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
! |
|
36 |
||
6218 | 37 |
documentation |
38 |
" |
|
39 |
Raised when a division by zero is attempted. |
|
40 |
" |
|
7584 | 41 |
! |
42 |
||
43 |
examples |
|
44 |
" |
|
45 |
the following leads into a debugger: |
|
46 |
[exBegin] |
|
47 |
|divisor| |
|
48 |
||
49 |
divisor := 0. |
|
50 |
Transcript showCR: ( 5 / divisor ). |
|
51 |
[exEnd] |
|
52 |
||
53 |
||
10273
84eddf61acc5
Fix spelling in example comment
Stefan Vogel <sv@exept.de>
parents:
7585
diff
changeset
|
54 |
the following does NOT lead into a debugger: |
7584 | 55 |
[exBegin] |
56 |
|divisor| |
|
57 |
||
58 |
divisor := 0. |
|
59 |
[ |
|
60 |
Transcript showCR: ( 5 / divisor ). |
|
10273
84eddf61acc5
Fix spelling in example comment
Stefan Vogel <sv@exept.de>
parents:
7585
diff
changeset
|
61 |
] on:ZeroDivide do:[ |
84eddf61acc5
Fix spelling in example comment
Stefan Vogel <sv@exept.de>
parents:
7585
diff
changeset
|
62 |
Transcript flash. |
84eddf61acc5
Fix spelling in example comment
Stefan Vogel <sv@exept.de>
parents:
7585
diff
changeset
|
63 |
] |
7584 | 64 |
[exEnd] |
65 |
" |
|
6218 | 66 |
! ! |
5947 | 67 |
|
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
68 |
|
6690
07ef28245da8
notifier now initialized here
Claus Gittinger <cg@exept.de>
parents:
6218
diff
changeset
|
69 |
!ZeroDivide class methodsFor:'initialization'! |
07ef28245da8
notifier now initialized here
Claus Gittinger <cg@exept.de>
parents:
6218
diff
changeset
|
70 |
|
07ef28245da8
notifier now initialized here
Claus Gittinger <cg@exept.de>
parents:
6218
diff
changeset
|
71 |
initialize |
07ef28245da8
notifier now initialized here
Claus Gittinger <cg@exept.de>
parents:
6218
diff
changeset
|
72 |
NotifierString := 'division by zero'. |
07ef28245da8
notifier now initialized here
Claus Gittinger <cg@exept.de>
parents:
6218
diff
changeset
|
73 |
! ! |
07ef28245da8
notifier now initialized here
Claus Gittinger <cg@exept.de>
parents:
6218
diff
changeset
|
74 |
|
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
75 |
|
5947 | 76 |
!ZeroDivide methodsFor:'accessing'! |
77 |
||
14717 | 78 |
defaultResumeValue |
79 |
"no, we return infinity here, if ever proceeded" |
|
80 |
||
81 |
^ parameter receiver class infinity |
|
82 |
||
83 |
" |
|
84 |
|a b| |
|
85 |
||
86 |
a := 5. |
|
87 |
b := 0. |
|
88 |
ZeroDivide handle:[:ex | |
|
89 |
Transcript showCR:('division by zero - dividend was: ' , ex dividend printString). |
|
90 |
ex proceed |
|
91 |
] do:[ |
|
92 |
a / b |
|
93 |
] |
|
94 |
" |
|
95 |
||
96 |
" |
|
97 |
|a b| |
|
98 |
||
99 |
a := 5.0. |
|
100 |
b := 0.0. |
|
101 |
ZeroDivide handle:[:ex | |
|
102 |
Transcript showCR:('division by zero - dividend was: ' , ex dividend printString). |
|
103 |
ex proceed |
|
104 |
] do:[ |
|
105 |
a / b |
|
106 |
] |
|
107 |
" |
|
108 |
! |
|
109 |
||
5947 | 110 |
dividend |
111 |
"Return the number that was being divided by zero." |
|
112 |
||
5969 | 113 |
^ parameter receiver |
5947 | 114 |
|
115 |
" |
|
116 |
|a b| |
|
117 |
||
118 |
a := 5. |
|
119 |
b := 0. |
|
120 |
Integer divisionByZeroSignal handle:[:ex | |
|
5969 | 121 |
Transcript showCR:('division by zero - dividend was: ' , ex dividend printString) |
5947 | 122 |
] do:[ |
123 |
a // b |
|
124 |
] |
|
125 |
" |
|
126 |
! ! |
|
127 |
||
18017
7fef9e17913f
Merged 956be83322ff and 8657c48a4c03 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
128 |
|
5947 | 129 |
!ZeroDivide class methodsFor:'documentation'! |
130 |
||
131 |
version |
|
14717 | 132 |
^ '$Header: /cvs/stx/stx/libbasic/ZeroDivide.st,v 1.8 2013-01-25 17:19:34 cg Exp $' |
17761
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
133 |
! |
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
134 |
|
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
135 |
version_SVN |
17911 | 136 |
^ '$Id: ZeroDivide.st 10761 2012-01-19 11:46:00Z vranyj1 $' |
5947 | 137 |
! ! |
7584 | 138 |
|
14717 | 139 |
|
6690
07ef28245da8
notifier now initialized here
Claus Gittinger <cg@exept.de>
parents:
6218
diff
changeset
|
140 |
ZeroDivide initialize! |