YAPC::EU 2018 Glasgow Update!

This commit is contained in:
Ingy döt Net 2018-08-17 15:15:24 +01:00
parent 22f33d4004
commit 4e2d22a71d
1170 changed files with 15042 additions and 3047 deletions

View file

@ -0,0 +1,15 @@
#! /usr/local/bin/newlisp
(define (check-division x y)
(catch (/ x y) 'check-zero)
(if (not (integer? check-zero))
(setq check-zero "Division by zero."))
check-zero
)
(println (check-division 10 4))
(println (check-division 4 0))
(println (check-division 20 5))
(println (check-division 11 0))
(exit)

View file

@ -1,7 +1,5 @@
REBOL [
Title: "Detect Divide by Zero"
Date: 2009-12-16
Author: oofoe
URL: http://rosettacode.org/wiki/Divide_by_Zero_Detection
]

View file

@ -1,22 +1,23 @@
/*REXX program demonstrates detects and handles division by zero. */
signal on syntax /*handle all REXX syntax errors. */
x = sourceline() /*being cute, x=size of this pgm.*/
y = x-x /*setting to zero the obtuse way.*/
z = x/y /*this'll do it, furrrr shurrre. */
exit /*We're kaput. Ja vohl ! */
/*───────────────────────────────error handling subroutines and others.─*/
err: if rc==42 then do; say; say /*1st, check for a specific error*/
say center(' division by zero is a no-no. ',79,'')
say; say
exit 130
end
say; say; say center(' error! ',max(40,linesize()%2),"*"); say
do j=1 for arg(); say arg(j); say; end; say;
exit 13
novalue: syntax: call err 'REXX program' condition('C') "error",,
condition('D'),'REXX source statement (line' sigl"):",,
sourceline(sigl)
/*REXX program demonstrates detection and handling division by zero. */
signal on syntax /*handle all REXX syntax errors. */
x = sourceline() /*being cute, x=is the size of this pgm*/
y = x - x /*setting to zero the obtuse way. */
z = x / y /*this'll trigger it, furrrr shurrre. */
exit /*We're kaput. Ja vohl ! */
/*──────────────────────────────────────────────────────────────────────────────────────*/
err: if rc==42 then do; say /*first, check for a specific error. */
say center(' ***error*** ', 79, "")
say 'Division by zero detected at line ' @ ,
" and the REXX statement is:"
say sourceLine(@)
say
exit 42
end
say
say center(' error! ', 79, "*")
do #=1 for arg(); say; say arg(#); say
end /*#*/
exit 13
/*──────────────────────────────────────────────────────────────────────────────────────*/
syntax: @=sigl; call err 'REXX program' condition("C") 'error', condition('D'), ,
'REXX source statement (line' sigl"):", sourceLine(sigl)

View file

@ -0,0 +1,15 @@
65 64 69 76 69 64 00000008'010E0000' 0000 1 desc: .ascid "divide by zero"
6F 72 65 7A 20 79 62 20 000E
0000 0016 2 .entry handler,0
E5 AF 7F 0018 3 pushaq desc
00000000'GF 01 FB 001B 4 calls #1, g^lib$put_output
04 0022 5 ret
0023 6
0000 0023 7 .entry main,0
6D EE AF 9E 0025 8 movab handler, (fp) ;register exception handler
50 01 00 C7 0029 9 divl3 #0, #1, r0
04 002D 10 ret
002E 11
002E 12 .end main
$ run dv
divide by zero