Projects
New Ticket     Wiki     Browse Source     Timeline     Roadmap     Bug Reports     Search

Changeset 38506 for trunk/base/src

Show
Ignore:
Timestamp:
07/23/08 02:43:14 (4 months ago)
Author:
rhwood@…
Message:

Armahg's patch to macports::ui_init for the GSOC08 frameworks project.

This patch allows users of the Tcl API for MacPorts to define custom ui_*
procedures message handling mechanisms.

Closes #15913, committing per email and IRC conversation.

Files:
1 modified

Legend:

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

    r37780 r38506  
    7777#     no message. 
    7878# if these functions are not provided, defaults are used. 
     79# Clients of the library may optionally provide ui_init with the following 
     80# prototype. 
     81#     proc ui_init {priority prefix channels message} 
     82# ui_init needs to correctly define the proc ::ui_$priority {message} or throw 
     83# an error. 
     84# if this function is not provided or throws an error, default procedures for 
     85# ui_$priority are defined. 
    7986 
    8087# ui_options accessor 
     
    119126        } 
    120127 
    121         if {$nbchans == 1} { 
    122             set chan [lindex $channels 0] 
    123             proc ::ui_$priority {str} [subst { puts $chan "$prefix\$str" }] 
    124         } else { 
    125             proc ::ui_$priority {str} [subst { 
    126                 foreach chan \$channels { 
    127                     puts $chan "$prefix\$str" 
    128                 } 
    129             }] 
     128        try { 
     129            ::ui_init $priority $prefix $channels $message 
     130        } catch * { 
     131            if {$nbchans == 1} { 
     132                set chan [lindex $channels 0] 
     133                proc ::ui_$priority {str} [subst { puts $chan "$prefix\$str" }] 
     134            } else { 
     135                proc ::ui_$priority {str} [subst { 
     136                    foreach chan \$channels { 
     137                        puts $chan "$prefix\$str" 
     138                    } 
     139                }] 
     140            } 
    130141        } 
    131142