From 22880ac83114fd4989ad3e231063278f63ebfbae Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Mon, 27 Mar 2017 00:11:05 +0200 Subject: [PATCH] scm: Support reading negative hex numbers. * module/mes/read-0.mes (read-hex): Support negative hex numbers. * tests/math.test ("#x-10"): New test. * tests/read.test: Add test. --- module/mes/read-0-32.mo | Bin 80657 -> 80945 bytes module/mes/read-0.mes | 9 +++++---- tests/math.test | 2 ++ tests/read.test | 1 + 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/module/mes/read-0-32.mo b/module/mes/read-0-32.mo index 5ddf8c2a292c781788d4f58fc6e7fd6f2f8a093d..ed377e94d7b802ac5c219dc6d23ed91accc452d4 100644 GIT binary patch delta 18477 zcmZvk2Y6Ifw1w{tEeQ}>GHH-N0-+|M_m1?YR8gsliV8tN1q&l~Q9&H_f`z6isDKm; z7MhCKKomtmil8E>h)M_Htu?c@oacM@`;PlR>+I9ZEfbu1y!i5y#b3MRK)87s&kHJf zUMbJ>X2m0jXTv@%-U=Td>GVlLct-lOu%^@JIq7p?=ZfdS&KK84-UZ@OSR4KA&U#Q7qL|>Nl3hb-mtteuNcq!~M)7kdOuwPOm`7`6= zmRE|jI}-}8K;lXSyNUqp+$w0VBP4>$myV?tgLwm594vj_1iytqUJd&;f?Zb5JJ8Z(+X^v%x#WJ7K>U?}FVe-UGW=`~&Ph@qSoq>a&>SAEp1~=s$xG#PlBC zFMxxwh<6C~SMhJKzl*sL4~zeRwF-`a|CIh$r0xFH@ZV1AQSdRP9(VK;;FHq1_D_kq z=d9$@(9TFd3;U1Qor!bM&P(@_kvCcUhMO)90vAp(*y3Vtt`g#s$w9cHAG(?gsFXBL zXS_H8)*6!tE-k$bY*}&n5*K`upp`Qnwt~12WmZg%%*_miN3$w~N=QmZuuqHjyUsXz-G!1QEw~)^~%ty#Pl%re-pAGW+Tw)Yt&dZ z<`nhmjQ>)v1}#TE9H(3{y8Uk>szb8|g^^H0KAhM*G5g|ssGo&0p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~Yc*v-w3?D+Y@vVj_TYAw6fB%rrN6O6u>&rhtIm;Z~{Fg&pLETHT+AN?pAcV-^EiA`5q_pRCFZ-!X)*sWct*^Rw`axtf_zR~2M@k~iwAVE+TFYE-H?`!-$(gj~6!q z7Z*1MCuCs!xoa9Blu$xLa7l3kaH6YJx-J8sJoMb#R)v8aQ2i88|~+6`U!~1D6+90ap<729YJ^eJ2|nX76(lDk`B8 zxRSUc)5O`}TyYk-vbX}cinu&DPn-#^Du(ec6LYq!iLoTYUUfzAk>9H!=7T~_F&3 c 96) (< c 103)) (+ (- c 97) 10)) ((and (> c 47) (< c 58)) (- c 48)) (#t 0))) - (define (read-hex c p n) + (define (read-hex c p s n) (if (not (or (and (> p 64) (< p 71)) (and (> p 96) (< p 103)) - (and (> p 47) (< p 58)))) (+ (ash n 4) (calc c)) - (read-hex (read-byte) (peek-byte) (+ (ash n 4) (calc c))))) + (and (> p 47) (< p 58)))) (* s (+ (ash n 4) (calc c))) + (read-hex (read-byte) (peek-byte) s (+ (ash n 4) (calc c))))) ((lambda (c p) - (read-hex c p 0)) + (if (eq? c 45) (read-hex (read-byte) (peek-byte) -1 0) + (read-hex c p 1 0))) (read-byte) (peek-byte))) (define (read-string) diff --git a/tests/math.test b/tests/math.test index 6a567e62..e9e6ffc7 100755 --- a/tests/math.test +++ b/tests/math.test @@ -79,4 +79,6 @@ exit $? (pass-if "min 1" (seq? (min 0 1) 0)) (pass-if "min 2" (seq? (min 1 0 2) 0)) +(pass-if-equal "#x-10" -16 #x-10) + (result 'report) diff --git a/tests/read.test b/tests/read.test index 41aaf8ce..c23a530e 100755 --- a/tests/read.test +++ b/tests/read.test @@ -18,6 +18,7 @@ cons 'foo (display 'foo) (newline) (display #x16) (newline) +(display #x-16) (newline) (display #\A) (newline) (display #\newline) (newline) #\alarm