1 .HLL 'Tcl', 'tcl_group'
5 .param pmc argv :slurpy
10 unless $I0 goto no_args
12 .local string subcommand_name
13 subcommand_name = shift argv
16 options = new 'ResizablePMCArray'
17 push options, 'format'
20 .local pmc select_option
21 select_option = get_root_global ['_tcl'], 'select_option'
22 .local string canonical_subcommand
23 canonical_subcommand = select_option(options, subcommand_name)
25 .local pmc subcommand_proc
28 subcommand_proc = get_root_global ['_tcl'; 'helpers'; 'binary'], canonical_subcommand
29 if_null subcommand_proc, bad_args
30 .return subcommand_proc(argv)
33 .return ('') # once all commands are implemented, remove this...
36 tcl_error 'wrong # args: should be "binary option ?arg arg ...?"'
40 .namespace [ 'helpers'; 'binary' ]
49 unless argc goto bad_args
51 .local string formatString, binStr
52 formatString = shift argv
53 binStr = tcl_binary_format formatString, argv
58 tcl_error 'wrong # args: should be "binary format formatString ?arg arg ...?"'
66 unless argc >= 2 goto bad_args
68 .local string value, formatString
70 formatString = shift argv
73 ret = tcl_binary_scan value, formatString
75 .local pmc __set, variables, values
76 __set = get_root_global ['_tcl'], '__set'
77 variables = new 'Iterator', argv
78 values = new 'Iterator', ret
80 unless variables goto end
81 unless values goto end
94 tcl_error 'wrong # args: should be "binary scan value formatString ?varName varName ...?"'
101 # vim: expandtab shiftwidth=4 ft=pir: