Revision: 45899
          http://brlcad.svn.sourceforge.net/brlcad/?rev=45899&view=rev
Author:   brlcad
Date:     2011-08-10 14:04:10 +0000 (Wed, 10 Aug 2011)

Log Message:
-----------
this could use some rethinking, but instead of testing to make sure the 
commands we need actually exist at 'source' time, see if they exist at 
run-time.  this should avoid pkgindex blather and be more likely that the 
command is actually already loaded.

Modified Paths:
--------------
    brlcad/trunk/src/tclscripts/mged/bots.tcl
    brlcad/trunk/src/tclscripts/mged/e_id.tcl
    brlcad/trunk/src/tclscripts/mged/get_regions.tcl
    brlcad/trunk/src/tclscripts/mged/raypick.tcl
    brlcad/trunk/src/tclscripts/mged/reid.tcl
    brlcad/trunk/src/tclscripts/mged/remap_mater.tcl
    brlcad/trunk/src/tclscripts/mged/remat.tcl
    brlcad/trunk/src/tclscripts/mged/solclick.tcl

Modified: brlcad/trunk/src/tclscripts/mged/bots.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/mged/bots.tcl   2011-08-10 13:55:30 UTC (rev 
45898)
+++ brlcad/trunk/src/tclscripts/mged/bots.tcl   2011-08-10 14:04:10 UTC (rev 
45899)
@@ -25,15 +25,6 @@
 # introspect primitive data parameters (form elements)
 #
 
