OSDN Git Service

2002-12-03 Martin M. Hunt <hunt@redhat.com>
authorhunt <hunt>
Tue, 3 Dec 2002 22:25:10 +0000 (22:25 +0000)
committerhunt <hunt>
Tue, 3 Dec 2002 22:25:10 +0000 (22:25 +0000)
* library/main.tcl: Require package "debug". Make
package loading a bit more robust.

gdb/gdbtk/ChangeLog
gdb/gdbtk/library/main.tcl

index 8e8f1e7..c56543b 100644 (file)
@@ -1,3 +1,8 @@
+2002-12-03  Martin M. Hunt  <hunt@redhat.com>
+
+       * library/main.tcl: Require package "debug". Make
+       package loading a bit more robust.
+
 2002-11-30  Andrew Cagney  <ac131313@redhat.com>
 
        * generic/gdbtk-stack.c: Replace selected_frame with
index dc77828..77a105b 100644 (file)
@@ -53,35 +53,38 @@ if {[info exists auto_path]} {
   }
 }
 
+
 # Require the packages we need.  Most are loaded already, but this will catch 
 # any odd errors... :
-package require Tcl 8.0
-package require Tk 8.0
-package require Itcl 3.0
-package require Itk 3.0
-package require Gdbtk 1.0
-package require combobox 1.0
 
-namespace import itcl::*
+foreach p {{Tcl 8.0} {Tk 8.0} {Itcl 3.0} {Itk 3.0} {Gdbtk 1.0} {combobox 1.0} {debug 1.0}} {
+  if {[catch {package require [lindex $p 0] [lindex $p 1]} msg]} {
+    if {![info exists ::env(GDBTK_TEST_RUNNING)] || $::env(GDBTK_TEST_RUNNING) == 0} {
+      puts stderr "Error: $msg"
+      catch {tk_messageBox -title Error -message $msg -icon error -type ok}
+    }
+    exit -1
+  } else {
+    #puts "Loaded [lindex $p 0] $msg"
+  }
+}
 
+namespace import itcl::*
 namespace import debug::*
 
-# Setup iwidgets path, if needed
+# Finally, load Iwidgets
 if {[info exists IWIDGETS_LIBRARY]} {
   lappend auto_path $IWIDGETS_LIBRARY
 }
-
-if {[catch {package require Iwidgets 3.0} errMsg]} {
-  set msg "Could not find the Iwidgets libraries.\n\nGot nameofexec: [info nameofexecutable]\nError(s) were: \n$errMsg"
-
+if {[catch {package require Iwidgets 3.0} msg]} {
   if {![info exists ::env(GDBTK_TEST_RUNNING)] || $::env(GDBTK_TEST_RUNNING) == 0} {
-    puts stderr $msg
-  } else {
-    tk_messageBox -title Error -message $msg -icon error -type ok
+    puts stderr "Error: $msg"
+    catch {tk_messageBox -title Error -message $msg -icon error -type ok}
   }
-  exit
+  exit -1
 }
 
+
 # Environment variables controlling debugging:
 # GDBTK_TRACE
 #      unset or 0      no tracing