OSDN Git Service

2001-09-13 graydon hoare <graydon@redhat.com>
authorgraydon <graydon>
Thu, 13 Sep 2001 19:45:00 +0000 (19:45 +0000)
committergraydon <graydon>
Thu, 13 Sep 2001 19:45:00 +0000 (19:45 +0000)
* sw-visual-sched.tk: New file.
* Makefile.am (pkgdata_DATA): Add sw-visual-sched.tk.
* Makefile.in: Regenerate.
* compSched.cxx (scheduler_component_ctor_1): Add gui attribute for
tksm to introspect and find sw-visual-sched.

sid/component/sched/ChangeLog
sid/component/sched/Makefile.am
sid/component/sched/Makefile.in
sid/component/sched/compSched.cxx
sid/component/sched/sw-visual-sched.tk [new file with mode: 0644]

index 16e23c1..60ab268 100644 (file)
@@ -1,3 +1,11 @@
+2001-09-13  graydon hoare  <graydon@redhat.com>
+
+       * sw-visual-sched.tk: New file.
+       * Makefile.am (pkgdata_DATA): Add sw-visual-sched.tk.
+       * Makefile.in: Regenerate.
+       * compSched.cxx (scheduler_component_ctor_1): Add gui attribute for
+       tksm to introspect and find sw-visual-sched.
+
 2001-08-03  matthew green  <mrg@redhat.com>
 
        * compSched.cxx (~scheduler_component): Add prototype.
index 3c539a0..70f2a84 100644 (file)
@@ -8,7 +8,7 @@ INCLUDES = -I. -I../../include -I$(srcdir)/../../include
 libsched_la_SOURCES = compSched.cxx
 libsched_la_LDFLAGS = -module -no-undefined
 
-pkgdata_DATA = sid-sched.txt
+pkgdata_DATA = sw-visual-sched.tk sid-sched.txt
 
 DEJAGNUTESTS=schedbase.exp schedhost.exp schedhost2.exp schedmonkey.exp
 check-local: all
index 0817172..683127d 100644 (file)
@@ -106,7 +106,7 @@ INCLUDES = -I. -I../../include -I$(srcdir)/../../include
 libsched_la_SOURCES = compSched.cxx
 libsched_la_LDFLAGS = -module -no-undefined
 
-pkgdata_DATA = sid-sched.txt
+pkgdata_DATA = sw-visual-sched.tk sid-sched.txt
 
 DEJAGNUTESTS = schedbase.exp schedhost.exp schedhost2.exp schedmonkey.exp
 
index d52495c..68ed1f5 100644 (file)
@@ -1421,6 +1421,7 @@ scheduler_component<Scheduler>::scheduler_component_ctor_1()
   add_attribute ("yield", & this->yield_pin, "pin");
   add_attribute ("enabled?", & this->enable_p, "setting");
   add_attribute ("yield-host-time?", & this->yield_host_time_p, "setting");
+  add_attribute_ro_value ("scheduler-control-gui", string("sw-visual-sched"), "gui");
 }
 
 template <class Scheduler>
diff --git a/sid/component/sched/sw-visual-sched.tk b/sid/component/sched/sw-visual-sched.tk
new file mode 100644 (file)
index 0000000..c238fdc
--- /dev/null
@@ -0,0 +1,92 @@
+#!/usr/bin/wish -f
+#
+# -*- tcl -*-
+#
+# copyright 2001 Red Hat Inc.
+#
+# this is a bridge-tk based component which manages a set of subscriptions
+# a single related scheduler, and puts up a little toggle for "pausing" them.
+#
+
+variable names
+
+proc get_sub {sched n} {
+    set time [sid::component::attribute_value $sched $n-time]
+    set regular [sid::component::attribute_value $sched $n-regular?]
+    return [list $time $regular]
+}
+
+
+proc set_sub {sched n pair} {
+    set time [lindex $pair 0]
+    set regular [lindex $pair 1]
+    set time [sid::component::set_attribute_value $sched $n-time $time]
+    set regular [sid::component::set_attribute_value $sched $n-regular? $regular]
+}
+
+
+proc set_enable {sched flag} {
+    sid::component::set_attribute_value $sched enabled? $flag
+}
+
+
+proc toggle_subscription {sched n} {
+    global saved_subs
+    set_enable $sched 0
+    set new_sub $saved_subs($sched,$n)
+    set saved_subs($sched,$n) [get_sub $sched $n]
+    set_sub $sched $n $new_sub
+    set_enable $sched 1
+}
+
+
+proc make_toggle {sched n caption} {
+    global saved_subs
+    set saved_subs($sched,$n) {0 no}
+    checkbutton .rc.toggle-$n -text $caption -command [list toggle_subscription $sched $n]
+    grid .rc.toggle-$n -sticky w
+}
+
+
+proc relate {rel comp} {
+    global names
+    set n [sid::component::attribute_value $comp num-clients]
+    for {set i 0} {$i < $n} {incr i} {
+       if {[array get names $i] == {}} {
+           make_toggle $comp $i "pause subscription $i"
+       } else {
+           make_toggle $comp $i "pause $names($i)"
+       }
+    }
+    return ok
+}
+
+proc set_attribute_value {name value} {
+    global names
+    if {[regexp {^([0-9]+)-name$} $name zz num] != 0} {
+       set names($num) $value
+       return ok
+    } else {
+       return bad_value 
+    }
+}
+
+
+# basic stubs
+proc find_pin { name } { return "" }
+proc pin_names {} { return "" }
+proc connect_pin {name pin} { return not_found }
+proc disconnect_pin {name pin} { return not_found }
+proc connected_pins {name} { return "" }
+proc attribute_names_in_category {c} { return "" }
+proc attribute_names {} { return "" }
+proc bus_names {} { return "" }
+proc find_bus {b} { return "" }
+proc accessor_names {} { return "" }
+proc relationship_names {} { return "" }
+
+
+frame .rc
+pack .rc
+wm title . "scheduler controls"
+update