-set extern_commands [list db tops]
-foreach cmd $extern_commands {
-    catch {auto_load $cmd} val
-    if {[expr [string compare [info command $cmd] $cmd] != 0]} {
-       puts stderr "[info script]: Application fails to provide command '$cmd'"
-       return
-    }
-}
-
 proc per_line { args } {
     puts stderr "DEPRECATION WARNING: 'bots' and 'per_line' are temporary 
until 'search' is enhanced."
     foreach list $args {
@@ -44,6 +35,16 @@
 }
 
 proc bots { args } {
+
+    set extern_commands [list db tops]
+    foreach cmd $extern_commands {
+       catch {auto_load $cmd} val
+       if {[expr [string compare [info command $cmd] $cmd] != 0]} {
+           puts stderr "[info script]: Application fails to provide command 
'$cmd'"
+           return
+       }
+    }
+
     set argc [llength $args]
     set results [list]
 

Modified: brlcad/trunk/src/tclscripts/mged/e_id.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/mged/e_id.tcl   2011-08-10 13:55:30 UTC (rev 
45898)
+++ brlcad/trunk/src/tclscripts/mged/e_id.tcl   2011-08-10 14:04:10 UTC (rev 
45899)
@@ -31,24 +31,25 @@
 #      the specified ident.
 
 #
-#    Preliminary...
-#    Ensure that all commands used here but not defined herein
-#    are provided by the application
+#    The actual macro
 #
+proc e_id {args} {
 
-set extern_commands "whichid e"
-foreach cmd $extern_commands {
-    catch {auto_load $cmd} val
-    if {[expr [string compare [info command $cmd] $cmd] != 0]} {
-       puts stderr "[info script]: Application fails to provide command '$cmd'"
-       return
+    #
+    #    Preliminary...
+    #    Ensure that all commands used here but not defined herein
+    #    are provided by the application
+    #
+
+    set extern_commands "whichid e"
+    foreach cmd $extern_commands {
+       catch {auto_load $cmd} val
+       if {[expr [string compare [info command $cmd] $cmd] != 0]} {
+           puts stderr "[info script]: Application fails to provide command 
'$cmd'"
+           return
+       }
     }
-}
 
-#
-#    The actual macro
-#
-proc e_id {args} {
     #
     #  Ensure that at least one argument was given
     #

Modified: brlcad/trunk/src/tclscripts/mged/get_regions.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/mged/get_regions.tcl    2011-08-10 13:55:30 UTC 
(rev 45898)
+++ brlcad/trunk/src/tclscripts/mged/get_regions.tcl    2011-08-10 14:04:10 UTC 
(rev 45899)
@@ -22,17 +22,17 @@
 # list all regions at or under a given hierarchy node
 #
 
-set extern_commands [list db]
-foreach cmd $extern_commands {
-    catch {auto_load $cmd} val
-    if {[expr [string compare [info command $cmd] $cmd] != 0]} {
-       puts stderr "[info script]: Application fails to provide command '$cmd'"
-       return
+proc get_regions { args } {
+
+    set extern_commands [list db]
+    foreach cmd $extern_commands {
+       catch {auto_load $cmd} val
+       if {[expr [string compare [info command $cmd] $cmd] != 0]} {
+           puts stderr "[info script]: Application fails to provide command 
'$cmd'"
+           return
+       }
     }
-}
 
-
-proc get_regions { args } {
     if { [llength $args] != 1 } {
        puts "Usage: get_regions object"
        return ""

Modified: brlcad/trunk/src/tclscripts/mged/raypick.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/mged/raypick.tcl        2011-08-10 13:55:30 UTC 
(rev 45898)
+++ brlcad/trunk/src/tclscripts/mged/raypick.tcl        2011-08-10 14:04:10 UTC 
(rev 45899)
@@ -18,23 +18,23 @@
 # information.
 #
 ###
-#
-#    Preliminary...
-#    Ensure that all commands used here but not defined herein
-#    are provided by the application
-#
 
-set extern_commands "M _mged_M"
-foreach cmd $extern_commands {
-    catch {auto_load $cmd} val
-    if {[expr [string compare [info command $cmd] $cmd] != 0]} {
-       puts stderr "[info script]: Application fails to provide command '$cmd'"
-       return
+
+proc raypick { } {
+
+    #    Preliminary...
+    #    Ensure that all commands used here but not defined herein
+    #    are provided by the application
+    #
+    set extern_commands "M _mged_M"
+    foreach cmd $extern_commands {
+       catch {auto_load $cmd} val
+       if {[expr [string compare [info command $cmd] $cmd] != 0]} {
+           puts stderr "[info script]: Application fails to provide command 
'$cmd'"
+           return
+       }
     }
-}
 
-
-proc raypick { } {
     echo Shoot a ray by clicking the middle mouse button.
     # Replace mouse event handler
     proc M { up x y } {

Modified: brlcad/trunk/src/tclscripts/mged/reid.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/mged/reid.tcl   2011-08-10 13:55:30 UTC (rev 
45898)
+++ brlcad/trunk/src/tclscripts/mged/reid.tcl   2011-08-10 14:04:10 UTC (rev 
45899)
@@ -23,17 +23,18 @@
 # some given region ID number.
 #
 
-set extern_commands [list db get_regions attr]
-foreach cmd $extern_commands {
-    catch {auto_load $cmd} val
-    if {[expr [string compare [info command $cmd] $cmd] != 0]} {
-       puts stderr "[info script]: Application fails to provide command '$cmd'"
-       return
+
+proc  reid { args } {
+
+    set extern_commands [list db get_regions attr]
+    foreach cmd $extern_commands {
+       catch {auto_load $cmd} val
+       if {[expr [string compare [info command $cmd] $cmd] != 0]} {
+           puts stderr "[info script]: Application fails to provide command 
'$cmd'"
+           return
+       }
     }
-}
 
-
-proc  reid { args } {
     if { [llength $args] != 2 } {
        puts "Usage: reid assembly regionID"
        return

Modified: brlcad/trunk/src/tclscripts/mged/remap_mater.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/mged/remap_mater.tcl    2011-08-10 13:55:30 UTC 
(rev 45898)
+++ brlcad/trunk/src/tclscripts/mged/remap_mater.tcl    2011-08-10 14:04:10 UTC 
(rev 45899)
@@ -66,17 +66,6 @@
 ###
 
 
-# make sure the mged commands we need actually exist
-set extern_commands [list db]
-foreach cmd $extern_commands {
-    catch {auto_load $cmd} val
-    if {[expr [string compare [info command $cmd] $cmd] != 0]} {
-       puts stderr "[info script]: Application fails to provide command '$cmd'"
-       return
-    }
-}
-
-
 #
 # An ugly little kludge to allow modern versions of Tcl to use the
 # "string is digit" construct, while providing older versions a
@@ -102,6 +91,16 @@
 
 proc remap_mater {file_name {silent 0}} {
 
+    # make sure the mged commands we need actually exist
+    set extern_commands [list db]
+    foreach cmd $extern_commands {
+       catch {auto_load $cmd} val
+       if {[expr [string compare [info command $cmd] $cmd] != 0]} {
+           puts stderr "[info script]: Application fails to provide command 
'$cmd'"
+           return
+       }
+    }
+
     #
     # Read in the spec file and build the mapping
     #

Modified: brlcad/trunk/src/tclscripts/mged/remat.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/mged/remat.tcl  2011-08-10 13:55:30 UTC (rev 
45898)
+++ brlcad/trunk/src/tclscripts/mged/remat.tcl  2011-08-10 14:04:10 UTC (rev 
45899)
@@ -23,18 +23,18 @@
 # material ID number.
 #
 
-# make sure the mged commands we need actually exist
-set extern_commands [list db get_regions attr]
-foreach cmd $extern_commands {
-    catch {auto_load $cmd} val
-    if {[expr [string compare [info command $cmd] $cmd] != 0]} {
-       puts stderr "[info script]: Application fails to provide command '$cmd'"
-       return
+
+proc remat { args } {
+    # make sure the mged commands we need actually exist
+    set extern_commands [list db get_regions attr]
+    foreach cmd $extern_commands {
+       catch {auto_load $cmd} val
+       if {[expr [string compare [info command $cmd] $cmd] != 0]} {
+           puts stderr "[info script]: Application fails to provide command 
'$cmd'"
+           return
+       }
     }
-}
 
-
-proc remat { args } {
     if { [llength $args] != 2 } {
        puts "Usage: remat assembly materialID"
        return

Modified: brlcad/trunk/src/tclscripts/mged/solclick.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/mged/solclick.tcl       2011-08-10 13:55:30 UTC 
(rev 45898)
+++ brlcad/trunk/src/tclscripts/mged/solclick.tcl       2011-08-10 14:04:10 UTC 
(rev 45899)
@@ -25,23 +25,24 @@
 #             user interface.
 #
 
-#
-#    Preliminary...
-#    Ensure that all commands used here but not defined herein
-#    are provided by the application
-#
 
-set extern_commands "M _mged_M"
-foreach cmd $extern_commands {
-    catch {auto_load $cmd} val
-    if {[expr [string compare [info command $cmd] $cmd] != 0]} {
-       puts stderr "[info script]: Application fails to provide command '$cmd'"
-       return
+proc solclick { } {
+
+    #
+    #    Preliminary...
+    #    Ensure that all commands used here but not defined herein
+    #    are provided by the application
+    #
+
+    set extern_commands "M _mged_M"
+    foreach cmd $extern_commands {
+       catch {auto_load $cmd} val
+       if {[expr [string compare [info command $cmd] $cmd] != 0]} {
+           puts stderr "[info script]: Application fails to provide command 
'$cmd'"
+           return
+       }
     }
-}
 
-
-proc solclick { } {
     echo "\nShoot a ray by clicking the middle mouse button."
     # Replace mouse event handler
     proc M { up x y } {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to