author | Claus Gittinger <cg@exept.de> |
Fri, 15 Sep 2006 19:52:31 +0200 | |
changeset 9908 | eede5b535b1e |
parent 7585 | 87d76b40f897 |
child 10273 | 84eddf61acc5 |
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 |
" |
|
12 |
||
5947 | 13 |
"{ Package: 'stx:libbasic' }" |
14 |
||
15 |
DomainError subclass:#ZeroDivide |
|
16 |
instanceVariableNames:'' |
|
17 |
classVariableNames:'' |
|
18 |
poolDictionaries:'' |
|
6218 | 19 |
category:'Kernel-Exceptions-Errors' |
5947 | 20 |
! |
21 |
||
6218 | 22 |
!ZeroDivide class methodsFor:'documentation'! |
23 |
||
7585 | 24 |
copyright |
25 |
" |
|
26 |
COPYRIGHT (c) 2001 by eXept Software AG |
|
27 |
All Rights Reserved |
|
28 |
||
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
! |
|
37 |
||
6218 | 38 |
documentation |
39 |
" |
|
40 |
Raised when a division by zero is attempted. |
|
41 |
" |
|
7584 | 42 |
! |
43 |
||
44 |
examples |
|
45 |
" |
|
46 |
the following leads into a debugger: |
|
47 |
[exBegin] |
|
48 |
|divisor| |
|
49 |
||
50 |
divisor := 0. |
|
51 |
Transcript showCR: ( 5 / divisor ). |
|
52 |
[exEnd] |
|
53 |
||
54 |
||
55 |
the following does NOT leads into a debugger: |
|
56 |
[exBegin] |
|
57 |
|divisor| |
|
58 |
||
59 |
divisor := 0. |
|
60 |
[ |
|
61 |
Transcript showCR: ( 5 / divisor ). |
|
62 |
] on:ZeroDivide |
|
63 |
do: |
|
64 |
[ |
|
65 |
Transcript flash. |
|
66 |
] |
|
67 |
[exEnd] |
|
68 |
" |
|
6218 | 69 |
! ! |
5947 | 70 |
|
6690
07ef28245da8
notifier now initialized here
Claus Gittinger <cg@exept.de>
parents:
6218
diff
changeset
|
71 |
!ZeroDivide class methodsFor:'initialization'! |
07ef28245da8
notifier now initialized here
Claus Gittinger <cg@exept.de>
parents:
6218
diff
changeset
|
72 |
|
07ef28245da8
notifier now initialized here
Claus Gittinger <cg@exept.de>
parents:
6218
diff
changeset
|
73 |
initialize |
07ef28245da8
notifier now initialized here
Claus Gittinger <cg@exept.de>
parents:
6218
diff
changeset
|
74 |
NotifierString := 'division by zero'. |
07ef28245da8
notifier now initialized here
Claus Gittinger <cg@exept.de>
parents:
6218
diff
changeset
|
75 |
! ! |
07ef28245da8
notifier now initialized here
Claus Gittinger <cg@exept.de>
parents:
6218
diff
changeset
|
76 |
|
5947 | 77 |
!ZeroDivide methodsFor:'accessing'! |
78 |
||
79 |
dividend |
|
80 |
"Return the number that was being divided by zero." |
|
81 |
||
5969 | 82 |
^ parameter receiver |
5947 | 83 |
|
84 |
" |
|
85 |
|a b| |
|
86 |
||
87 |
a := 5. |
|
88 |
b := 0. |
|
89 |
Integer divisionByZeroSignal handle:[:ex | |
|
5969 | 90 |
Transcript showCR:('division by zero - dividend was: ' , ex dividend printString) |
5947 | 91 |
] do:[ |
92 |
a // b |
|
93 |
] |
|
94 |
" |
|
95 |
! ! |
|
96 |
||
97 |
!ZeroDivide class methodsFor:'documentation'! |
|
98 |
||
99 |
version |
|
7585 | 100 |
^ '$Header: /cvs/stx/stx/libbasic/ZeroDivide.st,v 1.6 2003-08-29 19:10:23 cg Exp $' |
5947 | 101 |
! ! |
7584 | 102 |
|
6690
07ef28245da8
notifier now initialized here
Claus Gittinger <cg@exept.de>
parents:
6218
diff
changeset
|
103 |
ZeroDivide initialize! |