Changeset 134833


Ignore:
Timestamp:
Apr 8, 2015, 2:30:14 PM (4 years ago)
Author:
jmr@…
Message:

simplify makeuserproc and get rid of weird overquoting requirement (which probably only existed because someone called their argument 'args' in the calling procs without realising what that does)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port1.0/portutil.tcl

    r133649 r134833  
    602602    # make a user procedure named variant-blah-blah
    603603    # we will call this procedure during variant-run
    604     makeuserproc "variant-[ditem_key $ditem name]" \{$code\}
     604    makeuserproc variant-[ditem_key $ditem name] $code
    605605
    606606    # Export provided variant to PortInfo
     
    12821282# thought of any other way to do this.
    12831283proc makeuserproc {name body} {
    1284     regsub -- "^\{(.*?)" $body "\{ \n foreach g \[info globals\] \{ \n global \$g \n \} \n \\1" body
    1285     eval "proc $name {} $body"
     1284    append modified_body {global {*}[info globals]\n} $body
     1285    proc $name {} $modified_body
    12861286}
    12871287
     
    22002200        set ident [ditem_key $ditem name]
    22012201        if {[info commands $target] eq ""} {
    2202             proc $target {args} "
     2202            proc $target {code} "
    22032203                variable proc_index
    22042204                set proc_index \[llength \[ditem_key $ditem proc\]\]
     
    22122212                \"
    22132213                proc do-$target {} { $origproc $target }
    2214                 makeuserproc userproc-${ident}-${target}-\${proc_index} \$args
     2214                makeuserproc userproc-${ident}-${target}-\${proc_index} \$code
    22152215            "
    22162216        }
    2217         proc pre-$target {args} "
     2217        proc pre-$target {code} "
    22182218            variable proc_index
    22192219            set proc_index \[llength \[ditem_key $ditem pre\]\]
     
    22262226                }
    22272227            \"
    2228             makeuserproc userproc-pre-${ident}-${target}-\${proc_index} \$args
     2228            makeuserproc userproc-pre-${ident}-${target}-\${proc_index} \$code
    22292229        "
    2230         proc post-$target {args} "
     2230        proc post-$target {code} "
    22312231            variable proc_index
    22322232            set proc_index \[llength \[ditem_key $ditem post\]\]
     
    22392239                }
    22402240            \"
    2241             makeuserproc userproc-post-${ident}-${target}-\${proc_index} \$args
     2241            makeuserproc userproc-post-${ident}-${target}-\${proc_index} \$code
    22422242        "
    22432243    }
Note: See TracChangeset for help on using the changeset viewer.