aboutsummaryrefslogtreecommitdiff
path: root/binary.tcl
diff options
context:
space:
mode:
authorVadim Zborovskii <vadim_z@triniti.ru>2012-07-14 01:21:07 +0400
committerSteve Bennett <steveb@workware.net.au>2013-08-19 21:15:55 +1000
commit74b38b366e17e5075e3a44994c6b2fb95d2f2a03 (patch)
tree0e60ff74b8d77cd8e11d9b85390ae87bbaa976f9 /binary.tcl
parent05f1c54f9c2aabf0621a9faba234cd4ea006c6e9 (diff)
downloadjimtcl-74b38b366e17e5075e3a44994c6b2fb95d2f2a03.zip
jimtcl-74b38b366e17e5075e3a44994c6b2fb95d2f2a03.tar.gz
jimtcl-74b38b366e17e5075e3a44994c6b2fb95d2f2a03.tar.bz2
Fixes to make behaviour of Jim's 'binary' more compliant to Tcl.
Diffstat (limited to 'binary.tcl')
-rw-r--r--binary.tcl6
1 files changed, 4 insertions, 2 deletions
diff --git a/binary.tcl b/binary.tcl
index cc9c9ea..f04b9e4 100644
--- a/binary.tcl
+++ b/binary.tcl
@@ -14,7 +14,8 @@ proc binary {cmd args} {
proc "binary format" {formatString args} {
set bitoffset 0
set result {}
- foreach {conv t u n} [regexp -all -inline {([a-zA-Z@])(u)?([*0-9]*)} $formatString] {
+ # This RE is too unreliable...
+ foreach {conv t u n} [regexp -all -inline {([^[:space:]])(u)?([*0-9]*)} $formatString] {
if {$t in {a A}} {
set value [binary.nextarg args]
set sn [string bytelength $value]
@@ -116,7 +117,8 @@ proc "binary scan" {value formatString {args varName}} {
# Throws an error if no more args
set bitoffset 0
set count 0
- foreach {conv t u n} [regexp -all -inline {([a-zA-Z@])(u)?([*0-9]*)} $formatString] {
+ # This RE is too unreliable...
+ foreach {conv t u n} [regexp -all -inline {([^[:space:]])(u)?([*0-9]*)} $formatString] {
set rembytes $([string bytelength $value] - $bitoffset / 8)
if {$t in {a A}} {
if {$n eq "*"} {