work on drawserv from 2/24/04 to 3/16/04

[email protected] Tue, 16 Mar 2004 11:05:07 -0800
Newsgroups gmane.comp.lib.ivtools.patches
Message-ID <[email protected]>
--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed

This is a single e-mail with 34 patch attachments.  This represent 34 
individual commits to the cvs server from 2/24/04 thru 3/16/04.  For 
the most part it represents the evolution of drawserv toward a 
peer-to-peer drawing chat program.  It does include one fix for the 
default -display argument introduced in ivtools-1.1.3.  Now this should 
work on Unix boxes that disallow localhost, and thru ssh X forwarding.

Scott Johnston





--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040226-johnston-013"
Content-Disposition: attachment;
	filename=ivtools-040226-johnston-013

Patch:    ivtools-040226-johnston-013
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  patch to propogate drawserv development via cvs
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

- patch to propogate drawserv development via cvs

Index: DrawServ/Imakefile
diff -c DrawServ/Imakefile:1.3 DrawServ/Imakefile:1.4
*** DrawServ/Imakefile:1.3	Wed Feb 18 09:29:27 2004
--- src/DrawServ/Imakefile	Thu Feb 26 10:51:27 2004
***************
*** 24,29 ****
--- 24,31 ----
  Obj26(drawcomps)
  Obj26(draweditor)
  Obj26A(drawfunc)
+ Obj26A(drawlink)
+ Obj26(drawlinklist)
  Obj26(drawserv)
  Obj26(drawviews)
  
Index: DrawServ/draweditor.c
diff -c DrawServ/draweditor.c:1.1 DrawServ/draweditor.c:1.2
*** DrawServ/draweditor.c:1.1	Thu Feb 12 13:27:07 2004
--- src/DrawServ/draweditor.c	Thu Feb 26 10:51:27 2004
***************
*** 83,88 ****
  void DrawEditor::AddCommands(ComTerp* comterp) {
    FrameEditor::AddCommands(comterp);
  
!   comterp->add_command("drawserv", new DrawServFunc(comterp, this));
  }
  
--- 83,88 ----
  void DrawEditor::AddCommands(ComTerp* comterp) {
    FrameEditor::AddCommands(comterp);
  
!   comterp->add_command("drawlink", new DrawLinkFunc(comterp, this));
  }
  
Index: DrawServ/drawfunc.c
diff -c DrawServ/drawfunc.c:1.2 DrawServ/drawfunc.c:1.3
*** DrawServ/drawfunc.c:1.2	Wed Feb 18 09:29:27 2004
--- src/DrawServ/drawfunc.c	Thu Feb 26 10:51:27 2004
***************
*** 28,42 ****
  
  #include <DrawServ/draweditor.h>
  #include <DrawServ/drawfunc.h>
  
! #define TITLE "DrawServFunc"
  
  /*****************************************************************************/
  
! DrawServFunc::DrawServFunc(ComTerp* comterp, DrawEditor* ed) : UnidrawFunc(comterp, ed) {
  }
  
! void DrawServFunc::execute() {
  #ifndef HAVE_ACE
  
    reset_stack();
--- 28,43 ----
  
  #include <DrawServ/draweditor.h>
  #include <DrawServ/drawfunc.h>
+ #include <DrawServ/drawserv.h>
  
! #define TITLE "DrawLinkFunc"
  
  /*****************************************************************************/
  
! DrawLinkFunc::DrawLinkFunc(ComTerp* comterp, DrawEditor* ed) : UnidrawFunc(comterp, ed) {
  }
  
! void DrawLinkFunc::execute() {
  #ifndef HAVE_ACE
  
    reset_stack();
***************
*** 58,80 ****
  #endif
  
    if (hostv.is_string() && portv.is_known()) {
! 
      const char* hoststr = hostv.string_ptr();
      const char* portstr = portv.is_string() ? portv.string_ptr() : nil;
      u_short portnum = portstr ? atoi(portstr) : portv.ushort_val();
-     ACE_INET_Addr addr (portnum, hoststr);
-     ACE_SOCK_Stream socket;
-     ACE_SOCK_Connector conn;
-     if (conn.connect (socket, addr) == -1) {
-       ACE_ERROR ((LM_ERROR, "%p\n", "open"));
-       push_stack(ComValue::nullval());
-       return;
-     }
  
!     if (socket.close () == -1)
!         ACE_ERROR ((LM_ERROR, "%p\n", "close"));
! 
!     push_stack(ComValue::zeroval());
    } 
      
    return;
--- 59,73 ----
  #endif
  
    if (hostv.is_string() && portv.is_known()) {
!     
      const char* hoststr = hostv.string_ptr();
      const char* portstr = portv.is_string() ? portv.string_ptr() : nil;
      u_short portnum = portstr ? atoi(portstr) : portv.ushort_val();
  
!     if (((DrawServ*)unidraw)->linkup(hoststr, portnum))
!       push_stack(ComValue::minusoneval());
!     else
!       push_stack(ComValue::zeroval());
    } 
      
    return;
***************
*** 82,85 ****
  #endif
  
  }
- 
--- 75,77 ----
Index: DrawServ/drawfunc.h
diff -c DrawServ/drawfunc.h:1.1 DrawServ/drawfunc.h:1.2
*** DrawServ/drawfunc.h:1.1	Thu Feb 12 13:27:07 2004
--- src/DrawServ/drawfunc.h	Thu Feb 26 10:51:27 2004
***************
*** 28,37 ****
  #include <ComUnidraw/unifunc.h>
  
  //: command to connect to another drawserv
! // drawserv(hoststr :port portnum) -- connect to remote drawserv
! class DrawServFunc : public UnidrawFunc {
  public:
!     DrawServFunc(ComTerp*,DrawEditor*);
      virtual void execute();
      virtual const char* docstring() { 
  	return "%s(hoststr :port portnum) -- connect to remote drawserv"; }
--- 28,37 ----
  #include <ComUnidraw/unifunc.h>
  
  //: command to connect to another drawserv
! // drawlink(hoststr :port portnum) -- connect to remote drawserv
! class DrawLinkFunc : public UnidrawFunc {
  public:
!     DrawLinkFunc(ComTerp*,DrawEditor*);
      virtual void execute();
      virtual const char* docstring() { 
  	return "%s(hoststr :port portnum) -- connect to remote drawserv"; }
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.1 DrawServ/drawserv.c:1.2
*** DrawServ/drawserv.c:1.1	Thu Feb 12 13:27:07 2004
--- src/DrawServ/drawserv.c	Thu Feb 26 10:51:27 2004
***************
*** 25,42 ****
--- 25,64 ----
   * Implementation of DrawServ class.
   */
  
+ #include <DrawServ/drawlink.h>
+ #include <DrawServ/drawlinklist.h>
  #include <DrawServ/drawserv.h>
+ 
+ #include <Unidraw/iterator.h>
+ #include <Unidraw/ulist.h>
  /*****************************************************************************/
  
  DrawServ::DrawServ (Catalog* c, int& argc, char** argv, 
  		    OptionDesc* od, PropertyData* pd) 
  : OverlayUnidraw(c, argc, argv, od, pd) {
+   Init();
  }
  
  DrawServ::DrawServ (Catalog* c, World* w) 
  : OverlayUnidraw(c, w) {
+   Init();
+ }
+ 
+ void DrawServ::Init() {
+   _list = new DrawLinkList;
  }
  
  DrawServ::~DrawServ () 
  {
+ }
+ 
+ int DrawServ::linkup(const char* hostname, int portnum) {
+   DrawLink* link = new DrawLink(hostname, portnum);
+   if (link && link->up()) {
+     _list->add_drawlink(link);
+     return 0;
+   } else {
+     delete link;
+     return -1;
+   }
  }
Index: DrawServ/drawserv.h
diff -c DrawServ/drawserv.h:1.1 DrawServ/drawserv.h:1.2
*** DrawServ/drawserv.h:1.1	Thu Feb 12 13:27:07 2004
--- src/DrawServ/drawserv.h	Thu Feb 26 10:51:27 2004
***************
*** 32,37 ****
--- 32,40 ----
  //: Unidraw specialized for DrawServ
  // Unidraw (OverlayUnidraw) specialized for DrawServ application.
  // Networked application of the Unidraw framework.
+ 
+ class DrawLinkList;
+ 
  class DrawServ : public OverlayUnidraw {
  public:
      DrawServ(
***************
*** 41,47 ****
--- 44,56 ----
      DrawServ(Catalog*, World*);
      virtual ~DrawServ();
  
+     void Init();
+ 
+     int linkup(const char* hostname, int portnum);
+     // create new link to remote drawserv, return -1 if error
+ 
  protected:
+     DrawLinkList* _list;
  };
  
  #endif
Index: top_ivtools/MANIFEST
diff -c top_ivtools/MANIFEST:1.3 top_ivtools/MANIFEST:1.4
*** top_ivtools/MANIFEST:1.3	Thu Feb 12 13:26:51 2004
--- ./MANIFEST	Thu Feb 26 10:50:58 2004
***************
*** 287,292 ****
--- 287,296 ----
  ivtools-1.1/src/DrawServ/drawfunc.h
  ivtools-1.1/src/DrawServ/drawkit.c
  ivtools-1.1/src/DrawServ/drawkit.h
+ ivtools-1.1/src/DrawServ/drawlink.c
+ ivtools-1.1/src/DrawServ/drawlink.h
+ ivtools-1.1/src/DrawServ/drawlinklist.c
+ ivtools-1.1/src/DrawServ/drawlinklist.h
  ivtools-1.1/src/DrawServ/drawserv.c
  ivtools-1.1/src/DrawServ/drawserv.h
  ivtools-1.1/src/DrawServ/drawviews.c
***************
*** 1387,1393 ****
  ivtools-1.1/src/include/InterViews/printer.h
  ivtools-1.1/src/include/InterViews/psfont.h
  ivtools-1.1/src/include/InterViews/raster.h
! ivtools-1.1/src/include/InterViews/regexp.h
  ivtools-1.1/src/include/InterViews/reqerr.h
  ivtools-1.1/src/include/InterViews/resource.h
  ivtools-1.1/src/include/InterViews/rule.h
--- 1391,1397 ----
  ivtools-1.1/src/include/InterViews/printer.h
  ivtools-1.1/src/include/InterViews/psfont.h
  ivtools-1.1/src/include/InterViews/raster.h
! ivtools-1.1/src/include/InterViews/regexpo.h
  ivtools-1.1/src/include/InterViews/reqerr.h
  ivtools-1.1/src/include/InterViews/resource.h
  ivtools-1.1/src/include/InterViews/rule.h
Index: top_ivtools/MANIFEST.perceps
diff -c top_ivtools/MANIFEST.perceps:1.2 top_ivtools/MANIFEST.perceps:1.3
*** top_ivtools/MANIFEST.perceps:1.2	Thu Feb 12 13:26:52 2004
--- ./MANIFEST.perceps	Thu Feb 26 10:50:58 2004
***************
*** 72,77 ****
--- 72,79 ----
  DrawServ/draweditor.h
  DrawServ/drawfunc.h
  DrawServ/drawkit.h
+ DrawServ/drawlink.h
+ DrawServ/drawlinklist.h
  DrawServ/drawserv.h
  DrawServ/drawviews.h
  FrameUnidraw/framecatalog.h
*** /dev/null	 Thu Feb 26 10:51:41 PST 2004
--- patches/ivtools-040226-johnston-013
*************** patches/ivtools-040226-johnston-013
*** 0 ****
--- 1 ----
+ ivtools-040226-johnston-013

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040226-johnston-014"
Content-Disposition: attachment;
	filename=ivtools-040226-johnston-014

Patch:    ivtools-040226-johnston-014
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  patch to propogate drawserv development via cvs
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

- patch to propogate drawserv development via cvs

Index: DrawServ/drawlink.c
diff -c /dev/null DrawServ/drawlink.c:1.1
*** /dev/null	Thu Feb 26 10:54:56 2004
--- src/DrawServ/drawlink.c	Thu Feb 26 10:54:54 2004
***************
*** 0 ****
--- 1,78 ----
+ /*
+  * Copyright (c) 2004 Scott E. Johnston
+  *
+  * Permission to use, copy, modify, distribute, and sell this software and
+  * its documentation for any purpose is hereby granted without fee, provided
+  * that the above copyright notice appear in all copies and that both that
+  * copyright notice and this permission notice appear in supporting
+  * documentation, and that the names of the copyright holders not be used in
+  * advertising or publicity pertaining to distribution of the software
+  * without specific, written prior permission.  The copyright holders make
+  * no representations about the suitability of this software for any purpose.
+  * It is provided "as is" without express or implied warranty.
+  *
+  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL,
+  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  * 
+  */
+ 
+ /*
+  * Implementation of Drawlink class.
+  */
+ 
+ #include <DrawServ/drawlink.h>
+ #include <Unidraw/globals.h>
+ #include <fstream.h>
+ #include <unistd.h>
+ 
+ /*****************************************************************************/
+ 
+ DrawLink::DrawLink (const char* hostname, int portnum)
+ {
+   _host = strnew(hostname);
+   _port = portnum;
+   _up = false;
+ 
+   _addr = nil;
+   _socket = nil;
+   _conn = nil;
+ 
+ #if defined(HAVE_ACE) && (__GNUC__>3 || __GNUC__==3 && __GNUC_MINOR__>0)
+   _addr = new ACE_INET_Addr(portnum, hostname);
+   _socket = new ACE_SOCK_Stream;
+   _conn = new ACE_SOCK_Connector;
+   if (_conn->connect (*_socket, *_addr) == -1)
+     ACE_ERROR ((LM_ERROR, "%p\n", "open"));
+   else {
+ 
+     fileptr_filebuf obuf(_socket->get_handle(), ios_base::out, false, static_cast<size_t>(BUFSIZ));
+     ostream out(&obuf);
+     out << "drawlink(\"";
+     char buffer[HOST_NAME_MAX];
+     gethostname(buffer, HOST_NAME_MAX);
+     out << buffer;
+     out << "\")\n";
+     out.flush();
+     _up = true;
+   }
+ #else
+   fprintf(stderr, "drawserv requires ACE and >= gcc-3.1 for full functionality\n");
+ #endif
+ }
+ 
+ DrawLink::~DrawLink () 
+ {
+ #ifdef HAVE_ACE
+     if (_socket->close () == -1)
+         ACE_ERROR ((LM_ERROR, "%p\n", "close"));
+     delete _conn;
+     delete _socket;
+     delete _addr;
+     delete _host;
+ #endif
+ }
Index: DrawServ/drawlink.h
diff -c /dev/null DrawServ/drawlink.h:1.1
*** /dev/null	Thu Feb 26 10:54:56 2004
--- src/DrawServ/drawlink.h	Thu Feb 26 10:54:54 2004
***************
*** 0 ****
--- 1,68 ----
+ /*
+  * Copyright (c) 2004 Scott E. Johnston
+  *
+  * Permission to use, copy, modify, distribute, and sell this software and
+  * its documentation for any purpose is hereby granted without fee, provided
+  * that the above copyright notice appear in all copies and that both that
+  * copyright notice and this permission notice appear in supporting
+  * documentation, and that the names of the copyright holders not be used in
+  * advertising or publicity pertaining to distribution of the software
+  * without specific, written prior permission.  The copyright holders make
+  * no representations about the suitability of this software for any purpose.
+  * It is provided "as is" without express or implied warranty.
+  *
+  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL,
+  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  * 
+  */
+ 
+ /*
+  * DrawLink - object to encapsulate 2-way link with remote drawserv
+  */
+ #ifndef drawlink_h
+ #define drawlink_h
+ 
+ class DrawServ;
+ 
+ #ifdef HAVE_ACE
+ #include <ComTerp/comhandler.h>
+ #include <ace/SOCK_Connector.h>
+ 
+ class ACE_INET_Addr;
+ class ACE_SOCK_Stream;
+ class ACE_SOCK_Stream;
+ #endif
+ 
+ //: object to encapsulate 2-way link with remote drawserv
+ class DrawLink {
+ public:
+     DrawLink(const char* hostname, int portnum);
+     virtual ~DrawLink();
+ 
+     const char* hostname() { return _host; }
+     // return name of remote host
+ 
+     int portnum() { return _port; }
+     // return port on remote host
+ 
+     int up() { return _up; }
+     // return 1 if link up, 0 if down
+ 
+ protected:
+     const char* _host;
+     int _port;
+     int _up;
+ 
+ #ifdef HAVE_ACE
+     ACE_INET_Addr* _addr;
+     ACE_SOCK_Connector* _conn;
+     ACE_SOCK_Stream* _socket;
+ #endif
+ };
+ 
+ #endif
Index: DrawServ/drawlinklist.c
diff -c /dev/null DrawServ/drawlinklist.c:1.1
*** /dev/null	Thu Feb 26 10:54:56 2004
--- src/DrawServ/drawlinklist.c	Thu Feb 26 10:54:54 2004
***************
*** 0 ****
--- 1,120 ----
+ /*
+  * Copyright (c) 2004 Scott E. Johnston
+  *
+  * Permission to use, copy, modify, distribute, and sell this software and
+  * its documentation for any purpose is hereby granted without fee, provided
+  * that the above copyright notice appear in all copies and that both that
+  * copyright notice and this permission notice appear in supporting
+  * documentation, and that the names of the copyright holders not be used in
+  * advertising or publicity pertaining to distribution of the software
+  * without specific, written prior permission.  The copyright holders make
+  * no representations about the suitability of this software for any purpose.
+  * It is provided "as is" without express or implied warranty.
+  *
+  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL,
+  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  * 
+  */
+ 
+ /*
+  * Implementation of DrawLinkList class.
+  */
+ 
+ #include <DrawServ/drawlink.h>
+ #include <DrawServ/drawlinklist.h>
+ #include <Unidraw/iterator.h>
+ #include <Unidraw/ulist.h>
+ /*****************************************************************************/
+ 
+ DrawLinkList::DrawLinkList() 
+ {
+   _ulist = new UList;
+   _count = 0;
+ }
+ 
+ DrawLinkList::~DrawLinkList () 
+ {
+   if (_ulist) {
+     Iterator i;
+     for (First(i); !Done(i); Next(i)) {
+       delete GetDrawLink(i);
+     }
+     delete _ulist; 
+   }
+ }
+ 
+ 
+ void DrawLinkList::add_drawlink(DrawLink* new_link) {
+   Iterator i;
+   First(i);
+   InsertBefore(i, new_link);
+ }
+ 
+ DrawLink* DrawLinkList::Link (UList* r) {
+     return (DrawLink*) (*r)();
+ }
+ 
+ UList* DrawLinkList::Elem (Iterator i) { return (UList*) i.GetValue(); }
+ 
+ void DrawLinkList::Append (DrawLink* v) {
+     _ulist->Append(new UList(v));
+     ++_count;
+ }
+ 
+ void DrawLinkList::Prepend (DrawLink* v) {
+     _ulist->Prepend(new UList(v));
+     ++_count;
+ }
+ 
+ void DrawLinkList::InsertAfter (Iterator i, DrawLink* v) {
+     Elem(i)->Prepend(new UList(v));
+     ++_count;
+ }
+ 
+ void DrawLinkList::InsertBefore (Iterator i, DrawLink* v) {
+     Elem(i)->Append(new UList(v));
+     ++_count;
+ }
+ 
+ void DrawLinkList::Remove (Iterator& i) {
+     UList* doomed = Elem(i);
+ 
+     Next(i);
+     _ulist->Remove(doomed);
+     delete doomed;
+     --_count;
+ }	
+     
+ void DrawLinkList::Remove (DrawLink* p) {
+     UList* temp;
+ 
+     if ((temp = _ulist->Find(p)) != nil) {
+ 	_ulist->Remove(temp);
+         delete temp;
+ 	--_count;
+     }
+ }
+ 
+ DrawLink* DrawLinkList::GetDrawLink (Iterator i) { return Link(Elem(i)); }
+ 
+ void DrawLinkList::SetDrawLink (DrawLink* gv, Iterator& i) {
+     i.SetValue(_ulist->Find(gv));
+ }
+ 
+ void DrawLinkList::First (Iterator& i) { i.SetValue(_ulist->First()); }
+ void DrawLinkList::Last (Iterator& i) { i.SetValue(_ulist->Last()); }
+ void DrawLinkList::Next (Iterator& i) { i.SetValue(Elem(i)->Next()); }
+ void DrawLinkList::Prev (Iterator& i) { i.SetValue(Elem(i)->Prev()); }
+ boolean DrawLinkList::Done (Iterator i) { return Elem(i) == _ulist->End(); }
+ int DrawLinkList::Number () { return _count; }
+ 
+ boolean DrawLinkList::Includes (DrawLink* e) {
+     return _ulist->Find(e) != nil;
+ }
+ 
+ boolean DrawLinkList::IsEmpty () { return _ulist->IsEmpty(); }
Index: DrawServ/drawlinklist.h
diff -c /dev/null DrawServ/drawlinklist.h:1.1
*** /dev/null	Thu Feb 26 10:54:56 2004
--- src/DrawServ/drawlinklist.h	Thu Feb 26 10:54:54 2004
***************
*** 0 ****
--- 1,96 ----
+ /*
+  * Copyright (c) 2004 Scott E. Johnston
+  *
+  * Permission to use, copy, modify, distribute, and sell this software and
+  * its documentation for any purpose is hereby granted without fee, provided
+  * that the above copyright notice appear in all copies and that both that
+  * copyright notice and this permission notice appear in supporting
+  * documentation, and that the names of the copyright holders not be used in
+  * advertising or publicity pertaining to distribution of the software
+  * without specific, written prior permission.  The copyright holders make
+  * no representations about the suitability of this software for any purpose.
+  * It is provided "as is" without express or implied warranty.
+  *
+  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL,
+  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  * 
+  */
+ 
+ /*
+  * DrawLinkList - a UList based list of DrawLink's
+  */
+ #ifndef drawlinklist_h
+ #define drawlinklist_h
+ 
+ 
+ //: UList based list of DrawLink's
+ 
+ #include <Unidraw/globals.h>
+ 
+ class Iterator;
+ class UList;
+ 
+ class DrawLinkList {
+ public:
+     DrawLinkList();
+     virtual ~DrawLinkList();
+ 
+     void add_drawlink(DrawLink*);
+     // add DrawLink to list
+ 
+     void First(Iterator&);
+     // set iterator to point to first DrawLink in list.
+     void Last(Iterator&);
+     // set iterator to point to last DrawLink in list.
+     void Next(Iterator&);
+     // set iterator to point to next DrawLink in list.
+     void Prev(Iterator&);
+     // set iterator to point to previous DrawLink in list.
+     boolean Done(Iterator);
+     // return true if iterator is pointing off the end of the list.
+     // works for forward and backward traversals.
+     boolean IsEmpty();
+     // true if no DrawLink objects in list.
+     int Number();
+     // number of DrawLink objects in list.
+ 
+     void Append(DrawLink*);
+     // append DrawLink to end of list.
+     void Prepend(DrawLink*);
+     // append DrawLink to front of list.
+     void InsertAfter(Iterator, DrawLink*);
+     // insert DrawLink after position pointed to by iterator.
+     void InsertBefore(Iterator, DrawLink*);
+     // insert DrawLink before position pointed to by iterator.
+     void Remove(DrawLink*);
+     // remove DrawLink from list, returning responsibility for freeing the
+     // associated memory.
+ 
+     DrawLink* GetDrawLink(Iterator);
+     // get DrawLink pointed to by iterator.
+     void SetDrawLink(DrawLink*, Iterator&);
+     // set DrawLink pointed to by iterator.
+     boolean Includes(DrawLink*);
+     // check if list includes DrawLink by pointer-comparison.
+ 
+     UList* Elem(Iterator); 
+     // return UList (UList) pointed to by Iterator (Iterator).
+     DrawLink* Link(UList*);
+     // return DrawLink pointed to by UList (UList).
+ 
+ protected:
+     void Remove(Iterator&);
+     // remove DrawLink pointed to by iterator from the list, 
+     // returning responsibility for freeing the associated memory.
+     // This requires saving a pointer to the DrawLink before calling this method.
+ 
+     UList* _ulist;
+     unsigned int _count;
+ };
+ 
+ #endif
*** /dev/null	 Thu Feb 26 10:55:01 PST 2004
--- patches/ivtools-040226-johnston-014
*************** patches/ivtools-040226-johnston-014
*** 0 ****
--- 1 ----
+ ivtools-040226-johnston-014

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040226-johnston-015"
Content-Disposition: attachment;
	filename=ivtools-040226-johnston-015

Patch:    ivtools-040226-johnston-015
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  patch to propogate drawserv development via cvs
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

- patch to propogate drawserv development via cvs

Index: DrawServ/drawfunc.c
diff -c DrawServ/drawfunc.c:1.3 DrawServ/drawfunc.c:1.4
*** DrawServ/drawfunc.c:1.3	Thu Feb 26 10:51:27 2004
--- src/DrawServ/drawfunc.c	Thu Feb 26 12:14:12 2004
***************
*** 50,55 ****
--- 50,58 ----
    static int port_sym = symbol_add("port");
    ComValue default_port(20002);
    ComValue portv(stack_key(port_sym, false, default_port, true));
+   static int state_sym = symbol_add("state");
+   ComValue default_state(20002);
+   ComValue statev(stack_key(state_sym, false, default_state, true));
    reset_stack();
  
  #if __GNUC__==3&&__GNUC_MINOR__<1
***************
*** 58,70 ****
    return;
  #endif
  
!   if (hostv.is_string() && portv.is_known()) {
      
      const char* hoststr = hostv.string_ptr();
      const char* portstr = portv.is_string() ? portv.string_ptr() : nil;
      u_short portnum = portstr ? atoi(portstr) : portv.ushort_val();
  
!     if (((DrawServ*)unidraw)->linkup(hoststr, portnum))
        push_stack(ComValue::minusoneval());
      else
        push_stack(ComValue::zeroval());
--- 61,75 ----
    return;
  #endif
  
!   if (hostv.is_string() && portv.is_known() && statev.is_known()) {
      
      const char* hoststr = hostv.string_ptr();
      const char* portstr = portv.is_string() ? portv.string_ptr() : nil;
      u_short portnum = portstr ? atoi(portstr) : portv.ushort_val();
+     const char* statestr = statev.is_string() ? statev.string_ptr() : nil;
+     u_short statenum = statestr ? atoi(statestr) : statev.ushort_val();
  
!     if (((DrawServ*)unidraw)->linkup(hoststr, portnum, statenum))
        push_stack(ComValue::minusoneval());
      else
        push_stack(ComValue::zeroval());
Index: DrawServ/drawlink.c
diff -c DrawServ/drawlink.c:1.1 DrawServ/drawlink.c:1.2
*** DrawServ/drawlink.c:1.1	Thu Feb 26 10:54:54 2004
--- src/DrawServ/drawlink.c	Thu Feb 26 12:14:12 2004
***************
*** 32,38 ****
  
  /*****************************************************************************/
  
! DrawLink::DrawLink (const char* hostname, int portnum)
  {
    _host = strnew(hostname);
    _port = portnum;
--- 32,38 ----
  
  /*****************************************************************************/
  
! DrawLink::DrawLink (const char* hostname, int portnum, int state)
  {
    _host = strnew(hostname);
    _port = portnum;
***************
*** 49,62 ****
    if (_conn->connect (*_socket, *_addr) == -1)
      ACE_ERROR ((LM_ERROR, "%p\n", "open"));
    else {
- 
      fileptr_filebuf obuf(_socket->get_handle(), ios_base::out, false, static_cast<size_t>(BUFSIZ));
      ostream out(&obuf);
      out << "drawlink(\"";
      char buffer[HOST_NAME_MAX];
      gethostname(buffer, HOST_NAME_MAX);
!     out << buffer;
!     out << "\")\n";
      out.flush();
      _up = true;
    }
--- 49,62 ----
    if (_conn->connect (*_socket, *_addr) == -1)
      ACE_ERROR ((LM_ERROR, "%p\n", "open"));
    else {
      fileptr_filebuf obuf(_socket->get_handle(), ios_base::out, false, static_cast<size_t>(BUFSIZ));
      ostream out(&obuf);
      out << "drawlink(\"";
      char buffer[HOST_NAME_MAX];
      gethostname(buffer, HOST_NAME_MAX);
!     out << buffer << "\"";
!     out << " :state " << state+1;
!     out << ")\n";
      out.flush();
      _up = true;
    }
Index: DrawServ/drawlink.h
diff -c DrawServ/drawlink.h:1.1 DrawServ/drawlink.h:1.2
*** DrawServ/drawlink.h:1.1	Thu Feb 26 10:54:54 2004
--- src/DrawServ/drawlink.h	Thu Feb 26 12:14:12 2004
***************
*** 41,48 ****
  //: object to encapsulate 2-way link with remote drawserv
  class DrawLink {
  public:
!     DrawLink(const char* hostname, int portnum);
      virtual ~DrawLink();
  
      const char* hostname() { return _host; }
      // return name of remote host
--- 41,50 ----
  //: object to encapsulate 2-way link with remote drawserv
  class DrawLink {
  public:
!     DrawLink(const char* hostname, int portnum, int state);
      virtual ~DrawLink();
+ 
+     enum { new_link=0, half_duplex, full_duplex };
  
      const char* hostname() { return _host; }
      // return name of remote host
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.2 DrawServ/drawserv.c:1.3
*** DrawServ/drawserv.c:1.2	Thu Feb 26 10:51:27 2004
--- src/DrawServ/drawserv.c	Thu Feb 26 12:14:12 2004
***************
*** 52,64 ****
  {
  }
  
! int DrawServ::linkup(const char* hostname, int portnum) {
!   DrawLink* link = new DrawLink(hostname, portnum);
!   if (link && link->up()) {
!     _list->add_drawlink(link);
!     return 0;
    } else {
!     delete link;
!     return -1;
    }
  }
--- 52,68 ----
  {
  }
  
! int DrawServ::linkup(const char* hostname, int portnum, int state) {
!   if (state == DrawLink::new_link || state == DrawLink::half_duplex) {
!     DrawLink* link = new DrawLink(hostname, portnum, state);
!     if (link && link->up()) {
!       _list->add_drawlink(link);
!       return 0;
!     } else {
!       delete link;
!       return -1;
!     }
    } else {
!     fprintf(stderr, "link up\n");
    }
  }
Index: DrawServ/drawserv.h
diff -c DrawServ/drawserv.h:1.2 DrawServ/drawserv.h:1.3
*** DrawServ/drawserv.h:1.2	Thu Feb 26 10:51:27 2004
--- src/DrawServ/drawserv.h	Thu Feb 26 12:14:12 2004
***************
*** 46,53 ****
  
      void Init();
  
!     int linkup(const char* hostname, int portnum);
      // create new link to remote drawserv, return -1 if error
  
  protected:
      DrawLinkList* _list;
--- 46,54 ----
  
      void Init();
  
!     int linkup(const char* hostname, int portnum, int state);
      // create new link to remote drawserv, return -1 if error
+     // state: 0==new link, 1==half-duplex, 2==full-duplex
  
  protected:
      DrawLinkList* _list;
*** /dev/null	 Thu Feb 26 12:14:25 PST 2004
--- patches/ivtools-040226-johnston-015
*************** patches/ivtools-040226-johnston-015
*** 0 ****
--- 1 ----
+ ivtools-040226-johnston-015

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040226-johnston-016"
Content-Disposition: attachment;
	filename=ivtools-040226-johnston-016

Patch:    ivtools-040226-johnston-016
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  patch to propogate drawserv development via cvs
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

- patch to propogate drawserv development via cvs

Index: DrawServ/drawfunc.c
diff -c DrawServ/drawfunc.c:1.4 DrawServ/drawfunc.c:1.5
*** DrawServ/drawfunc.c:1.4	Thu Feb 26 12:14:12 2004
--- src/DrawServ/drawfunc.c	Thu Feb 26 12:16:52 2004
***************
*** 51,57 ****
    ComValue default_port(20002);
    ComValue portv(stack_key(port_sym, false, default_port, true));
    static int state_sym = symbol_add("state");
!   ComValue default_state(20002);
    ComValue statev(stack_key(state_sym, false, default_state, true));
    reset_stack();
  
--- 51,57 ----
    ComValue default_port(20002);
    ComValue portv(stack_key(port_sym, false, default_port, true));
    static int state_sym = symbol_add("state");
!   ComValue default_state(0);
    ComValue statev(stack_key(state_sym, false, default_state, true));
    reset_stack();
  
*** /dev/null	 Thu Feb 26 12:16:59 PST 2004
--- patches/ivtools-040226-johnston-016
*************** patches/ivtools-040226-johnston-016
*** 0 ****
--- 1 ----
+ ivtools-040226-johnston-016

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040226-johnston-017"
Content-Disposition: attachment;
	filename=ivtools-040226-johnston-017

Patch:    ivtools-040226-johnston-017
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  patch to propogate drawserv development via cvs
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

- patch to propogate drawserv development via cvs

Index: DrawServ/drawfunc.c
diff -c DrawServ/drawfunc.c:1.5 DrawServ/drawfunc.c:1.6
*** DrawServ/drawfunc.c:1.5	Thu Feb 26 12:16:52 2004
--- src/DrawServ/drawfunc.c	Thu Feb 26 13:24:17 2004
***************
*** 21,31 ****
   * 
   */
  
- #ifdef HAVE_ACE
- #include <ComTerp/comhandler.h>
- #include <ace/SOCK_Connector.h>
- #endif
- 
  #include <DrawServ/draweditor.h>
  #include <DrawServ/drawfunc.h>
  #include <DrawServ/drawserv.h>
--- 21,26 ----
***************
*** 53,58 ****
--- 48,57 ----
    static int state_sym = symbol_add("state");
    ComValue default_state(0);
    ComValue statev(stack_key(state_sym, false, default_state, true));
+   static int lid_sym = symbol_add("lid");
+   ComValue lidv(stack_key(lid_sym));
+   static int rid_sym = symbol_add("rid");
+   ComValue ridv(stack_key(rid_sym));
    reset_stack();
  
  #if __GNUC__==3&&__GNUC_MINOR__<1
***************
*** 66,75 ****
      const char* hoststr = hostv.string_ptr();
      const char* portstr = portv.is_string() ? portv.string_ptr() : nil;
      u_short portnum = portstr ? atoi(portstr) : portv.ushort_val();
!     const char* statestr = statev.is_string() ? statev.string_ptr() : nil;
!     u_short statenum = statestr ? atoi(statestr) : statev.ushort_val();
  
!     if (((DrawServ*)unidraw)->linkup(hoststr, portnum, statenum))
        push_stack(ComValue::minusoneval());
      else
        push_stack(ComValue::zeroval());
--- 65,75 ----
      const char* hoststr = hostv.string_ptr();
      const char* portstr = portv.is_string() ? portv.string_ptr() : nil;
      u_short portnum = portstr ? atoi(portstr) : portv.ushort_val();
!     u_short statenum = statev.ushort_val();
!     int lidnum = lidv.is_known() ? lidv.int_val() : -1;
!     int ridnum = ridv.is_known() ? ridv.int_val() : -1;
  
!     if (((DrawServ*)unidraw)->linkup(hoststr, portnum, statenum, lidnum, ridnum))
        push_stack(ComValue::minusoneval());
      else
        push_stack(ComValue::zeroval());
Index: DrawServ/drawlink.c
diff -c DrawServ/drawlink.c:1.2 DrawServ/drawlink.c:1.3
*** DrawServ/drawlink.c:1.2	Thu Feb 26 12:14:12 2004
--- src/DrawServ/drawlink.c	Thu Feb 26 13:24:17 2004
***************
*** 30,42 ****
  #include <fstream.h>
  #include <unistd.h>
  
  /*****************************************************************************/
  
  DrawLink::DrawLink (const char* hostname, int portnum, int state)
  {
    _host = strnew(hostname);
    _port = portnum;
!   _up = false;
  
    _addr = nil;
    _socket = nil;
--- 30,47 ----
  #include <fstream.h>
  #include <unistd.h>
  
+ static int DrawLink::_linkcnt = 0;
+ 
  /*****************************************************************************/
  
  DrawLink::DrawLink (const char* hostname, int portnum, int state)
  {
    _host = strnew(hostname);
+   _althost = nil;
    _port = portnum;
!   _ok = false;
!   _local_linkid = _linkcnt++;
!   _remote_linkid = -1;
  
    _addr = nil;
    _socket = nil;
***************
*** 56,64 ****
      gethostname(buffer, HOST_NAME_MAX);
      out << buffer << "\"";
      out << " :state " << state+1;
      out << ")\n";
      out.flush();
!     _up = true;
    }
  #else
    fprintf(stderr, "drawserv requires ACE and >= gcc-3.1 for full functionality\n");
--- 61,70 ----
      gethostname(buffer, HOST_NAME_MAX);
      out << buffer << "\"";
      out << " :state " << state+1;
+     out << " :id " << _local_linkid;
      out << ")\n";
      out.flush();
!     _ok = true;
    }
  #else
    fprintf(stderr, "drawserv requires ACE and >= gcc-3.1 for full functionality\n");
***************
*** 74,78 ****
--- 80,98 ----
      delete _socket;
      delete _addr;
      delete _host;
+     delete _althost;
  #endif
  }
+ 
+ void DrawLink::hostname(const char* host) {
+   delete _host;
+   _host = nil;
+   if (host) _host = strnew(host);
+ }
+ 
+ void DrawLink::althostname(const char* althost) {
+   delete _althost;
+   _althost = nil;
+   if (althost) _althost = strnew(althost);
+ }
+ 
Index: DrawServ/drawlink.h
diff -c DrawServ/drawlink.h:1.2 DrawServ/drawlink.h:1.3
*** DrawServ/drawlink.h:1.2	Thu Feb 26 12:14:12 2004
--- src/DrawServ/drawlink.h	Thu Feb 26 13:24:17 2004
***************
*** 44,64 ****
      DrawLink(const char* hostname, int portnum, int state);
      virtual ~DrawLink();
  
!     enum { new_link=0, half_duplex, full_duplex };
  
      const char* hostname() { return _host; }
      // return name of remote host
  
      int portnum() { return _port; }
      // return port on remote host
  
!     int up() { return _up; }
      // return 1 if link up, 0 if down
  
  protected:
      const char* _host;
      int _port;
!     int _up;
  
  #ifdef HAVE_ACE
      ACE_INET_Addr* _addr;
--- 44,90 ----
      DrawLink(const char* hostname, int portnum, int state);
      virtual ~DrawLink();
  
!     enum { new_link=0, one_way, two_way };
  
      const char* hostname() { return _host; }
      // return name of remote host
  
+     void hostname(const char* host);
+     // set name of remote host
+ 
+     const char* althostname() { return _althost; }
+     // return alternate name of remote host
+ 
+     void althostname(const char* althost);
+     // set alternate name of remote host
+ 
      int portnum() { return _port; }
      // return port on remote host
  
!     int up() { return 0; }
      // return 1 if link up, 0 if down
  
+     int ok() { return _ok; }
+     // return 1 if link ok (but not necessarily two-way yet), 0 if not
+ 
+     int local_linkid() { return _local_linkid; }
+     // get local DrawLink id
+     int remote_linkid() { return _remote_linkid; }
+     // get remote DrawLink id
+ 
+     void local_linkid(int id) { _local_linkid = id; }
+     // get local DrawLink id
+     void remote_linkid(int id) { _remote_linkid = id; }
+     // get remote DrawLink id
+ 
  protected:
      const char* _host;
+     const char* _althost;
      int _port;
!     int _ok;
!     static int _linkcnt;
!     int _local_linkid;
!     int _remote_linkid;
  
  #ifdef HAVE_ACE
      ACE_INET_Addr* _addr;
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.3 DrawServ/drawserv.c:1.4
*** DrawServ/drawserv.c:1.3	Thu Feb 26 12:14:12 2004
--- src/DrawServ/drawserv.c	Thu Feb 26 13:24:17 2004
***************
*** 52,61 ****
  {
  }
  
! int DrawServ::linkup(const char* hostname, int portnum, int state) {
!   if (state == DrawLink::new_link || state == DrawLink::half_duplex) {
      DrawLink* link = new DrawLink(hostname, portnum, state);
!     if (link && link->up()) {
        _list->add_drawlink(link);
        return 0;
      } else {
--- 52,63 ----
  {
  }
  
! int DrawServ::linkup(const char* hostname, int portnum, 
! 		     int state, int local_id, int remote_id) {
!   if (state == DrawLink::new_link || state == DrawLink::one_way) {
      DrawLink* link = new DrawLink(hostname, portnum, state);
!     if (link && link->ok()) {
!       link->remote_linkid(remote_id);
        _list->add_drawlink(link);
        return 0;
      } else {
***************
*** 63,68 ****
        return -1;
      }
    } else {
!     fprintf(stderr, "link up\n");
    }
  }
--- 65,83 ----
        return -1;
      }
    } else {
!     // search for existing link with matching local_id
!     Iterator i;
!     _list->First(i);
!     while(!_list->Done(i) && _list->GetDrawLink(i)->local_linkid()!=local_id);
!     if (!_list->Done(i)) {
!       DrawLink* curlink = _list->GetDrawLink(i);
!       curlink->remote_linkid(remote_id);
!       fprintf(stderr, "link up with %s via port %d\n", hostname, portnum);
!       fprintf(stderr, "local id %d, remote id %d\n", curlink->local_linkid(), 
! 	      curlink->remote_linkid());
!     } else
!       fprintf(stderr, "unable to complete two-way link\n");
    }
  }
+ 
+   
Index: DrawServ/drawserv.h
diff -c DrawServ/drawserv.h:1.3 DrawServ/drawserv.h:1.4
*** DrawServ/drawserv.h:1.3	Thu Feb 26 12:14:12 2004
--- src/DrawServ/drawserv.h	Thu Feb 26 13:24:17 2004
***************
*** 46,54 ****
  
      void Init();
  
!     int linkup(const char* hostname, int portnum, int state);
!     // create new link to remote drawserv, return -1 if error
!     // state: 0==new link, 1==half-duplex, 2==full-duplex
  
  protected:
      DrawLinkList* _list;
--- 46,58 ----
  
      void Init();
  
!     int linkup(const char* hostname, int portnum, 
! 	       int state, int local_id=-1, int remote_id=-1);
!     // Create new link to remote drawserv, return -1 if error
!     // state: 0==new_link, 1==one_way, 2==two_way.
!     // Let DrawLink assign local_id by passing -1 for local_id.
!     // The local_id argument is for verification purposes once
!     // two-way link is established.
  
  protected:
      DrawLinkList* _list;
*** /dev/null	 Thu Feb 26 13:24:25 PST 2004
--- patches/ivtools-040226-johnston-017
*************** patches/ivtools-040226-johnston-017
*** 0 ****
--- 1 ----
+ ivtools-040226-johnston-017

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040226-johnston-018"
Content-Disposition: attachment;
	filename=ivtools-040226-johnston-018

Patch:    ivtools-040226-johnston-018
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  patch to propogate drawserv development via cvs
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

- patch to propogate drawserv development via cvs

Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.4 DrawServ/drawserv.c:1.5
*** DrawServ/drawserv.c:1.4	Thu Feb 26 13:24:17 2004
--- src/DrawServ/drawserv.c	Thu Feb 26 13:33:50 2004
***************
*** 68,78 ****
      // search for existing link with matching local_id
      Iterator i;
      _list->First(i);
!     while(!_list->Done(i) && _list->GetDrawLink(i)->local_linkid()!=local_id);
      if (!_list->Done(i)) {
        DrawLink* curlink = _list->GetDrawLink(i);
        curlink->remote_linkid(remote_id);
!       fprintf(stderr, "link up with %s via port %d\n", hostname, portnum);
        fprintf(stderr, "local id %d, remote id %d\n", curlink->local_linkid(), 
  	      curlink->remote_linkid());
      } else
--- 68,81 ----
      // search for existing link with matching local_id
      Iterator i;
      _list->First(i);
!     while(!_list->Done(i) && _list->GetDrawLink(i)->local_linkid()!=local_id)
!       _list->Next(i);
      if (!_list->Done(i)) {
        DrawLink* curlink = _list->GetDrawLink(i);
        curlink->remote_linkid(remote_id);
!       curlink->althostname(hostname);
!       fprintf(stderr, "link up with %s(%s) via port %d\n", 
! 	      curlink->hostname(), curlink->althostname(), portnum);
        fprintf(stderr, "local id %d, remote id %d\n", curlink->local_linkid(), 
  	      curlink->remote_linkid());
      } else
*** /dev/null	 Thu Feb 26 13:33:57 PST 2004
--- patches/ivtools-040226-johnston-018
*************** patches/ivtools-040226-johnston-018
*** 0 ****
--- 1 ----
+ ivtools-040226-johnston-018

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040226-johnston-019"
Content-Disposition: attachment;
	filename=ivtools-040226-johnston-019

Patch:    ivtools-040226-johnston-019
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  patch to propogate drawserv development via cvs
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

- patch to propogate drawserv development via cvs

Index: DrawServ/drawlink.c
diff -c DrawServ/drawlink.c:1.3 DrawServ/drawlink.c:1.4
*** DrawServ/drawlink.c:1.3	Thu Feb 26 13:24:17 2004
--- src/DrawServ/drawlink.c	Thu Feb 26 13:40:39 2004
***************
*** 30,36 ****
  #include <fstream.h>
  #include <unistd.h>
  
! static int DrawLink::_linkcnt = 0;
  
  /*****************************************************************************/
  
--- 30,36 ----
  #include <fstream.h>
  #include <unistd.h>
  
! int DrawLink::_linkcnt = 0;
  
  /*****************************************************************************/
  
***************
*** 61,67 ****
      gethostname(buffer, HOST_NAME_MAX);
      out << buffer << "\"";
      out << " :state " << state+1;
!     out << " :id " << _local_linkid;
      out << ")\n";
      out.flush();
      _ok = true;
--- 61,68 ----
      gethostname(buffer, HOST_NAME_MAX);
      out << buffer << "\"";
      out << " :state " << state+1;
!     out << " :rid " << _local_linkid;
!     out << " :lid " << _remote_linkid;
      out << ")\n";
      out.flush();
      _ok = true;
*** /dev/null	 Thu Feb 26 13:40:47 PST 2004
--- patches/ivtools-040226-johnston-019
*************** patches/ivtools-040226-johnston-019
*** 0 ****
--- 1 ----
+ ivtools-040226-johnston-019

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040226-johnston-020"
Content-Disposition: attachment;
	filename=ivtools-040226-johnston-020

Patch:    ivtools-040226-johnston-020
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  patch to propogate drawserv development via cvs
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

- patch to propogate drawserv development via cvs

Index: DrawServ/drawlink.c
diff -c DrawServ/drawlink.c:1.4 DrawServ/drawlink.c:1.5
*** DrawServ/drawlink.c:1.4	Thu Feb 26 13:40:39 2004
--- src/DrawServ/drawlink.c	Thu Feb 26 13:51:28 2004
***************
*** 42,54 ****
    _ok = false;
    _local_linkid = _linkcnt++;
    _remote_linkid = -1;
  
    _addr = nil;
    _socket = nil;
    _conn = nil;
  
  #if defined(HAVE_ACE) && (__GNUC__>3 || __GNUC__==3 && __GNUC_MINOR__>0)
!   _addr = new ACE_INET_Addr(portnum, hostname);
    _socket = new ACE_SOCK_Stream;
    _conn = new ACE_SOCK_Connector;
    if (_conn->connect (*_socket, *_addr) == -1)
--- 42,59 ----
    _ok = false;
    _local_linkid = _linkcnt++;
    _remote_linkid = -1;
+   _state = state;
  
    _addr = nil;
    _socket = nil;
    _conn = nil;
  
+ }
+ 
+ int DrawLink::open() {
+ 
  #if defined(HAVE_ACE) && (__GNUC__>3 || __GNUC__==3 && __GNUC_MINOR__>0)
!   _addr = new ACE_INET_Addr(_host, _port);
    _socket = new ACE_SOCK_Stream;
    _conn = new ACE_SOCK_Connector;
    if (_conn->connect (*_socket, *_addr) == -1)
***************
*** 60,66 ****
      char buffer[HOST_NAME_MAX];
      gethostname(buffer, HOST_NAME_MAX);
      out << buffer << "\"";
!     out << " :state " << state+1;
      out << " :rid " << _local_linkid;
      out << " :lid " << _remote_linkid;
      out << ")\n";
--- 65,71 ----
      char buffer[HOST_NAME_MAX];
      gethostname(buffer, HOST_NAME_MAX);
      out << buffer << "\"";
!     out << " :state " << _state+1;
      out << " :rid " << _local_linkid;
      out << " :lid " << _remote_linkid;
      out << ")\n";
Index: DrawServ/drawlink.h
diff -c DrawServ/drawlink.h:1.3 DrawServ/drawlink.h:1.4
*** DrawServ/drawlink.h:1.3	Thu Feb 26 13:24:17 2004
--- src/DrawServ/drawlink.h	Thu Feb 26 13:51:28 2004
***************
*** 46,51 ****
--- 46,53 ----
  
      enum { new_link=0, one_way, two_way };
  
+     
+ 
      const char* hostname() { return _host; }
      // return name of remote host
  
***************
*** 61,66 ****
--- 63,71 ----
      int portnum() { return _port; }
      // return port on remote host
  
+     int open();
+     // open link to remote DrawServ
+ 
      int up() { return 0; }
      // return 1 if link up, 0 if down
  
***************
*** 85,90 ****
--- 90,96 ----
      static int _linkcnt;
      int _local_linkid;
      int _remote_linkid;
+     int _state;
  
  #ifdef HAVE_ACE
      ACE_INET_Addr* _addr;
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.5 DrawServ/drawserv.c:1.6
*** DrawServ/drawserv.c:1.5	Thu Feb 26 13:33:50 2004
--- src/DrawServ/drawserv.c	Thu Feb 26 13:51:28 2004
***************
*** 56,63 ****
  		     int state, int local_id, int remote_id) {
    if (state == DrawLink::new_link || state == DrawLink::one_way) {
      DrawLink* link = new DrawLink(hostname, portnum, state);
      if (link && link->ok()) {
-       link->remote_linkid(remote_id);
        _list->add_drawlink(link);
        return 0;
      } else {
--- 56,64 ----
  		     int state, int local_id, int remote_id) {
    if (state == DrawLink::new_link || state == DrawLink::one_way) {
      DrawLink* link = new DrawLink(hostname, portnum, state);
+     link->remote_linkid(remote_id);
+     link->open();
      if (link && link->ok()) {
        _list->add_drawlink(link);
        return 0;
      } else {
*** /dev/null	 Thu Feb 26 13:51:35 PST 2004
--- patches/ivtools-040226-johnston-020
*************** patches/ivtools-040226-johnston-020
*** 0 ****
--- 1 ----
+ ivtools-040226-johnston-020

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040226-johnston-021"
Content-Disposition: attachment;
	filename=ivtools-040226-johnston-021

Patch:    ivtools-040226-johnston-021
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  patch to propogate drawserv development via cvs
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

- patch to propogate drawserv development via cvs

Index: DrawServ/drawlink.c
diff -c DrawServ/drawlink.c:1.5 DrawServ/drawlink.c:1.6
*** DrawServ/drawlink.c:1.5	Thu Feb 26 13:51:28 2004
--- src/DrawServ/drawlink.c	Thu Feb 26 15:35:53 2004
***************
*** 53,59 ****
  int DrawLink::open() {
  
  #if defined(HAVE_ACE) && (__GNUC__>3 || __GNUC__==3 && __GNUC_MINOR__>0)
!   _addr = new ACE_INET_Addr(_host, _port);
    _socket = new ACE_SOCK_Stream;
    _conn = new ACE_SOCK_Connector;
    if (_conn->connect (*_socket, *_addr) == -1)
--- 53,59 ----
  int DrawLink::open() {
  
  #if defined(HAVE_ACE) && (__GNUC__>3 || __GNUC__==3 && __GNUC_MINOR__>0)
!   _addr = new ACE_INET_Addr(_port, _host);
    _socket = new ACE_SOCK_Stream;
    _conn = new ACE_SOCK_Connector;
    if (_conn->connect (*_socket, *_addr) == -1)
*** /dev/null	 Thu Feb 26 15:36:03 PST 2004
--- patches/ivtools-040226-johnston-021
*************** patches/ivtools-040226-johnston-021
*** 0 ****
--- 1 ----
+ ivtools-040226-johnston-021

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040227-johnston-022"
Content-Disposition: attachment;
	filename=ivtools-040227-johnston-022

Patch:    ivtools-040227-johnston-022
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  patch to propogate drawserv development via cvs
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

- patch to propogate drawserv development via cvs

Index: DrawServ/Imakefile
diff -c DrawServ/Imakefile:1.4 DrawServ/Imakefile:1.5
*** DrawServ/Imakefile:1.4	Thu Feb 26 10:51:27 2004
--- src/DrawServ/Imakefile	Fri Feb 27 09:32:51 2004
***************
*** 27,32 ****
--- 27,33 ----
  Obj26A(drawlink)
  Obj26(drawlinklist)
  Obj26(drawserv)
+ Obj26A(drawserv-handler)
  Obj26(drawviews)
  
  
Index: DrawServ/drawfunc.c
diff -c DrawServ/drawfunc.c:1.6 DrawServ/drawfunc.c:1.7
*** DrawServ/drawfunc.c:1.6	Thu Feb 26 13:24:17 2004
--- src/DrawServ/drawfunc.c	Fri Feb 27 09:32:51 2004
***************
*** 69,75 ****
      int lidnum = lidv.is_known() ? lidv.int_val() : -1;
      int ridnum = ridv.is_known() ? ridv.int_val() : -1;
  
!     if (((DrawServ*)unidraw)->linkup(hoststr, portnum, statenum, lidnum, ridnum))
        push_stack(ComValue::minusoneval());
      else
        push_stack(ComValue::zeroval());
--- 69,76 ----
      int lidnum = lidv.is_known() ? lidv.int_val() : -1;
      int ridnum = ridv.is_known() ? ridv.int_val() : -1;
  
!     if (((DrawServ*)unidraw)->linkup(hoststr, portnum, statenum, 
! 				     lidnum, ridnum, this->comterp()))
        push_stack(ComValue::minusoneval());
      else
        push_stack(ComValue::zeroval());
Index: DrawServ/drawlink.c
diff -c DrawServ/drawlink.c:1.6 DrawServ/drawlink.c:1.7
*** DrawServ/drawlink.c:1.6	Thu Feb 26 15:35:53 2004
--- src/DrawServ/drawlink.c	Fri Feb 27 09:32:51 2004
***************
*** 50,64 ****
  
  }
  
  int DrawLink::open() {
  
  #if defined(HAVE_ACE) && (__GNUC__>3 || __GNUC__==3 && __GNUC_MINOR__>0)
    _addr = new ACE_INET_Addr(_port, _host);
    _socket = new ACE_SOCK_Stream;
    _conn = new ACE_SOCK_Connector;
!   if (_conn->connect (*_socket, *_addr) == -1)
      ACE_ERROR ((LM_ERROR, "%p\n", "open"));
!   else {
      fileptr_filebuf obuf(_socket->get_handle(), ios_base::out, false, static_cast<size_t>(BUFSIZ));
      ostream out(&obuf);
      out << "drawlink(\"";
--- 50,78 ----
  
  }
  
+ DrawLink::~DrawLink () 
+ {
+ #ifdef HAVE_ACE
+     if (_socket->close () == -1)
+         ACE_ERROR ((LM_ERROR, "%p\n", "close"));
+     delete _conn;
+     delete _socket;
+     delete _addr;
+     delete _host;
+     delete _althost;
+ #endif
+ }
+ 
  int DrawLink::open() {
  
  #if defined(HAVE_ACE) && (__GNUC__>3 || __GNUC__==3 && __GNUC_MINOR__>0)
    _addr = new ACE_INET_Addr(_port, _host);
    _socket = new ACE_SOCK_Stream;
    _conn = new ACE_SOCK_Connector;
!   if (_conn->connect (*_socket, *_addr) == -1) {
      ACE_ERROR ((LM_ERROR, "%p\n", "open"));
!     return -1;
!   } else {
      fileptr_filebuf obuf(_socket->get_handle(), ios_base::out, false, static_cast<size_t>(BUFSIZ));
      ostream out(&obuf);
      out << "drawlink(\"";
***************
*** 71,93 ****
      out << ")\n";
      out.flush();
      _ok = true;
    }
  #else
    fprintf(stderr, "drawserv requires ACE and >= gcc-3.1 for full functionality\n");
  #endif
  }
  
! DrawLink::~DrawLink () 
! {
! #ifdef HAVE_ACE
!     if (_socket->close () == -1)
!         ACE_ERROR ((LM_ERROR, "%p\n", "close"));
!     delete _conn;
!     delete _socket;
!     delete _addr;
!     delete _host;
!     delete _althost;
! #endif
  }
  
  void DrawLink::hostname(const char* host) {
--- 85,101 ----
      out << ")\n";
      out.flush();
      _ok = true;
+     return 0;
    }
  #else
    fprintf(stderr, "drawserv requires ACE and >= gcc-3.1 for full functionality\n");
+   return -1;
  #endif
  }
  
! int DrawLink::close() {
!   fprintf(stderr, "Closing link to %s (%s) port # %d (lid=%d, rid=%d)\n", 
! 	  hostname(), althostname(), portnum(), local_linkid(), remote_linkid());
  }
  
  void DrawLink::hostname(const char* host) {
Index: DrawServ/drawlink.h
diff -c DrawServ/drawlink.h:1.4 DrawServ/drawlink.h:1.5
*** DrawServ/drawlink.h:1.4	Thu Feb 26 13:51:28 2004
--- src/DrawServ/drawlink.h	Fri Feb 27 09:32:52 2004
***************
*** 46,53 ****
  
      enum { new_link=0, one_way, two_way };
  
-     
- 
      const char* hostname() { return _host; }
      // return name of remote host
  
--- 46,51 ----
***************
*** 65,70 ****
--- 63,71 ----
  
      int open();
      // open link to remote DrawServ
+ 
+     int close();
+     // close link to remote DrawServ
  
      int up() { return 0; }
      // return 1 if link up, 0 if down
Index: DrawServ/drawserv-handler.c
diff -c /dev/null DrawServ/drawserv-handler.c:1.1
*** /dev/null	Fri Feb 27 09:32:53 2004
--- src/DrawServ/drawserv-handler.c	Fri Feb 27 09:32:52 2004
***************
*** 0 ****
--- 1,36 ----
+ /*
+  * Copyright (c) 1996 Vectaport Inc.
+  *
+  * Permission to use, copy, modify, distribute, and sell this software and
+  * its documentation for any purpose is hereby granted without fee, provided
+  * that the above copyright notice appear in all copies and that both that
+  * copyright notice and this permission notice appear in supporting
+  * documentation, and that the names of the copyright holders not be used in
+  * advertising or publicity pertaining to distribution of the software
+  * without specific, written prior permission.  The copyright holders make
+  * no representations about the suitability of this software for any purpose.
+  * It is provided "as is" without express or implied warranty.
+  *
+  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL,
+  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  * 
+  */
+ 
+ #ifdef HAVE_ACE
+ 
+ #include <DrawServ/drawserv-handler.h>
+ 
+ /*****************************************************************************/
+ 
+ // Default constructor.
+ 
+ DrawServHandler::DrawServHandler () : UnidrawComterpHandler()
+ {
+ }
+ 
+ #endif /* HAVE_ACE */
Index: DrawServ/drawserv-handler.h
diff -c /dev/null DrawServ/drawserv-handler.h:1.1
*** /dev/null	Fri Feb 27 09:32:53 2004
--- src/DrawServ/drawserv-handler.h	Fri Feb 27 09:32:52 2004
***************
*** 0 ****
--- 1,57 ----
+ /*
+  * Copyright (c) 1996,1999 Vectaport Inc.
+  *
+  * Permission to use, copy, modify, distribute, and sell this software and
+  * its documentation for any purpose is hereby granted without fee, provided
+  * that the above copyright notice appear in all copies and that both that
+  * copyright notice and this permission notice appear in supporting
+  * documentation, and that the names of the copyright holders not be used in
+  * advertising or publicity pertaining to distribution of the software
+  * without specific, written prior permission.  The copyright holders make
+  * no representations about the suitability of this software for any purpose.
+  * It is provided "as is" without express or implied warranty.
+  *
+  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL,
+  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  * 
+  */
+ 
+ #ifdef HAVE_ACE
+ 
+ #ifndef _drawserv_handler_
+ #define _drawserv_handler_
+ 
+ #include <ComUnidraw/comterp-acehandler.h>
+ 
+ class DrawLink;
+ 
+ //: specialized UnidrawComterpHandler for integration into DrawServ
+ class DrawServHandler : public UnidrawComterpHandler
+ {
+ 
+ public:
+   // = Initialization and termination methods.
+   DrawServHandler ();
+ 
+   DrawLink* drawlink() { return _drawlink; }
+   // get DrawLink associated with this handler
+   void drawlink(DrawLink* link) { _drawlink = link; }
+   // set DrawLink associated with this handler
+ 
+ protected:
+   DrawLink* _drawlink;
+ 
+ };
+ 
+ //: Acceptor specialized for use with DrawServ and ComTerp.
+ typedef ACE_Acceptor <DrawServHandler, ACE_SOCK_ACCEPTOR> 
+ 	DrawServAcceptor;
+ 
+ #endif /* _drawserv_handler_ */
+ 
+ #endif /* HAVE_ACE */
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.6 DrawServ/drawserv.c:1.7
*** DrawServ/drawserv.c:1.6	Thu Feb 26 13:51:28 2004
--- src/DrawServ/drawserv.c	Fri Feb 27 09:32:52 2004
***************
*** 28,36 ****
--- 28,39 ----
  #include <DrawServ/drawlink.h>
  #include <DrawServ/drawlinklist.h>
  #include <DrawServ/drawserv.h>
+ #include <DrawServ/drawserv-handler.h>
  
  #include <Unidraw/iterator.h>
  #include <Unidraw/ulist.h>
+ 
+ #include <ComTerp/comterp.h>
  /*****************************************************************************/
  
  DrawServ::DrawServ (Catalog* c, int& argc, char** argv, 
***************
*** 53,62 ****
  }
  
  int DrawServ::linkup(const char* hostname, int portnum, 
! 		     int state, int local_id, int remote_id) {
    if (state == DrawLink::new_link || state == DrawLink::one_way) {
      DrawLink* link = new DrawLink(hostname, portnum, state);
      link->remote_linkid(remote_id);
      link->open();
      if (link && link->ok()) {
        _list->add_drawlink(link);
--- 56,68 ----
  }
  
  int DrawServ::linkup(const char* hostname, int portnum, 
! 		     int state, int local_id, int remote_id,
! 		     ComTerp* comterp) {
    if (state == DrawLink::new_link || state == DrawLink::one_way) {
      DrawLink* link = new DrawLink(hostname, portnum, state);
      link->remote_linkid(remote_id);
+     if (state==DrawLink::one_way && comterp && comterp->handler()) 
+       ((DrawServHandler*)comterp->handler())->drawlink(link);
      link->open();
      if (link && link->ok()) {
        _list->add_drawlink(link);
***************
*** 66,80 ****
--- 72,91 ----
        return -1;
      }
    } else {
+ 
      // search for existing link with matching local_id
      Iterator i;
      _list->First(i);
      while(!_list->Done(i) && _list->GetDrawLink(i)->local_linkid()!=local_id)
        _list->Next(i);
+ 
+     /* if found, finalize linkup */
      if (!_list->Done(i)) {
        DrawLink* curlink = _list->GetDrawLink(i);
        curlink->remote_linkid(remote_id);
        curlink->althostname(hostname);
+       if (comterp && comterp->handler()) 
+ 	((DrawServHandler*)comterp->handler())->drawlink(curlink);
        fprintf(stderr, "link up with %s(%s) via port %d\n", 
  	      curlink->hostname(), curlink->althostname(), portnum);
        fprintf(stderr, "local id %d, remote id %d\n", curlink->local_linkid(), 
***************
*** 82,87 ****
--- 93,104 ----
      } else
        fprintf(stderr, "unable to complete two-way link\n");
    }
+ }
+ 
+ int DrawServ::linkdown(DrawLink* link) {
+   _list->Remove(link);
+   link->close();
+   delete link;
  }
  
    
Index: DrawServ/drawserv.h
diff -c DrawServ/drawserv.h:1.4 DrawServ/drawserv.h:1.5
*** DrawServ/drawserv.h:1.4	Thu Feb 26 13:24:17 2004
--- src/DrawServ/drawserv.h	Fri Feb 27 09:32:52 2004
***************
*** 33,38 ****
--- 33,40 ----
  // Unidraw (OverlayUnidraw) specialized for DrawServ application.
  // Networked application of the Unidraw framework.
  
+ class ComTerp;
+ class DrawLink;
  class DrawLinkList;
  
  class DrawServ : public OverlayUnidraw {
***************
*** 47,58 ****
      void Init();
  
      int linkup(const char* hostname, int portnum, 
! 	       int state, int local_id=-1, int remote_id=-1);
      // Create new link to remote drawserv, return -1 if error
      // state: 0==new_link, 1==one_way, 2==two_way.
      // Let DrawLink assign local_id by passing -1 for local_id.
      // The local_id argument is for verification purposes once
      // two-way link is established.
  
  protected:
      DrawLinkList* _list;
--- 49,64 ----
      void Init();
  
      int linkup(const char* hostname, int portnum, 
! 	       int state, int local_id=-1, int remote_id=-1,
! 	       ComTerp* comterp=nil);
      // Create new link to remote drawserv, return -1 if error
      // state: 0==new_link, 1==one_way, 2==two_way.
      // Let DrawLink assign local_id by passing -1 for local_id.
      // The local_id argument is for verification purposes once
      // two-way link is established.
+ 
+     int linkdown(DrawLink* link);
+     // shut down existing link to remote drawserv
  
  protected:
      DrawLinkList* _list;
Index: drawserv_/main.c
diff -c drawserv_/main.c:1.3 drawserv_/main.c:1.4
*** drawserv_/main.c:1.3	Thu Feb 12 13:27:09 2004
--- src/drawserv_/main.c	Fri Feb 27 09:32:53 2004
***************
*** 28,34 ****
   */
  
  #ifdef HAVE_ACE
! #include <ComUnidraw/comterp-acehandler.h>
  #include <OverlayUnidraw/aceimport.h>
  #include <AceDispatch/ace_dispatcher.h>
  #include <Comterp/comhandler.h>
--- 28,34 ----
   */
  
  #ifdef HAVE_ACE
! #include <DrawServ/drawserv-handler.h>
  #include <OverlayUnidraw/aceimport.h>
  #include <AceDispatch/ace_dispatcher.h>
  #include <Comterp/comhandler.h>
***************
*** 237,243 ****
  
  
      // Acceptor factory.
!     UnidrawComterpAcceptor* peer_acceptor = new UnidrawComterpAcceptor();
  
      const char* portstr = catalog->GetAttribute("comdraw");
      int portnum = atoi(portstr);
--- 237,243 ----
  
  
      // Acceptor factory.
!     DrawServAcceptor* peer_acceptor = new DrawServAcceptor();
  
      const char* portstr = catalog->GetAttribute("comdraw");
      int portnum = atoi(portstr);
***************
*** 284,290 ****
  
  #ifdef HAVE_ACE
  	/*  Start up one on stdin */
! 	UnidrawComterpHandler* stdin_handler = new UnidrawComterpHandler();
  #if 0
  	if (ACE::register_stdin_handler(stdin_handler, ComterpHandler::reactor_singleton(), nil) == -1)
  #else
--- 284,290 ----
  
  #ifdef HAVE_ACE
  	/*  Start up one on stdin */
! 	DrawServHandler* stdin_handler = new DrawServHandler();
  #if 0
  	if (ACE::register_stdin_handler(stdin_handler, ComterpHandler::reactor_singleton(), nil) == -1)
  #else
Index: top_ivtools/MANIFEST
diff -c top_ivtools/MANIFEST:1.4 top_ivtools/MANIFEST:1.5
*** top_ivtools/MANIFEST:1.4	Thu Feb 26 10:50:58 2004
--- ./MANIFEST	Fri Feb 27 09:32:29 2004
***************
*** 293,298 ****
--- 293,300 ----
  ivtools-1.1/src/DrawServ/drawlinklist.h
  ivtools-1.1/src/DrawServ/drawserv.c
  ivtools-1.1/src/DrawServ/drawserv.h
+ ivtools-1.1/src/DrawServ/drawserv-handler.c
+ ivtools-1.1/src/DrawServ/drawserv-handler.h
  ivtools-1.1/src/DrawServ/drawviews.c
  ivtools-1.1/src/DrawServ/drawviews.h
  ivtools-1.1/src/FrameUnidraw/Imakefile
Index: top_ivtools/MANIFEST.perceps
diff -c top_ivtools/MANIFEST.perceps:1.3 top_ivtools/MANIFEST.perceps:1.4
*** top_ivtools/MANIFEST.perceps:1.3	Thu Feb 26 10:50:58 2004
--- ./MANIFEST.perceps	Fri Feb 27 09:32:29 2004
***************
*** 75,80 ****
--- 75,81 ----
  DrawServ/drawlink.h
  DrawServ/drawlinklist.h
  DrawServ/drawserv.h
+ DrawServ/drawserv-handler.h
  DrawServ/drawviews.h
  FrameUnidraw/framecatalog.h
  FrameUnidraw/frameclasses.h
*** /dev/null	 Fri Feb 27 09:33:05 PST 2004
--- patches/ivtools-040227-johnston-022
*************** patches/ivtools-040227-johnston-022
*** 0 ****
--- 1 ----
+ ivtools-040227-johnston-022

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040227-johnston-023"
Content-Disposition: attachment;
	filename=ivtools-040227-johnston-023

Patch:    ivtools-040227-johnston-023
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  patch to propogate drawserv development via cvs
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

- patch to propogate drawserv development via cvs

Index: DrawServ/drawserv-handler.c
diff -c DrawServ/drawserv-handler.c:1.1 DrawServ/drawserv-handler.c:1.2
*** DrawServ/drawserv-handler.c:1.1	Fri Feb 27 09:32:52 2004
--- src/DrawServ/drawserv-handler.c	Fri Feb 27 09:41:36 2004
***************
*** 23,28 ****
--- 23,29 ----
  
  #ifdef HAVE_ACE
  
+ #include <DrawServ/drawserv.h>
  #include <DrawServ/drawserv-handler.h>
  
  /*****************************************************************************/
***************
*** 33,36 ****
--- 34,41 ----
  {
  }
  
+ void DrawServHandler::destroy (void) {
+   ComterpHandler::destroy();
+   if (drawlink()) ((DrawServ*)unidraw)->linkdown(drawlink());
+ }
  #endif /* HAVE_ACE */
Index: DrawServ/drawserv-handler.h
diff -c DrawServ/drawserv-handler.h:1.1 DrawServ/drawserv-handler.h:1.2
*** DrawServ/drawserv-handler.h:1.1	Fri Feb 27 09:32:52 2004
--- src/DrawServ/drawserv-handler.h	Fri Feb 27 09:41:36 2004
***************
*** 43,48 ****
--- 43,51 ----
    void drawlink(DrawLink* link) { _drawlink = link; }
    // set DrawLink associated with this handler
  
+   virtual void destroy (void);
+   // traps disconnects
+ 
  protected:
    DrawLink* _drawlink;
  
*** /dev/null	 Fri Feb 27 09:41:41 PST 2004
--- patches/ivtools-040227-johnston-023
*************** patches/ivtools-040227-johnston-023
*** 0 ****
--- 1 ----
+ ivtools-040227-johnston-023

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040227-johnston-024"
Content-Disposition: attachment;
	filename=ivtools-040227-johnston-024

Patch:    ivtools-040227-johnston-024
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  patch to propogate drawserv development via cvs
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

- patch to propogate drawserv development via cvs

Index: DrawServ/drawlink.c
diff -c DrawServ/drawlink.c:1.7 DrawServ/drawlink.c:1.8
*** DrawServ/drawlink.c:1.7	Fri Feb 27 09:32:51 2004
--- src/DrawServ/drawlink.c	Fri Feb 27 09:57:23 2004
***************
*** 48,53 ****
--- 48,55 ----
    _socket = nil;
    _conn = nil;
  
+   _handler = nil;
+ 
  }
  
  DrawLink::~DrawLink () 
***************
*** 96,101 ****
--- 98,107 ----
  int DrawLink::close() {
    fprintf(stderr, "Closing link to %s (%s) port # %d (lid=%d, rid=%d)\n", 
  	  hostname(), althostname(), portnum(), local_linkid(), remote_linkid());
+   if (_socket) {
+     if (_socket.close () == -1)
+       ACE_ERROR ((LM_ERROR, "%p\n", "close"));
+   }
  }
  
  void DrawLink::hostname(const char* host) {
Index: DrawServ/drawlink.h
diff -c DrawServ/drawlink.h:1.5 DrawServ/drawlink.h:1.6
*** DrawServ/drawlink.h:1.5	Fri Feb 27 09:32:52 2004
--- src/DrawServ/drawlink.h	Fri Feb 27 09:57:23 2004
***************
*** 28,33 ****
--- 28,34 ----
  #define drawlink_h
  
  class DrawServ;
+ class DrawServHandler;
  
  #ifdef HAVE_ACE
  #include <ComTerp/comhandler.h>
***************
*** 83,88 ****
--- 84,95 ----
      void remote_linkid(int id) { _remote_linkid = id; }
      // get remote DrawLink id
  
+     void handler(DrawServHandler* handler) { _handler = handler; }
+     // set DrawServHandler associated with incoming connection
+ 
+     DrawServHandler* handler() { return _handler; }
+     // get DrawServHandler associated with incoming connection
+ 
  protected:
      const char* _host;
      const char* _althost;
***************
*** 98,103 ****
--- 105,112 ----
      ACE_SOCK_Connector* _conn;
      ACE_SOCK_Stream* _socket;
  #endif
+ 
+     DrawServHandler* _handler;
  };
  
  #endif
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.7 DrawServ/drawserv.c:1.8
*** DrawServ/drawserv.c:1.7	Fri Feb 27 09:32:52 2004
--- src/DrawServ/drawserv.c	Fri Feb 27 09:57:23 2004
***************
*** 61,68 ****
    if (state == DrawLink::new_link || state == DrawLink::one_way) {
      DrawLink* link = new DrawLink(hostname, portnum, state);
      link->remote_linkid(remote_id);
!     if (state==DrawLink::one_way && comterp && comterp->handler()) 
        ((DrawServHandler*)comterp->handler())->drawlink(link);
      link->open();
      if (link && link->ok()) {
        _list->add_drawlink(link);
--- 61,70 ----
    if (state == DrawLink::new_link || state == DrawLink::one_way) {
      DrawLink* link = new DrawLink(hostname, portnum, state);
      link->remote_linkid(remote_id);
!     if (state==DrawLink::one_way && comterp && comterp->handler()) {
        ((DrawServHandler*)comterp->handler())->drawlink(link);
+       link->handler((DrawServHandler*)comterp->handler());
+     }
      link->open();
      if (link && link->ok()) {
        _list->add_drawlink(link);
***************
*** 84,91 ****
        DrawLink* curlink = _list->GetDrawLink(i);
        curlink->remote_linkid(remote_id);
        curlink->althostname(hostname);
!       if (comterp && comterp->handler()) 
  	((DrawServHandler*)comterp->handler())->drawlink(curlink);
        fprintf(stderr, "link up with %s(%s) via port %d\n", 
  	      curlink->hostname(), curlink->althostname(), portnum);
        fprintf(stderr, "local id %d, remote id %d\n", curlink->local_linkid(), 
--- 86,95 ----
        DrawLink* curlink = _list->GetDrawLink(i);
        curlink->remote_linkid(remote_id);
        curlink->althostname(hostname);
!       if (comterp && comterp->handler()) {
  	((DrawServHandler*)comterp->handler())->drawlink(curlink);
+ 	curlink->handler((DrawServHandler*)comterp->handler());
+       }
        fprintf(stderr, "link up with %s(%s) via port %d\n", 
  	      curlink->hostname(), curlink->althostname(), portnum);
        fprintf(stderr, "local id %d, remote id %d\n", curlink->local_linkid(), 
*** /dev/null	 Fri Feb 27 09:57:28 PST 2004
--- patches/ivtools-040227-johnston-024
*************** patches/ivtools-040227-johnston-024
*** 0 ****
--- 1 ----
+ ivtools-040227-johnston-024

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040227-johnston-025"
Content-Disposition: attachment;
	filename=ivtools-040227-johnston-025

Patch:    ivtools-040227-johnston-025
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  patch to propogate drawserv development via cvs
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

- patch to propogate drawserv development via cvs

Index: DrawServ/drawlink.c
diff -c DrawServ/drawlink.c:1.8 DrawServ/drawlink.c:1.9
*** DrawServ/drawlink.c:1.8	Fri Feb 27 09:57:23 2004
--- src/DrawServ/drawlink.c	Fri Feb 27 10:00:20 2004
***************
*** 99,105 ****
    fprintf(stderr, "Closing link to %s (%s) port # %d (lid=%d, rid=%d)\n", 
  	  hostname(), althostname(), portnum(), local_linkid(), remote_linkid());
    if (_socket) {
!     if (_socket.close () == -1)
        ACE_ERROR ((LM_ERROR, "%p\n", "close"));
    }
  }
--- 99,105 ----
    fprintf(stderr, "Closing link to %s (%s) port # %d (lid=%d, rid=%d)\n", 
  	  hostname(), althostname(), portnum(), local_linkid(), remote_linkid());
    if (_socket) {
!     if (_socket->close () == -1)
        ACE_ERROR ((LM_ERROR, "%p\n", "close"));
    }
  }
*** /dev/null	 Fri Feb 27 10:00:26 PST 2004
--- patches/ivtools-040227-johnston-025
*************** patches/ivtools-040227-johnston-025
*** 0 ****
--- 1 ----
+ ivtools-040227-johnston-025

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040227-johnston-026"
Content-Disposition: attachment;
	filename=ivtools-040227-johnston-026

Patch:    ivtools-040227-johnston-026
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  patch to propogate drawserv development via cvs
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

- patch to propogate drawserv development via cvs

Index: ComTerp/comhandler.c
diff -c ComTerp/comhandler.c:1.3 ComTerp/comhandler.c:1.4
*** ComTerp/comhandler.c:1.3	Fri Jan 30 11:20:41 2004
--- src/ComTerp/comhandler.c	Fri Feb 27 13:40:17 2004
***************
*** 215,221 ****
        comterp_->_outfunc = (outfuncptr)&ComTerpServ::fd_fputs;
  
        int  status = comterp_->ComTerp::run(false /* !once */, false /* !nested */);
!       return (input_good ? 0 : -1) && status;
      } else {
        if (inbuf[0]!='\004')
  	cout << inbuf << "\n";
--- 215,221 ----
        comterp_->_outfunc = (outfuncptr)&ComTerpServ::fd_fputs;
  
        int  status = comterp_->ComTerp::run(false /* !once */, false /* !nested */);
!       return input_good&&status==0 ? 0 : -1;
      } else {
        if (inbuf[0]!='\004')
  	cout << inbuf << "\n";
Index: DrawServ/Imakefile
diff -c DrawServ/Imakefile:1.5 DrawServ/Imakefile:1.6
*** DrawServ/Imakefile:1.5	Fri Feb 27 09:32:51 2004
--- src/DrawServ/Imakefile	Fri Feb 27 13:40:27 2004
***************
*** 25,30 ****
--- 25,31 ----
  Obj26(draweditor)
  Obj26A(drawfunc)
  Obj26A(drawlink)
+ Obj26(drawlinkcomp)
  Obj26(drawlinklist)
  Obj26(drawserv)
  Obj26A(drawserv-handler)
Index: DrawServ/drawclasses.h
diff -c DrawServ/drawclasses.h:1.1 DrawServ/drawclasses.h:1.2
*** DrawServ/drawclasses.h:1.1	Fri Jan  9 11:45:18 2004
--- src/DrawServ/drawclasses.h	Fri Feb 27 13:40:27 2004
***************
*** 31,34 ****
--- 31,36 ----
  #define DRAW_IDRAW_PS       Combine(DRAW_IDRAW_COMP,POSTSCRIPT_VIEW)
  #define DRAW_IDRAW_SCRIPT   Combine(DRAW_IDRAW_COMP, SCRIPT_VIEW)
  
+ #define DRAWLINK_COMP       9802
+ 
  #endif
Index: DrawServ/drawfunc.c
diff -c DrawServ/drawfunc.c:1.7 DrawServ/drawfunc.c:1.8
*** DrawServ/drawfunc.c:1.7	Fri Feb 27 09:32:51 2004
--- src/DrawServ/drawfunc.c	Fri Feb 27 13:40:27 2004
***************
*** 23,28 ****
--- 23,30 ----
  
  #include <DrawServ/draweditor.h>
  #include <DrawServ/drawfunc.h>
+ #include <DrawServ/drawlink.h>
+ #include <DrawServ/drawlinkcomp.h>
  #include <DrawServ/drawserv.h>
  
  #define TITLE "DrawLinkFunc"
***************
*** 69,79 ****
      int lidnum = lidv.is_known() ? lidv.int_val() : -1;
      int ridnum = ridv.is_known() ? ridv.int_val() : -1;
  
!     if (((DrawServ*)unidraw)->linkup(hoststr, portnum, statenum, 
! 				     lidnum, ridnum, this->comterp()))
!       push_stack(ComValue::minusoneval());
      else
!       push_stack(ComValue::zeroval());
    } 
      
    return;
--- 71,87 ----
      int lidnum = lidv.is_known() ? lidv.int_val() : -1;
      int ridnum = ridv.is_known() ? ridv.int_val() : -1;
  
!     DrawLink* link = 
!       ((DrawServ*)unidraw)->linkup(hoststr, portnum, statenum, 
! 				   lidnum, ridnum, this->comterp());
!     if (link) {
!       DrawLinkComp* linkcomp = new DrawLinkComp(link);
!       ComValue result(DrawLinkComp::class_symid(), new ComponentView(linkcomp));
!       result.object_compview(true);
!       push_stack(result);
!     }
      else
!       push_stack(ComValue::nullval());
    } 
      
    return;
Index: DrawServ/drawlinkcomp.c
diff -c /dev/null DrawServ/drawlinkcomp.c:1.1
*** /dev/null	Fri Feb 27 13:40:29 2004
--- src/DrawServ/drawlinkcomp.c	Fri Feb 27 13:40:27 2004
***************
*** 0 ****
--- 1,50 ----
+ /*
+  * Copyright 2004 Scott E. Johnston
+  *
+  * Permission to use, copy, modify, distribute, and sell this software and
+  * its documentation for any purpose is hereby granted without fee, provided
+  * that the above copyright notice appear in all copies and that both that
+  * copyright notice and this permission notice appear in supporting
+  * documentation, and that the names of the copyright holders not be used in
+  * advertising or publicity pertaining to distribution of the software
+  * without specific, written prior permission.  The copyright holders make
+  * no representations about the suitability of this software for any purpose.
+  * It is provided "as is" without express or implied warranty.
+  *
+  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL,
+  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  * 
+  */
+ 
+ #include <DrawServ/drawclasses.h>
+ #include <DrawServ/drawlinkcomp.h>
+ 
+ /****************************************************************************/
+ 
+ 
+ int DrawLinkComp::_symid = -1;
+ 
+ DrawLinkComp::DrawLinkComp(DrawLink* link) : OverlayComp() {
+   _drawlink = link;
+   _gr = nil;
+ }
+ 
+ DrawLinkComp::~DrawLinkComp() {
+ }
+ 
+ Component* DrawLinkComp::Copy() {
+   DrawLinkComp* comp = new DrawLinkComp(_drawlink);
+   return comp;
+ }
+ 
+ ClassId DrawLinkComp::GetClassId () { return DRAWLINK_COMP; }
+ 
+ boolean DrawLinkComp::IsA (ClassId id) {
+     return DRAWLINK_COMP == id || OverlayComp::IsA(id);
+ }
+ 
Index: DrawServ/drawlinkcomp.h
diff -c /dev/null DrawServ/drawlinkcomp.h:1.1
*** /dev/null	Fri Feb 27 13:40:29 2004
--- src/DrawServ/drawlinkcomp.h	Fri Feb 27 13:40:27 2004
***************
*** 0 ****
--- 1,50 ----
+ /*
+  * Copyright 2004 Scott E. Johnston
+  *
+  * Permission to use, copy, modify, distribute, and sell this software and
+  * its documentation for any purpose is hereby granted without fee, provided
+  * that the above copyright notice appear in all copies and that both that
+  * copyright notice and this permission notice appear in supporting
+  * documentation, and that the names of the copyright holders not be used in
+  * advertising or publicity pertaining to distribution of the software
+  * without specific, written prior permission.  The copyright holders make
+  * no representations about the suitability of this software for any purpose.
+  * It is provided "as is" without express or implied warranty.
+  *
+  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL,
+  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  * 
+  */
+ 
+ #ifndef drawlinkcomp_h
+ #define drawlinkcomp_h
+ 
+ #include <OverlayUnidraw/ovcomps.h>
+ 
+ class DrawLink;
+ 
+ class DrawLinkComp : public OverlayComp {
+ public:
+     DrawLinkComp(DrawLink* link = nil);
+     ~DrawLinkComp();
+ 
+     virtual Component* Copy();
+     virtual ClassId GetClassId();
+     virtual boolean IsA(ClassId);
+ 
+     DrawLink* drawlink() { return _drawlink; }
+     void drawlink(DrawLink* link) { _drawlink = link; }
+ 
+ protected:
+     CLASS_SYMID("DrawLinkComp");
+ 
+     DrawLink* _drawlink;
+ 
+ };
+ 
+ #endif
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.8 DrawServ/drawserv.c:1.9
*** DrawServ/drawserv.c:1.8	Fri Feb 27 09:57:23 2004
--- src/DrawServ/drawserv.c	Fri Feb 27 13:40:27 2004
***************
*** 55,61 ****
  {
  }
  
! int DrawServ::linkup(const char* hostname, int portnum, 
  		     int state, int local_id, int remote_id,
  		     ComTerp* comterp) {
    if (state == DrawLink::new_link || state == DrawLink::one_way) {
--- 55,61 ----
  {
  }
  
! DrawLink* DrawServ::linkup(const char* hostname, int portnum, 
  		     int state, int local_id, int remote_id,
  		     ComTerp* comterp) {
    if (state == DrawLink::new_link || state == DrawLink::one_way) {
***************
*** 68,77 ****
      link->open();
      if (link && link->ok()) {
        _list->add_drawlink(link);
!       return 0;
      } else {
        delete link;
!       return -1;
      }
    } else {
  
--- 68,77 ----
      link->open();
      if (link && link->ok()) {
        _list->add_drawlink(link);
!       return link;
      } else {
        delete link;
!       return nil;
      }
    } else {
  
***************
*** 94,101 ****
  	      curlink->hostname(), curlink->althostname(), portnum);
        fprintf(stderr, "local id %d, remote id %d\n", curlink->local_linkid(), 
  	      curlink->remote_linkid());
!     } else
        fprintf(stderr, "unable to complete two-way link\n");
    }
  }
  
--- 94,104 ----
  	      curlink->hostname(), curlink->althostname(), portnum);
        fprintf(stderr, "local id %d, remote id %d\n", curlink->local_linkid(), 
  	      curlink->remote_linkid());
!       return curlink;
!     } else {
        fprintf(stderr, "unable to complete two-way link\n");
+       return nil;
+     }
    }
  }
  
Index: DrawServ/drawserv.h
diff -c DrawServ/drawserv.h:1.5 DrawServ/drawserv.h:1.6
*** DrawServ/drawserv.h:1.5	Fri Feb 27 09:32:52 2004
--- src/DrawServ/drawserv.h	Fri Feb 27 13:40:27 2004
***************
*** 48,56 ****
  
      void Init();
  
!     int linkup(const char* hostname, int portnum, 
! 	       int state, int local_id=-1, int remote_id=-1,
! 	       ComTerp* comterp=nil);
      // Create new link to remote drawserv, return -1 if error
      // state: 0==new_link, 1==one_way, 2==two_way.
      // Let DrawLink assign local_id by passing -1 for local_id.
--- 48,56 ----
  
      void Init();
  
!     DrawLink* linkup(const char* hostname, int portnum, 
! 		     int state, int local_id=-1, int remote_id=-1,
! 		     ComTerp* comterp=nil);
      // Create new link to remote drawserv, return -1 if error
      // state: 0==new_link, 1==one_way, 2==two_way.
      // Let DrawLink assign local_id by passing -1 for local_id.
Index: top_ivtools/MANIFEST
diff -c top_ivtools/MANIFEST:1.5 top_ivtools/MANIFEST:1.6
*** top_ivtools/MANIFEST:1.5	Fri Feb 27 09:32:29 2004
--- ./MANIFEST	Fri Feb 27 13:40:14 2004
***************
*** 289,294 ****
--- 289,296 ----
  ivtools-1.1/src/DrawServ/drawkit.h
  ivtools-1.1/src/DrawServ/drawlink.c
  ivtools-1.1/src/DrawServ/drawlink.h
+ ivtools-1.1/src/DrawServ/drawlinkcomp.c
+ ivtools-1.1/src/DrawServ/drawlinkcomp.h
  ivtools-1.1/src/DrawServ/drawlinklist.c
  ivtools-1.1/src/DrawServ/drawlinklist.h
  ivtools-1.1/src/DrawServ/drawserv.c
Index: top_ivtools/MANIFEST.perceps
diff -c top_ivtools/MANIFEST.perceps:1.4 top_ivtools/MANIFEST.perceps:1.5
*** top_ivtools/MANIFEST.perceps:1.4	Fri Feb 27 09:32:29 2004
--- ./MANIFEST.perceps	Fri Feb 27 13:40:14 2004
***************
*** 73,78 ****
--- 73,79 ----
  DrawServ/drawfunc.h
  DrawServ/drawkit.h
  DrawServ/drawlink.h
+ DrawServ/drawlinkcomp.h
  DrawServ/drawlinklist.h
  DrawServ/drawserv.h
  DrawServ/drawserv-handler.h
*** /dev/null	 Fri Feb 27 13:40:33 PST 2004
--- patches/ivtools-040227-johnston-026
*************** patches/ivtools-040227-johnston-026
*** 0 ****
--- 1 ----
+ ivtools-040227-johnston-026

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040227-johnston-027"
Content-Disposition: attachment;
	filename=ivtools-040227-johnston-027

Patch:    ivtools-040227-johnston-027
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  patch to propogate drawserv development via cvs
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

- patch to propogate drawserv development via cvs

Index: DrawServ/drawfunc.c
diff -c DrawServ/drawfunc.c:1.8 DrawServ/drawfunc.c:1.9
*** DrawServ/drawfunc.c:1.8	Fri Feb 27 13:40:27 2004
--- src/DrawServ/drawfunc.c	Fri Feb 27 15:45:31 2004
***************
*** 54,59 ****
--- 54,61 ----
    ComValue lidv(stack_key(lid_sym));
    static int rid_sym = symbol_add("rid");
    ComValue ridv(stack_key(rid_sym));
+   static int close_sym = symbol_add("close");
+   ComValue closev(stack_key(close_sym));
    reset_stack();
  
  #if __GNUC__==3&&__GNUC_MINOR__<1
***************
*** 62,67 ****
--- 64,72 ----
    return;
  #endif
  
+   DrawLink* link = nil;
+ 
+   /* creating a new link to remote drawserv */
    if (hostv.is_string() && portv.is_known() && statev.is_known()) {
      
      const char* hoststr = hostv.string_ptr();
***************
*** 71,89 ****
      int lidnum = lidv.is_known() ? lidv.int_val() : -1;
      int ridnum = ridv.is_known() ? ridv.int_val() : -1;
  
!     DrawLink* link = 
        ((DrawServ*)unidraw)->linkup(hoststr, portnum, statenum, 
  				   lidnum, ridnum, this->comterp());
!     if (link) {
!       DrawLinkComp* linkcomp = new DrawLinkComp(link);
!       ComValue result(DrawLinkComp::class_symid(), new ComponentView(linkcomp));
!       result.object_compview(true);
!       push_stack(result);
!     }
!     else
!       push_stack(ComValue::nullval());
    } 
      
    return;
  
  #endif
--- 76,115 ----
      int lidnum = lidv.is_known() ? lidv.int_val() : -1;
      int ridnum = ridv.is_known() ? ridv.int_val() : -1;
  
!     link = 
        ((DrawServ*)unidraw)->linkup(hoststr, portnum, statenum, 
  				   lidnum, ridnum, this->comterp());
!   
!      
    } 
+ 
+   /* return pointer to existing link */
+   else if (ridv.is_known() || lidv.is_known()) {
+     link = ((DrawServ*)unidraw)->linkget
+       (lidv.is_known() ? lidv.int_val() : -1, 
+        ridv.is_known() ? ridv.int_val() : -1);
+ 
+     /* close if that flag is set. */
+     if (link && closev.is_true()) {
+       ((DrawServ*)unidraw)->linkdown(link);
+       link = nil;
+     }
      
+   }
+ 
+   /* dump DrawLink table to stderr */
+   else 
+     ((DrawServ*)unidraw)->linkdump(stderr);
+   
+   if (link) {
+     DrawLinkComp* linkcomp = new DrawLinkComp(link);
+     ComValue result(DrawLinkComp::class_symid(), new ComponentView(linkcomp));
+     result.object_compview(true);
+     push_stack(result);
+   }
+   else
+     push_stack(ComValue::nullval());
+ 
    return;
  
  #endif
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.9 DrawServ/drawserv.c:1.10
*** DrawServ/drawserv.c:1.9	Fri Feb 27 13:40:27 2004
--- src/DrawServ/drawserv.c	Fri Feb 27 15:45:31 2004
***************
*** 108,111 ****
    delete link;
  }
  
!   
--- 108,142 ----
    delete link;
  }
  
! DrawLink* DrawServ::linkget(int local_id, int remote_id) {
!   DrawLink* link = nil;
!   if (_list) {
!     Iterator(i);
!     _list->First(i);
!     while (!_list->Done(i) && !link) {
!       DrawLink* l = _list->GetDrawLink(i);
!       if (l->local_linkid()==local_id && remote_id==-1 ||
! 	  local_id==-1 && l->remote_linkid()==remote_id ||
! 	  l->local_linkid()==local_id && l->remote_linkid()==remote_id)
! 	link = l;
!       _list->Next(i);
!     }
!   }
!   return link;
! }
! 
! void DrawServ::linkdump(FILE* fptr) {
!   fprintf(fptr, "Host                            Alt.                            Port    LID  RID\n");
!   fprintf(fptr, "------------------------------  ------------------------------  ------  ---  ---\n");
!   if (_list) {
!     Iterator i;
!     _list->First(i);
!     while(!_list->Done(i)) {
!       DrawLink* link = _list->GetDrawLink(i);
!       fprintf(fptr, "%-30.30s  %-30.30s  %-6d  %-3d  %-3d\n", 
! 	      link->hostname(), link->althostname(), link->portnum(),
! 	      link->local_linkid(), link->remote_linkid());
!       _list->Next(i);
!     }
!   }
! }
Index: DrawServ/drawserv.h
diff -c DrawServ/drawserv.h:1.6 DrawServ/drawserv.h:1.7
*** DrawServ/drawserv.h:1.6	Fri Feb 27 13:40:27 2004
--- src/DrawServ/drawserv.h	Fri Feb 27 15:45:31 2004
***************
*** 60,65 ****
--- 60,71 ----
      int linkdown(DrawLink* link);
      // shut down existing link to remote drawserv
  
+     DrawLink* linkget(int local_id, int remote_id=-1);
+     // return pointer to existing DrawLink
+ 
+     void linkdump(FILE*);
+     // dump text table of DrawLink's
+ 
  protected:
      DrawLinkList* _list;
  };
*** /dev/null	 Fri Feb 27 15:45:36 PST 2004
--- patches/ivtools-040227-johnston-027
*************** patches/ivtools-040227-johnston-027
*** 0 ****
--- 1 ----
+ ivtools-040227-johnston-027

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040228-johnston-028"
Content-Disposition: attachment;
	filename=ivtools-040228-johnston-028

Patch:    ivtools-040228-johnston-028
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  patch to propogate drawserv development via cvs
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

- patch to propogate drawserv development via cvs

Index: DrawServ/drawserv-handler.c
diff -c DrawServ/drawserv-handler.c:1.2 DrawServ/drawserv-handler.c:1.3
*** DrawServ/drawserv-handler.c:1.2	Fri Feb 27 09:41:36 2004
--- src/DrawServ/drawserv-handler.c	Sat Feb 28 09:02:30 2004
***************
*** 36,41 ****
  
  void DrawServHandler::destroy (void) {
    ComterpHandler::destroy();
!   if (drawlink()) ((DrawServ*)unidraw)->linkdown(drawlink());
  }
  #endif /* HAVE_ACE */
--- 36,44 ----
  
  void DrawServHandler::destroy (void) {
    ComterpHandler::destroy();
!   if (drawlink()) {
!     ((DrawServ*)unidraw)->linkdown(drawlink());
!     drawlink(nil);
!   }
  }
  #endif /* HAVE_ACE */
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.10 DrawServ/drawserv.c:1.11
*** DrawServ/drawserv.c:1.10	Fri Feb 27 15:45:31 2004
--- src/DrawServ/drawserv.c	Sat Feb 28 09:02:30 2004
***************
*** 103,111 ****
  }
  
  int DrawServ::linkdown(DrawLink* link) {
!   _list->Remove(link);
!   link->close();
!   delete link;
  }
  
  DrawLink* DrawServ::linkget(int local_id, int remote_id) {
--- 103,115 ----
  }
  
  int DrawServ::linkdown(DrawLink* link) {
!   if (_list->Includes(link)) {
!     _list->Remove(link);
!     link->close();
!     delete link;
!     return 0;
!   } else
!     return -1;
  }
  
  DrawLink* DrawServ::linkget(int local_id, int remote_id) {
Index: DrawServ/drawserv.h
diff -c DrawServ/drawserv.h:1.7 DrawServ/drawserv.h:1.8
*** DrawServ/drawserv.h:1.7	Fri Feb 27 15:45:31 2004
--- src/DrawServ/drawserv.h	Sat Feb 28 09:02:31 2004
***************
*** 28,33 ****
--- 28,34 ----
  #define drawserv_h
  
  #include <OverlayUnidraw/ovunidraw.h>
+ #include <stdio.h>
  
  //: Unidraw specialized for DrawServ
  // Unidraw (OverlayUnidraw) specialized for DrawServ application.
*** /dev/null	 Sat Feb 28 09:02:41 PST 2004
--- patches/ivtools-040228-johnston-028
*************** patches/ivtools-040228-johnston-028
*** 0 ****
--- 1 ----
+ ivtools-040228-johnston-028

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040228-johnston-029"
Content-Disposition: attachment;
	filename=ivtools-040228-johnston-029

Patch:    ivtools-040228-johnston-029
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  patch to propogate drawserv development via cvs
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

- patch to propogate drawserv development via cvs

Index: ComTerp/comhandler.c
diff -c ComTerp/comhandler.c:1.4 ComTerp/comhandler.c:1.5
*** ComTerp/comhandler.c:1.4	Fri Feb 27 13:40:17 2004
--- src/ComTerp/comhandler.c	Sat Feb 28 09:45:59 2004
***************
*** 193,198 ****
--- 193,202 ----
      if (!comterp_ || !input_good)
        return -1;
      else if (!inbuf || !*inbuf) {
+ #if 1 // do nothing on null input
+       fprintf(stderr, "ComterpHandler::handle_input null input\n");
+       return 0;
+ #else
  #if __GNUC__<3
        filebuf obuf(fd ? fd : 1);
        ostream ostr(&obuf);
***************
*** 205,210 ****
--- 209,215 ----
        ostr << "\n";
        ostr.flush();
        return 0;
+ #endif
  #endif
      }
      if (!ComterpHandler::logger_mode()) {
*** /dev/null	 Sat Feb 28 09:46:13 PST 2004
--- patches/ivtools-040228-johnston-029
*************** patches/ivtools-040228-johnston-029
*** 0 ****
--- 1 ----
+ ivtools-040228-johnston-029

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040228-johnston-030"
Content-Disposition: attachment;
	filename=ivtools-040228-johnston-030

Patch:    ivtools-040228-johnston-030
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  patch to propogate drawserv development via cvs
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

- patch to propogate drawserv development via cvs

Index: ComTerp/comhandler.c
diff -c ComTerp/comhandler.c:1.5 ComTerp/comhandler.c:1.6
*** ComTerp/comhandler.c:1.5	Sat Feb 28 09:45:59 2004
--- src/ComTerp/comhandler.c	Sat Feb 28 09:51:46 2004
***************
*** 193,201 ****
      if (!comterp_ || !input_good)
        return -1;
      else if (!inbuf || !*inbuf) {
! #if 1 // do nothing on null input
!       fprintf(stderr, "ComterpHandler::handle_input null input\n");
!       return 0;
  #else
  #if __GNUC__<3
        filebuf obuf(fd ? fd : 1);
--- 193,201 ----
      if (!comterp_ || !input_good)
        return -1;
      else if (!inbuf || !*inbuf) {
! #if 1 // shut down on null input
!       fprintf(stderr, "ComterpHandler::handle_input null input--shutting down\n");
!       return -1;
  #else
  #if __GNUC__<3
        filebuf obuf(fd ? fd : 1);
*** /dev/null	 Sat Feb 28 09:52:01 PST 2004
--- patches/ivtools-040228-johnston-030
*************** patches/ivtools-040228-johnston-030
*** 0 ****
--- 1 ----
+ ivtools-040228-johnston-030

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040301-johnston-031"
Content-Disposition: attachment;
	filename=ivtools-040301-johnston-031

Patch:    ivtools-040301-johnston-031
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  patch to propogate drawserv development via cvs
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

- patch to propogate drawserv development via cvs

Index: ComTerp/comhandler.c
diff -c ComTerp/comhandler.c:1.6 ComTerp/comhandler.c:1.7
*** ComTerp/comhandler.c:1.6	Sat Feb 28 09:51:46 2004
--- src/ComTerp/comhandler.c	Mon Mar  1 13:41:37 2004
***************
*** 34,39 ****
--- 34,41 ----
  #include <vector.h>
  #endif
  
+ #include <signal.h>
+ 
  #if BUFSIZ>1024
  #undef BUFSIZ
  #define BUFSIZ 1024
***************
*** 193,202 ****
      if (!comterp_ || !input_good)
        return -1;
      else if (!inbuf || !*inbuf) {
- #if 1 // shut down on null input
-       fprintf(stderr, "ComterpHandler::handle_input null input--shutting down\n");
-       return -1;
- #else
  #if __GNUC__<3
        filebuf obuf(fd ? fd : 1);
        ostream ostr(&obuf);
--- 195,200 ----
***************
*** 204,215 ****
        ostr.flush();
        return 0;
  #else
        fileptr_filebuf obuf(fd ? wrfptr() : stdout, ios_base::out);
        ostream ostr(&obuf);
        ostr << "\n";
        ostr.flush();
        return 0;
- #endif
  #endif
      }
      if (!ComterpHandler::logger_mode()) {
--- 202,220 ----
        ostr.flush();
        return 0;
  #else
+       /* ignore broken pipe just in case that is why the input was null */
+       struct sigaction oldaction, newaction;
+       newaction.sa_handler = SIG_IGN;
+       newaction.sa_mask = 0;
+       newaction.sa_flags = 0;
+       newaction.sa_sigaction = 0;
+       int status = sigaction(SIGPIPE, &newaction, &oldaction);  // this doesn't work yet
        fileptr_filebuf obuf(fd ? wrfptr() : stdout, ios_base::out);
        ostream ostr(&obuf);
        ostr << "\n";
        ostr.flush();
+       status = sigaction(SIGPIPE, &oldaction, nil);
        return 0;
  #endif
      }
      if (!ComterpHandler::logger_mode()) {
Index: DrawServ/drawlink.c
diff -c DrawServ/drawlink.c:1.9 DrawServ/drawlink.c:1.10
*** DrawServ/drawlink.c:1.9	Fri Feb 27 10:00:20 2004
--- src/DrawServ/drawlink.c	Mon Mar  1 13:41:59 2004
***************
*** 116,118 ****
--- 116,122 ----
    if (althost) _althost = strnew(althost);
  }
  
+ int DrawLink::handle() {
+   if (_socket) return _socket->get_handle();
+   else return -1;
+ }
Index: DrawServ/drawlink.h
diff -c DrawServ/drawlink.h:1.6 DrawServ/drawlink.h:1.7
*** DrawServ/drawlink.h:1.6	Fri Feb 27 09:57:23 2004
--- src/DrawServ/drawlink.h	Mon Mar  1 13:41:59 2004
***************
*** 74,79 ****
--- 74,82 ----
      int ok() { return _ok; }
      // return 1 if link ok (but not necessarily two-way yet), 0 if not
  
+     int handle();
+     // return file descriptor associated with link
+ 
      int local_linkid() { return _local_linkid; }
      // get local DrawLink id
      int remote_linkid() { return _remote_linkid; }
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.11 DrawServ/drawserv.c:1.12
*** DrawServ/drawserv.c:1.11	Sat Feb 28 09:02:30 2004
--- src/DrawServ/drawserv.c	Mon Mar  1 13:41:59 2004
***************
*** 25,39 ****
   * Implementation of DrawServ class.
   */
  
  #include <DrawServ/drawlink.h>
  #include <DrawServ/drawlinklist.h>
  #include <DrawServ/drawserv.h>
  #include <DrawServ/drawserv-handler.h>
  
  #include <Unidraw/iterator.h>
  #include <Unidraw/ulist.h>
  
- #include <ComTerp/comterp.h>
  /*****************************************************************************/
  
  DrawServ::DrawServ (Catalog* c, int& argc, char** argv, 
--- 25,51 ----
   * Implementation of DrawServ class.
   */
  
+ #include <DrawServ/draweditor.h>
  #include <DrawServ/drawlink.h>
  #include <DrawServ/drawlinklist.h>
  #include <DrawServ/drawserv.h>
  #include <DrawServ/drawserv-handler.h>
  
+ #include <OverlayUnidraw/ovclasses.h>
+ #include <OverlayUnidraw/scriptview.h>
+ 
+ #include <Unidraw/Commands/command.h>
+ #include <Unidraw/catalog.h>
+ #include <Unidraw/clipboard.h>
+ #include <Unidraw/creator.h>
  #include <Unidraw/iterator.h>
  #include <Unidraw/ulist.h>
+ 
+ #include <ComTerp/comterpserv.h>
+ 
+ #include <fstream.h>
+ #include <strstream>
  
  /*****************************************************************************/
  
  DrawServ::DrawServ (Catalog* c, int& argc, char** argv, 
***************
*** 143,146 ****
--- 155,245 ----
        _list->Next(i);
      }
    }
+ }
+ 
+ void DrawServ::ExecuteCmd(Command* cmd) {
+   if(!_list || _list->Number()==0) 
+ 
+     /* normal Unidraw command execution */
+     Unidraw::ExecuteCmd(cmd);
+ 
+   else {
+ 
+     /* indirect command execution, all by script */
+     std::ostrstream sbuf;
+     boolean oldflag = OverlayScript::ptlist_parens();
+     OverlayScript::ptlist_parens(false);
+     switch (cmd->GetClassId()) {
+     case PASTE_CMD:
+       {
+       boolean scripted = false;
+       Clipboard* cb = cmd->GetClipboard();
+       if (cb) {
+ 	Iterator it;
+ 	for (cb->First(it); !cb->Done(it); cb->Next(it)) {
+ 	  OverlayComp* comp = (OverlayComp*)cb->GetComp(it);
+ 	  if (comp) {
+ 	    Creator* creator = unidraw->GetCatalog()->GetCreator();
+ 	    OverlayScript* scripter = (OverlayScript*)
+ 	      creator->Create(Combine(comp->GetClassId(), SCRIPT_VIEW));
+ 	    if (scripter) {
+ 	      scripter->SetSubject(comp);
+ 	      if (scripted) 
+ 		sbuf << ';';
+ 	      else 
+ 		scripted = true;
+ 	      boolean status = scripter->Definition(sbuf);
+ 	      delete scripter;
+ 	    }
+ 	  }
+ 	}
+       }
+       if (!scripted)
+ 	sbuf << "print(\"Failed attempt to generate script for a PASTE_CMD\\n\" :err)";
+       sbuf.put('\0');
+       cout << sbuf.str() << "\n";
+       cout.flush();
+ 
+       /* first execute here */
+       ((ComEditor*)cmd->GetEditor())->GetComTerp()->run(sbuf.str());
+ 
+       /* then send everywhere else */
+       DistributeCmdString(sbuf.str());
+ 
+       delete cmd;
+       }
+       break;
+     default:
+       sbuf << "print(\"Attempt to convert unknown command (id == %d) to interpretable script\\n\" " << cmd->GetClassId() << " :err)";
+       cmd->Execute();
+       if (cmd->Reversible()) {
+ 	cmd->Log();
+       } else {
+ 	delete cmd;
+       }
+       break;
+     }
+     OverlayScript::ptlist_parens(oldflag);
+   }
+ }
+ 
+ void DrawServ::DistributeCmdString(const char* cmdstring) {
+ 
+   Iterator i;
+   _list->First(i);
+   while (!_list->Done(i)) {
+     DrawLink* link = _list->GetDrawLink(i);
+     if (link) {
+       int fd = link->handle();
+       if (fd>=0) {
+ 	fileptr_filebuf fbuf(fd, ios_base::out, false, static_cast<size_t>(BUFSIZ));
+ 	ostream out(&fbuf);
+ 	out << cmdstring;
+ 	out << "\n";
+ 	out.flush();
+       }
+     }
+     _list->Next(i);
+   }
+ 
  }
Index: DrawServ/drawserv.h
diff -c DrawServ/drawserv.h:1.8 DrawServ/drawserv.h:1.9
*** DrawServ/drawserv.h:1.8	Sat Feb 28 09:02:31 2004
--- src/DrawServ/drawserv.h	Mon Mar  1 13:41:59 2004
***************
*** 67,72 ****
--- 67,78 ----
      void linkdump(FILE*);
      // dump text table of DrawLink's
  
+     virtual void ExecuteCmd(Command*);
+     // execute Command's locally, and on remote linked DrawServ's.
+ 
+     virtual void DistributeCmdString(const char* cmdstring);
+     // execute command string locally, and on remote DrawServ's
+ 
  protected:
      DrawLinkList* _list;
  };
Index: OverlayUnidraw/ovimport.c
diff -c OverlayUnidraw/ovimport.c:1.1 OverlayUnidraw/ovimport.c:1.2
*** OverlayUnidraw/ovimport.c:1.1	Fri Jan  9 11:44:53 2004
--- src/OverlayUnidraw/ovimport.c	Mon Mar  1 13:41:54 2004
***************
*** 1630,1637 ****
        }
  
      } else if (strncmp(creator, "JPEG", 4)==0) {
!       if (OverlayKit::bincheck("stdcmapppm") && 
! 	  OverlayKit::bincheck("djpeg")) {
  
  	if (pathname && !return_fd) {
  	  char buffer[BUFSIZ];
--- 1630,1638 ----
        }
  
      } else if (strncmp(creator, "JPEG", 4)==0) {
!       boolean stdcmapppm_flag = OverlayKit::bincheck("stdcmapppm");
!       boolean djpeg_flag = OverlayKit::bincheck("djpeg");
!       if (stdcmapppm_flag && djpeg_flag) {
  
  	if (pathname && !return_fd) {
  	  char buffer[BUFSIZ];
Index: OverlayUnidraw/ovkit.c
diff -c OverlayUnidraw/ovkit.c:1.1 OverlayUnidraw/ovkit.c:1.2
*** OverlayUnidraw/ovkit.c:1.1	Fri Jan  9 11:44:54 2004
--- src/OverlayUnidraw/ovkit.c	Mon Mar  1 13:41:54 2004
***************
*** 1639,1648 ****
  
  int OverlayKit::bintest(const char* command) {
    char combuf[BUFSIZ];
!   sprintf( combuf, "which %s", command );
    FILE* fptr = popen(combuf, "r");
    char testbuf[BUFSIZ];	
    fgets(testbuf, BUFSIZ, fptr);  
    pclose(fptr);
    if (strncmp(testbuf+strlen(testbuf)-strlen(command)-1, 
  	      command, strlen(command)) != 0) {
--- 1639,1651 ----
  
  int OverlayKit::bintest(const char* command) {
    char combuf[BUFSIZ];
!   // the echo -n $PATH is to workaround a mysterious problem on MacOS X
!   // whereby the which sometime returns nothing
!   sprintf( combuf, "echo -n $PATH; which %s", command );
    FILE* fptr = popen(combuf, "r");
    char testbuf[BUFSIZ];	
    fgets(testbuf, BUFSIZ, fptr);  
+   // fprintf(stderr, "%s\n", testbuf);
    pclose(fptr);
    if (strncmp(testbuf+strlen(testbuf)-strlen(command)-1, 
  	      command, strlen(command)) != 0) {
***************
*** 1653,1659 ****
  
  boolean OverlayKit::bincheck(const char* command) {
    int status = bintest(command);
!   return !status;
  }
  
  const char* OverlayKit::otherdisplay() { return _otherdisplay; }
--- 1656,1662 ----
  
  boolean OverlayKit::bincheck(const char* command) {
    int status = bintest(command);
!   return status==0 ? 1 : 0;
  }
  
  const char* OverlayKit::otherdisplay() { return _otherdisplay; }
*** /dev/null	 Mon Mar 1 13:42:10 PST 2004
--- patches/ivtools-040301-johnston-031
*************** patches/ivtools-040301-johnston-031
*** 0 ****
--- 1 ----
+ ivtools-040301-johnston-031

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040305-johnston-032"
Content-Disposition: attachment;
	filename=ivtools-040305-johnston-032

Patch:    ivtools-040305-johnston-032
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  patch to propogate drawserv development via cvs
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

- patch to propogate drawserv development via cvs

Index: Attribute/attrvalue.c
diff -c Attribute/attrvalue.c:1.1 Attribute/attrvalue.c:1.2
*** Attribute/attrvalue.c:1.1	Fri Jan  9 11:42:18 2004
--- src/Attribute/attrvalue.c	Fri Mar  5 10:53:14 2004
***************
*** 1067,1069 ****
--- 1067,1082 ----
    } else
      return 0;
  }
+ 
+ int AttributeValue::state() {
+   if (!is_stream() && !is_object() && !is_command()) 
+     return _state;
+   else
+     return -1;
+ }
+ 
+ void AttributeValue::state(int val) {
+   if (!is_stream() && !is_object() && !is_command()) 
+     _state = val;
+ }
+ 
Index: Attribute/attrvalue.h
diff -c Attribute/attrvalue.h:1.1 Attribute/attrvalue.h:1.2
*** Attribute/attrvalue.h:1.1	Fri Jan  9 11:42:18 2004
--- src/Attribute/attrvalue.h	Fri Mar  5 10:53:15 2004
***************
*** 256,261 ****
--- 256,266 ----
      void stream_list(AttributeValueList* list); 
      // set pointer to AttributeValueList associated with stream object
  
+     int state();
+     // get generic state value useful for any type other than CommandType, ObjectType, or StreamType
+     void state(int val);
+     // set generic state value useful for any type other than CommandType, ObjectType, or StreamType0 = disabled, negative = internal, positive = external
+ 
      void negate();
      // negate numeric values.
  
***************
*** 370,375 ****
--- 375,381 ----
        int _command_symid; // used for CommandType.
        boolean _object_compview; // used for ObjectType.
        int _stream_mode; // used for StreamType
+       int _state; // useful for any type other than CommandType, ObjectType, or StreamType
      };
      static int* _type_syms;
  
Index: ComUnidraw/grfunc.c
diff -c ComUnidraw/grfunc.c:1.3 ComUnidraw/grfunc.c:1.4
*** ComUnidraw/grfunc.c:1.3	Thu Jan 29 10:54:56 2004
--- src/ComUnidraw/grfunc.c	Fri Mar  5 10:54:06 2004
***************
*** 898,904 ****
        return;
      }
        
!     OverlaySelection* newSel = new OverlaySelection();
      
      Viewer* viewer = _ed->GetViewer();
      AttributeValueList* avl = new AttributeValueList();
--- 898,904 ----
        return;
      }
        
!     OverlaySelection* newSel = ((OverlayEditor*)_ed)->overlay_kit()->MakeSelection();
      
      Viewer* viewer = _ed->GetViewer();
      AttributeValueList* avl = new AttributeValueList();
Index: DrawServ/Imakefile
diff -c DrawServ/Imakefile:1.6 DrawServ/Imakefile:1.7
*** DrawServ/Imakefile:1.6	Fri Feb 27 13:40:27 2004
--- src/DrawServ/Imakefile	Fri Mar  5 10:54:11 2004
***************
*** 30,35 ****
--- 30,38 ----
  Obj26(drawserv)
  Obj26A(drawserv-handler)
  Obj26(drawviews)
+ Obj26(grid)
+ Obj26(gridlist)
+ Obj26(linkselection)
  
  
  #define Obj31(file) MakeObjectFromSrcFlags(file, -Div2_6_incompatible -I$(TOP)/src/include $(TOP_CCINCLUDES))
Index: DrawServ/draweditor.c
diff -c DrawServ/draweditor.c:1.2 DrawServ/draweditor.c:1.3
*** DrawServ/draweditor.c:1.2	Thu Feb 26 10:51:27 2004
--- src/DrawServ/draweditor.c	Fri Mar  5 10:54:11 2004
***************
*** 84,88 ****
--- 84,89 ----
    FrameEditor::AddCommands(comterp);
  
    comterp->add_command("drawlink", new DrawLinkFunc(comterp, this));
+   comterp->add_command("reserve", new ReserveFunc(comterp, this));
  }
  
Index: DrawServ/draweditor.h
diff -c DrawServ/draweditor.h:1.1 DrawServ/draweditor.h:1.2
*** DrawServ/draweditor.h:1.1	Thu Feb 12 13:27:07 2004
--- src/DrawServ/draweditor.h	Fri Mar  5 10:54:11 2004
***************
*** 26,31 ****
--- 26,33 ----
  
  #include <FrameUnidraw/frameeditor.h>
  
+ class DrawKit;
+ 
  //: editor for DrawServ application
  class DrawEditor : public FrameEditor {
  public:
***************
*** 44,49 ****
--- 46,53 ----
      // this DrawEditor.
  
  protected:
+ 
+ friend class DrawKit;
  
  };
  
Index: DrawServ/drawfunc.c
diff -c DrawServ/drawfunc.c:1.9 DrawServ/drawfunc.c:1.10
*** DrawServ/drawfunc.c:1.9	Fri Feb 27 15:45:31 2004
--- src/DrawServ/drawfunc.c	Fri Mar  5 10:54:11 2004
***************
*** 27,32 ****
--- 27,35 ----
  #include <DrawServ/drawlinkcomp.h>
  #include <DrawServ/drawserv.h>
  
+ #include <Attribute/attrlist.h>
+ #include <Attribute/attrvalue.h>
+ 
  #define TITLE "DrawLinkFunc"
  
  /*****************************************************************************/
***************
*** 115,117 ****
--- 118,240 ----
  #endif
  
  }
+ 
+ 
+ /*****************************************************************************/
+ 
+ ReserveFunc::ReserveFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) {
+ }
+ 
+ void ReserveFunc::execute() {
+ #if 1
+   static int batchid_symid = symbol_add("batchid");
+   ComValue batchidv(stack_key(batchid_symid));
+   unsigned int batchid = batchidv.is_known() ? batchidv.uint_val() : 0;
+ 
+   static int batch_symid = symbol_add("batch");
+   ComValue batch_flagv(stack_key(batch_symid));
+   boolean batch_flag = batch_flagv.is_true();
+ 
+   ComValue arrayv(stack_arg(0));
+ 
+   reset_stack();
+ 
+   /* provoke a batch request */
+   if (batch_flag) 
+     ((DrawServ*)unidraw)->reserve_batch_request(DrawServ::reserve_batch_size());
+ 
+   /* handle a batch request */
+   else if (arrayv.is_array()) {
+     AttributeValueList* avl = arrayv.array_val();
+     Iterator it;
+     avl->First(it);
+     const int nids = avl->Number();
+     unsigned int ids[nids];
+     for (int i=0; i<nids; i++) {
+       ids[i] = avl->GetAttrVal(it)->uint_val();
+       avl->Next(it);
+     }
+     ((DrawServ*)unidraw)->reserve_batch_handle(nil, ids, nids, batchid);
+   }
+     
+ 
+ #else
+     static int all_symid = symbol_add("all");
+     ComValue all_flagv(stack_key(all_symid));
+     boolean all_flag = all_flagv.is_true();
+ 
+     static int clear_symid = symbol_add("clear");
+     ComValue clear_flagv(stack_key(clear_symid));
+     boolean clear_flag = clear_flagv.is_true();
+ 
+     Selection* sel = _ed->GetViewer()->GetSelection();
+     if (clear_flag) {
+       sel->Clear();
+       reset_stack();
+       return;
+     }
+       
+     OverlaySelection* newSel = ((OverlayEditor*)_ed)->overlay_kit()->MakeSelection();
+     
+     Viewer* viewer = _ed->GetViewer();
+     AttributeValueList* avl = new AttributeValueList();
+     if (all_flag) {
+ 
+       GraphicView* gv = ((OverlayEditor*)_ed)->GetFrame();
+       Iterator i;
+       int count=0;
+       for (gv->First(i); !gv->Done(i); gv->Next(i)) {
+ 	GraphicView* subgv = gv->GetView(i);
+ 	newSel->Append(subgv);
+ 	OverlayComp* comp = (OverlayComp*)subgv->GetGraphicComp();
+ 	ComValue* compval = new ComValue(comp->classid(), new ComponentView(comp));
+ 	compval->object_compview(true);
+ 	avl->Append(compval);
+       }
+ 
+     } else if (nargs()==0) {
+       Iterator i;
+       int count=0;
+       for (sel->First(i); !sel->Done(i); sel->Next(i)) {
+ 	GraphicView* grview = sel->GetView(i);
+ 	OverlayComp* comp = grview ? (OverlayComp*)grview->GetSubject() : nil;
+ 	ComValue* compval = comp ? new ComValue(comp->classid(), new ComponentView(comp)) : nil;
+ 
+ 	if (compval) {
+ 	  compval->object_compview(true);
+ 	  avl->Append(compval);
+ 	}
+ 	delete newSel;
+         newSel = nil;
+       }
+ 
+     } else {
+ 
+       for (int i=0; i<nargsfixed(); i++) {
+         ComValue& obj = stack_arg(i);
+ 	if (obj.object_compview()) {
+ 	  ComponentView* comview = (ComponentView*)obj.obj_val();
+ 	  OverlayComp* comp = (OverlayComp*)comview->GetSubject();
+ 	  if (comp) {
+ 	    newSel->Append(comp->FindView(viewer));
+ 	    ComValue* compval = new ComValue(comp->classid(), new ComponentView(comp));
+ 	    compval->object_compview(true);
+ 	    avl->Append(compval);
+ 	  }
+ 	}
+       }
+     }
+ 
+     if (newSel){
+       sel->Clear();
+       delete sel;
+       _ed->SetSelection(newSel);
+       newSel->Update(viewer);
+       unidraw->Update();
+     }
+     reset_stack();
+     ComValue retval(avl);
+     push_stack(retval);
+ #endif
+ }
+ 
Index: DrawServ/drawfunc.h
diff -c DrawServ/drawfunc.h:1.2 DrawServ/drawfunc.h:1.3
*** DrawServ/drawfunc.h:1.2	Thu Feb 26 10:51:27 2004
--- src/DrawServ/drawfunc.h	Fri Mar  5 10:54:11 2004
***************
*** 37,41 ****
--- 37,51 ----
  	return "%s(hoststr :port portnum) -- connect to remote drawserv"; }
  };
  
+ //: command to reserve graphics for selection in remote editors
+ // reserve([compview ...] :all :clear) -- reserve graphic(s) for remote selection
+ class ReserveFunc : public UnidrawFunc {
+ public:
+     ReserveFunc(ComTerp*,Editor*);
+     virtual void execute();
+     virtual const char* docstring() { 
+ 	return "%s([compview ...] :all :clear) -- reserve graphic(s) for remote selection"; }
+ };
+ 
  #endif /* !defined(_drawfunc_h) */
  
Index: DrawServ/drawkit.c
diff -c DrawServ/drawkit.c:1.1 DrawServ/drawkit.c:1.2
*** DrawServ/drawkit.c:1.1	Fri Jan  9 11:45:18 2004
--- src/DrawServ/drawkit.c	Fri Mar  5 10:54:11 2004
***************
*** 29,35 ****
  
  #include <DrawServ/drawkit.h>
  #include <DrawServ/drawcomps.h>
! #include <ComUnidraw/comeditor.h>
  
  #include <FrameUnidraw/frameeditor.h>
  
--- 29,38 ----
  
  #include <DrawServ/drawkit.h>
  #include <DrawServ/drawcomps.h>
! #include <DrawServ/draweditor.h>
! #include <DrawServ/drawlinklist.h>
! #include <DrawServ/drawserv.h>
! #include <DrawServ/linkselection.h>
  
  #include <FrameUnidraw/frameeditor.h>
  
***************
*** 448,450 ****
--- 451,456 ----
    unidraw->Open(ed);
  }
  
+ OverlaySelection* DrawKit::MakeSelection(Selection* sel) {
+   return new LinkSelection(((DrawServ*)unidraw)->linklist(), sel);
+ }
Index: DrawServ/drawkit.h
diff -c DrawServ/drawkit.h:1.1 DrawServ/drawkit.h:1.2
*** DrawServ/drawkit.h:1.1	Fri Jan  9 11:45:18 2004
--- src/DrawServ/drawkit.h	Fri Mar  5 10:54:11 2004
***************
*** 1,4 ****
--- 1,5 ----
  /*
+  * Copyright (c) 2004 Scott E. Johnston
   * Copyright (c) 1994-1997,1999 Vectaport Inc.
   *
   * Permission to use, copy, modify, distribute, and sell this software and
***************
*** 47,52 ****
--- 48,55 ----
  
      static DrawKit* Instance();
  
+     virtual OverlaySelection* MakeSelection(Selection* sel = nil);
+     // make Selection of the proper derivation.
  protected:
      void toolbar0();
      void toolbar1();
Index: DrawServ/drawlinklist.h
diff -c DrawServ/drawlinklist.h:1.1 DrawServ/drawlinklist.h:1.2
*** DrawServ/drawlinklist.h:1.1	Thu Feb 26 10:54:54 2004
--- src/DrawServ/drawlinklist.h	Fri Mar  5 10:54:11 2004
***************
*** 32,37 ****
--- 32,38 ----
  
  #include <Unidraw/globals.h>
  
+ class DrawLink;
  class Iterator;
  class UList;
  
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.12 DrawServ/drawserv.c:1.13
*** DrawServ/drawserv.c:1.12	Mon Mar  1 13:41:59 2004
--- src/DrawServ/drawserv.c	Fri Mar  5 10:54:11 2004
***************
*** 30,35 ****
--- 30,37 ----
  #include <DrawServ/drawlinklist.h>
  #include <DrawServ/drawserv.h>
  #include <DrawServ/drawserv-handler.h>
+ #include <DrawServ/grid.h>
+ #include <DrawServ/gridlist.h>
  
  #include <OverlayUnidraw/ovclasses.h>
  #include <OverlayUnidraw/scriptview.h>
***************
*** 43,51 ****
--- 45,60 ----
  
  #include <ComTerp/comterpserv.h>
  
+ #include <Attribute/attrlist.h>
+ 
  #include <fstream.h>
  #include <strstream>
  
+ int DrawServ::_reserve_batch_min = 3;
+ int DrawServ::_reserve_batch_size = 5;
+ 
+ implementTable(GraphicIdTable,int,void*)
+ 
  /*****************************************************************************/
  
  DrawServ::DrawServ (Catalog* c, int& argc, char** argv, 
***************
*** 60,70 ****
  }
  
  void DrawServ::Init() {
!   _list = new DrawLinkList;
  }
  
  DrawServ::~DrawServ () 
  {
  }
  
  DrawLink* DrawServ::linkup(const char* hostname, int portnum, 
--- 69,86 ----
  }
  
  void DrawServ::Init() {
!   _linklist = new DrawLinkList;
!   _grid_request_list = new GraphicIdList;
!   _grid_reserved_list = new GraphicIdList;
!   _gridtable = new GraphicIdTable(1024);
  }
  
  DrawServ::~DrawServ () 
  {
+   delete _linklist;
+   delete _grid_request_list;
+   delete _grid_reserved_list;
+   delete _gridtable;
  }
  
  DrawLink* DrawServ::linkup(const char* hostname, int portnum, 
***************
*** 79,85 ****
      }
      link->open();
      if (link && link->ok()) {
!       _list->add_drawlink(link);
        return link;
      } else {
        delete link;
--- 95,101 ----
      }
      link->open();
      if (link && link->ok()) {
!       _linklist->add_drawlink(link);
        return link;
      } else {
        delete link;
***************
*** 89,101 ****
  
      // search for existing link with matching local_id
      Iterator i;
!     _list->First(i);
!     while(!_list->Done(i) && _list->GetDrawLink(i)->local_linkid()!=local_id)
!       _list->Next(i);
  
      /* if found, finalize linkup */
!     if (!_list->Done(i)) {
!       DrawLink* curlink = _list->GetDrawLink(i);
        curlink->remote_linkid(remote_id);
        curlink->althostname(hostname);
        if (comterp && comterp->handler()) {
--- 105,117 ----
  
      // search for existing link with matching local_id
      Iterator i;
!     _linklist->First(i);
!     while(!_linklist->Done(i) && _linklist->GetDrawLink(i)->local_linkid()!=local_id)
!       _linklist->Next(i);
  
      /* if found, finalize linkup */
!     if (!_linklist->Done(i)) {
!       DrawLink* curlink = _linklist->GetDrawLink(i);
        curlink->remote_linkid(remote_id);
        curlink->althostname(hostname);
        if (comterp && comterp->handler()) {
***************
*** 115,122 ****
  }
  
  int DrawServ::linkdown(DrawLink* link) {
!   if (_list->Includes(link)) {
!     _list->Remove(link);
      link->close();
      delete link;
      return 0;
--- 131,138 ----
  }
  
  int DrawServ::linkdown(DrawLink* link) {
!   if (_linklist->Includes(link)) {
!     _linklist->Remove(link);
      link->close();
      delete link;
      return 0;
***************
*** 126,141 ****
  
  DrawLink* DrawServ::linkget(int local_id, int remote_id) {
    DrawLink* link = nil;
!   if (_list) {
      Iterator(i);
!     _list->First(i);
!     while (!_list->Done(i) && !link) {
!       DrawLink* l = _list->GetDrawLink(i);
        if (l->local_linkid()==local_id && remote_id==-1 ||
  	  local_id==-1 && l->remote_linkid()==remote_id ||
  	  l->local_linkid()==local_id && l->remote_linkid()==remote_id)
  	link = l;
!       _list->Next(i);
      }
    }
    return link;
--- 142,157 ----
  
  DrawLink* DrawServ::linkget(int local_id, int remote_id) {
    DrawLink* link = nil;
!   if (_linklist) {
      Iterator(i);
!     _linklist->First(i);
!     while (!_linklist->Done(i) && !link) {
!       DrawLink* l = _linklist->GetDrawLink(i);
        if (l->local_linkid()==local_id && remote_id==-1 ||
  	  local_id==-1 && l->remote_linkid()==remote_id ||
  	  l->local_linkid()==local_id && l->remote_linkid()==remote_id)
  	link = l;
!       _linklist->Next(i);
      }
    }
    return link;
***************
*** 144,164 ****
  void DrawServ::linkdump(FILE* fptr) {
    fprintf(fptr, "Host                            Alt.                            Port    LID  RID\n");
    fprintf(fptr, "------------------------------  ------------------------------  ------  ---  ---\n");
!   if (_list) {
      Iterator i;
!     _list->First(i);
!     while(!_list->Done(i)) {
!       DrawLink* link = _list->GetDrawLink(i);
        fprintf(fptr, "%-30.30s  %-30.30s  %-6d  %-3d  %-3d\n", 
  	      link->hostname(), link->althostname(), link->portnum(),
  	      link->local_linkid(), link->remote_linkid());
!       _list->Next(i);
      }
    }
  }
  
  void DrawServ::ExecuteCmd(Command* cmd) {
!   if(!_list || _list->Number()==0) 
  
      /* normal Unidraw command execution */
      Unidraw::ExecuteCmd(cmd);
--- 160,180 ----
  void DrawServ::linkdump(FILE* fptr) {
    fprintf(fptr, "Host                            Alt.                            Port    LID  RID\n");
    fprintf(fptr, "------------------------------  ------------------------------  ------  ---  ---\n");
!   if (_linklist) {
      Iterator i;
!     _linklist->First(i);
!     while(!_linklist->Done(i)) {
!       DrawLink* link = _linklist->GetDrawLink(i);
        fprintf(fptr, "%-30.30s  %-30.30s  %-6d  %-3d  %-3d\n", 
  	      link->hostname(), link->althostname(), link->portnum(),
  	      link->local_linkid(), link->remote_linkid());
!       _linklist->Next(i);
      }
    }
  }
  
  void DrawServ::ExecuteCmd(Command* cmd) {
!   if(!_linklist || _linklist->Number()==0) 
  
      /* normal Unidraw command execution */
      Unidraw::ExecuteCmd(cmd);
***************
*** 226,234 ****
  void DrawServ::DistributeCmdString(const char* cmdstring) {
  
    Iterator i;
!   _list->First(i);
!   while (!_list->Done(i)) {
!     DrawLink* link = _list->GetDrawLink(i);
      if (link) {
        int fd = link->handle();
        if (fd>=0) {
--- 242,250 ----
  void DrawServ::DistributeCmdString(const char* cmdstring) {
  
    Iterator i;
!   _linklist->First(i);
!   while (!_linklist->Done(i)) {
!     DrawLink* link = _linklist->GetDrawLink(i);
      if (link) {
        int fd = link->handle();
        if (fd>=0) {
***************
*** 238,245 ****
  	out << "\n";
  	out.flush();
        }
      }
!     _list->Next(i);
    }
  
  }
--- 254,341 ----
  	out << "\n";
  	out.flush();
        }
+     }
+     _linklist->Next(i);
+   }
+ 
+ }
+ 
+ void DrawServ::reserve_batch_request(int nids) {
+ 
+   /* generate a new batch of id's while generating command to reserve them*/
+   GraphicIdsRequest* gridr = new GraphicIdsRequest();
+   GraphicIdList* gridr_list = gridr->sublist();
+   std::ostrstream sbuf;
+   sbuf << "reserve(";
+   for (int i=0; i<_reserve_batch_size; i++) {
+     GraphicId* grid = new GraphicId();
+     gridr_list->Append(grid);
+     if (i) sbuf << ',';
+     sbuf << grid->id();
+   }
+   sbuf << ":batchid " << gridr->id() << ")";
+   DistributeCmdString(sbuf.str());
+ 
+ }
+ 
+ void DrawServ::reserve_batch_response(int reserved, unsigned int batchid) {
+ }
+ 
+ void DrawServ::reserve_batch_handle(DrawLink* link, unsigned int *ids, int nids, unsigned int batchid) {
+   fprintf(stderr, "reserve batch request has been made, batchid==%d\n, batchid");
+   for (int i=0; i<nids; i++) {
+     if (i) fprintf(stderr, ",");
+     fprintf(stderr, "%d", ids[i]);
+   }
+   fprintf(stderr, "\n");
+ }
+ 
+ int DrawServ::reserved_id() {
+   int return_id = 0;
+ 
+   /* process next batch if no more id's ready */
+   if (_grid_reserved_list->Number()==0) reserved_batch();
+ 
+   /* reserve a new batch if number available falls below a threshold */
+   if (_grid_request_list->Number()<reserve_batch_min()) reserve_batch_request(reserve_batch_size());
+ 
+   return return_id;
+ }
+ 
+ int DrawServ::reserved_batch() {
+ 
+   int count = 0;
+ 
+   /* search through list of candidate id sets, and remove 1st */
+   /* set that has completed the reservation process           */
+   Iterator it;
+   _grid_request_list->First(it);
+   GraphicIdsRequest* gridr = nil;
+   while (!_grid_request_list->Done(it) && !gridr) {
+     GraphicIdsRequest* gridr = (GraphicIdsRequest*)_grid_request_list->GetGraphicId(it);
+     if(gridr && gridr->reserved()) {
+       _grid_request_list->Remove(it);
      }
!     _grid_request_list->Next(it);
    }
  
+   /* transfer all of these to the reservation completed list */
+   if (gridr && gridr->sublist()) {
+     Iterator jt;
+     GraphicIdList* gridr_list = gridr->sublist();
+     count = gridr_list->Number();
+     gridr_list->First(jt);
+     while (!gridr_list->Done(jt)) {
+       GraphicId* grid = gridr_list->GetGraphicId(jt);
+       gridr_list->Remove(jt);
+       if (grid) _grid_reserved_list->Append(grid);
+     }
+     delete gridr;
+     return count;
+   } else {
+     fprintf(stderr, "No batch of graphic ids has completed reservation process\n");
+     fprintf(stderr, "Someone should really do something about this\n");
+     return 0;
+   }
  }
+ 
Index: DrawServ/drawserv.h
diff -c DrawServ/drawserv.h:1.9 DrawServ/drawserv.h:1.10
*** DrawServ/drawserv.h:1.9	Mon Mar  1 13:41:59 2004
--- src/DrawServ/drawserv.h	Fri Mar  5 10:54:11 2004
***************
*** 30,42 ****
--- 30,47 ----
  #include <OverlayUnidraw/ovunidraw.h>
  #include <stdio.h>
  
+ #include <OS/table.h>
+ declareTable(GraphicIdTable,int,void*)
+ 
  //: Unidraw specialized for DrawServ
  // Unidraw (OverlayUnidraw) specialized for DrawServ application.
  // Networked application of the Unidraw framework.
  
+ class AttributeValueList;
  class ComTerp;
  class DrawLink;
  class DrawLinkList;
+ class GraphicIdList;
  
  class DrawServ : public OverlayUnidraw {
  public:
***************
*** 73,80 ****
      virtual void DistributeCmdString(const char* cmdstring);
      // execute command string locally, and on remote DrawServ's
  
  protected:
!     DrawLinkList* _list;
  };
  
  #endif
--- 78,124 ----
      virtual void DistributeCmdString(const char* cmdstring);
      // execute command string locally, and on remote DrawServ's
  
+     DrawLinkList* linklist() { return _linklist; }
+     // return pointer to list of DrawLink's
+ 
+ 
+     /* mechanism for reserving graphic ids */
+ 
+     void reserve_batch_request(int nids);
+     // initiate reservation of a set of graphic ids.
+     void reserve_batch_response(int reserved, unsigned int batchid);
+     // finalize reservation of a set of graphic ids
+     void reserve_batch_handle(DrawLink* link, unsigned int* ids, int nids, unsigned int batchid);
+     // respond to a request to reserve ids from a particular DrawLink
+     int reserved_id();
+     // next available reserved id.
+     int reserved_batch();
+     // process next available batch of reserved id's.
+ 
+     static int reserve_batch_min() { return _reserve_batch_min; }
+     // get the minimum number of reserved id batches allowed.
+     static void reserve_batch_min(int min) { _reserve_batch_min = min; }
+     // set the minimum number of reserved id batches allowed.
+     static int reserve_batch_size() { return _reserve_batch_size; }
+     // get the batch size for a request to reserve ids
+     static void reserve_batch_size(int size) { _reserve_batch_size = size; }
+     // set the batch size for a request to reserve ids
+ 
+     GraphicIdTable* gridtable() { return _gridtable; }
+     // return pointer to table of GraphicId's.
+ 
  protected:
!     DrawLinkList* _linklist;
!     // DrawLink list
!     GraphicIdList* _grid_request_list;
!     // GraphicId reservation request list
!     GraphicIdList* _grid_reserved_list;
!     // GraphicId reservation completed list
!     GraphicIdTable* _gridtable;
!     // table of all GraphicId's.
! 
!     static int _reserve_batch_min;
!     static int _reserve_batch_size;
  };
  
  #endif
Index: DrawServ/grid.c
diff -c /dev/null DrawServ/grid.c:1.1
*** /dev/null	Fri Mar  5 10:54:13 2004
--- src/DrawServ/grid.c	Fri Mar  5 10:54:11 2004
***************
*** 0 ****
--- 1,138 ----
+ /*
+  * Copyright (c) 2004 Scott E. Johnston
+  *
+  * Permission to use, copy, modify, distribute, and sell this software and
+  * its documentation for any purpose is hereby granted without fee, provided
+  * that the above copyright notice appear in all copies and that both that
+  * copyright notice and this permission notice appear in supporting
+  * documentation, and that the names of the copyright holders not be used in
+  * advertising or publicity pertaining to distribution of the software
+  * without specific, written prior permission.  The copyright holders make
+  * no representations about the suitability of this software for any purpose.
+  * It is provided "as is" without express or implied warranty.
+  *
+  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL,
+  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  * 
+  */
+ 
+ /*
+  * Implementation of GraphicId class.
+  */
+ 
+ #include <DrawServ/drawlink.h>
+ #include <DrawServ/drawlinklist.h>
+ #include <DrawServ/drawserv.h>
+ #include <DrawServ/grid.h>
+ #include <DrawServ/gridlist.h>
+ 
+ #include <Unidraw/iterator.h>
+ 
+ #include <stdlib.h>
+ #include <time.h>
+ 
+ /*****************************************************************************/
+ 
+ GraphicId::GraphicId () 
+ {
+   _id = candidate_id();
+   GraphicIdTable* table = ((DrawServ*)unidraw)->gridtable();
+   table->insert(_id, this);
+ }
+ 
+ GraphicId::~GraphicId () 
+ {
+   GraphicIdTable* table = ((DrawServ*)unidraw)->gridtable();
+   table->remove(_id);
+ }
+ 
+ int GraphicId::candidate_id() {
+   static int seed=0;
+   if (!seed) {
+     seed = time(nil) & (time(nil) << 16);
+     srand(seed);
+   }
+   int retval;
+   do {
+     static int flip=0;
+     while ((retval=(flip=!flip ? (rand()&time(nil)) : (rand()|time(nil))))==0);
+   } while (!unique_id(retval));
+   return retval;
+ }
+ 
+ int GraphicId::unique_id(unsigned int id) {
+   GraphicIdTable* table = ((DrawServ*)unidraw)->gridtable();
+   void* ptr = nil;
+   table->find(ptr, id);
+   if (ptr) 
+     return 0;
+   else
+     return 1;
+ }
+ 
+ /*****************************************************************************/
+ 
+ GraphicIds::GraphicIds(GraphicId* subids, int nsubs) : GraphicId ()
+ {
+   if (nsubs>0) {
+     _sublist = new GraphicIdList();
+      for(int i=0; i<nsubs; i++)
+       _sublist->Append(&subids[i]);
+   }
+   Resource::ref(_sublist);
+ }
+ 
+ GraphicIds::GraphicIds(GraphicIdList* sublist) : GraphicId ()
+ {
+   if (!sublist) sublist = new GraphicIdList;
+   _sublist = sublist;
+   _sublist->Reference();
+ }
+ 
+ GraphicIds::~GraphicIds () 
+ {
+   Unref(_sublist);
+   _sublist = nil;
+ }
+ 
+ 
+ /*****************************************************************************/
+ 
+ GraphicIdsRequest::GraphicIdsRequest(GraphicId* subids, int nsubs) : GraphicIds (subids, nsubs)
+ {
+   Init();
+ }
+ 
+ GraphicIdsRequest::GraphicIdsRequest(GraphicIdList* sublist) : GraphicIds (sublist)
+ {
+   Init();
+ }
+ 
+ GraphicIdsRequest::~GraphicIdsRequest () 
+ {
+   delete [] _ready;
+   delete [] _links;
+ }
+ 
+ void GraphicIdsRequest::Init() {
+   DrawLinkList* links = ((DrawServ*)unidraw)->linklist();
+   _nlinks = links->Number();
+   _ready = new int[_nlinks];
+   _links = new DrawLink*[_nlinks];
+   Iterator it;
+   links->First(it);
+   for(int i=0; i<_nlinks; i++) {
+     _ready[i] = 0;
+     _links[i] = links->GetDrawLink(it);
+     links->Next(it);
+   }
+ }
+ 
+ int GraphicIdsRequest::reserved() {
+   return 0;
+ }
Index: DrawServ/grid.h
diff -c /dev/null DrawServ/grid.h:1.1
*** /dev/null	Fri Mar  5 10:54:13 2004
--- src/DrawServ/grid.h	Fri Mar  5 10:54:11 2004
***************
*** 0 ****
--- 1,96 ----
+ /*
+  * Copyright (c) 2004 Scott E. Johnston
+  *
+  * Permission to use, copy, modify, distribute, and sell this software and
+  * its documentation for any purpose is hereby granted without fee, provided
+  * that the above copyright notice appear in all copies and that both that
+  * copyright notice and this permission notice appear in supporting
+  * documentation, and that the names of the copyright holders not be used in
+  * advertising or publicity pertaining to distribution of the software
+  * without specific, written prior permission.  The copyright holders make
+  * no representations about the suitability of this software for any purpose.
+  * It is provided "as is" without express or implied warranty.
+  *
+  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL,
+  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  * 
+  */
+ 
+ /*
+  * GraphicId - object to encapsulate 2-way link with remote drawserv
+  */
+ #ifndef grid_h
+ #define grid_h
+ 
+ #include <Unidraw/globals.h>
+ 
+ class DrawLink;
+ class GraphicIdList;
+ 
+ //: object to encapsulate unique graphic id
+ class GraphicId {
+ public:
+   GraphicId();
+   virtual ~GraphicId();
+   
+   unsigned int id() { return _id; }
+   // get associated unique integer id
+ 
+   virtual int composite() { return 0; }
+   // return true if can be cast to GraphicIds
+   virtual int request() { return 0; }
+   // return true if can be cast to GraphicIdsRequest
+   virtual GraphicIdList* sublist() { return nil; }
+   // returns pointer to sublist of GraphicId's, if any
+ protected:
+   static int candidate_id();
+   // generate candidate graphic id.
+   static int unique_id(unsigned int id);
+   // test candidate id for uniqueness
+   
+   unsigned int _id;
+   
+ };
+ 
+ //: object to encapsulate a set of graphic ids
+ class GraphicIds : public GraphicId {
+ public:
+   GraphicIds(GraphicId* subids, int nsubids); 
+   GraphicIds(GraphicIdList* sublist=nil);
+   virtual ~GraphicIds();
+ 
+   virtual int composite() { return 1; }
+   // return true if can be cast to GraphicIds
+   virtual GraphicIdList* sublist() { return _sublist; }
+   // returns pointer to sublist of GraphicId's, if any
+ 
+ protected:
+   GraphicIdList* _sublist;
+ };
+ 
+ //: object to encapsulate a request to reserve a set of graphic ids
+ class GraphicIdsRequest : public GraphicIds {
+ public:
+   GraphicIdsRequest(GraphicId* subids, int nsubids); 
+   GraphicIdsRequest(GraphicIdList* sublist=nil);
+   virtual ~GraphicIdsRequest();
+ 
+   void Init();
+ 
+   virtual int request() { return 1; }
+   // return true if can be cast to GraphicIdsRequest
+   int reserved();
+   // return 1 if id is completely reserved, otherwise 0.
+ 
+ protected:
+   int* _ready;
+   DrawLink** _links;
+   int _nlinks;
+ };
+ 
+ #endif
Index: DrawServ/gridlist.c
diff -c /dev/null DrawServ/gridlist.c:1.1
*** /dev/null	Fri Mar  5 10:54:13 2004
--- src/DrawServ/gridlist.c	Fri Mar  5 10:54:11 2004
***************
*** 0 ****
--- 1,120 ----
+ /*
+  * Copyright (c) 2004 Scott E. Johnston
+  *
+  * Permission to use, copy, modify, distribute, and sell this software and
+  * its documentation for any purpose is hereby granted without fee, provided
+  * that the above copyright notice appear in all copies and that both that
+  * copyright notice and this permission notice appear in supporting
+  * documentation, and that the names of the copyright holders not be used in
+  * advertising or publicity pertaining to distribution of the software
+  * without specific, written prior permission.  The copyright holders make
+  * no representations about the suitability of this software for any purpose.
+  * It is provided "as is" without express or implied warranty.
+  *
+  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL,
+  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  * 
+  */
+ 
+ /*
+  * Implementation of GraphicIdList class.
+  */
+ 
+ #include <DrawServ/grid.h>
+ #include <DrawServ/gridlist.h>
+ #include <Unidraw/iterator.h>
+ #include <Unidraw/ulist.h>
+ /*****************************************************************************/
+ 
+ GraphicIdList::GraphicIdList() 
+ {
+   _ulist = new UList;
+   _count = 0;
+ }
+ 
+ GraphicIdList::~GraphicIdList () 
+ {
+   if (_ulist) {
+     Iterator i;
+     for (First(i); !Done(i); Next(i)) {
+       delete GetGraphicId(i);
+     }
+     delete _ulist; 
+   }
+ }
+ 
+ 
+ void GraphicIdList::add_grid(GraphicId* new_id) {
+   Iterator i;
+   First(i);
+   InsertBefore(i, new_id);
+ }
+ 
+ GraphicId* GraphicIdList::Id (UList* r) {
+     return (GraphicId*) (*r)();
+ }
+ 
+ UList* GraphicIdList::Elem (Iterator i) { return (UList*) i.GetValue(); }
+ 
+ void GraphicIdList::Append (GraphicId* v) {
+     _ulist->Append(new UList(v));
+     ++_count;
+ }
+ 
+ void GraphicIdList::Prepend (GraphicId* v) {
+     _ulist->Prepend(new UList(v));
+     ++_count;
+ }
+ 
+ void GraphicIdList::InsertAfter (Iterator i, GraphicId* v) {
+     Elem(i)->Prepend(new UList(v));
+     ++_count;
+ }
+ 
+ void GraphicIdList::InsertBefore (Iterator i, GraphicId* v) {
+     Elem(i)->Append(new UList(v));
+     ++_count;
+ }
+ 
+ void GraphicIdList::Remove (Iterator& i) {
+     UList* doomed = Elem(i);
+ 
+     Next(i);
+     _ulist->Remove(doomed);
+     delete doomed;
+     --_count;
+ }	
+     
+ void GraphicIdList::Remove (GraphicId* p) {
+     UList* temp;
+ 
+     if ((temp = _ulist->Find(p)) != nil) {
+ 	_ulist->Remove(temp);
+         delete temp;
+ 	--_count;
+     }
+ }
+ 
+ GraphicId* GraphicIdList::GetGraphicId (Iterator i) { return Id(Elem(i)); }
+ 
+ void GraphicIdList::SetGraphicId (GraphicId* gv, Iterator& i) {
+     i.SetValue(_ulist->Find(gv));
+ }
+ 
+ void GraphicIdList::First (Iterator& i) { i.SetValue(_ulist->First()); }
+ void GraphicIdList::Last (Iterator& i) { i.SetValue(_ulist->Last()); }
+ void GraphicIdList::Next (Iterator& i) { i.SetValue(Elem(i)->Next()); }
+ void GraphicIdList::Prev (Iterator& i) { i.SetValue(Elem(i)->Prev()); }
+ boolean GraphicIdList::Done (Iterator i) { return Elem(i) == _ulist->End(); }
+ int GraphicIdList::Number () { return _count; }
+ 
+ boolean GraphicIdList::Includes (GraphicId* e) {
+     return _ulist->Find(e) != nil;
+ }
+ 
+ boolean GraphicIdList::IsEmpty () { return _ulist->IsEmpty(); }
Index: DrawServ/gridlist.h
diff -c /dev/null DrawServ/gridlist.h:1.1
*** /dev/null	Fri Mar  5 10:54:13 2004
--- src/DrawServ/gridlist.h	Fri Mar  5 10:54:11 2004
***************
*** 0 ****
--- 1,100 ----
+ /*
+  * Copyright (c) 2004 Scott E. Johnston
+  *
+  * Permission to use, copy, modify, distribute, and sell this software and
+  * its documentation for any purpose is hereby granted without fee, provided
+  * that the above copyright notice appear in all copies and that both that
+  * copyright notice and this permission notice appear in supporting
+  * documentation, and that the names of the copyright holders not be used in
+  * advertising or publicity pertaining to distribution of the software
+  * without specific, written prior permission.  The copyright holders make
+  * no representations about the suitability of this software for any purpose.
+  * It is provided "as is" without express or implied warranty.
+  *
+  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL,
+  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  * 
+  */
+ 
+ /*
+  * GraphicIdList - a UList based list of GraphicId's
+  */
+ #ifndef gridlist_h
+ #define gridlist_h
+ 
+ 
+ //: UList based list of GraphicId's
+ 
+ #include <Unidraw/globals.h>
+ #include <InterViews/resource.h>
+ 
+ class GraphicId;
+ class Iterator;
+ class UList;
+ 
+ class GraphicIdList : public Resource {
+ public:
+     GraphicIdList();
+     virtual ~GraphicIdList();
+ 
+     void add_grid(GraphicId*);
+     // add GraphicId to list
+ 
+     void First(Iterator&);
+     // set iterator to point to first GraphicId in list.
+     void Last(Iterator&);
+     // set iterator to point to last GraphicId in list.
+     void Next(Iterator&);
+     // set iterator to point to next GraphicId in list.
+     void Prev(Iterator&);
+     // set iterator to point to previous GraphicId in list.
+     boolean Done(Iterator);
+     // return true if iterator is pointing off the end of the list.
+     // works for forward and backward traversals.
+     boolean IsEmpty();
+     // true if no GraphicId objects in list.
+     int Number();
+     // number of GraphicId objects in list.
+ 
+     void Append(GraphicId*);
+     // append GraphicId to end of list.
+     void Prepend(GraphicId*);
+     // append GraphicId to front of list.
+     void InsertAfter(Iterator, GraphicId*);
+     // insert GraphicId after position pointed to by iterator.
+     void InsertBefore(Iterator, GraphicId*);
+     // insert GraphicId before position pointed to by iterator.
+     void Remove(GraphicId*);
+     // remove GraphicId from list, returning responsibility for freeing the
+     // associated memory.
+ 
+     GraphicId* GetGraphicId(Iterator);
+     // get GraphicId pointed to by iterator.
+     void SetGraphicId(GraphicId*, Iterator&);
+     // set GraphicId pointed to by iterator.
+     boolean Includes(GraphicId*);
+     // check if list includes GraphicId by pointer-comparison.
+ 
+     UList* Elem(Iterator); 
+     // return UList (UList) pointed to by Iterator (Iterator).
+     GraphicId* Id(UList*);
+     // return GraphicId pointed to by UList (UList).
+ 
+ protected:
+     void Remove(Iterator&);
+     // remove GraphicId pointed to by iterator from the list, 
+     // returning responsibility for freeing the associated memory.
+     // This requires saving a pointer to the GraphicId before calling this method.
+ 
+     UList* _ulist;
+     unsigned int _count;
+ 
+ friend class DrawServ;
+ };
+ 
+ #endif
Index: DrawServ/linkselection.c
diff -c /dev/null DrawServ/linkselection.c:1.1
*** /dev/null	Fri Mar  5 10:54:13 2004
--- src/DrawServ/linkselection.c	Fri Mar  5 10:54:11 2004
***************
*** 0 ****
--- 1,96 ----
+ /*
+  * Copyright (c) 2004 Scott E. Johnston
+  *
+  * Permission to use, copy, modify, distribute, and sell this software and
+  * its documentation for any purpose is hereby granted without fee, provided
+  * that the above copyright notice appear in all copies and that both that
+  * copyright notice and this permission notice appear in supporting
+  * documentation, and that the names of the copyright holders not be used in
+  * advertising or publicity pertaining to distribution of the software
+  * without specific, written prior permission.  The copyright holders make
+  * no representations about the suitability of this software for any purpose.
+  * It is provided "as is" without express or implied warranty.
+  *
+  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL,
+  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  * 
+  */
+ 
+ /*
+  * Implementation of LinkSelection class.
+  */
+ 
+ #include <DrawServ/drawserv.h>
+ #include <DrawServ/linkselection.h>
+ 
+ #include <OverlayUnidraw/ovviews.h>
+ 
+ #include <Unidraw/iterator.h>
+ 
+ #include <stdio.h>
+ 
+ /*****************************************************************************/
+ 
+ LinkSelection::LinkSelection (DrawLinkList* linklist, LinkSelection* s) : OverlaySelection(s) {
+   _linklist = linklist;
+ }
+ 
+ LinkSelection::LinkSelection (DrawLinkList* linklist, Selection* s) : OverlaySelection(s) {
+   _linklist = linklist;
+ }
+ 
+ void LinkSelection::Merge (Selection* s) {
+   fprintf(stderr, "LinkSelection::Merge\n");
+   OverlaySelection::Merge(s);
+ }
+ 
+ void LinkSelection::Exclusive (Selection* s) {
+   fprintf(stderr, "LinkSelection::Exclusive\n");
+   OverlaySelection::Exclusive(s);
+ }
+ 
+ void LinkSelection::Append (GraphicView* v) {
+   fprintf(stderr, "LinkSelection::Append\n");
+   OverlaySelection::Append(v);
+ }
+ 
+ void LinkSelection::Prepend (GraphicView* v) {
+   fprintf(stderr, "LinkSelection::Prepend\n");
+   OverlaySelection::Prepend(v);
+ }
+ 
+ void LinkSelection::InsertAfter (Iterator i, GraphicView* v) {
+   fprintf(stderr, "LinkSelection::InsertAfter\n");
+   OverlaySelection::InsertAfter(i, v);
+ }
+ 
+ void LinkSelection::InsertBefore (Iterator i, GraphicView* v) {
+   fprintf(stderr, "LinkSelection::InsertBefore\n");
+   OverlaySelection::InsertBefore(i, v);
+ }
+ 
+ void LinkSelection::Remove (Iterator& i) {
+   fprintf(stderr, "LinkSelection::Remove(i)\n");
+   OverlaySelection::Remove(i);
+ }	
+     
+ void LinkSelection::Remove (GraphicView* p) {
+   fprintf(stderr, "LinkSelection::Remove(p)\n");
+   OverlaySelection::Remove(p);
+ }
+ 
+ 
+ OverlaySelection* LinkSelection::ViewsWithin(IntCoord l, IntCoord b, IntCoord r, IntCoord t) {
+     OverlaySelection* newSel = new LinkSelection(((DrawServ*)unidraw)->linklist());
+     Iterator i;
+     for (First(i); !Done(i); Next(i)) {
+ 	OverlayView* view = GetView(i);
+ 	newSel->Merge(view->ViewsWithin(l, b, r, t));
+     }
+     return newSel;
+ }
Index: DrawServ/linkselection.h
diff -c /dev/null DrawServ/linkselection.h:1.1
*** /dev/null	Fri Mar  5 10:54:13 2004
--- src/DrawServ/linkselection.h	Fri Mar  5 10:54:11 2004
***************
*** 0 ****
--- 1,59 ----
+ /*
+  * Copyright (c) 2004 Scott E. Johnston
+  *
+  * Permission to use, copy, modify, distribute, and sell this software and
+  * its documentation for any purpose is hereby granted without fee, provided
+  * that the above copyright notice appear in all copies and that both that
+  * copyright notice and this permission notice appear in supporting
+  * documentation, and that the names of the copyright holders not be used in
+  * advertising or publicity pertaining to distribution of the software
+  * without specific, written prior permission.  The copyright holders make
+  * no representations about the suitability of this software for any purpose.
+  * It is provided "as is" without express or implied warranty.
+  *
+  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL,
+  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  * 
+  */
+ 
+ /*
+  * LinkSelection - manages the selection of graphics between remotely linked drawing editors.
+  */
+ 
+ #ifndef link_selection_h
+ #define link_selection_h
+ 
+ #include <OverlayUnidraw/ovselection.h>
+ 
+ class DrawLinkList;
+ 
+ //: distributed Selection class
+ // specialized Selection class with support for coordinating the selection of graphics
+ // between two remote drawing editors that are linked together.
+ class LinkSelection: public OverlaySelection {
+ public:
+     LinkSelection(DrawLinkList* list, LinkSelection* = nil);
+     LinkSelection(DrawLinkList* list, Selection*);
+ 
+     virtual void Exclusive(Selection*);
+     virtual void Merge(Selection*);    
+ 
+     virtual void Append(GraphicView*);
+     virtual void Prepend(GraphicView*);
+     virtual void InsertAfter(Iterator, GraphicView*);
+     virtual void InsertBefore(Iterator, GraphicView*);
+     virtual void Remove(GraphicView*);
+     virtual void Remove(Iterator&);
+ 
+     virtual OverlaySelection* ViewsWithin(IntCoord l, IntCoord b, IntCoord r, IntCoord t);
+ 
+ protected:
+     DrawLinkList* _linklist;
+ };
+ 
+ #endif
Index: include_unidraw/selection.h
diff -c include_unidraw/selection.h:1.1 include_unidraw/selection.h:1.2
*** include_unidraw/selection.h:1.1	Fri Jan  9 11:45:57 2004
--- src/include/Unidraw/selection.h	Fri Mar  5 10:54:17 2004
***************
*** 51,62 ****
      virtual void Init(Viewer* = nil);   /* explicitly init handles */
      virtual void Clear(Viewer* = nil);	/* removes & clears all views */
  
!     void Append(GraphicView*);
!     void Prepend(GraphicView*);
!     void InsertAfter(Iterator, GraphicView*);
!     void InsertBefore(Iterator, GraphicView*);
!     void Remove(GraphicView*);
!     void Remove(Iterator&);
  
      GraphicView* GetView(Iterator);
      void SetView(GraphicView*, Iterator&);
--- 51,62 ----
      virtual void Init(Viewer* = nil);   /* explicitly init handles */
      virtual void Clear(Viewer* = nil);	/* removes & clears all views */
  
!     virtual void Append(GraphicView*);
!     virtual void Prepend(GraphicView*);
!     virtual void InsertAfter(Iterator, GraphicView*);
!     virtual void InsertBefore(Iterator, GraphicView*);
!     virtual void Remove(GraphicView*);
!     virtual void Remove(Iterator&);
  
      GraphicView* GetView(Iterator);
      void SetView(GraphicView*, Iterator&);
Index: OverlayUnidraw/ovcmds.c
diff -c OverlayUnidraw/ovcmds.c:1.1 OverlayUnidraw/ovcmds.c:1.2
*** OverlayUnidraw/ovcmds.c:1.1	Fri Jan  9 11:44:53 2004
--- src/OverlayUnidraw/ovcmds.c	Fri Mar  5 10:54:02 2004
***************
*** 675,682 ****
  }
  
  void OvSlctAllCmd::Execute () {
!     Editor* editor = GetEditor();
!     OverlaySelection* newSel = new OverlaySelection;
      Selection* s;
      Viewer* viewer;
  
--- 675,682 ----
  }
  
  void OvSlctAllCmd::Execute () {
!     OverlayEditor* editor = (OverlayEditor*)GetEditor();
!     OverlaySelection* newSel = editor->overlay_kit()->MakeSelection();
      Selection* s;
      Viewer* viewer;
  
Index: OverlayUnidraw/ovimport.c
diff -c OverlayUnidraw/ovimport.c:1.2 OverlayUnidraw/ovimport.c:1.3
*** OverlayUnidraw/ovimport.c:1.2	Mon Mar  1 13:41:54 2004
--- src/OverlayUnidraw/ovimport.c	Fri Mar  5 10:54:02 2004
***************
*** 1119,1125 ****
      if (comp_ != nil) {
          OverlaySelection* oldsel;
  	if (preserve_selection_)
! 	  oldsel = new OverlaySelection((OverlaySelection*)GetEditor()->GetSelection());
  	((OverlayEditor*)GetEditor())->DoAutoNewFrame();
  	if (comp_->IsA(GRAPHIC_COMP)) {
  	    PasteCmd* paste_cmd = new PasteCmd(GetEditor(), new Clipboard((GraphicComp*)comp_));
--- 1119,1126 ----
      if (comp_ != nil) {
          OverlaySelection* oldsel;
  	if (preserve_selection_)
! 	  oldsel = ((OverlayEditor*)GetEditor())->overlay_kit()->
! 	    MakeSelection((OverlaySelection*)GetEditor()->GetSelection());
  	((OverlayEditor*)GetEditor())->DoAutoNewFrame();
  	if (comp_->IsA(GRAPHIC_COMP)) {
  	    PasteCmd* paste_cmd = new PasteCmd(GetEditor(), new Clipboard((GraphicComp*)comp_));
Index: OverlayUnidraw/ovkit.c
diff -c OverlayUnidraw/ovkit.c:1.2 OverlayUnidraw/ovkit.c:1.3
*** OverlayUnidraw/ovkit.c:1.2	Mon Mar  1 13:41:54 2004
--- src/OverlayUnidraw/ovkit.c	Fri Mar  5 10:54:03 2004
***************
*** 270,276 ****
      _ed->_comp = comp;
      _ed->_keymap = new KeyMap;
      _ed->_curCtrl = new ControlState;
!     _ed->_selection = new OverlaySelection;
      _ed->_tray = new Tray;
      _ed->_tray->Propagate(false);
  }
--- 270,276 ----
      _ed->_comp = comp;
      _ed->_keymap = new KeyMap;
      _ed->_curCtrl = new ControlState;
!     _ed->_selection = MakeSelection();
      _ed->_tray = new Tray;
      _ed->_tray->Propagate(false);
  }
***************
*** 1662,1664 ****
--- 1662,1669 ----
  const char* OverlayKit::otherdisplay() { return _otherdisplay; }
  void OverlayKit::otherdisplay(const char* display) 
  { delete _otherdisplay; _otherdisplay= strdup(display); }
+ 
+ 
+ OverlaySelection* OverlayKit::MakeSelection(Selection* sel) {
+   return new OverlaySelection(sel);
+ }
Index: OverlayUnidraw/ovkit.h
diff -c OverlayUnidraw/ovkit.h:1.1 OverlayUnidraw/ovkit.h:1.2
*** OverlayUnidraw/ovkit.h:1.1	Fri Jan  9 11:44:54 2004
--- src/OverlayUnidraw/ovkit.h	Fri Mar  5 10:54:03 2004
***************
*** 45,59 ****
  class ObservableText;
  class OverlayComp;
  class OverlayEditor;
! class Patch;
! class UPage;
  class PSBrush;
  class PSColor;
  class PSPattern;
! class Viewer;
  class TelltaleGroup;
  class Tool;
  class ToolButton;
  
  //: helper class for constructing an OverlayEditor.
  // this class (or something derived from it) is supplied to the constructor
--- 45,61 ----
  class ObservableText;
  class OverlayComp;
  class OverlayEditor;
! class OverlaySelection;
  class PSBrush;
  class PSColor;
  class PSPattern;
! class Patch;
! class Selection;
  class TelltaleGroup;
  class Tool;
  class ToolButton;
+ class UPage;
+ class Viewer;
  
  //: helper class for constructing an OverlayEditor.
  // this class (or something derived from it) is supplied to the constructor
***************
*** 197,202 ****
--- 199,207 ----
  
      OverlayComp* add_tool_button(const char* path, OverlayComp* comp=nil);
      // low-level routine used by ::add_custom_tool and others
+ 
+     virtual OverlaySelection* MakeSelection(Selection* sel = nil);
+     // make Selection of the proper derivation.
  protected:
      Glyph* MenuLine(PSBrush*);
      // create line to put in a pulldown menu.
Index: OverlayUnidraw/ovselection.h
diff -c OverlayUnidraw/ovselection.h:1.1 OverlayUnidraw/ovselection.h:1.2
*** OverlayUnidraw/ovselection.h:1.1	Fri Jan  9 11:44:54 2004
--- src/OverlayUnidraw/ovselection.h	Fri Mar  5 10:54:03 2004
***************
*** 67,73 ****
      OverlayView* GetView(Iterator);
      void SetView(OverlayView*, Iterator&);
  
!     OverlaySelection* ViewsWithin(IntCoord l, IntCoord b, IntCoord r, IntCoord t);
  
  protected:
      boolean _clear_to_repair;
--- 67,73 ----
      OverlayView* GetView(Iterator);
      void SetView(OverlayView*, Iterator&);
  
!     virtual OverlaySelection* ViewsWithin(IntCoord l, IntCoord b, IntCoord r, IntCoord t);
  
  protected:
      boolean _clear_to_repair;
Index: OverlayUnidraw/ovviews.c
diff -c OverlayUnidraw/ovviews.c:1.1 OverlayUnidraw/ovviews.c:1.2
*** OverlayUnidraw/ovviews.c:1.1	Fri Jan  9 11:44:54 2004
--- src/OverlayUnidraw/ovviews.c	Fri Mar  5 10:54:03 2004
***************
*** 162,168 ****
  void OverlayView::Desensitize() { _gr->Desensitize(); }
  void OverlayView::Sensitize() { _gr->Sensitize(); }
  
! Selection* OverlayView::MakeSelection() { return new OverlaySelection; }
  
  void OverlayView::AdjustForZoom(float factor, Coord cx, Coord cy) {
      if (factor==1.0) return;
--- 162,171 ----
  void OverlayView::Desensitize() { _gr->Desensitize(); }
  void OverlayView::Sensitize() { _gr->Sensitize(); }
  
! Selection* OverlayView::MakeSelection() 
! { 
!   return ((OverlayEditor*)GetViewer()->GetEditor())->overlay_kit()->MakeSelection(); 
! }
  
  void OverlayView::AdjustForZoom(float factor, Coord cx, Coord cy) {
      if (factor==1.0) return;
Index: top_ivtools/MANIFEST
diff -c top_ivtools/MANIFEST:1.6 top_ivtools/MANIFEST:1.7
*** top_ivtools/MANIFEST:1.6	Fri Feb 27 13:40:14 2004
--- ./MANIFEST	Fri Mar  5 10:53:08 2004
***************
*** 299,304 ****
--- 299,310 ----
  ivtools-1.1/src/DrawServ/drawserv-handler.h
  ivtools-1.1/src/DrawServ/drawviews.c
  ivtools-1.1/src/DrawServ/drawviews.h
+ ivtools-1.1/src/DrawServ/grid.c
+ ivtools-1.1/src/DrawServ/grid.h
+ ivtools-1.1/src/DrawServ/gridlist.c
+ ivtools-1.1/src/DrawServ/gridlist.h
+ ivtools-1.1/src/DrawServ/linkselection.c
+ ivtools-1.1/src/DrawServ/linkselection.h
  ivtools-1.1/src/FrameUnidraw/Imakefile
  ivtools-1.1/src/FrameUnidraw/Makefile
  ivtools-1.1/src/FrameUnidraw/framecatalog.c
Index: top_ivtools/MANIFEST.perceps
diff -c top_ivtools/MANIFEST.perceps:1.5 top_ivtools/MANIFEST.perceps:1.6
*** top_ivtools/MANIFEST.perceps:1.5	Fri Feb 27 13:40:14 2004
--- ./MANIFEST.perceps	Fri Mar  5 10:53:08 2004
***************
*** 78,83 ****
--- 78,86 ----
  DrawServ/drawserv.h
  DrawServ/drawserv-handler.h
  DrawServ/drawviews.h
+ DrawServ/grid.h
+ DrawServ/gridlist.h
+ DrawServ/linkselection.h
  FrameUnidraw/framecatalog.h
  FrameUnidraw/frameclasses.h
  FrameUnidraw/framecmds.h
*** /dev/null	 Fri Mar 5 10:54:26 PST 2004
--- patches/ivtools-040305-johnston-032
*************** patches/ivtools-040305-johnston-032
*** 0 ****
--- 1 ----
+ ivtools-040305-johnston-032

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040305-johnston-033"
Content-Disposition: attachment;
	filename=ivtools-040305-johnston-033

Patch:    ivtools-040305-johnston-033
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  change X11 display default to ":0.0"
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

- change the default for the X11 -display argument from "localhost:0.0" to ":0.0".
Much to my surprise, there are Unix/X11 setups that can't resolve "localhost".
This patch should fix a problem that was introduced in ivtools-1.1.3.

Index: src_interviews/session.c
diff -c src_interviews/session.c:1.2 src_interviews/session.c:1.3
*** src_interviews/session.c:1.2	Thu Jan 29 10:51:51 2004
--- src/InterViews/session.c	Fri Mar  5 11:19:27 2004
***************
*** 725,731 ****
      } else if (style_->find_attribute(String("display"), name)) {
  	default_ = Display::open(name);
      } else {
! 	default_ = Display::open("localhost:0.0");
      }
      if (default_ == nil) {
  	if (name.length() > 0) {
--- 725,731 ----
      } else if (style_->find_attribute(String("display"), name)) {
  	default_ = Display::open(name);
      } else {
! 	default_ = Display::open(":0.0");
      }
      if (default_ == nil) {
  	if (name.length() > 0) {
*** /dev/null	 Fri Mar 5 11:19:56 PST 2004
--- patches/ivtools-040305-johnston-033
*************** patches/ivtools-040305-johnston-033
*** 0 ****
--- 1 ----
+ ivtools-040305-johnston-033

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040308-johnston-034"
Content-Disposition: attachment;
	filename=ivtools-040308-johnston-034

Patch:    ivtools-040308-johnston-034
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  patch to propogate drawserv development via cvs
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

- patch to propogate drawserv development via cvs

Index: DrawServ/draweditor.c
diff -c DrawServ/draweditor.c:1.3 DrawServ/draweditor.c:1.4
*** DrawServ/draweditor.c:1.3	Fri Mar  5 10:54:11 2004
--- src/DrawServ/draweditor.c	Mon Mar  8 13:29:19 2004
***************
*** 84,89 ****
--- 84,90 ----
    FrameEditor::AddCommands(comterp);
  
    comterp->add_command("drawlink", new DrawLinkFunc(comterp, this));
+   comterp->add_command("sessionid", new SessionIdFunc(comterp, this));
    comterp->add_command("reserve", new ReserveFunc(comterp, this));
  }
  
Index: DrawServ/drawfunc.c
diff -c DrawServ/drawfunc.c:1.10 DrawServ/drawfunc.c:1.11
*** DrawServ/drawfunc.c:1.10	Fri Mar  5 10:54:11 2004
--- src/DrawServ/drawfunc.c	Mon Mar  8 13:29:19 2004
***************
*** 122,131 ****
--- 122,205 ----
  
  /*****************************************************************************/
  
+ SessionIdFunc::SessionIdFunc(ComTerp* comterp, DrawEditor* ed) : UnidrawFunc(comterp, ed) {
+ }
+ 
+ void SessionIdFunc::execute() {
+ #ifndef HAVE_ACE
+ 
+   reset_stack();
+   fprintf(stderr, "rebuild ivtools with ACE support to get full drawserv functionality\n");
+   push_stack(ComValue::nullval());
+ 
+ #else
+   static int new_sym = symbol_add("new");
+   ComValue newv(stack_key(new_sym));
+ 
+   static int trial_sym = symbol_add("trial");
+   ComValue trialv(stack_key(trial_sym));
+ 
+   static int rid_sym = symbol_add("rid");
+   ComValue ridv(stack_key(rid_sym));
+ 
+   static int ok_sym = symbol_add("ok");
+   ComValue okv(stack_key(ok_sym));
+ 
+   ComValue idv(stack_arg(0));
+ 
+   reset_stack();
+ 
+ #if __GNUC__==3&&__GNUC_MINOR__<1
+   fprintf(stderr, "Please upgrade to gcc-3.1 or greater\n");
+   push_stack(ComValue::nullval());
+   return;
+ #endif
+ 
+   unsigned int returnid = 0;
+ 
+   /* request a new session id */
+   if (newv.is_true()) {    
+     ((DrawServ*)unidraw)->sessionid_request_new();
+     returnid = ((DrawServ*)unidraw)->sessionid(true);
+   }
+ 
+   /* return the trial id */
+   else if (trialv.is_true()) {    
+     returnid = ((DrawServ*)unidraw)->sessionid(true);
+   }
+ 
+   /* handle new session id request */
+   else if (nargs()==1 && nkeys()==0 && idv.is_known() && ridv.is_known()) {
+     returnid = idv.uint_val();
+     ((DrawServ*)unidraw)->sessionid_handle_new(returnid, ridv.int_val());
+   }
+ 
+   /* handle callback */ 
+   else if (okv.is_known() && ridv.is_known()) {
+     returnid = idv.uint_val();
+     ((DrawServ*)unidraw)->sessionid_callback_new(ridv.int_val(), returnid, okv.is_true());
+   }
+ 
+   /* return current session id */
+   else if (nargs()==0 && nkeys()==0) 
+     returnid = ((DrawServ*)unidraw)->sessionid();
+ 
+   ComValue retval(returnid);
+   push_stack(retval);
+   return;
+ 
+ #endif
+ 
+ }
+ 
+ 
+ /*****************************************************************************/
+ 
  ReserveFunc::ReserveFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) {
  }
  
  void ReserveFunc::execute() {
+ #if 0
  #if 1
    static int batchid_symid = symbol_add("batchid");
    ComValue batchidv(stack_key(batchid_symid));
***************
*** 235,240 ****
--- 309,315 ----
      reset_stack();
      ComValue retval(avl);
      push_stack(retval);
+ #endif
  #endif
  }
  
Index: DrawServ/drawfunc.h
diff -c DrawServ/drawfunc.h:1.3 DrawServ/drawfunc.h:1.4
*** DrawServ/drawfunc.h:1.3	Fri Mar  5 10:54:11 2004
--- src/DrawServ/drawfunc.h	Mon Mar  8 13:29:19 2004
***************
*** 34,40 ****
      DrawLinkFunc(ComTerp*,DrawEditor*);
      virtual void execute();
      virtual const char* docstring() { 
! 	return "%s(hoststr :port portnum) -- connect to remote drawserv"; }
  };
  
  //: command to reserve graphics for selection in remote editors
--- 34,50 ----
      DrawLinkFunc(ComTerp*,DrawEditor*);
      virtual void execute();
      virtual const char* docstring() { 
! 	return "%s(hoststr :port portnum :state num :lid num :rid num :close) -- connect to remote drawserv"; }
! };
! 
! //: command to reserve unique session id
! // sessionid(:new) -- command to manage session id's
! class SessionIdFunc : public UnidrawFunc {
! public:
!     SessionIdFunc(ComTerp*,DrawEditor*);
!     virtual void execute();
!     virtual const char* docstring() { 
! 	return "%s(:new) -- command to manage session id's"; }
  };
  
  //: command to reserve graphics for selection in remote editors
Index: DrawServ/drawlink.c
diff -c DrawServ/drawlink.c:1.10 DrawServ/drawlink.c:1.11
*** DrawServ/drawlink.c:1.10	Mon Mar  1 13:41:59 2004
--- src/DrawServ/drawlink.c	Mon Mar  8 13:29:19 2004
***************
*** 50,55 ****
--- 50,56 ----
  
    _handler = nil;
  
+   _sessionid_state = SessionIdNada;
  }
  
  DrawLink::~DrawLink () 
Index: DrawServ/drawlink.h
diff -c DrawServ/drawlink.h:1.7 DrawServ/drawlink.h:1.8
*** DrawServ/drawlink.h:1.7	Mon Mar  1 13:41:59 2004
--- src/DrawServ/drawlink.h	Mon Mar  8 13:29:19 2004
***************
*** 93,98 ****
--- 93,108 ----
      DrawServHandler* handler() { return _handler; }
      // get DrawServHandler associated with incoming connection
  
+     int sessionid_state() { return _sessionid_state; }
+     // get state of session id negotiation
+     // -1 = no id, 0 = request made, 1 = request approved, 2 = request denied.
+ 
+     void sessionid_state(int state) { _sessionid_state = state; }
+     // set state of session id negotiation
+     // -1 = no id, 0 = request made, 1 = request approved, 2 = request denied.
+ 
+     enum {SessionIdNada=-1, SessionIdRequested=0, SessionIdApproved=1, SessionIdDenied=2};
+ 
  protected:
      const char* _host;
      const char* _althost;
***************
*** 102,107 ****
--- 112,118 ----
      int _local_linkid;
      int _remote_linkid;
      int _state;
+     int _sessionid_state;
  
  #ifdef HAVE_ACE
      ACE_INET_Addr* _addr;
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.13 DrawServ/drawserv.c:1.14
*** DrawServ/drawserv.c:1.13	Fri Mar  5 10:54:11 2004
--- src/DrawServ/drawserv.c	Mon Mar  8 13:29:19 2004
***************
*** 50,59 ****
  #include <fstream.h>
  #include <strstream>
  
- int DrawServ::_reserve_batch_min = 3;
- int DrawServ::_reserve_batch_size = 5;
- 
  implementTable(GraphicIdTable,int,void*)
  
  /*****************************************************************************/
  
--- 50,57 ----
  #include <fstream.h>
  #include <strstream>
  
  implementTable(GraphicIdTable,int,void*)
+ implementTable(SessionIdTable,int,void*)
  
  /*****************************************************************************/
  
***************
*** 70,85 ****
  
  void DrawServ::Init() {
    _linklist = new DrawLinkList;
!   _grid_request_list = new GraphicIdList;
!   _grid_reserved_list = new GraphicIdList;
    _gridtable = new GraphicIdTable(1024);
  }
  
  DrawServ::~DrawServ () 
  {
    delete _linklist;
-   delete _grid_request_list;
-   delete _grid_reserved_list;
    delete _gridtable;
  }
  
--- 68,84 ----
  
  void DrawServ::Init() {
    _linklist = new DrawLinkList;
! 
    _gridtable = new GraphicIdTable(1024);
+   _sessionidtable = new SessionIdTable(256);
+ 
+   _sessionid = -1;
+   _trialid = -1;
  }
  
  DrawServ::~DrawServ () 
  {
    delete _linklist;
    delete _gridtable;
  }
  
***************
*** 260,341 ****
  
  }
  
! void DrawServ::reserve_batch_request(int nids) {
  
!   /* generate a new batch of id's while generating command to reserve them*/
!   GraphicIdsRequest* gridr = new GraphicIdsRequest();
!   GraphicIdList* gridr_list = gridr->sublist();
!   std::ostrstream sbuf;
!   sbuf << "reserve(";
!   for (int i=0; i<_reserve_batch_size; i++) {
!     GraphicId* grid = new GraphicId();
!     gridr_list->Append(grid);
!     if (i) sbuf << ',';
!     sbuf << grid->id();
    }
-   sbuf << ":batchid " << gridr->id() << ")";
-   DistributeCmdString(sbuf.str());
- 
  }
  
! void DrawServ::reserve_batch_response(int reserved, unsigned int batchid) {
! }
  
! void DrawServ::reserve_batch_handle(DrawLink* link, unsigned int *ids, int nids, unsigned int batchid) {
!   fprintf(stderr, "reserve batch request has been made, batchid==%d\n, batchid");
!   for (int i=0; i<nids; i++) {
!     if (i) fprintf(stderr, ",");
!     fprintf(stderr, "%d", ids[i]);
    }
-   fprintf(stderr, "\n");
  }
- 
- int DrawServ::reserved_id() {
-   int return_id = 0;
- 
-   /* process next batch if no more id's ready */
-   if (_grid_reserved_list->Number()==0) reserved_batch();
  
!   /* reserve a new batch if number available falls below a threshold */
!   if (_grid_request_list->Number()<reserve_batch_min()) reserve_batch_request(reserve_batch_size());
! 
!   return return_id;
  }
- 
- int DrawServ::reserved_batch() {
  
!   int count = 0;
  
!   /* search through list of candidate id sets, and remove 1st */
!   /* set that has completed the reservation process           */
!   Iterator it;
!   _grid_request_list->First(it);
!   GraphicIdsRequest* gridr = nil;
!   while (!_grid_request_list->Done(it) && !gridr) {
!     GraphicIdsRequest* gridr = (GraphicIdsRequest*)_grid_request_list->GetGraphicId(it);
!     if(gridr && gridr->reserved()) {
!       _grid_request_list->Remove(it);
!     }
!     _grid_request_list->Next(it);
!   }
  
!   /* transfer all of these to the reservation completed list */
!   if (gridr && gridr->sublist()) {
!     Iterator jt;
!     GraphicIdList* gridr_list = gridr->sublist();
!     count = gridr_list->Number();
!     gridr_list->First(jt);
!     while (!gridr_list->Done(jt)) {
!       GraphicId* grid = gridr_list->GetGraphicId(jt);
!       gridr_list->Remove(jt);
!       if (grid) _grid_reserved_list->Append(grid);
!     }
!     delete gridr;
!     return count;
!   } else {
!     fprintf(stderr, "No batch of graphic ids has completed reservation process\n");
!     fprintf(stderr, "Someone should really do something about this\n");
!     return 0;
!   }
  }
  
--- 259,325 ----
  
  }
  
! void DrawServ::SendCmdString(DrawLink* link, const char* cmdstring) {
  
!   if (link) {
!     int fd = link->handle();
!     if (fd>=0) {
!       fileptr_filebuf fbuf(fd, ios_base::out, false, static_cast<size_t>(BUFSIZ));
!       ostream out(&fbuf);
!       out << cmdstring;
!       out << "\n";
!       out.flush();
!     }
    }
  }
  
! // generate request to reserve unique session id
! void DrawServ::sessionid_request_new() {
!   _trialid = GraphicId::candidate_sessionid();
  
!   Iterator it;
!   _linklist->First(it);
!   char buf[BUFSIZ];
!   while(!_linklist->Done(it)) {
!     DrawLink* link = _linklist->GetDrawLink(it);
!     link->sessionid_state(DrawLink::SessionIdRequested);
!     snprintf(buf, BUFSIZ, "session(0x%08x :rid %d)%c", _trialid, link->local_linkid(), '\0');
!     SendCmdString(link, buf);
!     _linklist->Next(it);
    }
  }
  
! // handle request to reserve unique session id
! void DrawServ::sessionid_handle_new(int new_id, int remote_linkid) {
!   DrawLink* link = linkget(-1, remote_linkid);
!   if (link) {
!     if (_linklist->Number()==1) {
!       int okflag = false;
!       if (okflag = GraphicId::unique_sessionid(new_id)) {
! 	SessionIdTable* table = ((DrawServ*)unidraw)->sessionidtable();
! 	table->insert(new_id, link);
!       }
!       char buf[BUFSIZ];
!       snprintf(buf, BUFSIZ, "sessionid(0x08x :ok %d)%c", new_id, okflag, '\0');
!       SendCmdString(link, buf);
!     } else {
!       fprintf(stderr, "code for passing selection id request on to other DrawLink's not implemented\n");
!     }
!   } else
!     fprintf(stderr, "no link with remote id of %d found\n", remote_linkid);
  }
  
! // process callbacks on request to reserve unique session id
! void DrawServ::sessionid_callback_new(int new_id, int remote_linkid, int ok_flag) {
!   fprintf(stderr, "sessionid_callback_new: new_id %d,  remote_linkid %d, ok_flag %d\n",
! 	  new_id, remote_linkid, ok_flag);
! }
  
! // generate request to change/set unique session id
! void DrawServ::sessionid_request_chg() {
! }
  
! // handle request to change unique session id
! void DrawServ::sessionid_handle_chg(int new_id, int old_id) {
  }
  
Index: DrawServ/drawserv.h
diff -c DrawServ/drawserv.h:1.10 DrawServ/drawserv.h:1.11
*** DrawServ/drawserv.h:1.10	Fri Mar  5 10:54:11 2004
--- src/DrawServ/drawserv.h	Mon Mar  8 13:29:19 2004
***************
*** 32,37 ****
--- 32,38 ----
  
  #include <OS/table.h>
  declareTable(GraphicIdTable,int,void*)
+ declareTable(SessionIdTable,int,void*)
  
  //: Unidraw specialized for DrawServ
  // Unidraw (OverlayUnidraw) specialized for DrawServ application.
***************
*** 76,124 ****
      // execute Command's locally, and on remote linked DrawServ's.
  
      virtual void DistributeCmdString(const char* cmdstring);
!     // execute command string locally, and on remote DrawServ's
  
      DrawLinkList* linklist() { return _linklist; }
      // return pointer to list of DrawLink's
  
  
!     /* mechanism for reserving graphic ids */
  
!     void reserve_batch_request(int nids);
!     // initiate reservation of a set of graphic ids.
!     void reserve_batch_response(int reserved, unsigned int batchid);
!     // finalize reservation of a set of graphic ids
!     void reserve_batch_handle(DrawLink* link, unsigned int* ids, int nids, unsigned int batchid);
!     // respond to a request to reserve ids from a particular DrawLink
!     int reserved_id();
!     // next available reserved id.
!     int reserved_batch();
!     // process next available batch of reserved id's.
! 
!     static int reserve_batch_min() { return _reserve_batch_min; }
!     // get the minimum number of reserved id batches allowed.
!     static void reserve_batch_min(int min) { _reserve_batch_min = min; }
!     // set the minimum number of reserved id batches allowed.
!     static int reserve_batch_size() { return _reserve_batch_size; }
!     // get the batch size for a request to reserve ids
!     static void reserve_batch_size(int size) { _reserve_batch_size = size; }
!     // set the batch size for a request to reserve ids
  
!     GraphicIdTable* gridtable() { return _gridtable; }
!     // return pointer to table of GraphicId's.
  
  protected:
      DrawLinkList* _linklist;
      // DrawLink list
-     GraphicIdList* _grid_request_list;
-     // GraphicId reservation request list
-     GraphicIdList* _grid_reserved_list;
-     // GraphicId reservation completed list
      GraphicIdTable* _gridtable;
      // table of all GraphicId's.
  
-     static int _reserve_batch_min;
-     static int _reserve_batch_size;
  };
  
  #endif
--- 77,129 ----
      // execute Command's locally, and on remote linked DrawServ's.
  
      virtual void DistributeCmdString(const char* cmdstring);
!     // execute command string remote DrawServ's
  
+     virtual void SendCmdString(DrawLink* link, const char* cmdstring);
+     // execute command string on one remote DrawServ
+ 
      DrawLinkList* linklist() { return _linklist; }
      // return pointer to list of DrawLink's
  
+     GraphicIdTable* gridtable() { return _gridtable; }
+     // return pointer to table of GraphicId's.
  
!     SessionIdTable* sessionidtable() { return _sessionidtable; }
!     // return pointer to table of DrawLink's as a function of session id's.
  
!     void sessionid_request_new();
!     // generate request to reserve unique session id
  
!     void sessionid_handle_new(int new_id, int remote_linkid);
!     // handle request to reserve unique session id
! 
!     void sessionid_callback_new(int new_id, int remote_linkid, int ok_flag);
!     // process callbacks on request to reserve unique session id
! 
!     void sessionid_request_chg();
!     // generate request to change/set unique session id
! 
!     void sessionid_handle_chg(int new_id, int old_id);
!     // handle request to change unique session id
! 
!     int sessionid(int trial=false) { return trial ? _trialid : _sessionid; }
!     // current unique session id.
  
  protected:
      DrawLinkList* _linklist;
      // DrawLink list
      GraphicIdTable* _gridtable;
      // table of all GraphicId's.
+     // maps from id to GraphicId*
+     SessionIdTable* _sessionidtable;
+     // table of all session id's.
+     // maps from id to DrawLink*
+ 
+     int _sessionid;
+     // unique session id.
+     int _trialid;
+     // session id undergoing reservation
  
  };
  
  #endif
Index: DrawServ/grid.c
diff -c DrawServ/grid.c:1.1 DrawServ/grid.c:1.2
*** DrawServ/grid.c:1.1	Fri Mar  5 10:54:11 2004
--- src/DrawServ/grid.c	Mon Mar  8 13:29:19 2004
***************
*** 36,46 ****
  #include <stdlib.h>
  #include <time.h>
  
  /*****************************************************************************/
  
  GraphicId::GraphicId () 
  {
!   _id = candidate_id();
    GraphicIdTable* table = ((DrawServ*)unidraw)->gridtable();
    table->insert(_id, this);
  }
--- 36,49 ----
  #include <stdlib.h>
  #include <time.h>
  
+ unsigned int GraphicId::GraphicIdMask = 0x000fffff;
+ unsigned int GraphicId::SessionIdMask = 0xfff00000;
+ 
  /*****************************************************************************/
  
  GraphicId::GraphicId () 
  {
!   _id = candidate_grid();
    GraphicIdTable* table = ((DrawServ*)unidraw)->gridtable();
    table->insert(_id, this);
  }
***************
*** 51,57 ****
    table->remove(_id);
  }
  
! int GraphicId::candidate_id() {
    static int seed=0;
    if (!seed) {
      seed = time(nil) & (time(nil) << 16);
--- 54,60 ----
    table->remove(_id);
  }
  
! int GraphicId::candidate_grid() {
    static int seed=0;
    if (!seed) {
      seed = time(nil) & (time(nil) << 16);
***************
*** 60,71 ****
    int retval;
    do {
      static int flip=0;
!     while ((retval=(flip=!flip ? (rand()&time(nil)) : (rand()|time(nil))))==0);
!   } while (!unique_id(retval));
    return retval;
  }
  
! int GraphicId::unique_id(unsigned int id) {
    GraphicIdTable* table = ((DrawServ*)unidraw)->gridtable();
    void* ptr = nil;
    table->find(ptr, id);
--- 63,75 ----
    int retval;
    do {
      static int flip=0;
!     while ((retval=rand()&GraphicIdMask)==0);
! 
!   } while (!unique_grid(retval));
    return retval;
  }
  
! int GraphicId::unique_grid(unsigned int id) {
    GraphicIdTable* table = ((DrawServ*)unidraw)->gridtable();
    void* ptr = nil;
    table->find(ptr, id);
***************
*** 75,80 ****
--- 79,109 ----
      return 1;
  }
  
+ int GraphicId::candidate_sessionid() {
+   static int seed=0;
+   if (!seed) {
+     seed = time(nil) & (time(nil) << 16);
+     srand(seed);
+   }
+   int retval;
+   do {
+     static int flip=0;
+     while ((retval=rand()&SessionIdMask)==0);
+ 
+   } while (!unique_sessionid(retval));
+   return retval;
+ }
+ 
+ int GraphicId::unique_sessionid(unsigned int id) {
+   SessionIdTable* table = ((DrawServ*)unidraw)->sessionidtable();
+   void* ptr = nil;
+   table->find(ptr, id);
+   if (ptr) 
+     return 0;
+   else
+     return 1;
+ }
+ 
  /*****************************************************************************/
  
  GraphicIds::GraphicIds(GraphicId* subids, int nsubs) : GraphicId ()
***************
*** 98,138 ****
  {
    Unref(_sublist);
    _sublist = nil;
- }
- 
- 
- /*****************************************************************************/
- 
- GraphicIdsRequest::GraphicIdsRequest(GraphicId* subids, int nsubs) : GraphicIds (subids, nsubs)
- {
-   Init();
- }
- 
- GraphicIdsRequest::GraphicIdsRequest(GraphicIdList* sublist) : GraphicIds (sublist)
- {
-   Init();
- }
- 
- GraphicIdsRequest::~GraphicIdsRequest () 
- {
-   delete [] _ready;
-   delete [] _links;
- }
- 
- void GraphicIdsRequest::Init() {
-   DrawLinkList* links = ((DrawServ*)unidraw)->linklist();
-   _nlinks = links->Number();
-   _ready = new int[_nlinks];
-   _links = new DrawLink*[_nlinks];
-   Iterator it;
-   links->First(it);
-   for(int i=0; i<_nlinks; i++) {
-     _ready[i] = 0;
-     _links[i] = links->GetDrawLink(it);
-     links->Next(it);
-   }
- }
- 
- int GraphicIdsRequest::reserved() {
-   return 0;
  }
--- 127,130 ----
Index: DrawServ/grid.h
diff -c DrawServ/grid.h:1.1 DrawServ/grid.h:1.2
*** DrawServ/grid.h:1.1	Fri Mar  5 10:54:11 2004
--- src/DrawServ/grid.h	Mon Mar  8 13:29:19 2004
***************
*** 43,60 ****
  
    virtual int composite() { return 0; }
    // return true if can be cast to GraphicIds
!   virtual int request() { return 0; }
!   // return true if can be cast to GraphicIdsRequest
    virtual GraphicIdList* sublist() { return nil; }
    // returns pointer to sublist of GraphicId's, if any
! protected:
!   static int candidate_id();
    // generate candidate graphic id.
!   static int unique_id(unsigned int id);
!   // test candidate id for uniqueness
    
!   unsigned int _id;
    
  };
  
  //: object to encapsulate a set of graphic ids
--- 43,67 ----
  
    virtual int composite() { return 0; }
    // return true if can be cast to GraphicIds
! 
    virtual GraphicIdList* sublist() { return nil; }
    // returns pointer to sublist of GraphicId's, if any
! 
!   static int candidate_grid();
    // generate candidate graphic id.
!   static int unique_grid(unsigned int id);
!   // test candidate graphic id for local uniqueness
!   static int candidate_sessionid();
!   // generate candidate session id.
!   static int unique_sessionid(unsigned int id);
!   // test candidate session id for local uniqueness
    
!   static unsigned int GraphicIdMask;
!   static unsigned int SessionIdMask;
    
+ protected:
+   unsigned int _id;
+ 
  };
  
  //: object to encapsulate a set of graphic ids
***************
*** 71,96 ****
  
  protected:
    GraphicIdList* _sublist;
- };
- 
- //: object to encapsulate a request to reserve a set of graphic ids
- class GraphicIdsRequest : public GraphicIds {
- public:
-   GraphicIdsRequest(GraphicId* subids, int nsubids); 
-   GraphicIdsRequest(GraphicIdList* sublist=nil);
-   virtual ~GraphicIdsRequest();
- 
-   void Init();
- 
-   virtual int request() { return 1; }
-   // return true if can be cast to GraphicIdsRequest
-   int reserved();
-   // return 1 if id is completely reserved, otherwise 0.
- 
- protected:
-   int* _ready;
-   DrawLink** _links;
-   int _nlinks;
  };
  
  #endif
--- 78,83 ----
*** /dev/null	 Mon Mar 8 13:29:40 PST 2004
--- patches/ivtools-040308-johnston-034
*************** patches/ivtools-040308-johnston-034
*** 0 ****
--- 1 ----
+ ivtools-040308-johnston-034

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040308-johnston-035"
Content-Disposition: attachment;
	filename=ivtools-040308-johnston-035

Patch:    ivtools-040308-johnston-035
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  patch to propogate drawserv development via cvs
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

- patch to propogate drawserv development via cvs

Index: DrawServ/drawfunc.c
diff -c DrawServ/drawfunc.c:1.11 DrawServ/drawfunc.c:1.12
*** DrawServ/drawfunc.c:1.11	Mon Mar  8 13:29:19 2004
--- src/DrawServ/drawfunc.c	Mon Mar  8 14:13:27 2004
***************
*** 169,175 ****
    }
  
    /* handle new session id request */
!   else if (nargs()==1 && nkeys()==0 && idv.is_known() && ridv.is_known()) {
      returnid = idv.uint_val();
      ((DrawServ*)unidraw)->sessionid_handle_new(returnid, ridv.int_val());
    }
--- 169,175 ----
    }
  
    /* handle new session id request */
!   else if (idv.is_known() && ridv.is_known()) {
      returnid = idv.uint_val();
      ((DrawServ*)unidraw)->sessionid_handle_new(returnid, ridv.int_val());
    }
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.14 DrawServ/drawserv.c:1.15
*** DrawServ/drawserv.c:1.14	Mon Mar  8 13:29:19 2004
--- src/DrawServ/drawserv.c	Mon Mar  8 14:13:27 2004
***************
*** 283,289 ****
    while(!_linklist->Done(it)) {
      DrawLink* link = _linklist->GetDrawLink(it);
      link->sessionid_state(DrawLink::SessionIdRequested);
!     snprintf(buf, BUFSIZ, "session(0x%08x :rid %d)%c", _trialid, link->local_linkid(), '\0');
      SendCmdString(link, buf);
      _linklist->Next(it);
    }
--- 283,289 ----
    while(!_linklist->Done(it)) {
      DrawLink* link = _linklist->GetDrawLink(it);
      link->sessionid_state(DrawLink::SessionIdRequested);
!     snprintf(buf, BUFSIZ, "sessionid(0x%08x :rid %d)%c", _trialid, link->local_linkid(), '\0');
      SendCmdString(link, buf);
      _linklist->Next(it);
    }
***************
*** 300,306 ****
  	table->insert(new_id, link);
        }
        char buf[BUFSIZ];
!       snprintf(buf, BUFSIZ, "sessionid(0x08x :ok %d)%c", new_id, okflag, '\0');
        SendCmdString(link, buf);
      } else {
        fprintf(stderr, "code for passing selection id request on to other DrawLink's not implemented\n");
--- 300,306 ----
  	table->insert(new_id, link);
        }
        char buf[BUFSIZ];
!       snprintf(buf, BUFSIZ, "sessionid(0x08x :ok %d :rid %d )%c", new_id, okflag, link->local_linkid(), '\0');
        SendCmdString(link, buf);
      } else {
        fprintf(stderr, "code for passing selection id request on to other DrawLink's not implemented\n");
*** /dev/null	 Mon Mar 8 14:13:43 PST 2004
--- patches/ivtools-040308-johnston-035
*************** patches/ivtools-040308-johnston-035
*** 0 ****
--- 1 ----
+ ivtools-040308-johnston-035

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040309-johnston-036"
Content-Disposition: attachment;
	filename=ivtools-040309-johnston-036

Patch:    ivtools-040309-johnston-036
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  patch to propogate drawserv development via cvs
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

- patch to propogate drawserv development via cvs

Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.15 DrawServ/drawserv.c:1.16
*** DrawServ/drawserv.c:1.15	Mon Mar  8 14:13:27 2004
--- src/DrawServ/drawserv.c	Tue Mar  9 09:12:00 2004
***************
*** 300,306 ****
  	table->insert(new_id, link);
        }
        char buf[BUFSIZ];
!       snprintf(buf, BUFSIZ, "sessionid(0x08x :ok %d :rid %d )%c", new_id, okflag, link->local_linkid(), '\0');
        SendCmdString(link, buf);
      } else {
        fprintf(stderr, "code for passing selection id request on to other DrawLink's not implemented\n");
--- 300,306 ----
  	table->insert(new_id, link);
        }
        char buf[BUFSIZ];
!       snprintf(buf, BUFSIZ, "sessionid(0x%08x :ok %d :rid %d )%c", new_id, okflag, link->local_linkid(), '\0');
        SendCmdString(link, buf);
      } else {
        fprintf(stderr, "code for passing selection id request on to other DrawLink's not implemented\n");
*** /dev/null	 Tue Mar 9 09:12:17 PST 2004
--- patches/ivtools-040309-johnston-036
*************** patches/ivtools-040309-johnston-036
*** 0 ****
--- 1 ----
+ ivtools-040309-johnston-036

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040309-johnston-037"
Content-Disposition: attachment;
	filename=ivtools-040309-johnston-037

Patch:    ivtools-040309-johnston-037
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  patch to propogate drawserv development via cvs
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

- patch to propogate drawserv development via cvs

Index: DrawServ/drawfunc.c
diff -c DrawServ/drawfunc.c:1.12 DrawServ/drawfunc.c:1.13
*** DrawServ/drawfunc.c:1.12	Mon Mar  8 14:13:27 2004
--- src/DrawServ/drawfunc.c	Tue Mar  9 10:15:26 2004
***************
*** 168,183 ****
      returnid = ((DrawServ*)unidraw)->sessionid(true);
    }
  
-   /* handle new session id request */
    else if (idv.is_known() && ridv.is_known()) {
      returnid = idv.uint_val();
!     ((DrawServ*)unidraw)->sessionid_handle_new(returnid, ridv.int_val());
    }
  
!   /* handle callback */ 
!   else if (okv.is_known() && ridv.is_known()) {
      returnid = idv.uint_val();
-     ((DrawServ*)unidraw)->sessionid_callback_new(ridv.int_val(), returnid, okv.is_true());
    }
  
    /* return current session id */
--- 168,187 ----
      returnid = ((DrawServ*)unidraw)->sessionid(true);
    }
  
    else if (idv.is_known() && ridv.is_known()) {
      returnid = idv.uint_val();
! 
!     /* handle new session id request */
!     if (!okv.is_known()) 
!       ((DrawServ*)unidraw)->sessionid_handle_new(returnid, ridv.int_val());
!     
!     /* handle callback */ 
!     else
!     ((DrawServ*)unidraw)->sessionid_callback_new(returnid, ridv.int_val(), okv.is_true());
    }
  
!   else if (idv.is_known() && okv.is_known() && ridv.is_known()) {
      returnid = idv.uint_val();
    }
  
    /* return current session id */
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.16 DrawServ/drawserv.c:1.17
*** DrawServ/drawserv.c:1.16	Tue Mar  9 09:12:00 2004
--- src/DrawServ/drawserv.c	Tue Mar  9 10:15:26 2004
***************
*** 73,79 ****
    _sessionidtable = new SessionIdTable(256);
  
    _sessionid = -1;
!   _trialid = -1;
  }
  
  DrawServ::~DrawServ () 
--- 73,79 ----
    _sessionidtable = new SessionIdTable(256);
  
    _sessionid = -1;
!   _trialid = GraphicId::candidate_sessionid();
  }
  
  DrawServ::~DrawServ () 
***************
*** 275,282 ****
  
  // generate request to reserve unique session id
  void DrawServ::sessionid_request_new() {
-   _trialid = GraphicId::candidate_sessionid();
- 
    Iterator it;
    _linklist->First(it);
    char buf[BUFSIZ];
--- 275,280 ----
***************
*** 290,295 ****
--- 288,295 ----
  }
  
  // handle request to reserve unique session id
+ // can be answered locally, because others are required to
+ // propogate their request completely before adopting new id.
  void DrawServ::sessionid_handle_new(int new_id, int remote_linkid) {
    DrawLink* link = linkget(-1, remote_linkid);
    if (link) {
***************
*** 313,318 ****
--- 313,326 ----
  void DrawServ::sessionid_callback_new(int new_id, int remote_linkid, int ok_flag) {
    fprintf(stderr, "sessionid_callback_new: new_id %d,  remote_linkid %d, ok_flag %d\n",
  	  new_id, remote_linkid, ok_flag);
+   if (new_id != _trialid) {
+     ok_flag = false;
+     fprintf(stderr, "new_id (%d) does not match _trialid (%d)\n", new_id, _trialid);
+   }
+   if (ok_flag) {
+     _sessionid = _trialid;
+   } else {
+   }
  }
  
  // generate request to change/set unique session id
***************
*** 323,325 ****
--- 331,336 ----
  void DrawServ::sessionid_handle_chg(int new_id, int old_id) {
  }
  
+ int DrawServ::online() {
+   return _sessionid==_trialid && _sessionid!=-1;
+ }
Index: DrawServ/drawserv.h
diff -c DrawServ/drawserv.h:1.11 DrawServ/drawserv.h:1.12
*** DrawServ/drawserv.h:1.11	Mon Mar  8 13:29:19 2004
--- src/DrawServ/drawserv.h	Tue Mar  9 10:15:26 2004
***************
*** 55,60 ****
--- 55,63 ----
  
      void Init();
  
+     int online();
+     // return true if session id initialized, otherwise false.
+ 
      DrawLink* linkup(const char* hostname, int portnum, 
  		     int state, int local_id=-1, int remote_id=-1,
  		     ComTerp* comterp=nil);
*** /dev/null	 Tue Mar 9 10:15:48 PST 2004
--- patches/ivtools-040309-johnston-037
*************** patches/ivtools-040309-johnston-037
*** 0 ****
--- 1 ----
+ ivtools-040309-johnston-037

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040309-johnston-038"
Content-Disposition: attachment;
	filename=ivtools-040309-johnston-038

Patch:    ivtools-040309-johnston-038
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  patch to propogate drawserv development via cvs
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawfunc.c
diff -c DrawServ/drawfunc.c:1.13 DrawServ/drawfunc.c:1.14
*** DrawServ/drawfunc.c:1.13	Tue Mar  9 10:15:26 2004
--- src/DrawServ/drawfunc.c	Tue Mar  9 11:11:35 2004
***************
*** 133,140 ****
    push_stack(ComValue::nullval());
  
  #else
!   static int new_sym = symbol_add("new");
!   ComValue newv(stack_key(new_sym));
  
    static int trial_sym = symbol_add("trial");
    ComValue trialv(stack_key(trial_sym));
--- 133,140 ----
    push_stack(ComValue::nullval());
  
  #else
!   static int chk_sym = symbol_add("chk");
!   ComValue chkv(stack_key(chk_sym));
  
    static int trial_sym = symbol_add("trial");
    ComValue trialv(stack_key(trial_sym));
***************
*** 158,165 ****
    unsigned int returnid = 0;
  
    /* request a new session id */
!   if (newv.is_true()) {    
!     ((DrawServ*)unidraw)->sessionid_request_new();
      returnid = ((DrawServ*)unidraw)->sessionid(true);
    }
  
--- 158,165 ----
    unsigned int returnid = 0;
  
    /* request a new session id */
!   if (chkv.is_true()) {    
!     ((DrawServ*)unidraw)->sessionid_request_chk();
      returnid = ((DrawServ*)unidraw)->sessionid(true);
    }
  
***************
*** 173,183 ****
  
      /* handle new session id request */
      if (!okv.is_known()) 
!       ((DrawServ*)unidraw)->sessionid_handle_new(returnid, ridv.int_val());
      
      /* handle callback */ 
      else
!     ((DrawServ*)unidraw)->sessionid_callback_new(returnid, ridv.int_val(), okv.is_true());
    }
  
    else if (idv.is_known() && okv.is_known() && ridv.is_known()) {
--- 173,183 ----
  
      /* handle new session id request */
      if (!okv.is_known()) 
!       ((DrawServ*)unidraw)->sessionid_handle_chk(returnid, ridv.int_val());
      
      /* handle callback */ 
      else
!     ((DrawServ*)unidraw)->sessionid_callback_chk(returnid, ridv.int_val(), okv.is_true());
    }
  
    else if (idv.is_known() && okv.is_known() && ridv.is_known()) {
Index: DrawServ/drawfunc.h
diff -c DrawServ/drawfunc.h:1.4 DrawServ/drawfunc.h:1.5
*** DrawServ/drawfunc.h:1.4	Mon Mar  8 13:29:19 2004
--- src/DrawServ/drawfunc.h	Tue Mar  9 11:11:35 2004
***************
*** 38,50 ****
  };
  
  //: command to reserve unique session id
! // sessionid(:new) -- command to manage session id's
  class SessionIdFunc : public UnidrawFunc {
  public:
      SessionIdFunc(ComTerp*,DrawEditor*);
      virtual void execute();
      virtual const char* docstring() { 
! 	return "%s(:new) -- command to manage session id's"; }
  };
  
  //: command to reserve graphics for selection in remote editors
--- 38,50 ----
  };
  
  //: command to reserve unique session id
! // sessionid(:chk :trial :rid num :ok bool) -- command to manage session id's
  class SessionIdFunc : public UnidrawFunc {
  public:
      SessionIdFunc(ComTerp*,DrawEditor*);
      virtual void execute();
      virtual const char* docstring() { 
! 	return "%s(:chk :trial :rid num :ok bool) -- command to manage session id's"; }
  };
  
  //: command to reserve graphics for selection in remote editors
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.17 DrawServ/drawserv.c:1.18
*** DrawServ/drawserv.c:1.17	Tue Mar  9 10:15:26 2004
--- src/DrawServ/drawserv.c	Tue Mar  9 11:11:35 2004
***************
*** 53,58 ****
--- 53,61 ----
  implementTable(GraphicIdTable,int,void*)
  implementTable(SessionIdTable,int,void*)
  
+ unsigned int DrawServ::GraphicIdMask = 0x000fffff;
+ unsigned int DrawServ::SessionIdMask = 0xfff00000;
+ 
  /*****************************************************************************/
  
  DrawServ::DrawServ (Catalog* c, int& argc, char** argv, 
***************
*** 72,79 ****
    _gridtable = new GraphicIdTable(1024);
    _sessionidtable = new SessionIdTable(256);
  
!   _sessionid = -1;
!   _trialid = GraphicId::candidate_sessionid();
  }
  
  DrawServ::~DrawServ () 
--- 75,83 ----
    _gridtable = new GraphicIdTable(1024);
    _sessionidtable = new SessionIdTable(256);
  
!   _sessionid = candidate_sessionid();
!   _trialid = _sessionid;
!   _sessionidtable->insert(_sessionid, nil); // nil pointer refers to local session id
  }
  
  DrawServ::~DrawServ () 
***************
*** 272,280 ****
      }
    }
  }
  
- // generate request to reserve unique session id
- void DrawServ::sessionid_request_new() {
    Iterator it;
    _linklist->First(it);
    char buf[BUFSIZ];
--- 276,285 ----
      }
    }
  }
+ 
+ // generate request to check unique session id
+ void DrawServ::sessionid_request_chk() {
  
    Iterator it;
    _linklist->First(it);
    char buf[BUFSIZ];
***************
*** 287,301 ****
    }
  }
  
! // handle request to reserve unique session id
  // can be answered locally, because others are required to
  // propogate their request completely before adopting new id.
! void DrawServ::sessionid_handle_new(int new_id, int remote_linkid) {
    DrawLink* link = linkget(-1, remote_linkid);
    if (link) {
      if (_linklist->Number()==1) {
        int okflag = false;
!       if (okflag = GraphicId::unique_sessionid(new_id)) {
  	SessionIdTable* table = ((DrawServ*)unidraw)->sessionidtable();
  	table->insert(new_id, link);
        }
--- 292,306 ----
    }
  }
  
! // handle request to check unique session id
  // can be answered locally, because others are required to
  // propogate their request completely before adopting new id.
! void DrawServ::sessionid_handle_chk(int new_id, int remote_linkid) {
    DrawLink* link = linkget(-1, remote_linkid);
    if (link) {
      if (_linklist->Number()==1) {
        int okflag = false;
!       if (okflag = DrawServ::unique_sessionid(new_id)) {
  	SessionIdTable* table = ((DrawServ*)unidraw)->sessionidtable();
  	table->insert(new_id, link);
        }
***************
*** 309,317 ****
      fprintf(stderr, "no link with remote id of %d found\n", remote_linkid);
  }
  
! // process callbacks on request to reserve unique session id
! void DrawServ::sessionid_callback_new(int new_id, int remote_linkid, int ok_flag) {
!   fprintf(stderr, "sessionid_callback_new: new_id %d,  remote_linkid %d, ok_flag %d\n",
  	  new_id, remote_linkid, ok_flag);
    if (new_id != _trialid) {
      ok_flag = false;
--- 314,322 ----
      fprintf(stderr, "no link with remote id of %d found\n", remote_linkid);
  }
  
! // process callbacks on request to check unique session id
! void DrawServ::sessionid_callback_chk(int new_id, int remote_linkid, int ok_flag) {
!   fprintf(stderr, "sessionid_callback_chk: new_id %d,  remote_linkid %d, ok_flag %d\n",
  	  new_id, remote_linkid, ok_flag);
    if (new_id != _trialid) {
      ok_flag = false;
***************
*** 334,336 ****
--- 339,392 ----
  int DrawServ::online() {
    return _sessionid==_trialid && _sessionid!=-1;
  }
+ 
+ int DrawServ::candidate_grid() {
+   static int seed=0;
+   if (!seed) {
+     seed = time(nil) & (time(nil) << 16);
+     srand(seed);
+   }
+   int retval;
+   do {
+     static int flip=0;
+     while ((retval=rand()&GraphicIdMask)==0);
+ 
+   } while (!unique_grid(retval));
+   return retval;
+ }
+ 
+ int DrawServ::unique_grid(unsigned int id) {
+   GraphicIdTable* table = ((DrawServ*)unidraw)->gridtable();
+   void* ptr = nil;
+   table->find(ptr, id);
+   if (ptr) 
+     return 0;
+   else
+     return 1;
+ }
+ 
+ int DrawServ::candidate_sessionid() {
+   static int seed=0;
+   if (!seed) {
+     seed = time(nil) & (time(nil) << 16);
+     srand(seed);
+   }
+   int retval;
+   do {
+     static int flip=0;
+     while ((retval=rand()&SessionIdMask)==0);
+ 
+   } while (!unique_sessionid(retval));
+   return retval;
+ }
+ 
+ int DrawServ::unique_sessionid(unsigned int id) {
+   SessionIdTable* table = ((DrawServ*)unidraw)->sessionidtable();
+   void* ptr = nil;
+   table->find(ptr, id);
+   if (ptr) 
+     return 0;
+   else
+     return 1;
+ }
+ 
Index: DrawServ/drawserv.h
diff -c DrawServ/drawserv.h:1.12 DrawServ/drawserv.h:1.13
*** DrawServ/drawserv.h:1.12	Tue Mar  9 10:15:26 2004
--- src/DrawServ/drawserv.h	Tue Mar  9 11:11:35 2004
***************
*** 46,117 ****
  
  class DrawServ : public OverlayUnidraw {
  public:
!     DrawServ(
!         Catalog*, int& argc, char** argv, 
!         OptionDesc* = nil, PropertyData* = nil
!     );
!     DrawServ(Catalog*, World*);
!     virtual ~DrawServ();
! 
!     void Init();
! 
!     int online();
!     // return true if session id initialized, otherwise false.
! 
!     DrawLink* linkup(const char* hostname, int portnum, 
! 		     int state, int local_id=-1, int remote_id=-1,
! 		     ComTerp* comterp=nil);
!     // Create new link to remote drawserv, return -1 if error
!     // state: 0==new_link, 1==one_way, 2==two_way.
!     // Let DrawLink assign local_id by passing -1 for local_id.
!     // The local_id argument is for verification purposes once
!     // two-way link is established.
! 
!     int linkdown(DrawLink* link);
!     // shut down existing link to remote drawserv
! 
!     DrawLink* linkget(int local_id, int remote_id=-1);
!     // return pointer to existing DrawLink
! 
!     void linkdump(FILE*);
!     // dump text table of DrawLink's
! 
!     virtual void ExecuteCmd(Command*);
!     // execute Command's locally, and on remote linked DrawServ's.
! 
!     virtual void DistributeCmdString(const char* cmdstring);
!     // execute command string remote DrawServ's
! 
!     virtual void SendCmdString(DrawLink* link, const char* cmdstring);
!     // execute command string on one remote DrawServ
! 
!     DrawLinkList* linklist() { return _linklist; }
!     // return pointer to list of DrawLink's
! 
!     GraphicIdTable* gridtable() { return _gridtable; }
!     // return pointer to table of GraphicId's.
! 
!     SessionIdTable* sessionidtable() { return _sessionidtable; }
!     // return pointer to table of DrawLink's as a function of session id's.
! 
!     void sessionid_request_new();
!     // generate request to reserve unique session id
! 
!     void sessionid_handle_new(int new_id, int remote_linkid);
!     // handle request to reserve unique session id
! 
!     void sessionid_callback_new(int new_id, int remote_linkid, int ok_flag);
!     // process callbacks on request to reserve unique session id
! 
!     void sessionid_request_chg();
!     // generate request to change/set unique session id
! 
!     void sessionid_handle_chg(int new_id, int old_id);
!     // handle request to change unique session id
! 
!     int sessionid(int trial=false) { return trial ? _trialid : _sessionid; }
!     // current unique session id.
! 
  protected:
      DrawLinkList* _linklist;
      // DrawLink list
--- 46,129 ----
  
  class DrawServ : public OverlayUnidraw {
  public:
!   DrawServ(
! 	   Catalog*, int& argc, char** argv, 
! 	   OptionDesc* = nil, PropertyData* = nil
! 	   );
!   DrawServ(Catalog*, World*);
!   virtual ~DrawServ();
!   
!   void Init();
!   
!   int online();
!   // return true if session id initialized, otherwise false.
!   
!   DrawLink* linkup(const char* hostname, int portnum, 
! 		   int state, int local_id=-1, int remote_id=-1,
! 		   ComTerp* comterp=nil);
!   // Create new link to remote drawserv, return -1 if error
!   // state: 0==new_link, 1==one_way, 2==two_way.
!   // Let DrawLink assign local_id by passing -1 for local_id.
!   // The local_id argument is for verification purposes once
!   // two-way link is established.
!   
!   int linkdown(DrawLink* link);
!   // shut down existing link to remote drawserv
!   
!   DrawLink* linkget(int local_id, int remote_id=-1);
!   // return pointer to existing DrawLink
!   
!   void linkdump(FILE*);
!   // dump text table of DrawLink's
!   
!   virtual void ExecuteCmd(Command*);
!   // execute Command's locally, and on remote linked DrawServ's.
!   
!   virtual void DistributeCmdString(const char* cmdstring);
!   // execute command string remote DrawServ's
!   
!   virtual void SendCmdString(DrawLink* link, const char* cmdstring);
!   // execute command string on one remote DrawServ
!   
!   DrawLinkList* linklist() { return _linklist; }
!   // return pointer to list of DrawLink's
!   
!   GraphicIdTable* gridtable() { return _gridtable; }
!   // return pointer to table of GraphicId's.
!   
!   SessionIdTable* sessionidtable() { return _sessionidtable; }
!   // return pointer to table of DrawLink's as a function of session id's.
!   
!   void sessionid_request_chk();
!   // generate next request to check unique session id
!   
!   void sessionid_handle_chk(int chk_id, int remote_linkid);
!   // handle request to check unique session id
!   
!   void sessionid_callback_chk(int chk_id, int remote_linkid, int ok_flag);
!   // process callbacks on request to check unique session id
!   
!   void sessionid_request_chg();
!   // generate request to change/set unique session id
!   
!   void sessionid_handle_chg(int new_id, int old_id);
!   // handle request to change unique session id
!   
!   int sessionid(int trial=false) { return trial ? _trialid : _sessionid; }
!   // current unique session id.
!   
!   static int candidate_grid();
!   // generate candidate graphic id.
!   static int unique_grid(unsigned int id);
!   // test candidate graphic id for local uniqueness
!   static int candidate_sessionid();
!   // generate candidate session id.
!   static int unique_sessionid(unsigned int id);
!   // test candidate session id for local uniqueness
!   
!   static unsigned int GraphicIdMask;
!   static unsigned int SessionIdMask;
!   
  protected:
      DrawLinkList* _linklist;
      // DrawLink list
Index: DrawServ/grid.c
diff -c DrawServ/grid.c:1.2 DrawServ/grid.c:1.3
*** DrawServ/grid.c:1.2	Mon Mar  8 13:29:19 2004
--- src/DrawServ/grid.c	Tue Mar  9 11:11:35 2004
***************
*** 36,49 ****
  #include <stdlib.h>
  #include <time.h>
  
- unsigned int GraphicId::GraphicIdMask = 0x000fffff;
- unsigned int GraphicId::SessionIdMask = 0xfff00000;
- 
  /*****************************************************************************/
  
  GraphicId::GraphicId () 
  {
!   _id = candidate_grid();
    GraphicIdTable* table = ((DrawServ*)unidraw)->gridtable();
    table->insert(_id, this);
  }
--- 36,46 ----
  #include <stdlib.h>
  #include <time.h>
  
  /*****************************************************************************/
  
  GraphicId::GraphicId () 
  {
!   _id = DrawServ::candidate_grid();
    GraphicIdTable* table = ((DrawServ*)unidraw)->gridtable();
    table->insert(_id, this);
  }
***************
*** 52,107 ****
  {
    GraphicIdTable* table = ((DrawServ*)unidraw)->gridtable();
    table->remove(_id);
- }
- 
- int GraphicId::candidate_grid() {
-   static int seed=0;
-   if (!seed) {
-     seed = time(nil) & (time(nil) << 16);
-     srand(seed);
-   }
-   int retval;
-   do {
-     static int flip=0;
-     while ((retval=rand()&GraphicIdMask)==0);
- 
-   } while (!unique_grid(retval));
-   return retval;
- }
- 
- int GraphicId::unique_grid(unsigned int id) {
-   GraphicIdTable* table = ((DrawServ*)unidraw)->gridtable();
-   void* ptr = nil;
-   table->find(ptr, id);
-   if (ptr) 
-     return 0;
-   else
-     return 1;
- }
- 
- int GraphicId::candidate_sessionid() {
-   static int seed=0;
-   if (!seed) {
-     seed = time(nil) & (time(nil) << 16);
-     srand(seed);
-   }
-   int retval;
-   do {
-     static int flip=0;
-     while ((retval=rand()&SessionIdMask)==0);
- 
-   } while (!unique_sessionid(retval));
-   return retval;
- }
- 
- int GraphicId::unique_sessionid(unsigned int id) {
-   SessionIdTable* table = ((DrawServ*)unidraw)->sessionidtable();
-   void* ptr = nil;
-   table->find(ptr, id);
-   if (ptr) 
-     return 0;
-   else
-     return 1;
  }
  
  /*****************************************************************************/
--- 49,54 ----
Index: DrawServ/grid.h
diff -c DrawServ/grid.h:1.2 DrawServ/grid.h:1.3
*** DrawServ/grid.h:1.2	Mon Mar  8 13:29:19 2004
--- src/DrawServ/grid.h	Tue Mar  9 11:11:35 2004
***************
*** 47,64 ****
    virtual GraphicIdList* sublist() { return nil; }
    // returns pointer to sublist of GraphicId's, if any
  
-   static int candidate_grid();
-   // generate candidate graphic id.
-   static int unique_grid(unsigned int id);
-   // test candidate graphic id for local uniqueness
-   static int candidate_sessionid();
-   // generate candidate session id.
-   static int unique_sessionid(unsigned int id);
-   // test candidate session id for local uniqueness
-   
-   static unsigned int GraphicIdMask;
-   static unsigned int SessionIdMask;
-   
  protected:
    unsigned int _id;
  
--- 47,52 ----
*** /dev/null	 Tue Mar 9 11:11:54 PST 2004
--- patches/ivtools-040309-johnston-038
*************** patches/ivtools-040309-johnston-038
*** 0 ****
--- 1 ----
+ ivtools-040309-johnston-038

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040309-johnston-039"
Content-Disposition: attachment;
	filename=ivtools-040309-johnston-039

Patch:    ivtools-040309-johnston-039
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.18 DrawServ/drawserv.c:1.19
*** DrawServ/drawserv.c:1.18	Tue Mar  9 11:11:35 2004
--- src/DrawServ/drawserv.c	Tue Mar  9 16:03:04 2004
***************
*** 46,51 ****
--- 46,52 ----
  #include <ComTerp/comterpserv.h>
  
  #include <Attribute/attrlist.h>
+ #include <Attribute/attrvalue.h>
  
  #include <fstream.h>
  #include <strstream>
***************
*** 177,182 ****
--- 178,185 ----
  }
  
  void DrawServ::ExecuteCmd(Command* cmd) {
+   static int id_sym = symbol_add("id");
+ 
    if(!_linklist || _linklist->Number()==0) 
  
      /* normal Unidraw command execution */
***************
*** 197,202 ****
--- 200,212 ----
  	Iterator it;
  	for (cb->First(it); !cb->Done(it); cb->Next(it)) {
  	  OverlayComp* comp = (OverlayComp*)cb->GetComp(it);
+ 
+ 	  /* generate unique id and add as attribute */
+ 	  GraphicId* grid = new GraphicId(sessionid());
+ 	  grid->grcomp(comp);
+ 	  AttributeList* al = comp->GetAttributeList();
+ 	  al->add_attr(id_sym, new AttributeValue(grid->id(), AttributeValue::UIntType));
+ 
  	  if (comp) {
  	    Creator* creator = unidraw->GetCatalog()->GetCreator();
  	    OverlayScript* scripter = (OverlayScript*)
***************
*** 340,346 ****
    return _sessionid==_trialid && _sessionid!=-1;
  }
  
! int DrawServ::candidate_grid() {
    static int seed=0;
    if (!seed) {
      seed = time(nil) & (time(nil) << 16);
--- 350,356 ----
    return _sessionid==_trialid && _sessionid!=-1;
  }
  
! unsigned int DrawServ::candidate_grid() {
    static int seed=0;
    if (!seed) {
      seed = time(nil) & (time(nil) << 16);
***************
*** 365,371 ****
      return 1;
  }
  
! int DrawServ::candidate_sessionid() {
    static int seed=0;
    if (!seed) {
      seed = time(nil) & (time(nil) << 16);
--- 375,381 ----
      return 1;
  }
  
! unsigned int DrawServ::candidate_sessionid() {
    static int seed=0;
    if (!seed) {
      seed = time(nil) & (time(nil) << 16);
Index: DrawServ/drawserv.h
diff -c DrawServ/drawserv.h:1.13 DrawServ/drawserv.h:1.14
*** DrawServ/drawserv.h:1.13	Tue Mar  9 11:11:35 2004
--- src/DrawServ/drawserv.h	Tue Mar  9 16:03:04 2004
***************
*** 109,122 ****
    void sessionid_handle_chg(int new_id, int old_id);
    // handle request to change unique session id
    
!   int sessionid(int trial=false) { return trial ? _trialid : _sessionid; }
    // current unique session id.
    
!   static int candidate_grid();
    // generate candidate graphic id.
    static int unique_grid(unsigned int id);
    // test candidate graphic id for local uniqueness
!   static int candidate_sessionid();
    // generate candidate session id.
    static int unique_sessionid(unsigned int id);
    // test candidate session id for local uniqueness
--- 109,122 ----
    void sessionid_handle_chg(int new_id, int old_id);
    // handle request to change unique session id
    
!   unsigned int sessionid(int trial=false) { return trial ? _trialid : _sessionid; }
    // current unique session id.
    
!   static unsigned int candidate_grid();
    // generate candidate graphic id.
    static int unique_grid(unsigned int id);
    // test candidate graphic id for local uniqueness
!   static unsigned int candidate_sessionid();
    // generate candidate session id.
    static int unique_sessionid(unsigned int id);
    // test candidate session id for local uniqueness
Index: DrawServ/grid.c
diff -c DrawServ/grid.c:1.3 DrawServ/grid.c:1.4
*** DrawServ/grid.c:1.3	Tue Mar  9 11:11:35 2004
--- src/DrawServ/grid.c	Tue Mar  9 16:03:04 2004
***************
*** 38,48 ****
  
  /*****************************************************************************/
  
! GraphicId::GraphicId () 
  {
    _id = DrawServ::candidate_grid();
    GraphicIdTable* table = ((DrawServ*)unidraw)->gridtable();
!   table->insert(_id, this);
  }
  
  GraphicId::~GraphicId () 
--- 38,50 ----
  
  /*****************************************************************************/
  
! GraphicId::GraphicId (unsigned int sessionid) 
  {
    _id = DrawServ::candidate_grid();
+   _sid = sessionid&DrawServ::SessionIdMask;
    GraphicIdTable* table = ((DrawServ*)unidraw)->gridtable();
!   table->insert(_id&_sid, this);
!   _comp = nil;
  }
  
  GraphicId::~GraphicId () 
***************
*** 53,59 ****
  
  /*****************************************************************************/
  
! GraphicIds::GraphicIds(GraphicId* subids, int nsubs) : GraphicId ()
  {
    if (nsubs>0) {
      _sublist = new GraphicIdList();
--- 55,61 ----
  
  /*****************************************************************************/
  
! GraphicIds::GraphicIds(unsigned int sessionid, GraphicId* subids, int nsubs) : GraphicId (sessionid)
  {
    if (nsubs>0) {
      _sublist = new GraphicIdList();
***************
*** 63,69 ****
    Resource::ref(_sublist);
  }
  
! GraphicIds::GraphicIds(GraphicIdList* sublist) : GraphicId ()
  {
    if (!sublist) sublist = new GraphicIdList;
    _sublist = sublist;
--- 65,71 ----
    Resource::ref(_sublist);
  }
  
! GraphicIds::GraphicIds(unsigned int sessionid, GraphicIdList* sublist) : GraphicId (sessionid)
  {
    if (!sublist) sublist = new GraphicIdList;
    _sublist = sublist;
Index: DrawServ/grid.h
diff -c DrawServ/grid.h:1.3 DrawServ/grid.h:1.4
*** DrawServ/grid.h:1.3	Tue Mar  9 11:11:35 2004
--- src/DrawServ/grid.h	Tue Mar  9 16:03:04 2004
***************
*** 30,65 ****
  #include <Unidraw/globals.h>
  
  class DrawLink;
  class GraphicIdList;
  
  //: object to encapsulate unique graphic id
  class GraphicId {
  public:
!   GraphicId();
    virtual ~GraphicId();
    
!   unsigned int id() { return _id; }
!   // get associated unique integer id
  
!   virtual int composite() { return 0; }
    // return true if can be cast to GraphicIds
  
    virtual GraphicIdList* sublist() { return nil; }
    // returns pointer to sublist of GraphicId's, if any
  
  protected:
    unsigned int _id;
  
  };
  
  //: object to encapsulate a set of graphic ids
  class GraphicIds : public GraphicId {
  public:
!   GraphicIds(GraphicId* subids, int nsubids); 
!   GraphicIds(GraphicIdList* sublist=nil);
    virtual ~GraphicIds();
  
!   virtual int composite() { return 1; }
    // return true if can be cast to GraphicIds
    virtual GraphicIdList* sublist() { return _sublist; }
    // returns pointer to sublist of GraphicId's, if any
--- 30,81 ----
  #include <Unidraw/globals.h>
  
  class DrawLink;
+ class GraphicComp;
  class GraphicIdList;
  
  //: object to encapsulate unique graphic id
  class GraphicId {
  public:
!   GraphicId(unsigned int sessionid);
    virtual ~GraphicId();
    
!   unsigned int id() { return _id&_sid; }
!   // get associated unique composite integer id
  
!   unsigned int grid() { return _id; }
!   // return graphic id portion of composite id
!   // unique only to this process
! 
!   unsigned int sessionid() { return _sid; }
!   // return session id portion of composite id
! 
!   virtual int is_list() { return 0; }
    // return true if can be cast to GraphicIds
  
    virtual GraphicIdList* sublist() { return nil; }
    // returns pointer to sublist of GraphicId's, if any
  
+   void grcomp(GraphicComp* comp) { _comp = comp; }
+   // set pointer to associated GraphicComp
+ 
+   GraphicComp* grcomp() { return _comp; }
+   // set pointer to associated GraphicComp
+ 
  protected:
    unsigned int _id;
+   unsigned int _sid;
+   GraphicComp* _comp;
  
  };
  
  //: object to encapsulate a set of graphic ids
  class GraphicIds : public GraphicId {
  public:
!   GraphicIds(unsigned int sessionid, GraphicId* subids, int nsubids); 
!   GraphicIds(unsigned int sessionid, GraphicIdList* sublist=nil);
    virtual ~GraphicIds();
  
!   virtual int is_list() { return 1; }
    // return true if can be cast to GraphicIds
    virtual GraphicIdList* sublist() { return _sublist; }
    // returns pointer to sublist of GraphicId's, if any
*** /dev/null	 Tue Mar 9 16:03:25 PST 2004
--- patches/ivtools-040309-johnston-039
*************** patches/ivtools-040309-johnston-039
*** 0 ****
--- 1 ----
+ ivtools-040309-johnston-039

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040312-johnston-040"
Content-Disposition: attachment;
	filename=ivtools-040312-johnston-040

Patch:    ivtools-040312-johnston-040
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: Attribute/attrvalue.c
diff -c Attribute/attrvalue.c:1.2 Attribute/attrvalue.c:1.3
*** Attribute/attrvalue.c:1.2	Fri Mar  5 10:53:14 2004
--- src/Attribute/attrvalue.c	Fri Mar 12 11:32:24 2004
***************
*** 717,723 ****
  	    break;
  	    
  	case AttributeValue::UIntType:
! 	    out << "uint (" << svp->uint_ref() << ")";
  	    break;
  	    
  	case AttributeValue::LongType:
--- 717,728 ----
  	    break;
  	    
  	case AttributeValue::UIntType:
! 	    if (svp->state()==AttributeValue::OctState) 
! 	      out << "uint (" << svp->uint_ref() << ")";
! 	    else if (svp->state()==AttributeValue::HexState) 
! 	      out << "uint (" << svp->uint_ref() << ")";
! 	    else
! 	      out << "uint (" << svp->uint_ref() << ")";
  	    break;
  	    
  	case AttributeValue::LongType:
***************
*** 798,803 ****
--- 803,816 ----
  	  break;
  	  
  	case AttributeValue::UIntType:
+ 	  if (svp->state()==AttributeValue::OctState)
+ 	    out << "0" << std::oct << svp->uint_ref() << std::dec;
+ 	  else if (svp->state()==AttributeValue::HexState)
+ 	    out << "0x" << std::hex << svp->uint_ref() << std::dec;
+ 	  else
+ 	    out << svp->uint_ref();
+ 	  break;
+ 
  	case AttributeValue::BooleanType:
  	  out << svp->uint_ref();
  	  break;
***************
*** 807,813 ****
  	  break;
  
  	case AttributeValue::UShortType:
! 	  out << svp->ushort_ref();
  	  break;
  
  	case AttributeValue::LongType:
--- 820,831 ----
  	  break;
  
  	case AttributeValue::UShortType:
! 	  if (svp->state()==AttributeValue::OctState)
! 	    out << "0" << std::oct << svp->ushort_ref() << std::dec;
! 	  else if (svp->state()==AttributeValue::HexState)
! 	    out << "0x" << std::hex << svp->ushort_ref() << std::dec;
! 	  else
! 	    out << svp->ushort_ref();
  	  break;
  
  	case AttributeValue::LongType:
***************
*** 815,821 ****
  	  break;
  	  
  	case AttributeValue::ULongType:
! 	  out << svp->ulong_ref();
  	  break;
  	  
  	case AttributeValue::FloatType:
--- 833,844 ----
  	  break;
  	  
  	case AttributeValue::ULongType:
! 	  if (svp->state()==AttributeValue::OctState)
! 	    out << "0" << std::oct << svp->ulong_ref() << std::dec;
! 	  else if (svp->state()==AttributeValue::HexState)
! 	    out << "0x" << std::hex << svp->ulong_ref() << std::dec;
! 	  else
! 	    out << svp->ulong_ref();
  	  break;
  	  
  	case AttributeValue::FloatType:
Index: Attribute/attrvalue.h
diff -c Attribute/attrvalue.h:1.2 Attribute/attrvalue.h:1.3
*** Attribute/attrvalue.h:1.2	Fri Mar  5 10:53:15 2004
--- src/Attribute/attrvalue.h	Fri Mar 12 11:32:24 2004
***************
*** 109,114 ****
--- 109,117 ----
  };
      // enum for attribute value types.
  
+     enum ValueState { UnknownState, OctState, HexState };
+     // enum for states
+ 
      AttributeValue(ValueType type);
      // construct with specified type and unitialized value.
      AttributeValue(ValueType type, attr_value value);
***************
*** 259,265 ****
      int state();
      // get generic state value useful for any type other than CommandType, ObjectType, or StreamType
      void state(int val);
!     // set generic state value useful for any type other than CommandType, ObjectType, or StreamType0 = disabled, negative = internal, positive = external
  
      void negate();
      // negate numeric values.
--- 262,268 ----
      int state();
      // get generic state value useful for any type other than CommandType, ObjectType, or StreamType
      void state(int val);
!     // set generic state value useful for any type other than CommandType, ObjectType, or StreamType
  
      void negate();
      // negate numeric values.
Index: ComTerp/comvalue.c
diff -c ComTerp/comvalue.c:1.2 ComTerp/comvalue.c:1.3
*** ComTerp/comvalue.c:1.2	Thu Jan 29 10:51:49 2004
--- src/ComTerp/comvalue.c	Fri Mar 12 11:32:26 2004
***************
*** 211,219 ****
  	  break;	    
  
  	case ComValue::UShortType:
! 	  if (brief)
! 	    out << svp->ushort_ref();
! 	  else
  	    out << "ushort( " << svp->ushort_ref() << ":" << (int)svp->ushort_ref() << " )";
  	  break;
  	    
--- 211,224 ----
  	  break;	    
  
  	case ComValue::UShortType:
! 	  if (brief) {
! 	    if (svp->state()==AttributeValue::OctState)
! 	      out << "0" << std::oct << svp->ushort_ref() << std::dec;
! 	    else if (svp->state()==AttributeValue::HexState)
! 	      out << "0x" << std::hex << svp->ushort_ref() << std::dec;
! 	    else
! 	      out << svp->ushort_ref();
! 	  } else
  	    out << "ushort( " << svp->ushort_ref() << ":" << (int)svp->ushort_ref() << " )";
  	  break;
  	    
***************
*** 225,233 ****
  	  break;
  	    
  	case ComValue::UIntType:
! 	  if (brief)
! 	    out << svp->uint_ref();
! 	  else
  	    out << "uint( " << svp->uint_ref() << " )";
  	  break;
  	    
--- 230,243 ----
  	  break;
  	    
  	case ComValue::UIntType:
! 	  if (brief) {
! 	    if (svp->state()==AttributeValue::OctState)
! 	      out << "0" << std::oct << svp->uint_ref() << std::dec;
! 	    else if (svp->state()==AttributeValue::HexState)
! 	      out << "0x" << std::hex << svp->uint_ref() << std::dec;
! 	    else
! 	      out << svp->uint_ref();
! 	  } else
  	    out << "uint( " << svp->uint_ref() << " )";
  	  break;
  	    
***************
*** 239,247 ****
  	  break;
  	    
  	case ComValue::ULongType:
! 	  if (brief)
! 	    out << svp->ulong_ref() << "L";
! 	  else
  	    out << "ulong( " << svp->ulong_ref() << " )";
  	  break;
  	    
--- 249,262 ----
  	  break;
  	    
  	case ComValue::ULongType:
! 	  if (brief) {
! 	    if (svp->state()==AttributeValue::OctState)
! 	      out << "0" << std::oct << svp->ulong_ref() << std::dec;
! 	    else if (svp->state()==AttributeValue::HexState)
! 	      out << "0x" << std::hex << svp->ulong_ref() << std::dec;
! 	    else
! 	      out << svp->ulong_ref() << "L";
! 	  } else
  	    out << "ulong( " << svp->ulong_ref() << " )";
  	  break;
  	    
Index: ComUnidraw/grfunc.c
diff -c ComUnidraw/grfunc.c:1.4 ComUnidraw/grfunc.c:1.5
*** ComUnidraw/grfunc.c:1.4	Fri Mar  5 10:54:06 2004
--- src/ComUnidraw/grfunc.c	Fri Mar 12 11:33:00 2004
***************
*** 99,104 ****
--- 99,107 ----
          coords[j] = avl->GetAttrVal(i)->int_val();
  	avl->Next(i);
      }
+ 
+     AttributeList* al = stack_keys();
+     Resource::ref(al);
      reset_stack();
  
      PasteCmd* cmd = nil;
***************
*** 126,131 ****
--- 129,135 ----
  	rect->SetTransformer(rel);
  	Unref(rel);
  	RectOvComp* comp = new RectOvComp(rect);
+ 	comp->SetAttributeList(al);
  	if (PasteModeFunc::paste_mode()==0)
  	  cmd = new PasteCmd(_ed, new Clipboard(comp));
  	ComValue compval(symbol_add("RectComp"), new ComponentView(comp));
***************
*** 135,140 ****
--- 139,145 ----
  	push_stack(ComValue::nullval());
  
      execute_log(cmd);
+     Unref(al);
  }
  
  /*****************************************************************************/
***************
*** 163,168 ****
--- 168,176 ----
          coords[j] = avl->GetAttrVal(i)->int_val();
  	avl->Next(i);
      }
+ 
+     AttributeList* al = stack_keys();
+     Resource::ref(al);
      reset_stack();
  
      PasteCmd* cmd = nil;
***************
*** 191,196 ****
--- 199,205 ----
  	line->SetTransformer(rel);
  	Unref(rel);
  	ArrowLineOvComp* comp = new ArrowLineOvComp(line);
+ 	comp->SetAttributeList(al);
  	if (PasteModeFunc::paste_mode()==0)
  	  cmd = new PasteCmd(_ed, new Clipboard(comp));
  	ComValue compval(symbol_add("ArrowLineComp"), new ComponentView(comp));
***************
*** 200,205 ****
--- 209,215 ----
  	push_stack(ComValue::nullval());
  
      execute_log(cmd);
+     Unref(al);
  }
  
  /*****************************************************************************/
***************
*** 228,233 ****
--- 238,246 ----
          args[j] = avl->GetAttrVal(i)->int_val();
  	avl->Next(i);
      }
+ 
+     AttributeList* al = stack_keys();
+     Resource::ref(al);
      reset_stack();
  
      PasteCmd* cmd = nil;
***************
*** 255,260 ****
--- 268,274 ----
  	ellipse->SetTransformer(rel);
  	Unref(rel);
  	EllipseOvComp* comp = new EllipseOvComp(ellipse);
+ 	comp->SetAttributeList(al);
  	if (PasteModeFunc::paste_mode()==0)
  	  cmd = new PasteCmd(_ed, new Clipboard(comp));
  	ComValue compval(symbol_add("EllipseComp"), new ComponentView(comp));
***************
*** 264,269 ****
--- 278,284 ----
  	push_stack(ComValue::nullval());
  
      execute_log(cmd);
+     Unref(al);
  }
  
  /*****************************************************************************/
***************
*** 295,300 ****
--- 310,318 ----
      }
  
      char* txt = symbol_pntr( txtv.symbol_ref() );
+ 
+     AttributeList* al = stack_keys();
+     Resource::ref(al);
      reset_stack();
     
      PasteCmd* cmd = nil;
***************
*** 321,326 ****
--- 339,345 ----
  	text->GetTransformer()->postmultiply(rel);
  	Unref(rel);
  	TextOvComp* comp = new TextOvComp(text);
+ 	comp->SetAttributeList(al);
  	if (PasteModeFunc::paste_mode()==0)
  	  cmd = new PasteCmd(_ed, new Clipboard(comp));
  	ComValue compval(symbol_add("TextComp"), new ComponentView(comp));
***************
*** 330,335 ****
--- 349,355 ----
          push_stack(ComValue::nullval());
  
      execute_log(cmd);
+     Unref(al);
  }
  
  /*****************************************************************************/
***************
*** 358,363 ****
--- 378,386 ----
          y[j] = avl->GetAttrVal(i)->int_val();
  	avl->Next(i);
      }
+ 
+     AttributeList* al = stack_keys();
+     Resource::ref(al);
      reset_stack();
  
      PasteCmd* cmd = nil;
***************
*** 387,392 ****
--- 410,416 ----
  	multiline->SetTransformer(rel);
  	Unref(rel);
  	ArrowMultiLineOvComp* comp = new ArrowMultiLineOvComp(multiline);
+ 	comp->SetAttributeList(al);
  	if (PasteModeFunc::paste_mode()==0)
  	  cmd = new PasteCmd(_ed, new Clipboard(comp));
  	ComValue compval(symbol_add("ArrowMultiLineComp"), new ComponentView(comp));
***************
*** 396,401 ****
--- 420,426 ----
  	push_stack(ComValue::nullval());
  
      execute_log(cmd);
+     Unref(al);
  }
  
  /*****************************************************************************/
***************
*** 424,429 ****
--- 449,457 ----
          y[j] = avl->GetAttrVal(i)->int_val();
  	avl->Next(i);
      }
+ 
+     AttributeList* al = stack_keys();
+     Resource::ref(al);
      reset_stack();
  
      PasteCmd* cmd = nil;
***************
*** 453,458 ****
--- 481,487 ----
  	openspline->SetTransformer(rel);
  	Unref(rel);
  	ArrowSplineOvComp* comp = new ArrowSplineOvComp(openspline);
+ 	comp->SetAttributeList(al);
  	if (PasteModeFunc::paste_mode()==0)
  	  cmd = new PasteCmd(_ed, new Clipboard(comp));
  	ComValue compval(symbol_add("ArrowSplineComp"), new ComponentView(comp));
***************
*** 462,467 ****
--- 491,497 ----
  	push_stack(ComValue::nullval());
  
      execute_log(cmd);
+     Unref(al);
  }
  
  /*****************************************************************************/
***************
*** 490,495 ****
--- 520,528 ----
          y[j] = avl->GetAttrVal(i)->int_val();
  	avl->Next(i);
      }
+ 
+     AttributeList* al = stack_keys();
+     Resource::ref(al);
      reset_stack();
  
      PasteCmd* cmd = nil;
***************
*** 517,522 ****
--- 550,556 ----
  	polygon->SetTransformer(rel);
  	Unref(rel);
  	PolygonOvComp* comp = new PolygonOvComp(polygon);
+ 	comp->SetAttributeList(al);
  	if (PasteModeFunc::paste_mode()==0)
  	  cmd = new PasteCmd(_ed, new Clipboard(comp));
  	ComValue compval(symbol_add("PolygonComp"), new ComponentView(comp));
***************
*** 526,531 ****
--- 560,566 ----
  	push_stack(ComValue::nullval());
  
      execute_log(cmd);
+     Unref(al);
  }
  
  /*****************************************************************************/
***************
*** 554,559 ****
--- 589,597 ----
          y[j] = avl->GetAttrVal(i)->int_val();
  	avl->Next(i);
      }
+ 
+     AttributeList* al = stack_keys();
+     Resource::ref(al);
      reset_stack();
  
      PasteCmd* cmd = nil;
***************
*** 582,587 ****
--- 620,626 ----
  	closedspline->SetTransformer(rel);
  	Unref(rel);
  	ClosedSplineOvComp* comp = new ClosedSplineOvComp(closedspline);
+ 	comp->SetAttributeList(al);
  	if (PasteModeFunc::paste_mode()==0)
  	  cmd = new PasteCmd(_ed, new Clipboard(comp));
  	ComValue compval(symbol_add("ClosedSplineComp"), new ComponentView(comp));
***************
*** 591,596 ****
--- 630,636 ----
  	push_stack(ComValue::nullval());
  
      execute_log(cmd);
+     Unref(al);
  }
  
  /*****************************************************************************/
***************
*** 619,624 ****
--- 659,667 ----
          coords[j] = avl->GetAttrVal(i)->int_val();
  	avl->Next(i);
      }
+ 
+     AttributeList* al = stack_keys();
+     Resource::ref(al);
      reset_stack();
  
      PasteCmd* cmd = nil;
***************
*** 644,649 ****
--- 687,693 ----
  	Unref(t);
  
  	RasterOvComp* comp = new RasterOvComp(rasterrect);
+ 	comp->SetAttributeList(al);
  	if (PasteModeFunc::paste_mode()==0)
  	  cmd = new PasteCmd(_ed, new Clipboard(comp));
  	ComValue compval(symbol_add("RasterComp"), new ComponentView(comp));
***************
*** 653,658 ****
--- 697,703 ----
  	push_stack(ComValue::nullval());
  
      execute_log(cmd);
+     Unref(al);
  }
  
  /*****************************************************************************/
Index: DrawServ/drawfunc.c
diff -c DrawServ/drawfunc.c:1.14 DrawServ/drawfunc.c:1.15
*** DrawServ/drawfunc.c:1.14	Tue Mar  9 11:11:35 2004
--- src/DrawServ/drawfunc.c	Fri Mar 12 11:33:04 2004
***************
*** 188,194 ****
    else if (nargs()==0 && nkeys()==0) 
      returnid = ((DrawServ*)unidraw)->sessionid();
  
!   ComValue retval(returnid);
    push_stack(retval);
    return;
  
--- 188,196 ----
    else if (nargs()==0 && nkeys()==0) 
      returnid = ((DrawServ*)unidraw)->sessionid();
  
!   ComValue retval(returnid, ComValue::UIntType);
! 
!   retval.state(AttributeValue::HexState);
    push_stack(retval);
    return;
  
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.19 DrawServ/drawserv.c:1.20
*** DrawServ/drawserv.c:1.19	Tue Mar  9 16:03:04 2004
--- src/DrawServ/drawserv.c	Fri Mar 12 11:33:04 2004
***************
*** 37,42 ****
--- 37,43 ----
  #include <OverlayUnidraw/scriptview.h>
  
  #include <Unidraw/Commands/command.h>
+ #include <Unidraw/Commands/edit.h>
  #include <Unidraw/catalog.h>
  #include <Unidraw/clipboard.h>
  #include <Unidraw/creator.h>
***************
*** 205,211 ****
  	  GraphicId* grid = new GraphicId(sessionid());
  	  grid->grcomp(comp);
  	  AttributeList* al = comp->GetAttributeList();
! 	  al->add_attr(id_sym, new AttributeValue(grid->id(), AttributeValue::UIntType));
  
  	  if (comp) {
  	    Creator* creator = unidraw->GetCatalog()->GetCreator();
--- 206,214 ----
  	  GraphicId* grid = new GraphicId(sessionid());
  	  grid->grcomp(comp);
  	  AttributeList* al = comp->GetAttributeList();
! 	  AttributeValue* av = new AttributeValue(grid->id(), AttributeValue::UIntType);
! 	  av->state(AttributeValue::HexState);
! 	  al->add_attr(id_sym, av);
  
  	  if (comp) {
  	    Creator* creator = unidraw->GetCatalog()->GetCreator();
***************
*** 230,253 ****
        cout.flush();
  
        /* first execute here */
        ((ComEditor*)cmd->GetEditor())->GetComTerp()->run(sbuf.str());
  
        /* then send everywhere else */
        DistributeCmdString(sbuf.str());
! 
!       delete cmd;
        }
        break;
      default:
        sbuf << "print(\"Attempt to convert unknown command (id == %d) to interpretable script\\n\" " << cmd->GetClassId() << " :err)";
        cmd->Execute();
-       if (cmd->Reversible()) {
- 	cmd->Log();
-       } else {
- 	delete cmd;
-       }
        break;
      }
      OverlayScript::ptlist_parens(oldflag);
    }
  }
--- 233,262 ----
        cout.flush();
  
        /* first execute here */
+ #if 0
        ((ComEditor*)cmd->GetEditor())->GetComTerp()->run(sbuf.str());
+       ((PasteCmd*)cmd)->executed(true);
+ #else
+       cmd->Execute();
+ #endif
  
        /* then send everywhere else */
        DistributeCmdString(sbuf.str());
!       
        }
        break;
      default:
        sbuf << "print(\"Attempt to convert unknown command (id == %d) to interpretable script\\n\" " << cmd->GetClassId() << " :err)";
        cmd->Execute();
        break;
      }
+ 
+     if (cmd->Reversible()) {
+       cmd->Log();
+     } else {
+       delete cmd;
+     }
+ 
      OverlayScript::ptlist_parens(oldflag);
    }
  }
Index: DrawServ/grid.c
diff -c DrawServ/grid.c:1.4 DrawServ/grid.c:1.5
*** DrawServ/grid.c:1.4	Tue Mar  9 16:03:04 2004
--- src/DrawServ/grid.c	Fri Mar 12 11:33:04 2004
***************
*** 43,49 ****
    _id = DrawServ::candidate_grid();
    _sid = sessionid&DrawServ::SessionIdMask;
    GraphicIdTable* table = ((DrawServ*)unidraw)->gridtable();
!   table->insert(_id&_sid, this);
    _comp = nil;
  }
  
--- 43,49 ----
    _id = DrawServ::candidate_grid();
    _sid = sessionid&DrawServ::SessionIdMask;
    GraphicIdTable* table = ((DrawServ*)unidraw)->gridtable();
!   table->insert(_id|_sid, this);
    _comp = nil;
  }
  
Index: DrawServ/grid.h
diff -c DrawServ/grid.h:1.4 DrawServ/grid.h:1.5
*** DrawServ/grid.h:1.4	Tue Mar  9 16:03:04 2004
--- src/DrawServ/grid.h	Fri Mar 12 11:33:04 2004
***************
*** 39,45 ****
    GraphicId(unsigned int sessionid);
    virtual ~GraphicId();
    
!   unsigned int id() { return _id&_sid; }
    // get associated unique composite integer id
  
    unsigned int grid() { return _id; }
--- 39,45 ----
    GraphicId(unsigned int sessionid);
    virtual ~GraphicId();
    
!   unsigned int id() { return _id|_sid; }
    // get associated unique composite integer id
  
    unsigned int grid() { return _id; }
***************
*** 59,69 ****
    // set pointer to associated GraphicComp
  
    GraphicComp* grcomp() { return _comp; }
!   // set pointer to associated GraphicComp
  
  protected:
    unsigned int _id;
    unsigned int _sid;
    GraphicComp* _comp;
  
  };
--- 59,83 ----
    // set pointer to associated GraphicComp
  
    GraphicComp* grcomp() { return _comp; }
!   // get pointer to associated GraphicComp
! 
!   void selector(unsigned int sid) { _selector = sid; }
!   // set session id of current selector
! 
!   unsigned int selector() { return _selector; }
!   // get session id of current selector
! 
!   void selected(int flag) { _selected = flag; }
!   // set flag that indicates graphic is currently selected
! 
!   int selected() { return _selected; }
!   // get flag that indicates graphics is currently selected
  
  protected:
    unsigned int _id;
    unsigned int _sid;
+   unsigned int _selector;
+   int _selected;
    GraphicComp* _comp;
  
  };
Index: DrawServ/linkselection.c
diff -c DrawServ/linkselection.c:1.1 DrawServ/linkselection.c:1.2
*** DrawServ/linkselection.c:1.1	Fri Mar  5 10:54:11 2004
--- src/DrawServ/linkselection.c	Fri Mar 12 11:33:04 2004
***************
*** 26,37 ****
--- 26,42 ----
   */
  
  #include <DrawServ/drawserv.h>
+ #include <DrawServ/grid.h>
  #include <DrawServ/linkselection.h>
  
+ #include <OverlayUnidraw/ovcomps.h>
  #include <OverlayUnidraw/ovviews.h>
  
  #include <Unidraw/iterator.h>
  
+ #include <Attribute/attrlist.h>
+ #include <Attribute/attrvalue.h>
+ 
  #include <stdio.h>
  
  /*****************************************************************************/
***************
*** 43,96 ****
  LinkSelection::LinkSelection (DrawLinkList* linklist, Selection* s) : OverlaySelection(s) {
    _linklist = linklist;
  }
- 
- void LinkSelection::Merge (Selection* s) {
-   fprintf(stderr, "LinkSelection::Merge\n");
-   OverlaySelection::Merge(s);
- }
- 
- void LinkSelection::Exclusive (Selection* s) {
-   fprintf(stderr, "LinkSelection::Exclusive\n");
-   OverlaySelection::Exclusive(s);
- }
- 
- void LinkSelection::Append (GraphicView* v) {
-   fprintf(stderr, "LinkSelection::Append\n");
-   OverlaySelection::Append(v);
- }
  
! void LinkSelection::Prepend (GraphicView* v) {
!   fprintf(stderr, "LinkSelection::Prepend\n");
!   OverlaySelection::Prepend(v);
! }
! 
! void LinkSelection::InsertAfter (Iterator i, GraphicView* v) {
!   fprintf(stderr, "LinkSelection::InsertAfter\n");
!   OverlaySelection::InsertAfter(i, v);
! }
! 
! void LinkSelection::InsertBefore (Iterator i, GraphicView* v) {
!   fprintf(stderr, "LinkSelection::InsertBefore\n");
!   OverlaySelection::InsertBefore(i, v);
  }
  
! void LinkSelection::Remove (Iterator& i) {
!   fprintf(stderr, "LinkSelection::Remove(i)\n");
!   OverlaySelection::Remove(i);
! }	
!     
! void LinkSelection::Remove (GraphicView* p) {
!   fprintf(stderr, "LinkSelection::Remove(p)\n");
!   OverlaySelection::Remove(p);
  }
- 
  
! OverlaySelection* LinkSelection::ViewsWithin(IntCoord l, IntCoord b, IntCoord r, IntCoord t) {
!     OverlaySelection* newSel = new LinkSelection(((DrawServ*)unidraw)->linklist());
!     Iterator i;
!     for (First(i); !Done(i); Next(i)) {
! 	OverlayView* view = GetView(i);
! 	newSel->Merge(view->ViewsWithin(l, b, r, t));
!     }
!     return newSel;
  }
--- 48,85 ----
  LinkSelection::LinkSelection (DrawLinkList* linklist, Selection* s) : OverlaySelection(s) {
    _linklist = linklist;
  }
  
! int LinkSelection::Update(Viewer* viewer) {
!   fprintf(stderr, "LinkSelection::Update\n");
!   static int id_sym = symbol_add("id");
! 
!   /* remove anything from selection that has a remote selector */
!   Iterator it;
!   First(it);
!   while (!Done(it)) {
!     OverlayView* view = GetView(it);
!     OverlayComp* comp = view ? view->GetOverlayComp() : nil;
!     AttributeList* al = comp ? comp->attrlist() : nil;
!     AttributeValue* av = al ? al->find(id_sym) : nil;
!     if (av) {
!       void* ptr = nil;
!       ((DrawServ*)unidraw)->gridtable()->find(ptr, av->uint_val());
!       if (ptr) {
! 	GraphicId* grid = (GraphicId*)ptr;
! 	if (grid->selector() && grid->sessionid()!=grid->selector())
! 	  Remove(it);
!       }
!     }
!     Next(it);
!   }
!   return OverlaySelection::Update(viewer);
  }
  
! void LinkSelection::Clear(Viewer* viewer) {
!   fprintf(stderr, "LinkSelection::Clear\n");
!   OverlaySelection::Clear(viewer);
  }
  
! void LinkSelection::Reserve() {
!   fprintf(stderr, "LinkSelection::Reserve\n");
  }
Index: DrawServ/linkselection.h
diff -c DrawServ/linkselection.h:1.1 DrawServ/linkselection.h:1.2
*** DrawServ/linkselection.h:1.1	Fri Mar  5 10:54:11 2004
--- src/DrawServ/linkselection.h	Fri Mar 12 11:33:04 2004
***************
*** 40,56 ****
      LinkSelection(DrawLinkList* list, LinkSelection* = nil);
      LinkSelection(DrawLinkList* list, Selection*);
  
!     virtual void Exclusive(Selection*);
!     virtual void Merge(Selection*);    
  
!     virtual void Append(GraphicView*);
!     virtual void Prepend(GraphicView*);
!     virtual void InsertAfter(Iterator, GraphicView*);
!     virtual void InsertBefore(Iterator, GraphicView*);
!     virtual void Remove(GraphicView*);
!     virtual void Remove(Iterator&);
! 
!     virtual OverlaySelection* ViewsWithin(IntCoord l, IntCoord b, IntCoord r, IntCoord t);
  
  protected:
      DrawLinkList* _linklist;
--- 40,50 ----
      LinkSelection(DrawLinkList* list, LinkSelection* = nil);
      LinkSelection(DrawLinkList* list, Selection*);
  
!     virtual int Update(Viewer* = nil); 
!     virtual void Clear(Viewer* = nil);
  
!     virtual void Reserve();
!     // reserve newly created graphics in selection across the network
  
  protected:
      DrawLinkList* _linklist;
Index: include_commands/edit.h
diff -c include_commands/edit.h:1.1 include_commands/edit.h:1.2
*** include_commands/edit.h:1.1	Fri Jan  9 11:46:00 2004
--- src/include/Unidraw/Commands/edit.h	Fri Mar 12 11:33:13 2004
***************
*** 111,116 ****
--- 111,117 ----
      virtual Command* Copy();
      virtual ClassId GetClassId();
      virtual boolean IsA(ClassId);
+ 
  protected:
      boolean _executed;
  };
Index: include_unidraw/selection.h
diff -c include_unidraw/selection.h:1.2 include_unidraw/selection.h:1.3
*** include_unidraw/selection.h:1.2	Fri Mar  5 10:54:17 2004
--- src/include/Unidraw/selection.h	Fri Mar 12 11:33:11 2004
***************
*** 46,62 ****
      virtual ~Selection();
  
      virtual void Show(Viewer* = nil);	/* inits and draws handles (in given viewer) */
!     virtual void Update(Viewer* = nil); /* draws newly-added handles */
      virtual void Hide(Viewer* = nil);
      virtual void Init(Viewer* = nil);   /* explicitly init handles */
      virtual void Clear(Viewer* = nil);	/* removes & clears all views */
  
!     virtual void Append(GraphicView*);
!     virtual void Prepend(GraphicView*);
!     virtual void InsertAfter(Iterator, GraphicView*);
!     virtual void InsertBefore(Iterator, GraphicView*);
!     virtual void Remove(GraphicView*);
!     virtual void Remove(Iterator&);
  
      GraphicView* GetView(Iterator);
      void SetView(GraphicView*, Iterator&);
--- 46,62 ----
      virtual ~Selection();
  
      virtual void Show(Viewer* = nil);	/* inits and draws handles (in given viewer) */
!     virtual int Update(Viewer* = nil); /* draws newly-added handles */
      virtual void Hide(Viewer* = nil);
      virtual void Init(Viewer* = nil);   /* explicitly init handles */
      virtual void Clear(Viewer* = nil);	/* removes & clears all views */
  
!     void Append(GraphicView*);
!     void Prepend(GraphicView*);
!     void InsertAfter(Iterator, GraphicView*);
!     void InsertBefore(Iterator, GraphicView*);
!     void Remove(GraphicView*);
!     void Remove(Iterator&);
  
      GraphicView* GetView(Iterator);
      void SetView(GraphicView*, Iterator&);
Index: OverlayUnidraw/ovcomps.c
diff -c OverlayUnidraw/ovcomps.c:1.1 OverlayUnidraw/ovcomps.c:1.2
*** OverlayUnidraw/ovcomps.c:1.1	Fri Jan  9 11:44:53 2004
--- src/OverlayUnidraw/ovcomps.c	Fri Mar 12 11:32:55 2004
***************
*** 1008,1013 ****
--- 1008,1014 ----
              if (view != nil) s->Append(view);
          }
      }
+     ((OverlaySelection*)s)->Reserve();
  }
  
  void OverlaysComp::StorePosition (OverlayComp* comp, Command* cmd) {
Index: OverlayUnidraw/ovselection.c
diff -c OverlayUnidraw/ovselection.c:1.1 OverlayUnidraw/ovselection.c:1.2
*** OverlayUnidraw/ovselection.c:1.1	Fri Jan  9 11:44:54 2004
--- src/OverlayUnidraw/ovselection.c	Fri Mar 12 11:32:56 2004
***************
*** 47,53 ****
--- 47,62 ----
  }
  
  void OverlaySelection::Show (Viewer* viewer) {
+ #if 0
      if (!viewer) return;
+ #else
+     if (!viewer) {
+       Iterator i;
+       First(i);
+       if (Done(i)) return;
+       viewer = GetView(i)->GetViewer();
+     }
+ #endif
      if (ShowHighlights(viewer)) 
  	viewer->GetDamage()->Repair();
      if (HandlesEnabled()) 
***************
*** 55,75 ****
  }
  
  void OverlaySelection::Hide (Viewer* viewer) {
      if (!viewer) return;
      if (HandlesEnabled()) 
  	HideHandles(viewer);
      if (HideHighlights(viewer)) 
  	viewer->GetDamage()->Repair();
  }
  
! void OverlaySelection::Update (Viewer* viewer) {
      if (!viewer) return;
      if (HandlesEnabled()) 
  	HideHandles(viewer);
      ShowHighlights(viewer);
      viewer->GetDamage()->Repair();
      if (HandlesEnabled())
  	ShowHandles(viewer);
  }
  
  void OverlaySelection::Clear (Viewer* viewer) {
--- 64,103 ----
  }
  
  void OverlaySelection::Hide (Viewer* viewer) {
+ #if 0
      if (!viewer) return;
+ #else
+     if (!viewer) {
+       Iterator i;
+       First(i);
+       if (Done(i)) return;
+       viewer = GetView(i)->GetViewer();
+     }
+ #endif
      if (HandlesEnabled()) 
  	HideHandles(viewer);
      if (HideHighlights(viewer)) 
  	viewer->GetDamage()->Repair();
  }
  
! int OverlaySelection::Update (Viewer* viewer) {
! #if 0
      if (!viewer) return;
+ #else
+     if (!viewer) {
+       Iterator i;
+       First(i);
+       if (Done(i)) return -1;
+       viewer = GetView(i)->GetViewer();
+     }
+ #endif
      if (HandlesEnabled()) 
  	HideHandles(viewer);
      ShowHighlights(viewer);
      viewer->GetDamage()->Repair();
      if (HandlesEnabled())
  	ShowHandles(viewer);
+     return 0;
  }
  
  void OverlaySelection::Clear (Viewer* viewer) {
Index: OverlayUnidraw/ovselection.h
diff -c OverlayUnidraw/ovselection.h:1.2 OverlayUnidraw/ovselection.h:1.3
*** OverlayUnidraw/ovselection.h:1.2	Fri Mar  5 10:54:03 2004
--- src/OverlayUnidraw/ovselection.h	Fri Mar 12 11:32:56 2004
***************
*** 45,51 ****
  
      virtual void Show(Viewer* = nil);	
      virtual void Hide(Viewer* = nil);
!     virtual void Update(Viewer* = nil); 
      virtual void Clear(Viewer* = nil);
  
      virtual void RepairClear(Viewer*, boolean);
--- 45,51 ----
  
      virtual void Show(Viewer* = nil);	
      virtual void Hide(Viewer* = nil);
!     virtual int Update(Viewer* = nil); 
      virtual void Clear(Viewer* = nil);
  
      virtual void RepairClear(Viewer*, boolean);
***************
*** 67,73 ****
      OverlayView* GetView(Iterator);
      void SetView(OverlayView*, Iterator&);
  
!     virtual OverlaySelection* ViewsWithin(IntCoord l, IntCoord b, IntCoord r, IntCoord t);
  
  protected:
      boolean _clear_to_repair;
--- 67,76 ----
      OverlayView* GetView(Iterator);
      void SetView(OverlayView*, Iterator&);
  
!     OverlaySelection* ViewsWithin(IntCoord l, IntCoord b, IntCoord r, IntCoord t);
! 
!     virtual void Reserve() { return; }
!     // for use of derived classes
  
  protected:
      boolean _clear_to_repair;
Index: Unidraw/reshape.c
diff -c Unidraw/reshape.c:1.1 Unidraw/reshape.c:1.2
*** Unidraw/reshape.c:1.1	Fri Jan  9 11:44:39 2004
--- src/Unidraw/reshape.c	Fri Mar 12 11:32:51 2004
***************
*** 63,68 ****
--- 63,69 ----
          newSel->First(i);
  	gv = newSel->GetView(i);
          s->Append(gv);
+ 	s->Update();
          m = gv->CreateManipulator(v, e, rel, this);
      }
      delete newSel;
Index: Unidraw/selection.c
diff -c Unidraw/selection.c:1.1 Unidraw/selection.c:1.2
*** Unidraw/selection.c:1.1	Fri Jan  9 11:44:39 2004
--- src/Unidraw/selection.c	Fri Mar 12 11:32:51 2004
***************
*** 70,76 ****
      }
  }
  
! void Selection::Update (Viewer* viewer) {
      Iterator i;
      
      for (First(i); !Done(i); Next(i)) {
--- 70,76 ----
      }
  }
  
! int Selection::Update (Viewer* viewer) {
      Iterator i;
      
      for (First(i); !Done(i); Next(i)) {
***************
*** 80,85 ****
--- 80,86 ----
              view->DrawHandles();
          }
      }
+     return 0;
  }
  
  void Selection::Hide (Viewer* viewer) {
*** /dev/null	 Fri Mar 12 11:33:22 PST 2004
--- patches/ivtools-040312-johnston-040
*************** patches/ivtools-040312-johnston-040
*** 0 ****
--- 1 ----
+ ivtools-040312-johnston-040

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040312-johnston-041"
Content-Disposition: attachment;
	filename=ivtools-040312-johnston-041

Patch:    ivtools-040312-johnston-041
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: ComUnidraw/unifunc.c
diff -c ComUnidraw/unifunc.c:1.1 ComUnidraw/unifunc.c:1.2
*** ComUnidraw/unifunc.c:1.1	Fri Jan  9 11:45:01 2004
--- src/ComUnidraw/unifunc.c	Fri Mar 12 12:36:02 2004
***************
*** 72,77 ****
--- 72,78 ----
  }
  
  void UnidrawFunc::execute_log(Command* cmd) {
+ #if 0
      if (cmd != nil) {
  	cmd->Execute();
  	
***************
*** 81,86 ****
--- 82,90 ----
  	    delete cmd;
  	}
      }
+ #else
+     unidraw->ExecuteCmd(cmd);
+ #endif
  }
  
  void UnidrawFunc::menulength_execute(const char* kind) {
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.20 DrawServ/drawserv.c:1.21
*** DrawServ/drawserv.c:1.20	Fri Mar 12 11:33:04 2004
--- src/DrawServ/drawserv.c	Fri Mar 12 12:36:06 2004
***************
*** 180,185 ****
--- 180,186 ----
  
  void DrawServ::ExecuteCmd(Command* cmd) {
    static int id_sym = symbol_add("id");
+   static int sid_sym = symbol_add("sid");
  
    if(!_linklist || _linklist->Number()==0) 
  
***************
*** 201,215 ****
  	Iterator it;
  	for (cb->First(it); !cb->Done(it); cb->Next(it)) {
  	  OverlayComp* comp = (OverlayComp*)cb->GetComp(it);
- 
- 	  /* generate unique id and add as attribute */
- 	  GraphicId* grid = new GraphicId(sessionid());
- 	  grid->grcomp(comp);
  	  AttributeList* al = comp->GetAttributeList();
! 	  AttributeValue* av = new AttributeValue(grid->id(), AttributeValue::UIntType);
! 	  av->state(AttributeValue::HexState);
! 	  al->add_attr(id_sym, av);
! 
  	  if (comp) {
  	    Creator* creator = unidraw->GetCatalog()->GetCreator();
  	    OverlayScript* scripter = (OverlayScript*)
--- 202,232 ----
  	Iterator it;
  	for (cb->First(it); !cb->Done(it); cb->Next(it)) {
  	  OverlayComp* comp = (OverlayComp*)cb->GetComp(it);
  	  AttributeList* al = comp->GetAttributeList();
! 	  AttributeValue* idv = al->find(id_sym);
! 	  AttributeValue* sidv = al->find(sid_sym);
! 	  
! 	  /* unique id already remotely assigned */
! 	  if (idv && idv->uint_val() !=0 && sidv && sidv->uint_val()) {
! 	    GraphicId* grid = new GraphicId();
! 	    grid->id(idv->uint_val());
! 	    grid->selector(sidv->uint_val());
! 	  } 
! 	  
! 	  /* generate unique id and add as attribute */
! 	  /* also mark with selector id */
! 	  else {
! 	    GraphicId* grid = new GraphicId(sessionid());
! 	    grid->grcomp(comp);
! 	    grid->selector(((DrawServ*)unidraw)->sessionid());
! 	    AttributeValue* idv = new AttributeValue(grid->id(), AttributeValue::UIntType);
! 	    idv->state(AttributeValue::HexState);
! 	    al->add_attr(id_sym, idv);
! 	    AttributeValue* sidv = new AttributeValue(grid->selector(), AttributeValue::UIntType);
! 	    sidv->state(AttributeValue::HexState);
! 	    al->add_attr(sid_sym, sidv);
! 	  }
! 	    
  	  if (comp) {
  	    Creator* creator = unidraw->GetCatalog()->GetCreator();
  	    OverlayScript* scripter = (OverlayScript*)
Index: DrawServ/grid.c
diff -c DrawServ/grid.c:1.5 DrawServ/grid.c:1.6
*** DrawServ/grid.c:1.5	Fri Mar 12 11:33:04 2004
--- src/DrawServ/grid.c	Fri Mar 12 12:36:06 2004
***************
*** 40,56 ****
  
  GraphicId::GraphicId (unsigned int sessionid) 
  {
-   _id = DrawServ::candidate_grid();
-   _sid = sessionid&DrawServ::SessionIdMask;
-   GraphicIdTable* table = ((DrawServ*)unidraw)->gridtable();
-   table->insert(_id|_sid, this);
    _comp = nil;
  }
  
  GraphicId::~GraphicId () 
  {
    GraphicIdTable* table = ((DrawServ*)unidraw)->gridtable();
!   table->remove(_id);
  }
  
  /*****************************************************************************/
--- 40,69 ----
  
  GraphicId::GraphicId (unsigned int sessionid) 
  {
    _comp = nil;
+   if (sessionid != 0) {
+     _id = DrawServ::candidate_grid();
+     _sid = sessionid&DrawServ::SessionIdMask;
+     GraphicIdTable* table = ((DrawServ*)unidraw)->gridtable();
+     table->insert(_id|_sid, this);
+   } else {
+     _id = _sid = 0;
+   }
  }
  
  GraphicId::~GraphicId () 
  {
+   GraphicIdTable* table = ((DrawServ*)unidraw)->gridtable();
+   table->remove(_id&_sid);
+ }
+ 
+ void GraphicId::id(unsigned int id) {
    GraphicIdTable* table = ((DrawServ*)unidraw)->gridtable();
!   if (_id!=0 && _sid!=0) 
!     table->remove(_id&_sid);
!   _id = id & DrawServ::GraphicIdMask;
!   _sid = id & DrawServ::SessionIdMask;
!   table->insert(id, this);
  }
  
  /*****************************************************************************/
Index: DrawServ/grid.h
diff -c DrawServ/grid.h:1.5 DrawServ/grid.h:1.6
*** DrawServ/grid.h:1.5	Fri Mar 12 11:33:04 2004
--- src/DrawServ/grid.h	Fri Mar 12 12:36:06 2004
***************
*** 36,46 ****
  //: object to encapsulate unique graphic id
  class GraphicId {
  public:
!   GraphicId(unsigned int sessionid);
    virtual ~GraphicId();
    
    unsigned int id() { return _id|_sid; }
    // get associated unique composite integer id
  
    unsigned int grid() { return _id; }
    // return graphic id portion of composite id
--- 36,49 ----
  //: object to encapsulate unique graphic id
  class GraphicId {
  public:
!   GraphicId(unsigned int sessionid=0);
    virtual ~GraphicId();
    
    unsigned int id() { return _id|_sid; }
    // get associated unique composite integer id
+ 
+   void id(unsigned int id);
+   // set associated unique composite integer id
  
    unsigned int grid() { return _id; }
    // return graphic id portion of composite id
Index: DrawServ/linkselection.c
diff -c DrawServ/linkselection.c:1.2 DrawServ/linkselection.c:1.3
*** DrawServ/linkselection.c:1.2	Fri Mar 12 11:33:04 2004
--- src/DrawServ/linkselection.c	Fri Mar 12 12:36:06 2004
***************
*** 66,72 ****
        ((DrawServ*)unidraw)->gridtable()->find(ptr, av->uint_val());
        if (ptr) {
  	GraphicId* grid = (GraphicId*)ptr;
! 	if (grid->selector() && grid->sessionid()!=grid->selector())
  	  Remove(it);
        }
      }
--- 66,72 ----
        ((DrawServ*)unidraw)->gridtable()->find(ptr, av->uint_val());
        if (ptr) {
  	GraphicId* grid = (GraphicId*)ptr;
! 	if (grid->selector() && ((DrawServ*)unidraw)->sessionid()!=grid->selector())
  	  Remove(it);
        }
      }
*** /dev/null	 Fri Mar 12 12:36:20 PST 2004
--- patches/ivtools-040312-johnston-041
*************** patches/ivtools-040312-johnston-041
*** 0 ****
--- 1 ----
+ ivtools-040312-johnston-041

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040312-johnston-042"
Content-Disposition: attachment;
	filename=ivtools-040312-johnston-042

Patch:    ivtools-040312-johnston-042
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.21 DrawServ/drawserv.c:1.22
*** DrawServ/drawserv.c:1.21	Fri Mar 12 12:36:06 2004
--- src/DrawServ/drawserv.c	Fri Mar 12 15:42:43 2004
***************
*** 207,213 ****
  	  AttributeValue* sidv = al->find(sid_sym);
  	  
  	  /* unique id already remotely assigned */
! 	  if (idv && idv->uint_val() !=0 && sidv && sidv->uint_val()) {
  	    GraphicId* grid = new GraphicId();
  	    grid->id(idv->uint_val());
  	    grid->selector(sidv->uint_val());
--- 207,213 ----
  	  AttributeValue* sidv = al->find(sid_sym);
  	  
  	  /* unique id already remotely assigned */
! 	  if (idv && idv->uint_val() !=0 && sidv && sidv->uint_val() !=0) {
  	    GraphicId* grid = new GraphicId();
  	    grid->id(idv->uint_val());
  	    grid->selector(sidv->uint_val());
*** /dev/null	 Fri Mar 12 15:42:56 PST 2004
--- patches/ivtools-040312-johnston-042
*************** patches/ivtools-040312-johnston-042
*** 0 ****
--- 1 ----
+ ivtools-040312-johnston-042

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040312-johnston-043"
Content-Disposition: attachment;
	filename=ivtools-040312-johnston-043

Patch:    ivtools-040312-johnston-043
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.22 DrawServ/drawserv.c:1.23
*** DrawServ/drawserv.c:1.22	Fri Mar 12 15:42:43 2004
--- src/DrawServ/drawserv.c	Fri Mar 12 15:56:48 2004
***************
*** 181,186 ****
--- 181,187 ----
  void DrawServ::ExecuteCmd(Command* cmd) {
    static int id_sym = symbol_add("id");
    static int sid_sym = symbol_add("sid");
+   boolean original = false;
  
    if(!_linklist || _linklist->Number()==0) 
  
***************
*** 225,233 ****
  	    AttributeValue* sidv = new AttributeValue(grid->selector(), AttributeValue::UIntType);
  	    sidv->state(AttributeValue::HexState);
  	    al->add_attr(sid_sym, sidv);
  	  }
  	    
! 	  if (comp) {
  	    Creator* creator = unidraw->GetCatalog()->GetCreator();
  	    OverlayScript* scripter = (OverlayScript*)
  	      creator->Create(Combine(comp->GetClassId(), SCRIPT_VIEW));
--- 226,235 ----
  	    AttributeValue* sidv = new AttributeValue(grid->selector(), AttributeValue::UIntType);
  	    sidv->state(AttributeValue::HexState);
  	    al->add_attr(sid_sym, sidv);
+ 	    original = true;
  	  }
  	    
! 	  if (comp&&original) {
  	    Creator* creator = unidraw->GetCatalog()->GetCreator();
  	    OverlayScript* scripter = (OverlayScript*)
  	      creator->Create(Combine(comp->GetClassId(), SCRIPT_VIEW));
***************
*** 243,253 ****
  	  }
  	}
        }
!       if (!scripted)
! 	sbuf << "print(\"Failed attempt to generate script for a PASTE_CMD\\n\" :err)";
!       sbuf.put('\0');
!       cout << sbuf.str() << "\n";
!       cout.flush();
  
        /* first execute here */
  #if 0
--- 245,257 ----
  	  }
  	}
        }
!       if (original) {
! 	if (!scripted)
! 	  sbuf << "print(\"Failed attempt to generate script for a PASTE_CMD\\n\" :err)";
! 	sbuf.put('\0');
! 	cout << sbuf.str() << "\n";
! 	cout.flush();
!       }
  
        /* first execute here */
  #if 0
***************
*** 258,264 ****
  #endif
  
        /* then send everywhere else */
!       DistributeCmdString(sbuf.str());
        
        }
        break;
--- 262,268 ----
  #endif
  
        /* then send everywhere else */
!       if (original) DistributeCmdString(sbuf.str());
        
        }
        break;
*** /dev/null	 Fri Mar 12 15:57:05 PST 2004
--- patches/ivtools-040312-johnston-043
*************** patches/ivtools-040312-johnston-043
*** 0 ****
--- 1 ----
+ ivtools-040312-johnston-043

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040312-johnston-044"
Content-Disposition: attachment;
	filename=ivtools-040312-johnston-044

Patch:    ivtools-040312-johnston-044
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/linkselection.c
diff -c DrawServ/linkselection.c:1.3 DrawServ/linkselection.c:1.4
*** DrawServ/linkselection.c:1.3	Fri Mar 12 12:36:06 2004
--- src/DrawServ/linkselection.c	Fri Mar 12 16:07:20 2004
***************
*** 57,62 ****
--- 57,63 ----
    Iterator it;
    First(it);
    while (!Done(it)) {
+     int removed = false;
      OverlayView* view = GetView(it);
      OverlayComp* comp = view ? view->GetOverlayComp() : nil;
      AttributeList* al = comp ? comp->attrlist() : nil;
***************
*** 66,76 ****
        ((DrawServ*)unidraw)->gridtable()->find(ptr, av->uint_val());
        if (ptr) {
  	GraphicId* grid = (GraphicId*)ptr;
! 	if (grid->selector() && ((DrawServ*)unidraw)->sessionid()!=grid->selector())
  	  Remove(it);
        }
      }
!     Next(it);
    }
    return OverlaySelection::Update(viewer);
  }
--- 67,80 ----
        ((DrawServ*)unidraw)->gridtable()->find(ptr, av->uint_val());
        if (ptr) {
  	GraphicId* grid = (GraphicId*)ptr;
! 	if (grid->selector() && ((DrawServ*)unidraw)->sessionid()!=grid->selector()) {
  	  Remove(it);
+ 	  removed = true;
+ 	}
        }
      }
!     if (!removed) 
!       Next(it);
    }
    return OverlaySelection::Update(viewer);
  }
*** /dev/null	 Fri Mar 12 16:07:34 PST 2004
--- patches/ivtools-040312-johnston-044
*************** patches/ivtools-040312-johnston-044
*** 0 ****
--- 1 ----
+ ivtools-040312-johnston-044

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040315-johnston-045"
Content-Disposition: attachment;
	filename=ivtools-040315-johnston-045

Patch:    ivtools-040315-johnston-045
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawfunc.c
diff -c DrawServ/drawfunc.c:1.15 DrawServ/drawfunc.c:1.16
*** DrawServ/drawfunc.c:1.15	Fri Mar 12 11:33:04 2004
--- src/DrawServ/drawfunc.c	Mon Mar 15 13:25:48 2004
***************
*** 205,321 ****
  }
  
  void ReserveFunc::execute() {
! #if 0
! #if 1
!   static int batchid_symid = symbol_add("batchid");
!   ComValue batchidv(stack_key(batchid_symid));
!   unsigned int batchid = batchidv.is_known() ? batchidv.uint_val() : 0;
  
!   static int batch_symid = symbol_add("batch");
!   ComValue batch_flagv(stack_key(batch_symid));
!   boolean batch_flag = batch_flagv.is_true();
  
-   ComValue arrayv(stack_arg(0));
- 
    reset_stack();
- 
-   /* provoke a batch request */
-   if (batch_flag) 
-     ((DrawServ*)unidraw)->reserve_batch_request(DrawServ::reserve_batch_size());
  
!   /* handle a batch request */
!   else if (arrayv.is_array()) {
!     AttributeValueList* avl = arrayv.array_val();
!     Iterator it;
!     avl->First(it);
!     const int nids = avl->Number();
!     unsigned int ids[nids];
!     for (int i=0; i<nids; i++) {
!       ids[i] = avl->GetAttrVal(it)->uint_val();
!       avl->Next(it);
!     }
!     ((DrawServ*)unidraw)->reserve_batch_handle(nil, ids, nids, batchid);
    }
-     
- 
- #else
-     static int all_symid = symbol_add("all");
-     ComValue all_flagv(stack_key(all_symid));
-     boolean all_flag = all_flagv.is_true();
- 
-     static int clear_symid = symbol_add("clear");
-     ComValue clear_flagv(stack_key(clear_symid));
-     boolean clear_flag = clear_flagv.is_true();
- 
-     Selection* sel = _ed->GetViewer()->GetSelection();
-     if (clear_flag) {
-       sel->Clear();
-       reset_stack();
-       return;
-     }
-       
-     OverlaySelection* newSel = ((OverlayEditor*)_ed)->overlay_kit()->MakeSelection();
-     
-     Viewer* viewer = _ed->GetViewer();
-     AttributeValueList* avl = new AttributeValueList();
-     if (all_flag) {
- 
-       GraphicView* gv = ((OverlayEditor*)_ed)->GetFrame();
-       Iterator i;
-       int count=0;
-       for (gv->First(i); !gv->Done(i); gv->Next(i)) {
- 	GraphicView* subgv = gv->GetView(i);
- 	newSel->Append(subgv);
- 	OverlayComp* comp = (OverlayComp*)subgv->GetGraphicComp();
- 	ComValue* compval = new ComValue(comp->classid(), new ComponentView(comp));
- 	compval->object_compview(true);
- 	avl->Append(compval);
-       }
- 
-     } else if (nargs()==0) {
-       Iterator i;
-       int count=0;
-       for (sel->First(i); !sel->Done(i); sel->Next(i)) {
- 	GraphicView* grview = sel->GetView(i);
- 	OverlayComp* comp = grview ? (OverlayComp*)grview->GetSubject() : nil;
- 	ComValue* compval = comp ? new ComValue(comp->classid(), new ComponentView(comp)) : nil;
- 
- 	if (compval) {
- 	  compval->object_compview(true);
- 	  avl->Append(compval);
- 	}
- 	delete newSel;
-         newSel = nil;
-       }
- 
-     } else {
- 
-       for (int i=0; i<nargsfixed(); i++) {
-         ComValue& obj = stack_arg(i);
- 	if (obj.object_compview()) {
- 	  ComponentView* comview = (ComponentView*)obj.obj_val();
- 	  OverlayComp* comp = (OverlayComp*)comview->GetSubject();
- 	  if (comp) {
- 	    newSel->Append(comp->FindView(viewer));
- 	    ComValue* compval = new ComValue(comp->classid(), new ComponentView(comp));
- 	    compval->object_compview(true);
- 	    avl->Append(compval);
- 	  }
- 	}
-       }
-     }
- 
-     if (newSel){
-       sel->Clear();
-       delete sel;
-       _ed->SetSelection(newSel);
-       newSel->Update(viewer);
-       unidraw->Update();
-     }
-     reset_stack();
-     ComValue retval(avl);
-     push_stack(retval);
- #endif
- #endif
  }
  
--- 205,224 ----
  }
  
  void ReserveFunc::execute() {
!   static int rid_sym = symbol_add("rid");
!   ComValue ridv(stack_key(rid_sym));
  
!   ComValue idv(stack_arg(0));
  
    reset_stack();
  
!   if (idv.is_known() && ridv.is_known()) {
!     void* ptr = nil;
!     ((DrawServ*)unidraw)->gridtable()->find(ptr, idv.uint_val());
!     if (ptr) 
!       fprintf(stderr, "grid 0x%08x found\n", idv.uint_val());
!     else
!       fprintf(stderr, "grid 0x%08x not found\n", idv.uint_val());
    }
  }
  
Index: DrawServ/drawkit.c
diff -c DrawServ/drawkit.c:1.2 DrawServ/drawkit.c:1.3
*** DrawServ/drawkit.c:1.2	Fri Mar  5 10:54:11 2004
--- src/DrawServ/drawkit.c	Mon Mar 15 13:25:48 2004
***************
*** 452,456 ****
  }
  
  OverlaySelection* DrawKit::MakeSelection(Selection* sel) {
!   return new LinkSelection(((DrawServ*)unidraw)->linklist(), sel);
  }
--- 452,456 ----
  }
  
  OverlaySelection* DrawKit::MakeSelection(Selection* sel) {
!   return new LinkSelection(sel);
  }
Index: DrawServ/drawlink.h
diff -c DrawServ/drawlink.h:1.8 DrawServ/drawlink.h:1.9
*** DrawServ/drawlink.h:1.8	Mon Mar  8 13:29:19 2004
--- src/DrawServ/drawlink.h	Mon Mar 15 13:25:48 2004
***************
*** 103,108 ****
--- 103,113 ----
  
      enum {SessionIdNada=-1, SessionIdRequested=0, SessionIdApproved=1, SessionIdDenied=2};
  
+     unsigned int sessionid() { return _sessionid; }
+     // get unique session id of other side
+     void sessionid(unsigned int id) { _sessionid = id; }
+     // get unique session id of other side
+ 
  protected:
      const char* _host;
      const char* _althost;
***************
*** 113,118 ****
--- 118,124 ----
      int _remote_linkid;
      int _state;
      int _sessionid_state;
+     unsigned int _sessionid;
  
  #ifdef HAVE_ACE
      ACE_INET_Addr* _addr;
Index: DrawServ/drawlinklist.c
diff -c DrawServ/drawlinklist.c:1.1 DrawServ/drawlinklist.c:1.2
*** DrawServ/drawlinklist.c:1.1	Thu Feb 26 10:54:54 2004
--- src/DrawServ/drawlinklist.c	Mon Mar 15 13:25:48 2004
***************
*** 27,32 ****
--- 27,34 ----
  
  #include <DrawServ/drawlink.h>
  #include <DrawServ/drawlinklist.h>
+ #include <DrawServ/grid.h>
+ 
  #include <Unidraw/iterator.h>
  #include <Unidraw/ulist.h>
  /*****************************************************************************/
***************
*** 53,58 ****
--- 55,71 ----
    Iterator i;
    First(i);
    InsertBefore(i, new_link);
+ }
+ 
+ DrawLink* DrawLinkList::find_drawlink(GraphicId* grid) {
+   Iterator i;
+   First(i);
+   while(!Done(i) && GetDrawLink(i)->sessionid() != grid->sessionid()) 
+     Next(i);
+   if (!Done(i)) 
+     return GetDrawLink(i);
+   else
+     return nil;
  }
  
  DrawLink* DrawLinkList::Link (UList* r) {
Index: DrawServ/drawlinklist.h
diff -c DrawServ/drawlinklist.h:1.2 DrawServ/drawlinklist.h:1.3
*** DrawServ/drawlinklist.h:1.2	Fri Mar  5 10:54:11 2004
--- src/DrawServ/drawlinklist.h	Mon Mar 15 13:25:48 2004
***************
*** 33,38 ****
--- 33,39 ----
  #include <Unidraw/globals.h>
  
  class DrawLink;
+ class GraphicId;
  class Iterator;
  class UList;
  
***************
*** 43,48 ****
--- 44,52 ----
  
      void add_drawlink(DrawLink*);
      // add DrawLink to list
+ 
+     DrawLink* find_drawlink(GraphicId*);
+     // find DrawLink to the selector of this graphic
  
      void First(Iterator&);
      // set iterator to point to first DrawLink in list.
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.23 DrawServ/drawserv.c:1.24
*** DrawServ/drawserv.c:1.23	Fri Mar 12 15:56:48 2004
--- src/DrawServ/drawserv.c	Mon Mar 15 13:25:48 2004
***************
*** 347,352 ****
--- 347,353 ----
        char buf[BUFSIZ];
        snprintf(buf, BUFSIZ, "sessionid(0x%08x :ok %d :rid %d )%c", new_id, okflag, link->local_linkid(), '\0');
        SendCmdString(link, buf);
+       link->sessionid(new_id);
      } else {
        fprintf(stderr, "code for passing selection id request on to other DrawLink's not implemented\n");
      }
***************
*** 368,381 ****
    }
  }
  
- // generate request to change/set unique session id
- void DrawServ::sessionid_request_chg() {
- }
- 
- // handle request to change unique session id
- void DrawServ::sessionid_handle_chg(int new_id, int old_id) {
- }
- 
  int DrawServ::online() {
    return _sessionid==_trialid && _sessionid!=-1;
  }
--- 369,374 ----
***************
*** 428,432 ****
--- 421,437 ----
      return 0;
    else
      return 1;
+ }
+ 
+ void DrawServ::ReserveSelection(GraphicId* grid) {
+   /* find link on which current selector lives */
+   DrawLink* link = _linklist->find_drawlink(grid);
+ 
+   if (link) {
+     char buf[BUFSIZ];
+     snprintf(buf, BUFSIZ, "reserve(0x%08x :rid %d)%c", grid->id(), link->local_linkid(), '\0');
+     SendCmdString(link, buf);
+   } else
+     fprintf(stderr, "surprisingly no selector link found for GraphicId %u\n", grid->id());
  }
  
Index: DrawServ/drawserv.h
diff -c DrawServ/drawserv.h:1.14 DrawServ/drawserv.h:1.15
*** DrawServ/drawserv.h:1.14	Tue Mar  9 16:03:04 2004
--- src/DrawServ/drawserv.h	Mon Mar 15 13:25:48 2004
***************
*** 42,47 ****
--- 42,48 ----
  class ComTerp;
  class DrawLink;
  class DrawLinkList;
+ class GraphicId;
  class GraphicIdList;
  
  class DrawServ : public OverlayUnidraw {
***************
*** 84,89 ****
--- 85,93 ----
    
    virtual void SendCmdString(DrawLink* link, const char* cmdstring);
    // execute command string on one remote DrawServ
+ 
+   virtual void ReserveSelection(GraphicId* grid);
+   // send request to reserve graphic for future selection
    
    DrawLinkList* linklist() { return _linklist; }
    // return pointer to list of DrawLink's
***************
*** 102,113 ****
    
    void sessionid_callback_chk(int chk_id, int remote_linkid, int ok_flag);
    // process callbacks on request to check unique session id
-   
-   void sessionid_request_chg();
-   // generate request to change/set unique session id
-   
-   void sessionid_handle_chg(int new_id, int old_id);
-   // handle request to change unique session id
    
    unsigned int sessionid(int trial=false) { return trial ? _trialid : _sessionid; }
    // current unique session id.
--- 106,111 ----
Index: DrawServ/linkselection.c
diff -c DrawServ/linkselection.c:1.4 DrawServ/linkselection.c:1.5
*** DrawServ/linkselection.c:1.4	Fri Mar 12 16:07:20 2004
--- src/DrawServ/linkselection.c	Mon Mar 15 13:25:48 2004
***************
*** 41,56 ****
  
  /*****************************************************************************/
  
! LinkSelection::LinkSelection (DrawLinkList* linklist, LinkSelection* s) : OverlaySelection(s) {
!   _linklist = linklist;
  }
  
! LinkSelection::LinkSelection (DrawLinkList* linklist, Selection* s) : OverlaySelection(s) {
!   _linklist = linklist;
  }
  
! int LinkSelection::Update(Viewer* viewer) {
    fprintf(stderr, "LinkSelection::Update\n");
    static int id_sym = symbol_add("id");
  
    /* remove anything from selection that has a remote selector */
--- 41,65 ----
  
  /*****************************************************************************/
  
! LinkSelection::LinkSelection (LinkSelection* s) : OverlaySelection(s) {
  }
  
! LinkSelection::LinkSelection (Selection* s) : OverlaySelection(s) {
  }
  
! void LinkSelection::Update(Viewer* viewer) {
    fprintf(stderr, "LinkSelection::Update\n");
+   Reserve();
+   OverlaySelection::Update(viewer);
+ }
+ 
+ void LinkSelection::Clear(Viewer* viewer) {
+   fprintf(stderr, "LinkSelection::Clear\n");
+   OverlaySelection::Clear(viewer);
+ }
+ 
+ void LinkSelection::Reserve() {
+   fprintf(stderr, "LinkSelection::Reserve\n");
    static int id_sym = symbol_add("id");
  
    /* remove anything from selection that has a remote selector */
***************
*** 68,73 ****
--- 77,86 ----
        if (ptr) {
  	GraphicId* grid = (GraphicId*)ptr;
  	if (grid->selector() && ((DrawServ*)unidraw)->sessionid()!=grid->selector()) {
+ 
+ 	  /* make a request to select this in the future */
+ 	  ((DrawServ*)unidraw)->ReserveSelection(grid);
+ 
  	  Remove(it);
  	  removed = true;
  	}
***************
*** 76,89 ****
      if (!removed) 
        Next(it);
    }
-   return OverlaySelection::Update(viewer);
- }
- 
- void LinkSelection::Clear(Viewer* viewer) {
-   fprintf(stderr, "LinkSelection::Clear\n");
-   OverlaySelection::Clear(viewer);
- }
- 
- void LinkSelection::Reserve() {
-   fprintf(stderr, "LinkSelection::Reserve\n");
  }
--- 89,92 ----
Index: DrawServ/linkselection.h
diff -c DrawServ/linkselection.h:1.2 DrawServ/linkselection.h:1.3
*** DrawServ/linkselection.h:1.2	Fri Mar 12 11:33:04 2004
--- src/DrawServ/linkselection.h	Mon Mar 15 13:25:48 2004
***************
*** 37,53 ****
  // between two remote drawing editors that are linked together.
  class LinkSelection: public OverlaySelection {
  public:
!     LinkSelection(DrawLinkList* list, LinkSelection* = nil);
!     LinkSelection(DrawLinkList* list, Selection*);
  
!     virtual int Update(Viewer* = nil); 
      virtual void Clear(Viewer* = nil);
  
      virtual void Reserve();
      // reserve newly created graphics in selection across the network
  
  protected:
-     DrawLinkList* _linklist;
  };
  
  #endif
--- 37,52 ----
  // between two remote drawing editors that are linked together.
  class LinkSelection: public OverlaySelection {
  public:
!     LinkSelection(LinkSelection* = nil);
!     LinkSelection(Selection*);
  
!     virtual void Update(Viewer* = nil); 
      virtual void Clear(Viewer* = nil);
  
      virtual void Reserve();
      // reserve newly created graphics in selection across the network
  
  protected:
  };
  
  #endif
Index: include_unidraw/selection.h
diff -c include_unidraw/selection.h:1.3 include_unidraw/selection.h:1.4
*** include_unidraw/selection.h:1.3	Fri Mar 12 11:33:11 2004
--- src/include/Unidraw/selection.h	Mon Mar 15 13:25:55 2004
***************
*** 46,52 ****
      virtual ~Selection();
  
      virtual void Show(Viewer* = nil);	/* inits and draws handles (in given viewer) */
!     virtual int Update(Viewer* = nil); /* draws newly-added handles */
      virtual void Hide(Viewer* = nil);
      virtual void Init(Viewer* = nil);   /* explicitly init handles */
      virtual void Clear(Viewer* = nil);	/* removes & clears all views */
--- 46,52 ----
      virtual ~Selection();
  
      virtual void Show(Viewer* = nil);	/* inits and draws handles (in given viewer) */
!     virtual void Update(Viewer* = nil); /* draws newly-added handles */
      virtual void Hide(Viewer* = nil);
      virtual void Init(Viewer* = nil);   /* explicitly init handles */
      virtual void Clear(Viewer* = nil);	/* removes & clears all views */
Index: OverlayUnidraw/ovselection.c
diff -c OverlayUnidraw/ovselection.c:1.2 OverlayUnidraw/ovselection.c:1.3
*** OverlayUnidraw/ovselection.c:1.2	Fri Mar 12 11:32:56 2004
--- src/OverlayUnidraw/ovselection.c	Mon Mar 15 13:25:42 2004
***************
*** 80,93 ****
  	viewer->GetDamage()->Repair();
  }
  
! int OverlaySelection::Update (Viewer* viewer) {
  #if 0
      if (!viewer) return;
  #else
      if (!viewer) {
        Iterator i;
        First(i);
!       if (Done(i)) return -1;
        viewer = GetView(i)->GetViewer();
      }
  #endif
--- 80,93 ----
  	viewer->GetDamage()->Repair();
  }
  
! void OverlaySelection::Update (Viewer* viewer) {
  #if 0
      if (!viewer) return;
  #else
      if (!viewer) {
        Iterator i;
        First(i);
!       if (Done(i)) return;
        viewer = GetView(i)->GetViewer();
      }
  #endif
***************
*** 97,103 ****
      viewer->GetDamage()->Repair();
      if (HandlesEnabled())
  	ShowHandles(viewer);
-     return 0;
  }
  
  void OverlaySelection::Clear (Viewer* viewer) {
--- 97,102 ----
Index: OverlayUnidraw/ovselection.h
diff -c OverlayUnidraw/ovselection.h:1.3 OverlayUnidraw/ovselection.h:1.4
*** OverlayUnidraw/ovselection.h:1.3	Fri Mar 12 11:32:56 2004
--- src/OverlayUnidraw/ovselection.h	Mon Mar 15 13:25:42 2004
***************
*** 45,51 ****
  
      virtual void Show(Viewer* = nil);	
      virtual void Hide(Viewer* = nil);
!     virtual int Update(Viewer* = nil); 
      virtual void Clear(Viewer* = nil);
  
      virtual void RepairClear(Viewer*, boolean);
--- 45,51 ----
  
      virtual void Show(Viewer* = nil);	
      virtual void Hide(Viewer* = nil);
!     virtual void Update(Viewer* = nil); 
      virtual void Clear(Viewer* = nil);
  
      virtual void RepairClear(Viewer*, boolean);
Index: src_interviews/session.c
diff -c src_interviews/session.c:1.3 src_interviews/session.c:1.4
*** src_interviews/session.c:1.3	Fri Mar  5 11:19:27 2004
--- src/InterViews/session.c	Mon Mar 15 13:25:11 2004
***************
*** 725,731 ****
      } else if (style_->find_attribute(String("display"), name)) {
  	default_ = Display::open(name);
      } else {
! 	default_ = Display::open(":0.0");
      }
      if (default_ == nil) {
  	if (name.length() > 0) {
--- 725,732 ----
      } else if (style_->find_attribute(String("display"), name)) {
  	default_ = Display::open(name);
      } else {
!         const char* defaultvar = (char*)getenv( "DISPLAY" );
! 	default_ = Display::open(defaultvar ? defaultvar : ":0.0");
      }
      if (default_ == nil) {
  	if (name.length() > 0) {
Index: Unidraw/move.c
diff -c Unidraw/move.c:1.1 Unidraw/move.c:1.2
*** Unidraw/move.c:1.1	Fri Jan  9 11:44:39 2004
--- src/Unidraw/move.c	Mon Mar 15 13:25:39 2004
***************
*** 71,77 ****
  	}
          if (s->Number() > 1) {
              m = gv->GraphicView::CreateManipulator(v, e, rel, this);
!         } else {
              m = gv->CreateManipulator(v, e, rel, this);
          }
      }
--- 71,77 ----
  	}
          if (s->Number() > 1) {
              m = gv->GraphicView::CreateManipulator(v, e, rel, this);
!         } else if (s->Number() == 1 ) {
              m = gv->CreateManipulator(v, e, rel, this);
          }
      }
Index: Unidraw/reshape.c
diff -c Unidraw/reshape.c:1.2 Unidraw/reshape.c:1.3
*** Unidraw/reshape.c:1.2	Fri Mar 12 11:32:51 2004
--- src/Unidraw/reshape.c	Mon Mar 15 13:25:39 2004
***************
*** 64,70 ****
  	gv = newSel->GetView(i);
          s->Append(gv);
  	s->Update();
!         m = gv->CreateManipulator(v, e, rel, this);
      }
      delete newSel;
      return m;
--- 64,71 ----
  	gv = newSel->GetView(i);
          s->Append(gv);
  	s->Update();
! 	if (!s->IsEmpty())
! 	  m = gv->CreateManipulator(v, e, rel, this);
      }
      delete newSel;
      return m;
Index: Unidraw/rotate.c
diff -c Unidraw/rotate.c:1.1 Unidraw/rotate.c:1.2
*** Unidraw/rotate.c:1.1	Fri Jan  9 11:44:39 2004
--- src/Unidraw/rotate.c	Mon Mar 15 13:25:39 2004
***************
*** 72,78 ****
  	    s->Append(gv);
  	    s->Update();
  	}
!         m = gv->CreateManipulator(v, e, rel, this);
      }
      delete newSel;
      return m;
--- 72,79 ----
  	    s->Append(gv);
  	    s->Update();
  	}
! 	if (!s->IsEmpty()) 
! 	  m = gv->CreateManipulator(v, e, rel, this);
      }
      delete newSel;
      return m;
Index: Unidraw/scale.c
diff -c Unidraw/scale.c:1.1 Unidraw/scale.c:1.2
*** Unidraw/scale.c:1.1	Fri Jan  9 11:44:39 2004
--- src/Unidraw/scale.c	Mon Mar 15 13:25:39 2004
***************
*** 73,79 ****
  	    s->Append(gv);
  	    s->Update();
  	}
!         m = gv->CreateManipulator(v, e, rel, this);
      }
      delete newSel;
      return m;
--- 73,80 ----
  	    s->Append(gv);
  	    s->Update();
  	}
! 	if (!s->IsEmpty()) 
! 	  m = gv->CreateManipulator(v, e, rel, this);
      }
      delete newSel;
      return m;
Index: Unidraw/selection.c
diff -c Unidraw/selection.c:1.2 Unidraw/selection.c:1.3
*** Unidraw/selection.c:1.2	Fri Mar 12 11:32:51 2004
--- src/Unidraw/selection.c	Mon Mar 15 13:25:39 2004
***************
*** 70,76 ****
      }
  }
  
! int Selection::Update (Viewer* viewer) {
      Iterator i;
      
      for (First(i); !Done(i); Next(i)) {
--- 70,76 ----
      }
  }
  
! void Selection::Update (Viewer* viewer) {
      Iterator i;
      
      for (First(i); !Done(i); Next(i)) {
***************
*** 80,86 ****
              view->DrawHandles();
          }
      }
-     return 0;
  }
  
  void Selection::Hide (Viewer* viewer) {
--- 80,85 ----
Index: Unidraw/stretch.c
diff -c Unidraw/stretch.c:1.1 Unidraw/stretch.c:1.2
*** Unidraw/stretch.c:1.1	Fri Jan  9 11:44:39 2004
--- src/Unidraw/stretch.c	Mon Mar 15 13:25:39 2004
***************
*** 73,79 ****
  	    s->Append(gv);
  	    s->Update();
  	}
!         m = gv->CreateManipulator(v, e, rel, this);
      }
      delete newSel;
      return m;
--- 73,80 ----
  	    s->Append(gv);
  	    s->Update();
  	}
! 	if (!s->IsEmpty()) 
! 	  m = gv->CreateManipulator(v, e, rel, this);
      }
      delete newSel;
      return m;
*** /dev/null	 Mon Mar 15 13:26:03 PST 2004
--- patches/ivtools-040315-johnston-045
*************** patches/ivtools-040315-johnston-045
*** 0 ****
--- 1 ----
+ ivtools-040315-johnston-045

--Apple-Mail-6-224976654
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040316-johnston-046"
Content-Disposition: attachment;
	filename=ivtools-040316-johnston-046

Patch:    ivtools-040316-johnston-046
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawfunc.c
diff -c DrawServ/drawfunc.c:1.16 DrawServ/drawfunc.c:1.17
*** DrawServ/drawfunc.c:1.16	Mon Mar 15 13:25:48 2004
--- src/DrawServ/drawfunc.c	Tue Mar 16 10:54:59 2004
***************
*** 205,224 ****
  }
  
  void ReserveFunc::execute() {
!   static int rid_sym = symbol_add("rid");
!   ComValue ridv(stack_key(rid_sym));
  
    ComValue idv(stack_arg(0));
  
    reset_stack();
  
!   if (idv.is_known() && ridv.is_known()) {
!     void* ptr = nil;
!     ((DrawServ*)unidraw)->gridtable()->find(ptr, idv.uint_val());
!     if (ptr) 
!       fprintf(stderr, "grid 0x%08x found\n", idv.uint_val());
!     else
!       fprintf(stderr, "grid 0x%08x not found\n", idv.uint_val());
    }
  }
  
--- 205,226 ----
  }
  
  void ReserveFunc::execute() {
!   static int chg_sym = symbol_add("chg");
!   ComValue chgv(stack_key(chg_sym));
  
    ComValue idv(stack_arg(0));
+   ComValue selectorv(stack_arg(1));
  
    reset_stack();
  
!   if (idv.is_known() && selectorv.is_known()) {
!     if (chgv.is_false()) {
!       ((DrawServ*)unidraw)->reserve_handle
! 	(idv.uint_val(), selectorv.uint_val());
!     } else {
!       ((DrawServ*)unidraw)->reserve_change
! 	(idv.uint_val(), selectorv.uint_val(), chgv.is_true());
!     }
    }
  }
  
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.24 DrawServ/drawserv.c:1.25
*** DrawServ/drawserv.c:1.24	Mon Mar 15 13:25:48 2004
--- src/DrawServ/drawserv.c	Tue Mar 16 10:54:59 2004
***************
*** 34,39 ****
--- 34,40 ----
  #include <DrawServ/gridlist.h>
  
  #include <OverlayUnidraw/ovclasses.h>
+ #include <OverlayUnidraw/ovviews.h>
  #include <OverlayUnidraw/scriptview.h>
  
  #include <Unidraw/Commands/command.h>
***************
*** 42,48 ****
--- 43,51 ----
  #include <Unidraw/clipboard.h>
  #include <Unidraw/creator.h>
  #include <Unidraw/iterator.h>
+ #include <Unidraw/selection.h>
  #include <Unidraw/ulist.h>
+ #include <Unidraw/viewer.h>
  
  #include <ComTerp/comterpserv.h>
  
***************
*** 429,437 ****
  
    if (link) {
      char buf[BUFSIZ];
!     snprintf(buf, BUFSIZ, "reserve(0x%08x :rid %d)%c", grid->id(), link->local_linkid(), '\0');
      SendCmdString(link, buf);
    } else
      fprintf(stderr, "surprisingly no selector link found for GraphicId %u\n", grid->id());
  }
  
--- 432,505 ----
  
    if (link) {
      char buf[BUFSIZ];
!     snprintf(buf, BUFSIZ, "reserve(0x%08x 0x%08x)%c", grid->id(), sessionid(), '\0');
      SendCmdString(link, buf);
    } else
      fprintf(stderr, "surprisingly no selector link found for GraphicId %u\n", grid->id());
  }
  
+ // handle reserve request from remote DrawLink.
+ void DrawServ::reserve_handle(unsigned int id, unsigned int selector)
+ {
+   void* ptr = nil;
+   gridtable()->find(ptr, id);
+   if (ptr) {
+     GraphicId* grid = (GraphicId*)ptr;
+     
+     /* check if selected */
+     if( reserve_if_not_selected(grid, selector) ) {
+       
+       /* if available, broadcast to everyone */
+       char buf[BUFSIZ];
+       snprintf(buf, BUFSIZ, "reserve(0x%08x 0x%08x :chg)%c", id, selector, '\0');
+       DistributeCmdString(buf);
+     }
+     
+   } else
+     fprintf(stderr, "grid 0x%08x not found for selector 0x%08x\n", id, selector);
+ }
+ 
+ // callback for reserve request that goes to every DrawLink
+ void DrawServ::reserve_change(unsigned int id, unsigned int selector, 
+ 			      boolean ok)
+ {
+   if (ok) {
+     void* ptr = nil;
+     gridtable()->find(ptr, id);
+     if (ptr) {
+       GraphicId* grid = (GraphicId*)ptr;
+       grid->selector(selector);
+       grid->selected(false);
+     } else
+       fprintf(stderr, "reserve change received for unknown id 0x%08x\n", id);
+   } else
+     fprintf(stderr, "reserve request for 0x%08x denied\n", id);
+ }
+ 
+ boolean DrawServ::reserve_if_not_selected(GraphicId* grid, unsigned int selector) {
+   
+   /* check if graphic is still locally selected */
+   GraphicComp* comp = grid->grcomp();
+   boolean selected = false;
+   Iterator i;
+   First(i);
+   while (!Done(i) && !selected) {
+     Viewer* viewer = GetEditor(i)->GetViewer();
+     Selection* sel = viewer->GetSelection();
+     Iterator j;
+     sel->First(j);
+     while (!sel->Done(j) && !selected) {
+       if (sel->GetView(j)->GetGraphicComp()==comp) selected = true;
+       sel->Next(j);
+     }
+     Next(i);
+   }
+ 
+   if (selected)
+     return false;
+   else {
+     grid->selector(selector);
+     grid->selected(false);
+     return true;
+   }
+ }
Index: DrawServ/drawserv.h
diff -c DrawServ/drawserv.h:1.15 DrawServ/drawserv.h:1.16
*** DrawServ/drawserv.h:1.15	Mon Mar 15 13:25:48 2004
--- src/DrawServ/drawserv.h	Tue Mar 16 10:54:59 2004
***************
*** 109,114 ****
--- 109,123 ----
    
    unsigned int sessionid(int trial=false) { return trial ? _trialid : _sessionid; }
    // current unique session id.
+ 
+   void reserve_handle(unsigned int id, unsigned int selector);
+   // handle reserve request from remote DrawLink.
+ 
+   void reserve_change(unsigned int id, unsigned int selector, boolean ok); 
+   // callback for reserve request that goes to every DrawLink.
+ 
+   boolean reserve_if_not_selected(GraphicId* grid, unsigned int selector);
+   // check if graphic is selected, and allow it to be borrowed if not.
    
    static unsigned int candidate_grid();
    // generate candidate graphic id.
Index: DrawServ/grid.h
diff -c DrawServ/grid.h:1.6 DrawServ/grid.h:1.7
*** DrawServ/grid.h:1.6	Fri Mar 12 12:36:06 2004
--- src/DrawServ/grid.h	Tue Mar 16 10:54:59 2004
***************
*** 71,80 ****
    // get session id of current selector
  
    void selected(int flag) { _selected = flag; }
!   // set flag that indicates graphic is currently selected
  
    int selected() { return _selected; }
!   // get flag that indicates graphics is currently selected
  
  protected:
    unsigned int _id;
--- 71,80 ----
    // get session id of current selector
  
    void selected(int flag) { _selected = flag; }
!   // set flag that indicates graphic is remotely selected
  
    int selected() { return _selected; }
!   // get flag that indicates graphic is remotely selected
  
  protected:
    unsigned int _id;
*** /dev/null	 Tue Mar 16 10:55:12 PST 2004
--- patches/ivtools-040316-johnston-046
*************** patches/ivtools-040316-johnston-046
*** 0 ****
--- 1 ----
+ ivtools-040316-johnston-046

--Apple-Mail-6-224976654--



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click