5 .param pmc argv :slurpy
9 unless argc goto no_args
11 .local string subcommand_name
12 subcommand_name = shift argv
15 options = get_root_global ['_tcl'; 'helpers'; 'binary'], 'options'
17 .local pmc select_option
18 select_option = get_root_global ['_tcl'], 'select_option'
20 .local string canonical_subcommand
21 canonical_subcommand = select_option(options, subcommand_name)
23 .local pmc subcommand_proc
26 subcommand_proc = get_root_global ['_tcl'; 'helpers'; 'binary'], canonical_subcommand
27 if_null subcommand_proc, bad_args
28 .return subcommand_proc(argv)
31 .return ('') # once all commands are implemented, remove this...
34 die 'wrong # args: should be "binary option ?arg arg ...?"'
38 .namespace [ 'helpers'; 'binary' ]
45 unless argc goto bad_args
47 .local string formatString, binStr
48 formatString = shift argv
49 binStr = tcl_binary_format formatString, argv
54 die 'wrong # args: should be "binary format formatString ?arg arg ...?"'
62 unless argc >= 2 goto bad_args
64 .local string value, formatString
66 formatString = shift argv
69 ret = tcl_binary_scan value, formatString
71 .local pmc setVar, variables, values
72 setVar = get_root_global ['_tcl'], 'setVar'
73 variables = new 'Iterator', argv
74 values = new 'Iterator', ret
76 unless variables goto end
77 unless values goto end
90 die 'wrong # args: should be "binary scan value formatString ?varName varName ...?"'
93 .sub 'anon' :anon :load
95 options = new 'TclList'
96 push options, 'format'
99 set_root_global ['_tcl'; 'helpers'; 'binary'], 'options', options
105 # vim: expandtab shiftwidth=4 ft=pir: