Version 1 of distributed linked bwise

Updated 2003-11-04 21:01:47

by Theo Verelst

I've made various pages on bwise:

This one precedes more general work on the idea of using bwise in a distributed way, which can basically go three ways:

  • cooperating multiple (distributed) bwise-es, for instance working on the same design in a distributed fashion
  • linked into one distrbuted bwises for one application, where each bwise, probably on a different machine, or with windows on different X servers (or window terminals clients)
  • controlling a application with one (or a few non-distributed) bwise window, consisting of various, possibly distributed, processes.

This page is about the second option, to begin with.

We make two bwises connect up, and take part in a chain of events, linked to blocks on both its' canvasses which extends from the one to the other.

I was able to use two machines in this setup, a linux machine running tcl/tk 8.4, and a windows XP running PC having the latest cygwin suite on it, and my self compiled unix-type wish8.4 which uses Xwindows (for instance on the cygwin supplied XFree86 running fine under XP, albeit a touch slow in certain ways, it starts either the 'normal' way using the startx script, or by itself using xwin (manual page XWin), then twm or as I do wmaker, and some xterms), while running on XP.

Since that unix-type tcl/tk runs fine under XP with Xwindows output, I direct its windows where it is confortable, for instance another X screen on the other machine, and make it run bwise, along with another bwise, running on linux. That makes two bwises appear on the same machine, while they run not on the same machine, but they can't talk together yet, unless we'd use the X server based send command, but that's not the target, this setup should interconnect bwises (or other programs) running on all machine kinds, as long as they run a fairly basic version of tcl/tk and have sockets.

The setup is more or less symmetrical, but I use an example where the one machine has a terminal like block, and sets up a server socket, while the other simply feeds the data to some blocks and returns the result, and actively connects.

 # This goes in the server side Bwise, after having loaded bwise
 # -------------------------------------------------------------
 global bcount scopeindex wireindex shellindex drumindex entrycount moncount proccount seqcount stackcount termindex textcount
 set bcount 0
 set scopeindex 0
 set wireindex 4
 set shellindex 0
 set drumindex 0
 set termindex 2
 .mw.c create rectangle 82.0 124.0 122.0 154.0 -activedash {} -activefill {} -activeoutline {} -activeoutlinestipple {} -activestipple {} -activewidth 0.0 -dash {} -dashoffset 0 -disableddash {} -disabledfill {} -disabledoutline {} -disabledoutlinestipple {} -disabledstipple {} -disabledwidth 0 -fill yellow -offset 0,0 -outline darkblue -outlineoffset 0,0 -outlinestipple {} -state {} -stipple {} -tags {from newblock block} -width 1.0
 .mw.c create text 102.0 154.0 -activefill {} -activestipple {} -anchor n -disabledfill {} -disabledstipple {} -fill darkblue -font {Helvetica -12} -justify left -offset 0,0 -state {} -stipple {} -tags {from crb label} -text from -width 0
 .mw.c create text 123.0 143.0 -activefill {} -activestipple {} -anchor sw -disabledfill {} -disabledstipple {} -fill black -font {Helvetica -12} -justify left -offset 0,0 -state {} -stipple {} -tags {from crb pinname data} -text data -width 0
 .mw.c create line 142.0 144.0 122.0 144.0 -activedash {} -activefill {} -activestipple {} -activewidth 0.0 -arrow none -arrowshape {8 10 3} -capstyle butt -fill darkblue -dash {} -dashoffset 0 -disableddash {} -disabledfill {} -disabledstipple {} -disabledwidth 0.0 -joinstyle round -offset 0,0 -smooth 0 -splinesteps 12 -state {} -stipple {} -tags {from newblock pin data typeout} -width 2.0
 .mw.c create rectangle 501.0 124.0 541.0 154.0 -activedash {} -activefill {} -activeoutline {} -activeoutlinestipple {} -activestipple {} -activewidth 0.0 -dash {} -dashoffset 0 -disableddash {} -disabledfill {} -disabledoutline {} -disabledoutlinestipple {} -disabledstipple {} -disabledwidth 0 -fill yellow -offset 0,0 -outline darkblue -outlineoffset 0,0 -outlinestipple {} -state {} -stipple {} -tags {to newblock block} -width 1.0
 .mw.c create text 521.0 154.0 -activefill {} -activestipple {} -anchor n -disabledfill {} -disabledstipple {} -fill darkblue -font {Helvetica -12} -justify left -offset 0,0 -state {} -stipple {} -tags {to crb label} -text to -width 0
 .mw.c create text 500.0 143.0 -activefill {} -activestipple {} -anchor se -disabledfill {} -disabledstipple {} -fill black -font {Helvetica -12} -justify left -offset 0,0 -state {} -stipple {} -tags {to crb pinname in} -text in -width 0
 .mw.c create line 481.0 144.0 501.0 144.0 -activedash {} -activefill {} -activestipple {} -activewidth 0.0 -arrow none -arrowshape {8 10 3} -capstyle butt -fill darkblue -dash {} -dashoffset 0 -disableddash {} -disabledfill {} -disabledstipple {} -disabledwidth 0.0 -joinstyle round -offset 0,0 -smooth 0 -splinesteps 12 -state {} -stipple {} -tags {to  newblock pin in typein} -width 2.0
 #
 # I replaced the standard bwise saved canvas data for the 'term'inal block (which is 
 # incomplete, still, te widgets don't get saved, with the new* call:
 newterm term1 {} 219.0 124.0
 #
 .mw.c create line 142.0 144.0 199.0 144.0 -activedash {} -activefill {} -activestipple {} -activewidth 0.0 -arrow none -arrowshape {8 10 3} -capstyle butt -fill darkblue -dash {} -dashoffset 0 -disableddash {} -disabledfill {} -disabledstipple {} -disabledwidth 0.0 -joinstyle round -offset 0,0 -smooth 0 -splinesteps 12 -state {} -stipple {} -tags {wire2 connect wire from data term1 in} -width 1.0
 .mw.c create line 481.0 144.0 439.0 144.0 -activedash {} -activefill {} -activestipple {} -activewidth 0.0 -arrow none -arrowshape {8 10 3} -capstyle butt -fill darkblue -dash {} -dashoffset 0 -disableddash {} -disabledfill {} -disabledstipple {} -disabledwidth 0.0 -joinstyle round -offset 0,0 -smooth 0 -splinesteps 12 -state {} -stipple {} -tags {wire3  connect wire to in term1 out} -width 1.0
 #
 # now the block related variables\n
 set from.bfunc {puts "from received: ${from.data}"}
 set from.bfunc_init {}
 set from.data {}
 set to.bfunc {puts $bwcons ${to.in} ; flush $bwcons}
 set to.bfunc_init {}
 set to.in {test 4}
 set to.out {test}
 set term1.bfunc {.mw.c.term1.t insert end  ${term1.in} tnavy; .mw.c.term1.t see end; .mw.c.term1.e selection range 0 end}
 set term1.bfunc_init {.mw.c.term1.t del 0.0 end}
 set term1.in {}
 set term1.out {test 4}
 set term1.trig {}
 #
 # The server procedure:
 proc bwcon { {s} {ip} {po} } {
    global bwcons
    set bwcons $s
    fileevent $bwcons readable {
       set from.data [gets $bwcons]
       net_funpropc from
    }
    puts "Bwise connected to $ip:$po (socket: $s)"
    set bwcons $s
 }