Ignore:
Timestamp:
Sep 17, 2007, 7:55:36 AM (12 years ago)
Author:
jmpp@…
Message:

API change:

  • move ui_isset and global_option_isset procs that are found in every single macports1.0 client into macports1.0 itself, sparing the clients from implementing them repeatedly;
  • change their prototypes to require the arrays as arguments, so that the library clients can still set and fill them up as desired;
  • update every macports1.0 client in our tree to use this new API (this expands to the port, portindex and portmirror scripts in the base/src/port, do let me know of I'm missing any).

PS: The purpose of this commit is to further simplify macports1.0 scripting, so that a client is not forced to do all the UI initialization plumbing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/macports1.0/macports.tcl

    r28796 r29191  
    7878# not be relied upon for production code
    7979
     80# ui_options accessor
     81proc macports::ui_isset {ui_options val} {
     82    upvar $ui_options up_ui_options
     83    if {[info exists up_ui_options($val)]} {
     84        if {$up_ui_options($val) == "yes"} {
     85            return 1
     86        }
     87    }
     88    return 0
     89}
     90
     91
     92# global_options accessor
     93proc macports::global_option_isset {global_options val} {
     94    upvar $global_options up_global_options
     95    if {[info exists up_global_options($val)]} {
     96        if {$up_global_options($val) == "yes"} {
     97            puts "Global option \"$val\" in action!"
     98            return 1
     99        }
     100    }
     101    return 0
     102}
     103
     104
    80105proc macports::ui_init {priority message} {
    81106    # Get the list of channels.
Note: See TracChangeset for help on using the changeset viewer.