Ignore:
Timestamp:
Jan 13, 2003, 7:32:27 PM (16 years ago)
Author:
landonf
Message:

Add option deprecation routines
Deprecate build.target.all and build.target.install
Add install command and default it off of build command
Update documentation to reflect option changes

File:
1 edited

Legend:

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

    r1643 r1651  
    115115}
    116116
     117# option_deprecate
     118# Causes a warning to be printed when an option is set or accessed
     119proc option_deprecate {option {newoption ""} } {
     120    eval "proc warn_deprecated_$option \{option action args\} \{ \n\
     121        global portname $option $newoption \n\
     122        if \{\"$newoption\" != \"\" \&\& \$action != \"read\" \} \{ \n\
     123            $newoption \[set $option\] \n\
     124        \} else \{ \n\
     125            ui_warn \"Port \$portname using deprecated option \\\"$option\\\".\" \n\
     126            if \{ \"$newoption\" != \"\" && \$action == \"read\" \} \{ \n\
     127                $option \[set $newoption\] \n\
     128            \} \n\
     129        \}
     130    \}"
     131    # If a new option is specified, default the option to {${newoption}}
     132    if {$newoption != ""} {
     133        eval "default $option {\$\{$newoption\}}"
     134    }
     135    option_proc $option warn_deprecated_$option
     136}
     137
    117138proc option_proc {option args} {
     139    global option_procs $option
     140    eval "lappend option_procs($option) $args"
     141    # Add a read trace to the variable, as the option procedures have no access to reads
     142    trace variable $option r option_proc_trace
     143}
     144
     145# option_proc_trace
     146# trace handler for option reads. Calls option procedures with correct arguments.
     147proc option_proc_trace {optionName index op} {
    118148    global option_procs
    119     eval "lappend option_procs($option) $args"
     149    foreach p $option_procs($optionName) {
     150        eval "$p $optionName read"
     151    }
    120152}
    121153
Note: See TracChangeset for help on using the changeset viewer.