patches leading up to 1.2.5

ivtools patch distribution <[email protected]> Tue, 4 Mar 2008 12:27:49 -0800
Newsgroups gmane.comp.lib.ivtools.patches
Message-ID <[email protected]>
--Apple-Mail-5-869486645
Content-Disposition: attachment;
	filename=ivtools-071006-johnston-004
Content-Type: application/octet-stream; x-unix-mode=0644;
	name="ivtools-071006-johnston-004"
Content-Transfer-Encoding: 7bit

Patch:    ivtools-071006-johnston-004
For:      ivtools-1.2
Author:   [email protected]
Subject:  bringing up single ALU PE work
Requires: 

This is an intermediate patch to ivtools-1.2.  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/attrlist.c
diff -c Attribute/attrlist.c:1.3 Attribute/attrlist.c:1.4
*** Attribute/attrlist.c:1.3	Fri Sep 28 13:08:24 2007
--- src/Attribute/attrlist.c	Sat Oct  6 11:10:27 2007
***************
*** 442,447 ****
--- 442,450 ----
  	    case AttributeValue::BooleanType:
  	        out << attrval->boolean_ref();
  	        break;
+ 	    case AttributeValue::ArrayType:
+ 	        out << *attrval->array_ref();
+ 	        break;
              default:
  		out << "Unknown type";
  	        break;
***************
*** 464,466 ****
--- 467,505 ----
    }
  }
  
+ AttributeValue* AttributeValueList::Get(unsigned int index) {
+   if (Number()<=index) return nil;
+   Iterator it;
+   First(it);
+   for (int i=0; i<index; i++) Next(it);
+   return GetAttrVal(it);
+ }
+ 
+ AttributeValue* AttributeValueList::Set(unsigned int index, AttributeValue* av) {
+   if (Number()<=index) {
+     Iterator it;
+     Last(it);
+     int padding = index-Number();
+     for (int i=0; i<padding; i++) Append(new AttributeValue());
+     Append(av);
+     return nil;
+   }
+   else {
+     Iterator it;
+     First(it);
+     for (int i=0; i<index; i++) Next(it);
+     AttributeValue* oldv = Replace(it, av);
+     return oldv;
+   }
+ }
+ 
+ AttributeValue* AttributeValueList::Replace (ALIterator& i, AttributeValue* av) {
+     AList* doomed = Elem(i);
+     AttributeValue* removed = GetAttrVal(i);
+     Next(i);
+     _alist->Remove(doomed);
+     delete doomed;
+     Elem(i)->Append(new AList(av));
+     return removed;
+ }	
+     
Index: Attribute/attrlist.h
diff -c Attribute/attrlist.h:1.1 Attribute/attrlist.h:1.2
*** Attribute/attrlist.h:1.1	Wed Aug 29 10:37:46 2007
--- src/Attribute/attrlist.h	Sat Oct  6 11:10:27 2007
***************
*** 201,206 ****
--- 201,210 ----
      // remove AttributeValue pointed to by iterator from the list, 
      // returning responsibility for freeing the associated memory.
      // This requires saving a pointer to the AttributeValue before calling this method.
+     AttributeValue* Replace(ALIterator&, AttributeValue*);
+     // remove AttributeValue pointed to by iterator from the list, 
+     // returning responsibility for freeing the associated memory.
+     // Then insert new AttributeValue in the same place.
  
  
      AttributeValue* GetAttrVal(ALIterator);
***************
*** 210,215 ****
--- 214,225 ----
      boolean Includes(AttributeValue*);
      // check if list includes AttributeValue by pointer-comparison.
  
+     AttributeValue* Get(unsigned int index);
+     // retrieve value by index, return nil if not there
+     AttributeValue* Set(unsigned int index, AttributeValue* av);
+     // set value by index, increase list length if necessary with nil padding,
+     // take responsibility for the memory (and return responsibility for old memory)
+ 
      AList* Elem(ALIterator); 
      // return AList (UList) pointed to by ALIterator (Iterator).
      AttributeValue* AttrVal(AList*);
Index: ComTerp/assignfunc.c
diff -c ComTerp/assignfunc.c:1.2 ComTerp/assignfunc.c:1.3
*** ComTerp/assignfunc.c:1.2	Sun Sep 23 09:11:27 2007
--- src/ComTerp/assignfunc.c	Sat Oct  6 11:10:28 2007
***************
*** 99,106 ****
  	push_stack(*(ComValue*)op1val);
  	delete (ComValue*)op1val;
  	push_stack(operand2);
! 	static ModFunc* subfunc = new ModFunc(comterp());
! 	subfunc->exec(2,0);
  	ComValue* result = new ComValue(pop_stack());
          _comterp->localtable()->insert(operand1.symbol_val(), result);
  	push_stack(*result);
--- 99,106 ----
  	push_stack(*(ComValue*)op1val);
  	delete (ComValue*)op1val;
  	push_stack(operand2);
! 	ModFunc modfunc(comterp());
! 	modfunc.exec(2,0);
  	ComValue* result = new ComValue(pop_stack());
          _comterp->localtable()->insert(operand1.symbol_val(), result);
  	push_stack(*result);
***************
*** 130,137 ****
  	push_stack(*(ComValue*)op1val);
  	delete (ComValue*)op1val;
  	push_stack(operand2);
! 	static MpyFunc* subfunc = new MpyFunc(comterp());
! 	subfunc->exec(2,0);
  	ComValue* result = new ComValue(pop_stack());
          _comterp->localtable()->insert(operand1.symbol_val(), result);
  	push_stack(*result);
--- 130,137 ----
  	push_stack(*(ComValue*)op1val);
  	delete (ComValue*)op1val;
  	push_stack(operand2);
! 	MpyFunc mpyfunc(comterp());
! 	mpyfunc.exec(2,0);
  	ComValue* result = new ComValue(pop_stack());
          _comterp->localtable()->insert(operand1.symbol_val(), result);
  	push_stack(*result);
***************
*** 161,168 ****
  	push_stack(*(ComValue*)op1val);
  	delete (ComValue*)op1val;
  	push_stack(operand2);
! 	static AddFunc* subfunc = new AddFunc(comterp());
! 	subfunc->exec(2,0);
  	ComValue* result = new ComValue(pop_stack());
          _comterp->localtable()->insert(operand1.symbol_val(), result);
  	push_stack(*result);
--- 161,168 ----
  	push_stack(*(ComValue*)op1val);
  	delete (ComValue*)op1val;
  	push_stack(operand2);
! 	AddFunc addfunc(comterp());
! 	addfunc.exec(2,0);
  	ComValue* result = new ComValue(pop_stack());
          _comterp->localtable()->insert(operand1.symbol_val(), result);
  	push_stack(*result);
***************
*** 192,199 ****
  	push_stack(*(ComValue*)op1val);
  	delete (ComValue*)op1val;
  	push_stack(operand2);
! 	static SubFunc* subfunc = new SubFunc(comterp());
! 	subfunc->exec(2,0);
  	ComValue* result = new ComValue(pop_stack());
          _comterp->localtable()->insert(operand1.symbol_val(), result);
  	push_stack(*result);
--- 192,199 ----
  	push_stack(*(ComValue*)op1val);
  	delete (ComValue*)op1val;
  	push_stack(operand2);
! 	SubFunc subfunc(comterp());
! 	subfunc.exec(2,0);
  	ComValue* result = new ComValue(pop_stack());
          _comterp->localtable()->insert(operand1.symbol_val(), result);
  	push_stack(*result);
***************
*** 223,230 ****
  	push_stack(*(ComValue*)op1val);
  	delete (ComValue*)op1val;
  	push_stack(operand2);
! 	static DivFunc* subfunc = new DivFunc(comterp());
! 	subfunc->exec(2,0);
  	ComValue* result = new ComValue(pop_stack());
          _comterp->localtable()->insert(operand1.symbol_val(), result);
  	push_stack(*result);
--- 223,230 ----
  	push_stack(*(ComValue*)op1val);
  	delete (ComValue*)op1val;
  	push_stack(operand2);
! 	DivFunc divfunc(comterp());
! 	divfunc.exec(2,0);
  	ComValue* result = new ComValue(pop_stack());
          _comterp->localtable()->insert(operand1.symbol_val(), result);
  	push_stack(*result);
***************
*** 253,260 ****
  	    one.type(ComValue::IntType);
  	    one.int_ref() = 1;
  	    push_stack(one);
! 	    static AddFunc* subfunc = new AddFunc(comterp());
! 	    subfunc->exec(2,0);
  	    ComValue* result = new ComValue(pop_stack());
              _comterp->localtable()->insert(operand1.symbol_val(), result);
  	    push_stack(*result);
--- 253,260 ----
  	    one.type(ComValue::IntType);
  	    one.int_ref() = 1;
  	    push_stack(one);
! 	    AddFunc addfunc(comterp());
! 	    addfunc.exec(2,0);
  	    ComValue* result = new ComValue(pop_stack());
              _comterp->localtable()->insert(operand1.symbol_val(), result);
  	    push_stack(*result);
***************
*** 284,291 ****
  	    one.type(ComValue::IntType);
  	    one.int_ref() = 1;
  	    push_stack(one);
! 	    static AddFunc* subfunc = new AddFunc(comterp());
! 	    subfunc->exec(2,0);
  	    ComValue* result = new ComValue(pop_stack());
              _comterp->localtable()->insert(operand1.symbol_val(), result);
  	    push_stack(*(ComValue*)op1val);
--- 284,291 ----
  	    one.type(ComValue::IntType);
  	    one.int_ref() = 1;
  	    push_stack(one);
! 	    AddFunc addfunc(comterp());
! 	    addfunc.exec(2,0);
  	    ComValue* result = new ComValue(pop_stack());
              _comterp->localtable()->insert(operand1.symbol_val(), result);
  	    push_stack(*(ComValue*)op1val);
***************
*** 317,324 ****
  	    one.type(ComValue::IntType);
  	    one.int_ref() = 1;
  	    push_stack(one);
! 	    static SubFunc* subfunc = new SubFunc(comterp());
! 	    subfunc->exec(2,0);
  	    ComValue* result = new ComValue(pop_stack());
              _comterp->localtable()->insert(operand1.symbol_val(), result);
  	    push_stack(*result);
--- 317,324 ----
  	    one.type(ComValue::IntType);
  	    one.int_ref() = 1;
  	    push_stack(one);
! 	    SubFunc subfunc(comterp());
! 	    subfunc.exec(2,0);
  	    ComValue* result = new ComValue(pop_stack());
              _comterp->localtable()->insert(operand1.symbol_val(), result);
  	    push_stack(*result);
***************
*** 348,355 ****
  	    one.type(ComValue::IntType);
  	    one.int_ref() = 1;
  	    push_stack(one);
! 	    static SubFunc* subfunc = new SubFunc(comterp());
! 	    subfunc->exec(2,0);
  	    ComValue* result = new ComValue(pop_stack());
              _comterp->localtable()->insert(operand1.symbol_val(), result);
  	    push_stack(*(ComValue*)op1val);
--- 348,355 ----
  	    one.type(ComValue::IntType);
  	    one.int_ref() = 1;
  	    push_stack(one);
! 	    SubFunc subfunc(comterp());
! 	    subfunc.exec(2,0);
  	    ComValue* result = new ComValue(pop_stack());
              _comterp->localtable()->insert(operand1.symbol_val(), result);
  	    push_stack(*(ComValue*)op1val);
Index: ComTerp/boolfunc.c
diff -c ComTerp/boolfunc.c:1.1 ComTerp/boolfunc.c:1.2
*** ComTerp/boolfunc.c:1.1	Wed Aug 29 10:37:48 2007
--- src/ComTerp/boolfunc.c	Sat Oct  6 11:10:28 2007
***************
*** 283,288 ****
--- 283,295 ----
      ComValue result(operand1);
      result.type(ComValue::BooleanType);
  
+     if (operand1.type() != operand2.type()) {
+       result.boolean_ref() = true;
+       reset_stack();
+       push_stack(result);
+       return;
+     }
+ 
      switch (operand1.type()) {
      case ComValue::CharType:
  	result.boolean_ref() = operand1.char_val() != operand2.char_val();
Index: ComTerp/bquotefunc.h
diff -c ComTerp/bquotefunc.h:1.1 ComTerp/bquotefunc.h:1.2
*** ComTerp/bquotefunc.h:1.1	Wed Aug 29 10:37:48 2007
--- src/ComTerp/bquotefunc.h	Sat Oct  6 11:10:28 2007
***************
*** 38,43 ****
--- 38,44 ----
      BackQuoteFunc(ComTerp*);
  
      virtual void execute();
+     virtual boolean post_eval() { return true; }
      virtual const char* docstring() { 
        return "` is the LISP-like backquote operator"; }
  };
Index: ComTerp/comhandler.c
diff -c ComTerp/comhandler.c:1.1 ComTerp/comhandler.c:1.2
*** ComTerp/comhandler.c:1.1	Wed Aug 29 10:37:48 2007
--- src/ComTerp/comhandler.c	Sat Oct  6 11:10:28 2007
***************
*** 47,58 ****
  
  // Default constructor.
  
! ComterpHandler::ComterpHandler (void) 
  #if 0
  : ACE_Svc_Handler<ACE_SOCK_Stream, ACE_NULL_SYNCH>(0,0,ComterpHandler::reactor_singleton())
  #endif
  {
!     comterp_ = new ComTerpServ(BUFSIZ*BUFSIZ);
      comterp_->handler(this);
      comterp_->add_defaults();
      _timeoutscriptid = -1;
--- 47,58 ----
  
  // Default constructor.
  
! ComterpHandler::ComterpHandler (ComTerpServ* serv) 
  #if 0
  : ACE_Svc_Handler<ACE_SOCK_Stream, ACE_NULL_SYNCH>(0,0,ComterpHandler::reactor_singleton())
  #endif
  {
!     comterp_ = serv ? serv : new ComTerpServ(BUFSIZ*BUFSIZ);
      comterp_->handler(this);
      comterp_->add_defaults();
      _timeoutscriptid = -1;
Index: ComTerp/comhandler.h
diff -c ComTerp/comhandler.h:1.1 ComTerp/comhandler.h:1.2
*** ComTerp/comhandler.h:1.1	Wed Aug 29 10:37:48 2007
--- src/ComTerp/comhandler.h	Sat Oct  6 11:10:28 2007
***************
*** 54,60 ****
  
  public:
    // = Initialization and termination methods.
!   ComterpHandler (void);
    virtual ~ComterpHandler();
  
    virtual void destroy (void);
--- 54,60 ----
  
  public:
    // = Initialization and termination methods.
!   ComterpHandler (ComTerpServ* serv=NULL);
    virtual ~ComterpHandler();
  
    virtual void destroy (void);
***************
*** 144,151 ****
  //: version without ACE
  class ComterpHandler {
  public:
!     ComterpHandler(void) {comterp_ = new ComTerpServ(); _handle = 0;}
!     ComterpHandler(int id) { comterp_ = new ComTerpServ(); _handle = id;}
      int get_handle() { return _handle;}
  
      FILE* wrfptr() { return nil; }
--- 144,151 ----
  //: version without ACE
  class ComterpHandler {
  public:
!     ComterpHandler(ComTerpServ* serv=nil) {comterp_ = serv ? serv : new ComTerpServ(); _handle = 0; comterp_->add_defaults();}
!     ComterpHandler(int id, ComTerpServ* serv = nil) { comterp_ = serv ? serv : new ComTerpServ(); _handle = id; comterp_->add_defaults();}
      int get_handle() { return _handle;}
  
      FILE* wrfptr() { return nil; }
***************
*** 154,159 ****
--- 154,161 ----
      FILE* rdfptr() { return nil; }
      // file pointer for reading from handle
  
+     ComTerp* comterp() { return comterp_; }
+ 
  protected:
      int _handle;
      ComTerpServ* comterp_;
Index: ComTerp/comterp.c
diff -c ComTerp/comterp.c:1.3 ComTerp/comterp.c:1.4
*** ComTerp/comterp.c:1.3	Fri Sep 28 13:08:26 2007
--- src/ComTerp/comterp.c	Sat Oct  6 11:10:28 2007
***************
*** 247,256 ****
  
  void ComTerp::eval_expr_internals(int pedepth) {
    static int step_symid = symbol_add("step");
-   static ComFunc* stepfunc = nil;
-   if (!stepfunc)
-     stepfunc = new ComterpStepFunc(this);
- 
    ComValue sv = pop_stack(false);
    
    if (sv.type() == ComValue::CommandType) {
--- 247,252 ----
***************
*** 333,341 ****
        static int pause_symid = symbol_add("pause");
        ComValue pausekey(pause_symid, 0, ComValue::KeywordType);
        push_stack(pausekey);
!       stepfunc->push_funcstate(0,1, pedepth, step_symid);
!       stepfunc->execute();
!       stepfunc->pop_funcstate();
        pop_stack();
      }
  
--- 329,338 ----
        static int pause_symid = symbol_add("pause");
        ComValue pausekey(pause_symid, 0, ComValue::KeywordType);
        push_stack(pausekey);
!       ComterpStepFunc stepfunc(this);
!       stepfunc.push_funcstate(0,1, pedepth, step_symid);
!       stepfunc.execute();
!       stepfunc.pop_funcstate();
        pop_stack();
      }
  
***************
*** 954,960 ****
      fbuf.attach(fd);
    } else
      fbuf.attach(fileno(stdout));
! #elif (__GNUC__==3 && __GNUC_MINOR__<1) || __GNUC__>3
    fileptr_filebuf fbuf(handler() && handler()->wrfptr() 
  	       ? handler()->wrfptr() : stdout, 
  	       ios_base::out);
--- 951,957 ----
      fbuf.attach(fd);
    } else
      fbuf.attach(fileno(stdout));
! #elif (__GNUC__==3 && __GNUC_MINOR__<1) || __GNUC__>3 || defined(__CYGWIN__)
    fileptr_filebuf fbuf(handler() && handler()->wrfptr() 
  	       ? handler()->wrfptr() : stdout, 
  	       ios_base::out);
Index: ComTerp/condfunc.c
diff -c ComTerp/condfunc.c:1.1 ComTerp/condfunc.c:1.2
*** ComTerp/condfunc.c:1.1	Wed Aug 29 10:37:48 2007
--- src/ComTerp/condfunc.c	Sat Oct  6 11:10:28 2007
***************
*** 34,40 ****
    ComValue booltest(stack_arg_post_eval(0));
    ComValue retval(booltest.is_true() 
  		  ? stack_arg_post_eval(1)
! 		  : stack_arg_post_eval(2));
    reset_stack();
    push_stack(retval);
  }
--- 34,40 ----
    ComValue booltest(stack_arg_post_eval(0));
    ComValue retval(booltest.is_true() 
  		  ? stack_arg_post_eval(1)
! 		  : (nargs()>=3 ? stack_arg_post_eval(2) : ComValue::nullval()));
    reset_stack();
    push_stack(retval);
  }
Index: ComTerp/listfunc.c
diff -c ComTerp/listfunc.c:1.2 ComTerp/listfunc.c:1.3
*** ComTerp/listfunc.c:1.2	Sun Sep 23 09:11:27 2007
--- src/ComTerp/listfunc.c	Sat Oct  6 11:10:28 2007
***************
*** 101,106 ****
--- 101,107 ----
  
    if (listv.is_type(ComValue::ArrayType) && !nv.is_nil() && nv.int_val()>=0) {
      AttributeValueList* avl = listv.array_val();
+     #if 0
      if (avl && nv.int_val()<avl->Number()) {
        int count = 0;
        Iterator it;
***************
*** 114,119 ****
--- 115,137 ----
  	count++;
        }
      }
+     #else
+     if (avl) {
+       if (setflag) {
+ 	AttributeValue* oldv = avl->Set(nv.int_val(), new AttributeValue(setv));
+ 	delete oldv;
+ 	push_stack(setv);
+ 	return;
+       } else {
+ 	AttributeValue* retv = avl->Get(nv.int_val());
+ 	if (retv)
+ 	  push_stack(*retv);
+ 	else
+ 	  push_stack(ComValue::blankval());
+ 	return;
+       }
+     }
+     #endif
    } else if (listv.is_object(AttributeList::class_symid())) {
      AttributeList* al = (AttributeList*)listv.obj_val();
      if (al && nv.int_val()<al->Number()) {
Index: ComUnidraw/comterp-acehandler.c
diff -c ComUnidraw/comterp-acehandler.c:1.1 ComUnidraw/comterp-acehandler.c:1.2
*** ComUnidraw/comterp-acehandler.c:1.1	Wed Aug 29 10:38:54 2007
--- src/ComUnidraw/comterp-acehandler.c	Sat Oct  6 11:10:35 2007
***************
*** 35,45 ****
  
  // Default constructor.
  
! UnidrawComterpHandler::UnidrawComterpHandler ()
  {
    Iterator i;
    unidraw->First(i);
!   ((ComEditor*)unidraw->GetEditor(i))->AddCommands(comterp_);
  }
  
  #endif /* HAVE_ACE */
--- 35,45 ----
  
  // Default constructor.
  
! UnidrawComterpHandler::UnidrawComterpHandler (ComTerpServ* serv) : ComterpHandler(serv)
  {
    Iterator i;
    unidraw->First(i);
!   if (!serv) ((ComEditor*)unidraw->GetEditor(i))->AddCommands(comterp_);
  }
  
  #endif /* HAVE_ACE */
Index: ComUnidraw/comterp-acehandler.h
diff -c ComUnidraw/comterp-acehandler.h:1.1 ComUnidraw/comterp-acehandler.h:1.2
*** ComUnidraw/comterp-acehandler.h:1.1	Wed Aug 29 10:38:54 2007
--- src/ComUnidraw/comterp-acehandler.h	Sat Oct  6 11:10:35 2007
***************
*** 38,44 ****
  
  public:
    // = Initialization and termination methods.
!   UnidrawComterpHandler ();
  
  };
  
--- 38,44 ----
  
  public:
    // = Initialization and termination methods.
!   UnidrawComterpHandler (ComTerpServ* serv=NULL);
  
  };
  
Index: ComUnidraw/unifunc.c
diff -c ComUnidraw/unifunc.c:1.2 ComUnidraw/unifunc.c:1.3
*** ComUnidraw/unifunc.c:1.2	Sun Sep 30 13:49:20 2007
--- src/ComUnidraw/unifunc.c	Sat Oct  6 11:10:35 2007
***************
*** 671,676 ****
--- 671,677 ----
    } else {
      cerr << "this version of pause command only works with ComTextEditor\n";
    }
+   push_stack(ComValue::blankval());
  }
  
  /*****************************************************************************/
Index: ComUtil/atox.c
diff -c ComUtil/atox.c:1.1 ComUtil/atox.c:1.2
*** ComUtil/atox.c:1.1	Wed Aug 29 10:37:45 2007
--- src/ComUtil/atox.c	Sat Oct  6 11:10:26 2007
***************
*** 79,85 ****
  unsigned long value = 0;
  int index;
  
!    string_length = min( sizeof(unsigned long) * 2, strlen( string ));
  
     for( index=0; index<string_length; index++ ) {
        if( !isxdigit( string[index] ))
--- 79,85 ----
  unsigned long value = 0;
  int index;
  
!    string_length = MIN( sizeof(unsigned long) * 2, strlen( string ));
  
     for( index=0; index<string_length; index++ ) {
        if( !isxdigit( string[index] ))
***************
*** 137,143 ****
  unsigned long value = 0;
  int index;
  
!    string_length = min( sizeof(unsigned long) * 8 / 3, strlen( string ));
  
     for( index=0; index<string_length; index++ ) {
        if( !isodigit( string[index] ))
--- 137,143 ----
  unsigned long value = 0;
  int index;
  
!    string_length = MIN( sizeof(unsigned long) * 8 / 3, strlen( string ));
  
     for( index=0; index<string_length; index++ ) {
        if( !isodigit( string[index] ))
Index: ComUtil/errsys.c
diff -c ComUtil/errsys.c:1.1 ComUtil/errsys.c:1.2
*** ComUtil/errsys.c:1.1	Wed Aug 29 10:37:45 2007
--- src/ComUtil/errsys.c	Sat Oct  6 11:10:26 2007
***************
*** 424,430 ****
        for( index=TopError; index>=0; index-- ) {
  	 fseek( ErrorIOFile, (long)ErrorStructs[index].erroff, SEEK_SET );
  	 fgets( buffer,
! 		min( BUFSIZ, ErrorStructs[index].errlen+1),
  		ErrorIOFile );
  	 fprintf( outstream, "%s\n", buffer );
  	 }
--- 424,430 ----
        for( index=TopError; index>=0; index-- ) {
  	 fseek( ErrorIOFile, (long)ErrorStructs[index].erroff, SEEK_SET );
  	 fgets( buffer,
! 		MIN( BUFSIZ, ErrorStructs[index].errlen+1),
  		ErrorIOFile );
  	 fprintf( outstream, "%s\n", buffer );
  	 }
***************
*** 435,441 ****
  /* with command substituted for the function name              */
     else {
        fseek( ErrorIOFile, (long)ErrorStructs[TopError].erroff, SEEK_SET );
!       fgets( buffer, min( BUFSIZ, ErrorStructs[TopError].errlen+1),
  	     ErrorIOFile );
        ptr = buffer;
        if( isident( *ptr ))
--- 435,441 ----
  /* with command substituted for the function name              */
     else {
        fseek( ErrorIOFile, (long)ErrorStructs[TopError].erroff, SEEK_SET );
!       fgets( buffer, MIN( BUFSIZ, ErrorStructs[TopError].errlen+1),
  	     ErrorIOFile );
        ptr = buffer;
        if( isident( *ptr ))
***************
*** 532,538 ****
        for( index=TopError; index>=0; index-- ) {
  	 fseek( ErrorIOFile, (long)ErrorStructs[index].erroff, SEEK_SET );
  	 fgets( buffer,
! 		min( BUFSIZ, ErrorStructs[index].errlen+1),
  		ErrorIOFile );
  	 fprintf( outstream, "%s\n", buffer );
  	 }
--- 532,538 ----
        for( index=TopError; index>=0; index-- ) {
  	 fseek( ErrorIOFile, (long)ErrorStructs[index].erroff, SEEK_SET );
  	 fgets( buffer,
! 		MIN( BUFSIZ, ErrorStructs[index].errlen+1),
  		ErrorIOFile );
  	 fprintf( outstream, "%s\n", buffer );
  	 }
***************
*** 544,550 ****
     else {
  #endif
        fseek( ErrorIOFile, (long)ErrorStructs[TopError].erroff, SEEK_SET );
!       fgets( buffer, min( BUFSIZ, ErrorStructs[TopError].errlen+1),
  	     ErrorIOFile );
        ptr = buffer;
        if( isident( *ptr ))
--- 544,550 ----
     else {
  #endif
        fseek( ErrorIOFile, (long)ErrorStructs[TopError].erroff, SEEK_SET );
!       fgets( buffer, MIN( BUFSIZ, ErrorStructs[TopError].errlen+1),
  	     ErrorIOFile );
        ptr = buffer;
        if( isident( *ptr ))
Index: ComUtil/optable.c
diff -c ComUtil/optable.c:1.1 ComUtil/optable.c:1.2
*** ComUtil/optable.c:1.1	Wed Aug 29 10:37:45 2007
--- src/ComUtil/optable.c	Sat Oct  6 11:10:26 2007
***************
*** 333,339 ****
        COMERR_SET1( ERR_PRIORITY_RANGE, priority );
        return FUNCBAD;
        }
!    MaxPriority = max( MaxPriority, priority );
  
  /* Search for place to insert operator */
     while( table_off < NumOperators &&
--- 333,339 ----
        COMERR_SET1( ERR_PRIORITY_RANGE, priority );
        return FUNCBAD;
        }
!    MaxPriority = MAX( MaxPriority, priority );
  
  /* Search for place to insert operator */
     while( table_off < NumOperators &&
Index: ComUtil/util.h
diff -c ComUtil/util.h:1.1 ComUtil/util.h:1.2
*** ComUtil/util.h:1.1	Wed Aug 29 10:37:45 2007
--- src/ComUtil/util.h	Sat Oct  6 11:10:26 2007
***************
*** 114,124 ****
  extern  int   TITLE;
  #endif
  
! #if !defined(min) && !defined(COMUTIL_NOMINMAXDEF) 
! #define  min(a,b) (a<b?a:b)
  #endif
! #if !defined(max) && !defined(COMUTIL_NOMINMAXDEF)
! #define  max(a,b) (a>b?a:b)
  #endif
  
  /* Return Status for functions */
--- 114,124 ----
  extern  int   TITLE;
  #endif
  
! #if !defined(MIN) && !defined(COMUTIL_NOMINMAXDEF) 
! #define  MIN(a,b) (a<b?a:b)
  #endif
! #if !defined(MAX) && !defined(COMUTIL_NOMINMAXDEF)
! #define  MAX(a,b) (a>b?a:b)
  #endif
  
  /* Return Status for functions */
Index: DrawServ/drawcomps.c
diff -c DrawServ/drawcomps.c:1.2 DrawServ/drawcomps.c:1.3
*** DrawServ/drawcomps.c:1.2	Sun Sep 23 09:11:36 2007
--- src/DrawServ/drawcomps.c	Sat Oct  6 11:10:38 2007
***************
*** 46,52 ****
  ParamList* DrawIdrawComp::_com_idraw_params = nil;
  
  DrawIdrawComp::DrawIdrawComp (const char* pathname, OverlayComp* parent)
! : FrameIdrawComp(true, pathname, parent) {
      _graphedges = new UList();
  }
  
--- 46,52 ----
  ParamList* DrawIdrawComp::_com_idraw_params = nil;
  
  DrawIdrawComp::DrawIdrawComp (const char* pathname, OverlayComp* parent)
! : FrameIdrawComp(false, pathname, parent) {
      _graphedges = new UList();
  }
  
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	Wed Aug 29 10:39:00 2007
--- src/DrawServ/drawserv-handler.c	Sat Oct  6 11:10:38 2007
***************
*** 32,38 ****
  
  // Default constructor.
  
! DrawServHandler::DrawServHandler () : UnidrawComterpHandler()
  {
    _drawlink = nil;
    if (!_sigpipe_handler_initialized) {
--- 32,38 ----
  
  // Default constructor.
  
! DrawServHandler::DrawServHandler (ComTerpServ* serv) : UnidrawComterpHandler(serv)
  {
    _drawlink = nil;
    if (!_sigpipe_handler_initialized) {
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	Wed Aug 29 10:39:00 2007
--- src/DrawServ/drawserv-handler.h	Sat Oct  6 11:10:38 2007
***************
*** 37,43 ****
  
  public:
    // = Initialization and termination methods.
!   DrawServHandler ();
  
    DrawLink* drawlink() { return _drawlink; }
    // get DrawLink associated with this handler
--- 37,43 ----
  
  public:
    // = Initialization and termination methods.
!   DrawServHandler (ComTerpServ* serv = NULL);
  
    DrawLink* drawlink() { return _drawlink; }
    // get DrawLink associated with this handler
Index: FrameUnidraw/framecomps.c
diff -c FrameUnidraw/framecomps.c:1.1 FrameUnidraw/framecomps.c:1.2
*** FrameUnidraw/framecomps.c:1.1	Wed Aug 29 10:38:56 2007
--- src/FrameUnidraw/framecomps.c	Sat Oct  6 11:10:36 2007
***************
*** 488,494 ****
      _gslist = nil;
      _ptsbuf = nil;
      SetPathName(pathname);
!     if (add_bg)
          Append(new FrameComp());
  }
  
--- 488,494 ----
      _gslist = nil;
      _ptsbuf = nil;
      SetPathName(pathname);
!     if (add_bg || !pathname)
          Append(new FrameComp());
  }
  
Index: GraphUnidraw/nodecomp.c
diff -c GraphUnidraw/nodecomp.c:1.4 GraphUnidraw/nodecomp.c:1.5
*** GraphUnidraw/nodecomp.c:1.4	Sun Sep 30 13:49:22 2007
--- src/GraphUnidraw/nodecomp.c	Sat Oct  6 11:10:37 2007
***************
*** 417,422 ****
--- 417,434 ----
  	return (TextGraphic*)pic->GetGraphic(i);
  }
  
+ void NodeComp::SetText(TextGraphic* tg) {
+   TextGraphic* oldtg = GetText();
+   if (oldtg) {
+     ((Picture*)GetGraphic())->Remove(oldtg);
+     delete oldtg;
+   }
+   Iterator it;
+   GetGraphic()->First(it);
+   GetGraphic()->InsertAfter(it, tg);
+ }
+ 
+ 
  ArrowLine* NodeComp::SubEdgeGraphic(int index) {
      if (!GetGraph() || index == -1)
  	return nil;
***************
*** 500,508 ****
      else if (cmd->IsA(NODETEXT_CMD)) {
  	NodeTextCmd* ntcmd = (NodeTextCmd*)cmd;
  	TextGraphic* tg = ntcmd->Graphic();
! 	if (GetText())
! 	    ((Picture*)GetGraphic())->Remove(GetText());
! 	((Picture*)GetGraphic())->Append(tg);
  	Notify();
  	unidraw->Update();
      }
--- 512,518 ----
      else if (cmd->IsA(NODETEXT_CMD)) {
  	NodeTextCmd* ntcmd = (NodeTextCmd*)cmd;
  	TextGraphic* tg = ntcmd->Graphic();
! 	SetText(tg);
  	Notify();
  	unidraw->Update();
      }
***************
*** 989,995 ****
  
  	    #if 0
  	    textgr->Align(Center, ellipse, Center);
! 	    #else	    ellipse->Align(Center, textgr, Center);
  	    #endif
  	    cmd = new PasteCmd(ed, new Clipboard(NewNodeComp(ellipse, textgr)));
  	}
--- 999,1006 ----
  
  	    #if 0
  	    textgr->Align(Center, ellipse, Center);
! 	    #else
! 	    ellipse->Align(Center, textgr, Center);
  	    #endif
  	    cmd = new PasteCmd(ed, new Clipboard(NewNodeComp(ellipse, textgr)));
  	}
Index: GraphUnidraw/nodecomp.h
diff -c GraphUnidraw/nodecomp.h:1.3 GraphUnidraw/nodecomp.h:1.4
*** GraphUnidraw/nodecomp.h:1.3	Fri Sep 28 13:08:35 2007
--- src/GraphUnidraw/nodecomp.h	Sat Oct  6 11:10:37 2007
***************
*** 115,120 ****
--- 115,122 ----
      // return pointer to ellipse graphic.
      TextGraphic* GetText();
      // return pointer to text graphic.
+     void SetText(TextGraphic*);
+     // set pointer to text graphic.
      SF_Ellipse* GetEllipse2();
      // return pointer to second ellipse graphic used to indicate internal graph.
      EdgeComp* SubEdgeComp(int);
Index: Unidraw/verts.c
diff -c Unidraw/verts.c:1.3 Unidraw/verts.c:1.4
*** Unidraw/verts.c:1.3	Sun Sep 30 22:22:07 2007
--- src/Unidraw/verts.c	Sat Oct  6 11:10:33 2007
***************
*** 27,32 ****
--- 27,33 ----
  
  #include <Unidraw/Graphic/util.h>
  #include <Unidraw/Graphic/verts.h>
+ #include <InterViews/transformer.h>
  
  #include <IV-2_6/_enter.h>
  
***************
*** 181,183 ****
--- 182,196 ----
  Coord* Vertices::y() { 
      return _pts ? _pts->y() : nil; 
  }
+ 
+ boolean Vertices::GetPoint (int index, Coord& px, Coord& py) {
+     if (index<0 || index>=count()) return false;
+     Coord tx, ty;
+     Transformer t;
+     tx = x()[index];
+     ty = y()[index];
+     TotalTransformation(t);
+     t.Transform(tx, ty, px, py);
+     return true;
+ }
+ 
*** /dev/null	 Sat Oct 6 11:10:42 PDT 2007
--- patches/ivtools-071006-johnston-004
*************** patches/ivtools-071006-johnston-004
*** 0 ****
--- 1 ----
+ ivtools-071006-johnston-004

--Apple-Mail-5-869486645
Content-Disposition: attachment;
	filename=ivtools-071012-johnston-005
Content-Type: application/octet-stream; x-unix-mode=0644;
	name="ivtools-071012-johnston-005"
Content-Transfer-Encoding: 7bit

Patch:    ivtools-071012-johnston-005
For:      ivtools-1.2
Author:   [email protected]
Subject:  changes to demo pe2.ipd
Requires: 

This is an intermediate patch to ivtools-1.2.  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/attrlist.c
diff -c Attribute/attrlist.c:1.4 Attribute/attrlist.c:1.5
*** Attribute/attrlist.c:1.4	Sat Oct  6 11:10:27 2007
--- src/Attribute/attrlist.c	Fri Oct 12 08:11:22 2007
***************
*** 446,452 ****
  	        out << *attrval->array_ref();
  	        break;
              default:
! 		out << "Unknown type";
  	        break;
  	}
  
--- 446,452 ----
  	        out << *attrval->array_ref();
  	        break;
              default:
! 		out << "nil";
  	        break;
  	}
  
Index: ComTerp/helpfunc.c
diff -c ComTerp/helpfunc.c:1.1 ComTerp/helpfunc.c:1.2
*** ComTerp/helpfunc.c:1.1	Wed Aug 29 10:37:48 2007
--- src/ComTerp/helpfunc.c	Fri Oct 12 08:11:23 2007
***************
*** 41,46 ****
--- 41,48 ----
  
  #define TITLE "HelpFunc"
  
+ #define HELPOUT 0  // set to 1 if desire to print instead of return help info
+ 
  /*****************************************************************************/
  
  HelpFunc::HelpFunc(ComTerp* comterp) : ComFunc(comterp) {
***************
*** 130,146 ****
    std::strstreambuf sbuf;
  #if __GNUC__<3
    filebuf fbuf;
!   if (comterp()->handler()) {
      int fd = Math::max(1, comterp()->handler()->get_handle());
      fbuf.attach(fd);
    } 
!   ostream outs( comterp()->handler() ? ((streambuf*)&fbuf) : (streambuf*)&sbuf );
    ostream *out = &outs;
  #else
!   fileptr_filebuf fbuf(comterp()->handler() && comterp()->handler()->wrfptr()
  	       ? comterp()->handler()->wrfptr() : stdout, ios_base::out);
  #if 1
!   ostream outs(comterp()->handler() ? (streambuf*)&fbuf : (streambuf*)&sbuf);
  #else
    ostream outs((streambuf*)&fbuf);
  #endif
--- 132,148 ----
    std::strstreambuf sbuf;
  #if __GNUC__<3
    filebuf fbuf;
!   if (comterp()->handler() && HELPOUT) {
      int fd = Math::max(1, comterp()->handler()->get_handle());
      fbuf.attach(fd);
    } 
!   ostream outs( (comterp()->handler() && HELPOUT) ? ((streambuf*)&fbuf) : (streambuf*)&sbuf );
    ostream *out = &outs;
  #else
!   fileptr_filebuf fbuf((comterp()->handler() && HELPOUT) && comterp()->handler()->wrfptr()
  	       ? comterp()->handler()->wrfptr() : stdout, ios_base::out);
  #if 1
!   ostream outs((comterp()->handler() && HELPOUT) ? (streambuf*)&fbuf : (streambuf*)&sbuf);
  #else
    ostream outs((streambuf*)&fbuf);
  #endif
***************
*** 229,235 ****
    }
  
  
!   if (!comterp()->handler()) {
      *out << '\0';
      int help_str_symid = symbol_add(sbuf.str());
      ComValue retval(sbuf.str()); 
--- 231,237 ----
    }
  
  
!   if (!comterp()->handler() || !HELPOUT) {
      *out << '\0';
      int help_str_symid = symbol_add(sbuf.str());
      ComValue retval(sbuf.str()); 
Index: DrawServ/drawcomps.h
diff -c DrawServ/drawcomps.h:1.2 DrawServ/drawcomps.h:1.3
*** DrawServ/drawcomps.h:1.2	Sun Sep 23 09:11:36 2007
--- src/DrawServ/drawcomps.h	Fri Oct 12 08:11:30 2007
***************
*** 54,59 ****
--- 54,61 ----
      void AppendEdge(EdgeComp*);
      // add edge component to the graph.
  
+     UList* GraphEdges() { return _graphedges; }
+ 
  protected:
      UList* _graphedges;
      int _num_edge;
Index: GraphUnidraw/nodecomp.c
diff -c GraphUnidraw/nodecomp.c:1.5 GraphUnidraw/nodecomp.c:1.6
*** GraphUnidraw/nodecomp.c:1.5	Sat Oct  6 11:10:37 2007
--- src/GraphUnidraw/nodecomp.c	Fri Oct 12 08:11:29 2007
***************
*** 1323,1325 ****
--- 1323,1343 ----
          return 0;
      }
  }
+ 
+ void NodeComp::nedges(int &nin, int &nout) const {
+   nin = 0;
+   nout = 0;
+ 
+   TopoNode* toponode = Node();
+   if (toponode) {
+     Iterator it;
+     toponode->first(it);
+     while (!toponode->done(it)) {
+       TopoEdge* edge = toponode->get_edge(it);
+       if (edge && edge->end_node()==toponode) nin++;
+       if (edge && edge->start_node()==toponode) nout++;
+       toponode->next(it);
+     }
+   } 
+ }
+ 
Index: GraphUnidraw/nodecomp.h
diff -c GraphUnidraw/nodecomp.h:1.4 GraphUnidraw/nodecomp.h:1.5
*** GraphUnidraw/nodecomp.h:1.4	Sat Oct  6 11:10:37 2007
--- src/GraphUnidraw/nodecomp.h	Fri Oct 12 08:11:29 2007
***************
*** 146,151 ****
--- 146,154 ----
      EdgeComp* EdgeOut(int n) const;
      // return pointer to nth outgoing edge.
  
+     void nedges (int &nin, int &nout) const;
+     // count number of input and ouput edges
+ 
      EdgeComp* EdgeByDir(int n, boolean out_edge) const;
      // return pointer to nth edge of given direction.
  
*** /dev/null	 Fri Oct 12 08:11:33 PDT 2007
--- patches/ivtools-071012-johnston-005
*************** patches/ivtools-071012-johnston-005
*** 0 ****
--- 1 ----
+ ivtools-071012-johnston-005

--Apple-Mail-5-869486645
Content-Disposition: attachment;
	filename=ivtools-071107-johnston-007
Content-Type: application/octet-stream; x-unix-mode=0644;
	name="ivtools-071107-johnston-007"
Content-Transfer-Encoding: 7bit

Patch:    ivtools-071107-johnston-007
For:      ivtools-1.2
Author:   [email protected]
Subject:  
Requires: 

This is an intermediate patch to ivtools-1.2.  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/paramlist.c
diff -c Attribute/paramlist.c:1.1 Attribute/paramlist.c:1.2
*** Attribute/paramlist.c:1.1	Wed Aug 29 10:37:46 2007
--- src/Attribute/paramlist.c	Wed Nov  7 07:55:07 2007
***************
*** 386,392 ****
  	    }
  	}
      }
!     return in.good() ? 0 : -1;
  }
  
  int ParamList::read_float(istream& in, void* addr1, void* addr2, void* addr3, void* addr4) {
--- 386,392 ----
  	    }
  	}
      }
!     return (in.good()||in.eof()) ? 0 : -1;
  }
  
  int ParamList::read_float(istream& in, void* addr1, void* addr2, void* addr3, void* addr4) {
***************
*** 408,414 ****
  	    }
  	}
      }
!     return in.good() ? 0 : -1;
  }
   
  int ParamList::read_double(istream& in, void* addr1, void* addr2, void* addr3, void* addr4) {
--- 408,414 ----
  	    }
  	}
      }
!     return (in.good()||in.eof()) ? 0 : -1;
  }
   
  int ParamList::read_double(istream& in, void* addr1, void* addr2, void* addr3, void* addr4) {
***************
*** 430,436 ****
  	    }
  	}
      }
!     return in.good() ? 0 : -1;
  }
   
  int ParamList::read_string(istream& in, void* addr1, void* addr2, void* addr3, void* addr4) {
--- 430,436 ----
  	    }
  	}
      }
!     return (in.good()||in.eof()) ? 0 : -1;
  }
   
  int ParamList::read_string(istream& in, void* addr1, void* addr2, void* addr3, void* addr4) {
***************
*** 453,459 ****
  	    }
  	}
      }
!     return in.good() ? 0 : -1;
  }
   
  int ParamList::read_ints (istream& in, void* addr1, void* addr2, void* addr3, void* addr4) {
--- 453,459 ----
  	    }
  	}
      }
!     return (in.good()||in.eof()) ? 0 : -1;
  }
   
  int ParamList::read_ints (istream& in, void* addr1, void* addr2, void* addr3, void* addr4) {
***************
*** 481,487 ****
      
      *(int**)addr1 = nums;
      *(int*)addr2 = n;
!     return in.good() ? 0 : -1;
  }
  
  int ParamList::read_floats (istream& in, void* addr1, void* addr2, void* addr3, void* addr4) {
--- 481,487 ----
      
      *(int**)addr1 = nums;
      *(int*)addr2 = n;
!     return (in.good()||in.eof()) ? 0 : -1;
  }
  
  int ParamList::read_floats (istream& in, void* addr1, void* addr2, void* addr3, void* addr4) {
***************
*** 509,515 ****
      
      *(float**)addr1 = nums;
      *(int*)addr2 = n;
!     return in.good() ? 0 : -1;
  }
  
  int ParamList::read_doubles (istream& in, void* addr1, void* addr2, void* addr3, void* addr4) {
--- 509,515 ----
      
      *(float**)addr1 = nums;
      *(int*)addr2 = n;
!     return (in.good()||in.eof()) ? 0 : -1;
  }
  
  int ParamList::read_doubles (istream& in, void* addr1, void* addr2, void* addr3, void* addr4) {
***************
*** 537,543 ****
      
      *(double**)addr1 = nums;
      *(int*)addr2 = n;
!     return in.good() ? 0 : -1;
  }
  
  int ParamList::read_strings (istream& in, void* addr1, void* addr2, void* addr3, void* addr4) {
--- 537,543 ----
      
      *(double**)addr1 = nums;
      *(int*)addr2 = n;
!     return (in.good()||in.eof()) ? 0 : -1;
  }
  
  int ParamList::read_strings (istream& in, void* addr1, void* addr2, void* addr3, void* addr4) {
***************
*** 567,573 ****
      
      *(char***)addr1 = strings;
      *(int*)addr2 = n;
!     return in.good() ? 0 : -1;
  }
  
  int ParamList::skip_space (istream& in) {
--- 567,573 ----
      
      *(char***)addr1 = strings;
      *(int*)addr2 = n;
!     return (in.good()||in.eof()) ? 0 : -1;
  }
  
  int ParamList::skip_space (istream& in) {
***************
*** 575,581 ****
      while(isspace(ch=in.get()) && in.good());
      if (in.good())
  	in.putback(ch);
!     return in.good() ? 0 : -1;
  }
  
  int ParamList::parse_token (istream& in, char* buf, int buflen, char delim) {
--- 575,581 ----
      while(isspace(ch=in.get()) && in.good());
      if (in.good())
  	in.putback(ch);
!     return (in.good()||in.eof()) ? 0 : -1;
  }
  
  int ParamList::parse_token (istream& in, char* buf, int buflen, char delim) {
***************
*** 589,595 ****
      if (in.good() /* && ch != ')' */ )
  	in.putback(ch);
      buf[cnt] = '\0';
!     return in.good() && (ch==delim || ch==')') ? 0 : -1;
  }
  
  int ParamList::parse_token (istream& in, char* buf, int buflen, char* delim) {
--- 589,595 ----
      if (in.good() /* && ch != ')' */ )
  	in.putback(ch);
      buf[cnt] = '\0';
!     return (in.good()||in.eof()) && (ch==delim || ch==')') ? 0 : -1;
  }
  
  int ParamList::parse_token (istream& in, char* buf, int buflen, char* delim) {
***************
*** 603,609 ****
      if (in.good() /* && ch != ')' */ )
  	in.putback(ch);
      buf[cnt] = '\0';
!     return in.good() && (strchr(delim,ch) || ch==')') ? 0 : -1;
  }
  
  int ParamList::parse_string (istream& in, char* buf, int buflen, boolean keep_backslashes) {
--- 603,609 ----
      if (in.good() /* && ch != ')' */ )
  	in.putback(ch);
      buf[cnt] = '\0';
!     return (in.good()||in.eof()) && (strchr(delim,ch) || ch==')') ? 0 : -1;
  }
  
  int ParamList::parse_string (istream& in, char* buf, int buflen, boolean keep_backslashes) {
***************
*** 621,627 ****
          }
          buf[cnt] = '\0';
      }
!     return in.good() && curr_ch == '"' ? 0 : -1;
  }
  
  int ParamList::parse_points (istream& in, Coord*& x, Coord*& y, int& n) {
--- 621,627 ----
          }
          buf[cnt] = '\0';
      }
!     return (in.good()||in.eof()) && curr_ch == '"' ? 0 : -1;
  }
  
  int ParamList::parse_points (istream& in, Coord*& x, Coord*& y, int& n) {
***************
*** 660,666 ****
      } while ((ch = in.get()) == ',' && in.good());
      if (in.good()) in.putback(ch);
      
!     return in.good() ? 0 : -1;
  }
  
  int ParamList::parse_fltpts (istream& in, float*& x, float*& y, int& n) {
--- 660,666 ----
      } while ((ch = in.get()) == ',' && in.good());
      if (in.good()) in.putback(ch);
      
!     return (in.good()||in.eof()) ? 0 : -1;
  }
  
  int ParamList::parse_fltpts (istream& in, float*& x, float*& y, int& n) {
***************
*** 699,705 ****
      } while ((ch = in.get()) == ',' && in.good());
      if (in.good()) in.putback(ch);
      
!     return in.good() ? 0 : -1;
  }
  
  int ParamList::parse_dblpts (istream& in, double*& x, double*& y, int& n) {
--- 699,705 ----
      } while ((ch = in.get()) == ',' && in.good());
      if (in.good()) in.putback(ch);
      
!     return (in.good()||in.eof()) ? 0 : -1;
  }
  
  int ParamList::parse_dblpts (istream& in, double*& x, double*& y, int& n) {
***************
*** 738,744 ****
      } while ((ch = in.get()) == ',' && in.good());
      if (in.good()) in.putback(ch);
      
!     return in.good() ? 0 : -1;
  }
  
  int ParamList::parse_text(istream& in, char* buffer, int buflen) {
--- 738,744 ----
      } while ((ch = in.get()) == ',' && in.good());
      if (in.good()) in.putback(ch);
      
!     return (in.good()||in.eof()) ? 0 : -1;
  }
  
  int ParamList::parse_text(istream& in, char* buffer, int buflen) {
***************
*** 773,779 ****
      }
      in.putback(c);
      stext.Insert(stext.Length(), &null, 1);
!     return in.good() ? 0 : -1;
  }
  
  char* ParamList::parse_textbuf(istream& in) {
--- 773,779 ----
      }
      in.putback(c);
      stext.Insert(stext.Length(), &null, 1);
!     return (in.good()||in.eof()) ? 0 : -1;
  }
  
  char* ParamList::parse_textbuf(istream& in) {
Index: ComUnidraw/comeditor.c
diff -c ComUnidraw/comeditor.c:1.1 ComUnidraw/comeditor.c:1.2
*** ComUnidraw/comeditor.c:1.1	Wed Aug 29 10:38:54 2007
--- src/ComUnidraw/comeditor.c	Wed Nov  7 07:55:13 2007
***************
*** 225,230 ****
--- 225,231 ----
      comterp->add_command("pflush", new PixelFlushFunc(comterp, this));
      comterp->add_command("pclip", new PixelClipFunc(comterp, this));
      comterp->add_command("alpha", new AlphaTransFunc(comterp, this));
+ 
  }
  
  /* virtual */ void ComEditor::ExecuteCmd(Command* cmd) {
Index: ComUnidraw/grfunc.c
diff -c ComUnidraw/grfunc.c:1.2 ComUnidraw/grfunc.c:1.3
*** ComUnidraw/grfunc.c:1.2	Sun Sep 23 09:11:33 2007
--- src/ComUnidraw/grfunc.c	Wed Nov  7 07:55:13 2007
***************
*** 29,34 ****
--- 29,35 ----
  #include <ComTerp/comterp.h>
  
  #include <OverlayUnidraw/ovarrow.h>
+ #include <OverlayUnidraw/ovclasses.h>
  #include <OverlayUnidraw/oved.h>
  #include <OverlayUnidraw/ovcmds.h>
  #include <OverlayUnidraw/ovselection.h>
***************
*** 1302,1306 ****
      }
  }
  
- 
- 
--- 1303,1305 ----
Index: OverlayUnidraw/ovcomps.c
diff -c OverlayUnidraw/ovcomps.c:1.2 OverlayUnidraw/ovcomps.c:1.3
*** OverlayUnidraw/ovcomps.c:1.2	Sun Sep 30 13:49:19 2007
--- src/OverlayUnidraw/ovcomps.c	Wed Nov  7 07:55:12 2007
***************
*** 397,402 ****
--- 397,438 ----
    }
  }
  
+ boolean OverlayComp::IsPrev(OverlayComp* prev) {
+   OverlaysComp* parent = (OverlaysComp*)GetParent();
+   if (!parent) return false;
+   Iterator it;
+   parent->First(it);
+   while (parent->GetComp(it) != this) parent->Next(it);
+   parent->Prev(it);
+   return !parent->Done(it) && parent->GetComp(it)==prev;
+ }
+ 
+ boolean OverlayComp::IsNext(OverlayComp* next) {
+   OverlaysComp* parent = (OverlaysComp*)GetParent();
+   if (!parent) return false;
+   Iterator it;
+   parent->First(it);
+   while (parent->GetComp(it) != this) parent->Next(it);
+   parent->Next(it);
+   return !parent->Done(it) && parent->GetComp(it)==next;
+ }
+ 
+ boolean OverlayComp::IsParent(OverlayComp* parent) {
+   return parent==GetParent();
+ }
+ 
+ boolean OverlayComp::IsChild(OverlayComp* parent) {
+   return false;
+ }
+ 
+ OverlayComp* OverlayComp::DepthPrev(OverlayComp*) {
+   return (OverlayComp*) GetParent();
+ }
+ 
+ OverlayComp* OverlayComp::DepthNext(OverlayComp*) {
+   return (OverlayComp*) GetParent();
+ }
+ 
  /*****************************************************************************/
  
  ParamList* OverlaysComp::_overlay_comps_params = nil;
***************
*** 1206,1211 ****
--- 1242,1300 ----
    }
  }
  
+ boolean OverlaysComp::IsChild(OverlayComp* child) {
+   Iterator it;
+   First(it);
+   while (!Done(it) && GetComp(it)!=child) Next(it);
+   return !Done(it);
+ }
+ 
+ OverlayComp* OverlaysComp::DepthPrev(OverlayComp* before) {
+   Iterator it;
+   
+   // move down
+   if (!before || IsParent(before)) {
+     First(it);
+     return (OverlayComp*)GetComp(it);
+   } 
+ 
+   // IsChild(before)
+   else {  
+     First(it);
+     while (GetComp(it)!=before) Prev(it);
+     Prev(it);
+     if (!Done(it)) return (OverlayComp*)GetComp(it);
+   }
+   
+   // or move up
+   OverlaysComp* parent = (OverlaysComp*)GetParent();
+   return parent;
+ }
+ 
+ 
+ OverlayComp* OverlaysComp::DepthNext(OverlayComp* before) {
+   Iterator it;
+   
+   // move down
+   if (!before || IsParent(before)) {
+     First(it);
+     return (OverlayComp*)GetComp(it);
+   } 
+ 
+   // IsChild(before)
+   else {  
+     First(it);
+     while (GetComp(it)!=before) Next(it);
+     Next(it);
+     if (!Done(it)) return (OverlayComp*)GetComp(it);
+   }
+   
+   // or move up
+   OverlaysComp* parent = (OverlaysComp*)GetParent();
+   return parent;
+ }
+ 
+ 
  /*****************************************************************************/
  
  ParamList* OverlayIdrawComp::_overlay_idraw_params = nil;
Index: OverlayUnidraw/ovcomps.h
diff -c OverlayUnidraw/ovcomps.h:1.2 OverlayUnidraw/ovcomps.h:1.3
*** OverlayUnidraw/ovcomps.h:1.2	Sun Sep 30 13:49:19 2007
--- src/OverlayUnidraw/ovcomps.h	Wed Nov  7 07:55:12 2007
***************
*** 161,166 ****
--- 161,181 ----
  
      virtual void DeferredNotify();
      // do all deferred Notify's
+ 
+     virtual boolean IsPrev(OverlayComp*);
+     // true if previous sibling
+     virtual boolean IsNext(OverlayComp*);
+     // true if next sibling
+     virtual boolean IsParent(OverlayComp*);
+     // true if parent
+     virtual boolean IsChild(OverlayComp*);
+     // true if child
+ 
+     virtual OverlayComp* DepthNext(OverlayComp*);
+     // return next node in depth first traversal of tree
+     virtual OverlayComp* DepthPrev(OverlayComp*);
+     // return previous node in depth first traversal of tree
+ 
  protected:
      ParamList* GetParamList();
      // return ParamList of required/optional/keyword arguments to be read
***************
*** 283,288 ****
--- 298,311 ----
      virtual void DeferredNotify();
      // do all deferred Notify's
  
+     virtual boolean IsChild(OverlayComp*);
+     // true if child
+ 
+     virtual OverlayComp* DepthNext(OverlayComp*);
+     // return next node in depth first traversal of tree
+     virtual OverlayComp* DepthPrev(OverlayComp*);
+     // return previous node in depth first traversal of tree
+ 
  protected:
      OverlayComp* Comp(UList*);
      UList* Elem(Iterator);
***************
*** 303,309 ****
      // group everything in the clipboard into a new OverlaysComp
      void Ungroup(OverlayComp*, Clipboard*, Command*);
      // ungroup everything in an OverlaysComp into the clipboard.
! 
  protected:
      ParamList* GetParamList();
      void GrowParamList(ParamList*);
--- 326,332 ----
      // group everything in the clipboard into a new OverlaysComp
      void Ungroup(OverlayComp*, Clipboard*, Command*);
      // ungroup everything in an OverlaysComp into the clipboard.
!     
  protected:
      ParamList* GetParamList();
      void GrowParamList(ParamList*);
Index: src_dispatch/dispatcher.c
diff -c src_dispatch/dispatcher.c:1.1 src_dispatch/dispatcher.c:1.2
*** src_dispatch/dispatcher.c:1.1	Wed Aug 29 10:38:01 2007
--- src/Dispatch/dispatcher.c	Wed Nov  7 07:55:09 2007
***************
*** 72,78 ****
      void zero();
      void setBit(int);
      void clrBit(int);
!     boolean isSet(int) const;
      boolean anySet() const;
      int numSet() const;
  };
--- 72,78 ----
      void zero();
      void setBit(int);
      void clrBit(int);
!     boolean isSet(int);
      boolean anySet() const;
      int numSet() const;
  };
***************
*** 84,90 ****
  void FdMask::zero() { Memory::zero(this, sizeof(FdMask)); }
  void FdMask::setBit(int fd) { FD_SET(fd,this); }
  void FdMask::clrBit(int fd) { FD_CLR(fd,this); }
! boolean FdMask::isSet(int fd) const { return FD_ISSET(fd,this); }
  
  boolean FdMask::anySet() const {
      const int mskcnt = howmany(FD_SETSIZE,NFDBITS);
--- 84,90 ----
  void FdMask::zero() { Memory::zero(this, sizeof(FdMask)); }
  void FdMask::setBit(int fd) { FD_SET(fd,this); }
  void FdMask::clrBit(int fd) { FD_CLR(fd,this); }
! boolean FdMask::isSet(int fd) { return FD_ISSET(fd,this); }
  
  boolean FdMask::anySet() const {
      const int mskcnt = howmany(FD_SETSIZE,NFDBITS);
Index: src_os/string.c
diff -c src_os/string.c:1.1 src_os/string.c:1.2
*** src_os/string.c:1.1	Wed Aug 29 10:37:58 2007
--- src/OS/string.c	Wed Nov  7 07:55:08 2007
***************
*** 41,46 ****
--- 41,47 ----
      extern wchar_t toupper(wchar_t);
  #endif
  #else
+ #if !defined(__APPLE__)
  #ifndef tolower
      extern int tolower(int);
  #endif
***************
*** 48,53 ****
--- 49,55 ----
      extern int toupper(int);
  #endif
  #endif
+ #endif
      extern long int strtol(const char*, char**, int);
      extern double strtod(const char*, char**);
  }
Index: top_ivtools/INSTALL
diff -c top_ivtools/INSTALL:1.2 top_ivtools/INSTALL:1.3
*** top_ivtools/INSTALL:1.2	Sun Sep 23 09:11:24 2007
--- ./INSTALL	Wed Nov  7 07:55:06 2007
***************
*** 82,88 ****
  	cp config-linux.h config.h  # substitute appropriate OS name
  	cd ../include/makeinclude
  	cp platform_linux.GNU platform_macros.GNU  # substitute OS	
! 	emacs platform_macros.GNU   # add "threads = 0" near top of file
  	cd ../../ace
  	make
  
--- 82,88 ----
  	cp config-linux.h config.h  # substitute appropriate OS name
  	cd ../include/makeinclude
  	cp platform_linux.GNU platform_macros.GNU  # substitute OS	
! 	emacs platform_macros.GNU   # add "threads = 0" near top of file, step may no longer be needed
  	cd ../../ace
  	make
  
*** /dev/null	 Wed Nov 7 07:55:16 PST 2007
--- patches/ivtools-071107-johnston-007
*************** patches/ivtools-071107-johnston-007
*** 0 ****
--- 1 ----
+ ivtools-071107-johnston-007

--Apple-Mail-5-869486645
Content-Disposition: attachment;
	filename=ivtools-070923-johnston-000
Content-Type: application/octet-stream; x-unix-mode=0644;
	name="ivtools-070923-johnston-000"
Content-Transfer-Encoding: 7bit

Patch:    ivtools-070923-johnston-000
For:      ivtools-1.2
Author:   [email protected]
Subject:  leading up to 1.2.5
Requires: 

This is an intermediate patch to ivtools-1.2.  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/attrlist.c
diff -c Attribute/attrlist.c:1.1 Attribute/attrlist.c:1.2
*** Attribute/attrlist.c:1.1	Wed Aug 29 10:37:46 2007
--- src/Attribute/attrlist.c	Sun Sep 23 09:11:26 2007
***************
*** 41,46 ****
--- 41,54 ----
  
  #include <IV-2_6/_enter.h>
  
+ #define LEAKCHECK
+ 
+ #ifdef LEAKCHECK
+ #include <ivstd/leakchecker.h>
+ LeakChecker AttributeValueListchecker("AttributeValueList");
+ #endif
+ 
+ 
  /*****************************************************************************/
  
  int AttributeList::_symid = -1;
***************
*** 298,303 ****
--- 306,314 ----
  /*****************************************************************************/
  
  AttributeValueList::AttributeValueList (AttributeValueList* s) {
+ #ifdef LEAKCHECK
+     AttributeValueListchecker.create();
+ #endif
      _alist = new AList;
      _count = 0;
      if (s != nil) {
***************
*** 311,316 ****
--- 322,330 ----
  }
  
  AttributeValueList::~AttributeValueList () { 
+ #ifdef LEAKCHECK
+     AttributeValueListchecker.destroy();
+ #endif
      if (_alist) {
          ALIterator i;
  	for (First(i); !Done(i); Next(i)) {
***************
*** 425,430 ****
--- 439,447 ----
  	    case AttributeValue::DoubleType:
  	        out << attrval->double_ref();
  	        break;
+ 	    case AttributeValue::BooleanType:
+ 	        out << attrval->boolean_ref();
+ 	        break;
              default:
  		out << "Unknown type";
  	        break;
Index: Attribute/attrvalue.c
diff -c Attribute/attrvalue.c:1.1 Attribute/attrvalue.c:1.2
*** Attribute/attrvalue.c:1.1	Wed Aug 29 10:37:46 2007
--- src/Attribute/attrvalue.c	Sun Sep 23 09:11:26 2007
***************
*** 35,95 ****
--- 35,134 ----
  #include <stdio.h>
  #include <string.h>
  
+ #define LEAKCHECK
+ 
+ #ifdef LEAKCHECK
+ #include <ivstd/leakchecker.h>
+ LeakChecker AttributeValuechecker("AttributeValue");
+ #endif
+ 
+ 
  /*****************************************************************************/
  
  int* AttributeValue::_type_syms = nil;
  
  AttributeValue::AttributeValue(ValueType valtype) {
+ #ifdef LEAKCHECK
+     AttributeValuechecker.create();
+ #endif
      clear();
      type(valtype);
  }
  
  AttributeValue::AttributeValue(ValueType valtype, attr_value value) {
+ #ifdef LEAKCHECK
+     AttributeValuechecker.create();
+ #endif
      clear();
      type(valtype);
      _v = value;
+     ref_as_needed();
  }
  
  AttributeValue::AttributeValue(AttributeValue& sv) {
+ #ifdef LEAKCHECK
+     AttributeValuechecker.create();
+ #endif
      *this = sv;
  }
  
  AttributeValue::AttributeValue(AttributeValue* sv) {
+ #ifdef LEAKCHECK
+     AttributeValuechecker.create();
+ #endif
      *this = *sv;
      dup_as_needed();
  }
  
  AttributeValue::AttributeValue() {
+ #ifdef LEAKCHECK
+     AttributeValuechecker.create();
+ #endif
      clear();
      type(UnknownType);
      _command_symid = -1;
  }
  
  AttributeValue::AttributeValue(unsigned char v) { 
+ #ifdef LEAKCHECK
+     AttributeValuechecker.create();
+ #endif
      clear();
      _type = AttributeValue::UCharType;
      _v.ucharval = v;
  }
  
  AttributeValue::AttributeValue(char v) { 
+ #ifdef LEAKCHECK
+     AttributeValuechecker.create();
+ #endif
      clear();
      _type = AttributeValue::CharType;
      _v.charval = v;
  }
  
  AttributeValue::AttributeValue(unsigned short v) { 
+ #ifdef LEAKCHECK
+     AttributeValuechecker.create();
+ #endif
      clear();
      _type = AttributeValue::UShortType;
      _v.ushortval = v;
  }
  
  AttributeValue::AttributeValue(short v) { 
+ #ifdef LEAKCHECK
+     AttributeValuechecker.create();
+ #endif
      clear();
      _type = AttributeValue::ShortType;
      _v.shortval = v;
  }
  
  AttributeValue::AttributeValue(unsigned int v, ValueType type) { 
+ #ifdef LEAKCHECK
+     AttributeValuechecker.create();
+ #endif
      clear();
      _type = type;
      if ( type >= CharType && type <= UShortType ) {
***************
*** 112,117 ****
--- 151,159 ----
  }
  
  AttributeValue::AttributeValue(unsigned int kv, unsigned int kn, ValueType type) { 
+ #ifdef LEAKCHECK
+     AttributeValuechecker.create();
+ #endif
      clear();
      _type = type;
      _v.keyval.keyid = kv;
***************
*** 119,124 ****
--- 161,169 ----
  }
  
  AttributeValue::AttributeValue(int v, ValueType type) { 
+ #ifdef LEAKCHECK
+     AttributeValuechecker.create();
+ #endif
      clear();
      _type = type;
      if ( type >= CharType && type <= UShortType ) {
***************
*** 141,170 ****
--- 186,230 ----
  }
  
  AttributeValue::AttributeValue(unsigned long v) { 
+ #ifdef LEAKCHECK
+     AttributeValuechecker.create();
+ #endif
      clear();
      _type = AttributeValue::ULongType;
      _v.lnunsval = v;
  }
  
  AttributeValue::AttributeValue(long v) { 
+ #ifdef LEAKCHECK
+     AttributeValuechecker.create();
+ #endif
      clear();
      _type = AttributeValue::LongType;
      _v.lnintval = v;
  }
  
  AttributeValue::AttributeValue(float v) { 
+ #ifdef LEAKCHECK
+     AttributeValuechecker.create();
+ #endif
      clear();
      _type = AttributeValue::FloatType;
      _v.floatval = v;
  }
  
  AttributeValue::AttributeValue(double v) { 
+ #ifdef LEAKCHECK
+     AttributeValuechecker.create();
+ #endif
      clear();
      _type = AttributeValue::DoubleType;
      _v.doublval = v;
  }
  
  AttributeValue::AttributeValue(int classid, void* ptr) { 
+ #ifdef LEAKCHECK
+     AttributeValuechecker.create();
+ #endif
      _type = AttributeValue::ObjectType;
      _v.objval.ptr = ptr;
      _v.objval.type = classid;
***************
*** 172,177 ****
--- 232,240 ----
  }
  
  AttributeValue::AttributeValue(AttributeValueList* ptr) { 
+ #ifdef LEAKCHECK
+     AttributeValuechecker.create();
+ #endif
      _type = AttributeValue::ArrayType;
      _v.arrayval.ptr = ptr;
      _v.arrayval.type = 0;
***************
*** 179,184 ****
--- 242,250 ----
  }
  
  AttributeValue::AttributeValue(void* comfuncptr, AttributeValueList* vallist) {
+ #ifdef LEAKCHECK
+     AttributeValuechecker.create();
+ #endif
      _type = AttributeValue::StreamType;
      _v.streamval.funcptr = comfuncptr;
      _v.streamval.listptr = vallist;
***************
*** 186,196 ****
--- 252,268 ----
  }
  
  AttributeValue::AttributeValue(const char* string) { 
+ #ifdef LEAKCHECK
+     AttributeValuechecker.create();
+ #endif
      _type = AttributeValue::StringType;
      _v.dfintval = symbol_add((char*)string);
  }
  
  AttributeValue::~AttributeValue() {
+ #ifdef LEAKCHECK
+     AttributeValuechecker.destroy();
+ #endif
  #if 0  // disable symbol reference counting
      if (_type == StringType || _type == SymbolType) 
          symbol_del(string_val());
***************
*** 207,212 ****
--- 279,286 ----
  }
  
  AttributeValue& AttributeValue::operator= (const AttributeValue& sv) {
+     boolean preserve_flag = same_list(sv);
+     if (!preserve_flag) unref_as_needed();
      void* v1 = &_v;
      const void* v2 = &sv._v;
      memcpy(v1, v2, sizeof(_v));
***************
*** 219,225 ****
      }
      else 
  #endif
!     ref_as_needed();
      return *this;
  }
      
--- 293,299 ----
      }
      else 
  #endif
!     if (!preserve_flag) ref_as_needed();
      return *this;
  }
      
***************
*** 979,984 ****
--- 1053,1060 ----
  }
  
  void AttributeValue::assignval (const AttributeValue& av) {
+     boolean preserve_flag = same_list(av);
+     if (!preserve_flag) unref_as_needed();
      void* v1 = &_v;
      const void* v2 = &av._v;
      memcpy(v1, v2, sizeof(_v));
***************
*** 989,995 ****
  	symbol_add((char *)string_ptr());
      else 
  #endif
!     ref_as_needed();
  }
      
  
--- 1065,1071 ----
  	symbol_add((char *)string_ptr());
      else 
  #endif
!     if (!preserve_flag) ref_as_needed();
  }
      
  
***************
*** 1064,1075 ****
  }
  
  void AttributeValue::unref_as_needed() {
!     if (_type == AttributeValue::ArrayType)
        Resource::unref(_v.arrayval.ptr);
!     else if (_type == AttributeValue::StreamType)
        Resource::unref(_v.streamval.listptr);
  }
  
  void AttributeValue::stream_list(AttributeValueList* list) 
  { 
    if (is_stream()) {
--- 1140,1163 ----
  }
  
  void AttributeValue::unref_as_needed() {
!   if (_type == AttributeValue::ArrayType) {
!       if (_v.arrayval.ptr->refcount_==1) 
! 	fprintf(stderr, "AttributeValue::ArrayType about to be deleted.\n");
        Resource::unref(_v.arrayval.ptr);
!   }
!   else if (_type == AttributeValue::StreamType)
        Resource::unref(_v.streamval.listptr);
  }
  
+ boolean AttributeValue::same_list(const AttributeValue& av) {
+   if (_type == AttributeValue::ArrayType)
+     return _v.arrayval.ptr == av._v.arrayval.ptr;
+   else if (_type == AttributeValue::StreamType)
+     return _v.streamval.listptr == av._v.streamval.listptr;
+   else
+     return false;
+ }
+ 
  void AttributeValue::stream_list(AttributeValueList* list) 
  { 
    if (is_stream()) {
Index: Attribute/attrvalue.h
diff -c Attribute/attrvalue.h:1.1 Attribute/attrvalue.h:1.2
*** Attribute/attrvalue.h:1.1	Wed Aug 29 10:37:46 2007
--- src/Attribute/attrvalue.h	Sun Sep 23 09:11:26 2007
***************
*** 362,375 ****
      void* value_ptr() { return &_v; }
      // returns void* pointer to value struct.
  
- protected:
- 
      void ref_as_needed();
      // increment ref counters as needed
      void unref_as_needed();
      // decrement ref counters as needed
      void dup_as_needed();
      // duplicate lists then increment ref counters as needed
  
      ValueType _type;
      attr_value _v;
--- 362,377 ----
      void* value_ptr() { return &_v; }
      // returns void* pointer to value struct.
  
      void ref_as_needed();
      // increment ref counters as needed
      void unref_as_needed();
      // decrement ref counters as needed
      void dup_as_needed();
      // duplicate lists then increment ref counters as needed
+     boolean same_list(const AttributeValue& av);
+     // check if arrayval or streamval are the same
+ 
+ protected:
  
      ValueType _type;
      attr_value _v;
Index: ComGlyph/comtextview.c
diff -c ComGlyph/comtextview.c:1.1 ComGlyph/comtextview.c:1.2
*** ComGlyph/comtextview.c:1.1	Wed Aug 29 10:38:42 2007
--- src/ComGlyph/comtextview.c	Sun Sep 23 09:11:32 2007
***************
*** 227,233 ****
    comterp()->load_string(bufptr);
    int  status = comterp()->ComTerp::run(false /* !once */, true /* nested */);
    comterp()->linenum()--;
! #if 1
    ComValue result(comterp()->stack_top(1));
  #else
    ComValue result(comterp()->pop_stack());
--- 227,233 ----
    comterp()->load_string(bufptr);
    int  status = comterp()->ComTerp::run(false /* !once */, true /* nested */);
    comterp()->linenum()--;
! #if 0
    ComValue result(comterp()->stack_top(1));
  #else
    ComValue result(comterp()->pop_stack());
Index: ComGlyph/terpdialog.c
diff -c ComGlyph/terpdialog.c:1.1 ComGlyph/terpdialog.c:1.2
*** ComGlyph/terpdialog.c:1.1	Wed Aug 29 10:38:42 2007
--- src/ComGlyph/terpdialog.c	Sun Sep 23 09:11:32 2007
***************
*** 434,440 ****
      else
          sprintf(exprbuf, "%s", expr);
  
!     ComValue& retval = terpserv_->run(exprbuf);
  
      const char* errmsg = terpserv_->errmsg();
      if (*errmsg) {
--- 434,440 ----
      else
          sprintf(exprbuf, "%s", expr);
  
!     ComValue retval(terpserv_->run(exprbuf));
  
      const char* errmsg = terpserv_->errmsg();
      if (*errmsg) {
Index: ComTerp/assignfunc.c
diff -c ComTerp/assignfunc.c:1.1 ComTerp/assignfunc.c:1.2
*** ComTerp/assignfunc.c:1.1	Wed Aug 29 10:37:48 2007
--- src/ComTerp/assignfunc.c	Sun Sep 23 09:11:27 2007
***************
*** 55,64 ****
  					    operand2);
  	    attrlist->add_attribute(attr);
  	    Unref(attrlist);
! 	} else if (operand1.global_flag()) 
  	    comterp()->globaltable()->insert(operand1.symbol_val(), operand2);
! 	else
  	    comterp()->localtable()->insert(operand1.symbol_val(), operand2);
      } else if (operand1.is_object(Attribute::class_symid())) {
        Attribute* attr = (Attribute*)operand1.obj_val();
        attr->Value(operand2);
--- 55,72 ----
  					    operand2);
  	    attrlist->add_attribute(attr);
  	    Unref(attrlist);
! 	} else if (operand1.global_flag()) {
! 	    void* oldval = nil;
! 	    comterp()->globaltable()->find_and_remove(oldval, operand1.symbol_val());
! 	    if (oldval) delete (ComValue*)oldval;
  	    comterp()->globaltable()->insert(operand1.symbol_val(), operand2);
! 	}
! 	else {
! 	    void* oldval = nil;
! 	    comterp()->localtable()->find_and_remove(oldval, operand1.symbol_val());
! 	    if (oldval) delete (ComValue*)oldval;
  	    comterp()->localtable()->insert(operand1.symbol_val(), operand2);
+ 	}
      } else if (operand1.is_object(Attribute::class_symid())) {
        Attribute* attr = (Attribute*)operand1.obj_val();
        attr->Value(operand2);
Index: ComTerp/comfunc.c
diff -c ComTerp/comfunc.c:1.1 ComTerp/comfunc.c:1.2
*** ComTerp/comfunc.c:1.1	Wed Aug 29 10:37:48 2007
--- src/ComTerp/comfunc.c	Sun Sep 23 09:11:27 2007
***************
*** 31,36 ****
--- 31,43 ----
  
  #define TITLE "ComFunc"
  
+ #define LEAKCHECK
+ 
+ #ifdef LEAKCHECK
+ #include <ivstd/leakchecker.h>
+ extern LeakChecker AttributeValuechecker;
+ #endif
+ 
  /*****************************************************************************/
  
  int ComFunc::_symid = -1;
***************
*** 42,50 ****
  void ComFunc::reset_stack() {
    if (!post_eval()) {
      int count = nargs() + nkeys() - npops();
!     for (int i=1; i<=npops(); i++) 
        ((AttributeValue)_comterp->stack_top(i)).AttributeValue::~AttributeValue();
!     
      _comterp->decr_stack(count);
    } else 
      _comterp->decr_stack(1);
--- 49,63 ----
  void ComFunc::reset_stack() {
    if (!post_eval()) {
      int count = nargs() + nkeys() - npops();
!     #if 0 // now done immediately with stack_pop
!     for (int i=1; i<=npops(); i++) {
        ((AttributeValue)_comterp->stack_top(i)).AttributeValue::~AttributeValue();
!         #ifdef LEAKCHECK
! 	AttributeValuechecker.create();
!         #endif
!     }
!     #endif
! 
      _comterp->decr_stack(count);
    } else 
      _comterp->decr_stack(1);
***************
*** 69,75 ****
  		  keyref.keynarg_val())
  		return dflt;
  	    }
! 	    if (!symbol)
  	        argref = _comterp->lookup_symval(argref);
  	    return argref;
  	}
--- 82,88 ----
  		  keyref.keynarg_val())
  		return dflt;
  	    }
! 	    if (!symbol) 
  	        argref = _comterp->lookup_symval(argref);
  	    return argref;
  	}
***************
*** 114,120 ****
      return _comterp->stack_top(n+1+npops());
  }
  
! ComValue& ComFunc::stack_arg_post_eval(int n, boolean symbol, ComValue& dflt) {
    ComValue argoff(comterp()->stack_top());
    int offtop = argoff.int_val()-comterp()->_pfnum;
    int argcnt;
--- 127,133 ----
      return _comterp->stack_top(n+1+npops());
  }
  
! ComValue ComFunc::stack_arg_post_eval(int n, boolean symbol, ComValue& dflt) {
    ComValue argoff(comterp()->stack_top());
    int offtop = argoff.int_val()-comterp()->_pfnum;
    int argcnt;
***************
*** 135,141 ****
    return comterp()->pop_stack(!symbol);
  }
  
! ComValue& ComFunc::stack_key_post_eval
  (int id, boolean symbol, ComValue& dflt, boolean use_dflt_for_no_key) {
    ComValue argoff(comterp()->stack_top());
    int offtop = argoff.int_val()-comterp()->_pfnum;
--- 148,154 ----
    return comterp()->pop_stack(!symbol);
  }
  
! ComValue ComFunc::stack_key_post_eval
  (int id, boolean symbol, ComValue& dflt, boolean use_dflt_for_no_key) {
    ComValue argoff(comterp()->stack_top());
    int offtop = argoff.int_val()-comterp()->_pfnum;
***************
*** 221,234 ****
  			     offtop, -comterp()->_pfnum, argcnt);
  }
  
! ComValue& ComFunc::pop_stack() {
  
      /* get rid of keywords -- use stack_key and stack_arg to get those */
      if (!npops() && nkeys()) {
          int count = nargs() + nkeys();
  	int nkey = nkeys();
          for (int i=0; i<count; i++) {
! 	    ComValue& val = _comterp->pop_stack();
  	    npops()++;
  	    if (val.type() == ComValue::KeywordType) nkey--;
  	    if (nkey==0) break;    
--- 234,247 ----
  			     offtop, -comterp()->_pfnum, argcnt);
  }
  
! ComValue ComFunc::pop_stack() {
  
      /* get rid of keywords -- use stack_key and stack_arg to get those */
      if (!npops() && nkeys()) {
          int count = nargs() + nkeys();
  	int nkey = nkeys();
          for (int i=0; i<count; i++) {
! 	    ComValue val(_comterp->pop_stack());
  	    npops()++;
  	    if (val.type() == ComValue::KeywordType) nkey--;
  	    if (nkey==0) break;    
***************
*** 242,254 ****
          return ComValue::nullval();
  }
  
! ComValue& ComFunc::pop_symbol() {
      /* get rid of keywords -- use stack_key and stack_arg to get those */
      if (!npops() && nkeys()) {
          int count = nargs() + nkeys();
  	int nkey = nkeys();
          for (int i=0; i<count; i++) {
! 	    ComValue& val = _comterp->pop_stack();
  	    npops()++;
  	    if (val.type() == ComValue::KeywordType) nkey--;
  	    if (nkey==0) break;    
--- 255,267 ----
          return ComValue::nullval();
  }
  
! ComValue ComFunc::pop_symbol() {
      /* get rid of keywords -- use stack_key and stack_arg to get those */
      if (!npops() && nkeys()) {
          int count = nargs() + nkeys();
  	int nkey = nkeys();
          for (int i=0; i<count; i++) {
! 	    ComValue val = _comterp->pop_stack();
  	    npops()++;
  	    if (val.type() == ComValue::KeywordType) nkey--;
  	    if (nkey==0) break;    
Index: ComTerp/comfunc.h
diff -c ComTerp/comfunc.h:1.1 ComTerp/comfunc.h:1.2
*** ComTerp/comfunc.h:1.1	Wed Aug 29 10:37:48 2007
--- src/ComTerp/comfunc.h	Sun Sep 23 09:11:27 2007
***************
*** 99,107 ****
      // return ComTerpServ this ComFunc is associated with.
  
  
!     ComValue& pop_stack(); 
      // pop top off the stack.
!     ComValue& pop_symbol();
      // pop top off the stack preserving symbol ids if ComValue is a symbol type.
      void push_stack(ComValue&);
      // push ComValue onto the stack.
--- 99,107 ----
      // return ComTerpServ this ComFunc is associated with.
  
  
!     ComValue pop_stack(); 
      // pop top off the stack.
!     ComValue pop_symbol();
      // pop top off the stack preserving symbol ids if ComValue is a symbol type.
      void push_stack(ComValue&);
      // push ComValue onto the stack.
***************
*** 132,142 ****
      ComValue& stack_dotname(int n);
      // unused method to get at a dotted list of names, i.e. a.b.c
  
!     ComValue& stack_arg_post_eval(int n, boolean symbol=false, 
! 				  ComValue& dflt=ComValue::nullval());
      // evaluate the nth argument for this post-evaluating ComFunc.
  
!     ComValue& stack_key_post_eval(int id, boolean symbol=false, 
  				  ComValue& dflt=ComValue::trueval(), 
  				  boolean use_dflt_for_no_key=false);
      // evaluate the argument following a keyword for this post-evaluating ComFunc.
--- 132,142 ----
      ComValue& stack_dotname(int n);
      // unused method to get at a dotted list of names, i.e. a.b.c
  
!     ComValue stack_arg_post_eval(int n, boolean symbol=false, 
! 				 ComValue& dflt=ComValue::nullval());
      // evaluate the nth argument for this post-evaluating ComFunc.
  
!     ComValue stack_key_post_eval(int id, boolean symbol=false, 
  				  ComValue& dflt=ComValue::trueval(), 
  				  boolean use_dflt_for_no_key=false);
      // evaluate the argument following a keyword for this post-evaluating ComFunc.
Index: ComTerp/comterp.c
diff -c ComTerp/comterp.c:1.1 ComTerp/comterp.c:1.2
*** ComTerp/comterp.c:1.1	Wed Aug 29 10:37:48 2007
--- src/ComTerp/comterp.c	Sun Sep 23 09:11:27 2007
***************
*** 1,5 ****
  /*
!  * Copyright (c) 2001 Scott E. Johnston
   * Copyright (c) 2000 IET Inc.
   * Copyright (c) 1994-1998 Vectaport Inc.
   *
--- 1,5 ----
  /*
!  * Copyright (c) 2001-2007 Scott E. Johnston
   * Copyright (c) 2000 IET Inc.
   * Copyright (c) 1994-1998 Vectaport Inc.
   *
***************
*** 75,83 ****
--- 75,92 ----
  #include <fstream.h>
  #endif
  
+ #define LEAKCHECK
+ 
+ #ifdef LEAKCHECK
+ #include <ivstd/leakchecker.h>
+ extern LeakChecker AttributeValuechecker;
+ #endif
+ 
  #define TITLE "ComTerp"
  #define STREAM_MECH
  
+ extern int _detail_matched_delims;
+ 
  implementTable(ComValueTable,int,void*)
  
  ComTerp* ComTerp::_instance = nil;
***************
*** 150,155 ****
--- 159,166 ----
      _trace_mode = 0;
      _npause = 0;
      _stepflag = 0;
+     _echo_postfix = 0;
+     _delim_func;
  
  }
  
***************
*** 177,182 ****
--- 188,195 ----
  
      _pfoff = 0;
      save_parser_client();    
+     postfix_echo();
+ 
      return status==0 && _pfbuf[_pfnum-1].type != TOK_EOF && _buffer[0] != '\0';
  }
  
***************
*** 260,267 ****
        }
      if (has_streams) {
        AttributeValueList* avl = new AttributeValueList();
!       for(int i=0; i<sv.narg()+sv.nkey(); i++)
! 	avl->Prepend(new AttributeValue(pop_stack(true)));
        ComValue val(sv.obj_val(), avl);
        val.stream_mode(1); // for external use
        push_stack(val);
--- 273,282 ----
        }
      if (has_streams) {
        AttributeValueList* avl = new AttributeValueList();
!       for(int i=0; i<sv.narg()+sv.nkey(); i++) {
! 	ComValue topval(pop_stack(true));
! 	avl->Prepend(new AttributeValue(topval));
!       }
        ComValue val(sv.obj_val(), avl);
        val.stream_mode(1); // for external use
        push_stack(val);
***************
*** 277,282 ****
--- 292,301 ----
        func->push_funcstate(1, 0, pedepth, func->funcid());
      } else {   
        func = (ComFunc*)sv.obj_val();
+       if (_delim_func && sv.nids()!=1) {
+ 	ComValue nameval(sv.command_symid(), ComValue::SymbolType);
+ 	push_stack(nameval);  // this assumes it will be immediately popped off the stack
+       } 
        func->push_funcstate(sv.narg(), sv.nkey(), 
  			   pedepth, sv.command_symid());
      }
***************
*** 681,688 ****
      unsigned int command_symid = sv->int_val();
      localtable()->find(vptr, command_symid);
  
      /* handle case where symbol has arguments/keywords, but is not defined */
!     if (!vptr && (sv->narg() || sv->nkey())) {
        static int nil_symid = symbol_add("nil");
        localtable()->find(vptr, nil_symid);
      }
--- 700,728 ----
      unsigned int command_symid = sv->int_val();
      localtable()->find(vptr, command_symid);
  
+     /* handle case where symbol has matched parens, and things are set up to invoke a delim-specific func. */
+     if (!vptr && _delim_func && sv->nids() != 1) {
+       if (sv->nids() == TOK_RPAREN) {
+ 	static int parens_symid =  symbol_add("()");
+ 	localtable()->find(vptr, parens_symid);
+       }
+       if (sv->nids() == TOK_RBRACKET) {
+ 	static int brackets_symid =  symbol_add("[]");
+ 	localtable()->find(vptr, brackets_symid);
+       }
+       else if (sv->nids() == TOK_RBRACE) {
+ 	static int braces_symid =  symbol_add("{}");
+ 	localtable()->find(vptr, braces_symid);
+       }
+       else if (sv->nids() == TOK_RANGBRACK) {
+ 	static int anglebrackets_symid =  symbol_add("<>");
+ 	localtable()->find(vptr, anglebrackets_symid);
+       }
+       command_symid = sv->symbol_val();
+     }
+ 
      /* handle case where symbol has arguments/keywords, but is not defined */
!     else if (!vptr && (sv->narg() || sv->nkey())) {
        static int nil_symid = symbol_add("nil");
        localtable()->find(vptr, nil_symid);
      }
***************
*** 707,712 ****
--- 747,758 ----
  	}
      } 
      _stack_top++;
+ 
+     if (_stack_top<0) {
+       fprintf(stderr, "warning: comterp stack still empty after push\n");
+       return;
+     }
+ 
      ComValue* sv = _stack + _stack_top;
      *sv = ComValue(value);
      if (sv->type() == ComValue::KeywordType)
***************
*** 745,760 ****
      for (int i=0; i<n && _stack_top>=0; i++) {
          ComValue& stacktop = _stack[_stack_top--];
  	stacktop.AttributeValue::~AttributeValue();
      }
  }
  
! ComValue& ComTerp::pop_stack(boolean lookupsym) {
    if (!stack_empty()) {
      ComValue& stacktop = _stack[_stack_top--];
      if (lookupsym)
!       return lookup_symval(stacktop);
      else 
!       return stacktop;
    } else {
      cerr << "stack empty, blank returned\n";
      return ComValue::blankval();
--- 791,815 ----
      for (int i=0; i<n && _stack_top>=0; i++) {
          ComValue& stacktop = _stack[_stack_top--];
  	stacktop.AttributeValue::~AttributeValue();
+         #ifdef LEAKCHECK // destructor called where constructor never called
+ 	AttributeValuechecker.create();
+         #endif
      }
  }
  
! ComValue ComTerp::pop_stack(boolean lookupsym) {
    if (!stack_empty()) {
      ComValue& stacktop = _stack[_stack_top--];
+     ComValue topval(stacktop);
+     stacktop.AttributeValue::~AttributeValue();
+     #ifdef LEAKCHECK  // destructor called where constructor never called
+     AttributeValuechecker.create();
+     #endif
      if (lookupsym)
!       return lookup_symval(topval);
      else 
!       return topval;
! 
    } else {
      cerr << "stack empty, blank returned\n";
      return ComValue::blankval();
***************
*** 947,959 ****
          if (errbuf_save[0]) strcpy(_errbuf, errbuf_save);
        }
      }
!     if (!nested) 
!       _stack_top = -1;
      if (one_expr) break;
    }
    if (status==1 && _pfnum==0) status=2;
    if (status==1 && !errorflag) status=3;
!   if (nested && status!=2) _stack_top--;
    if (errno == EPIPE) {
      status = -1;
      fprintf(stderr, "broken pipe detected: comterp quit\n");
--- 1002,1016 ----
          if (errbuf_save[0]) strcpy(_errbuf, errbuf_save);
        }
      }
!     if (!nested)
!       decr_stack(_stack_top+1);
      if (one_expr) break;
    }
    if (status==1 && _pfnum==0) status=2;
    if (status==1 && !errorflag) status=3;
!   #if 0 // has to be dealt with a different way
!   if (nested && status!=2) pop_stack();
!   #endif
    if (errno == EPIPE) {
      status = -1;
      fprintf(stderr, "broken pipe detected: comterp quit\n");
***************
*** 1437,1439 ****
--- 1494,1550 ----
  }
  
  boolean ComTerp::stack_empty() { return _stack_top<0; }
+ 
+ void ComTerp::postfix_echo() {
+   if (!_echo_postfix) return;
+   // print everything in the _pfbuf for this function
+ #if __GNUC__<3
+   filebuf fbuf;
+   if (handler()) {
+     int fd = Math::max(1, handler()->get_handle());
+     fbuf.attach(fd);
+   } else
+     fbuf.attach(fileno(stdout));
+ #else
+   fileptr_filebuf fbuf(handler() && handler()->wrfptr()
+ 	       ? handler()->wrfptr() : stdout, ios_base::out);
+ #endif
+   ostream out(&fbuf);
+  
+   boolean oldbrief = brief();
+   brief(true);
+ 
+   ComValue val;
+   for (int i=0; i<_pfnum; i++) {
+     ComValue val;
+     token_to_comvalue(_pfbuf+i, &val);
+     val.comterp(this);
+     out << val;
+     if (val.is_type(AttributeValue::CommandType) ||
+        (_detail_matched_delims && val.is_type(AttributeValue::SymbolType) && 
+ 	val.nids() >= TOK_RPAREN )) {
+       if (!_detail_matched_delims) {
+ 	out << "[" << val.narg() << "|" << val.nkey() << "]";
+ 	ComFunc* func = (ComFunc*)val.obj_val();
+ 	if (func->post_eval()) out << "*";
+       } else {
+ 	char ldelim, rdelim;
+ 	if (val.nids()==TOK_RPAREN) {ldelim = '('; rdelim = ')'; }
+ 	else if (val.nids()==TOK_RBRACKET) {ldelim = '['; rdelim = ']'; }
+ 	else if (val.nids()==TOK_RBRACE) {ldelim = '{'; rdelim = '}'; }
+ 	else if (val.nids()==TOK_RANGBRACK) {ldelim = '<'; rdelim = '>'; }
+ 	else {ldelim = ':'; rdelim = 0x0;};
+ 	out << ldelim << val.narg();
+ 	if (rdelim) out << rdelim;
+       }
+     }
+     else if (val.is_type(AttributeValue::SymbolType) && 
+ 	     (val.narg() || val.nkey()))
+       out << "{" << val.narg() << "|" << val.nkey() << "}";
+     else if (val.is_type(AttributeValue::KeywordType))
+       out << "(" << val.keynarg_val() << ")";
+     out << ((i==_pfnum-1) ? "\n" : " ");
+   }
+   brief(oldbrief);
+ }
+ 
Index: ComTerp/comterp.h
diff -c ComTerp/comterp.h:1.1 ComTerp/comterp.h:1.2
*** ComTerp/comterp.h:1.1	Wed Aug 29 10:37:48 2007
--- src/ComTerp/comterp.h	Sun Sep 23 09:11:27 2007
***************
*** 1,5 ****
  /*
!  * Copyright (c) IET Inc.
   * Copyright (c) 1994-1999 Vectaport Inc.
   *
   * Permission to use, copy, modify, distribute, and sell this software and
--- 1,7 ----
  /*
!  * 
!  * Copyright (c) 2001-2007 Scott E. Johnston
!  * Copyright (c) 2000 IET Inc.
   * Copyright (c) 1994-1999 Vectaport Inc.
   *
   * Permission to use, copy, modify, distribute, and sell this software and
***************
*** 110,116 ****
      int* get_commands(int &ncommands, boolean sorted = false);
      // return an optionally sorted list of command names.
  
!     ComValue& pop_stack(boolean lookupsym=true);
      // return a reference (on the stack) to what was the top of the stack,
      // if 'lookupsym' is false, don't look up ComValue objects in 
      // the local or global symbol table to replace a symbol, just
--- 112,118 ----
      int* get_commands(int &ncommands, boolean sorted = false);
      // return an optionally sorted list of command names.
  
!     ComValue pop_stack(boolean lookupsym=true);
      // return a reference (on the stack) to what was the top of the stack,
      // if 'lookupsym' is false, don't look up ComValue objects in 
      // the local or global symbol table to replace a symbol, just
***************
*** 242,247 ****
--- 244,264 ----
      int& stepflag() { return _stepflag; }
      // return flag that controls stepwise execution
  
+     void echo_postfix(boolean flag) { _echo_postfix = flag; }
+     // set flag that indicates whether to echo postfix or not
+ 
+     boolean echo_postfix() const { return _echo_postfix; }
+     // return flag that indicates whether to echo contents of postfix buffer
+ 
+     void postfix_echo();
+     // echo the postfix tokens
+ 
+     void delim_func(boolean flag) { _delim_func = flag; }
+     // set flag that indicates whether to run a delimeter selected func.
+  
+     boolean delim_func() const { return _delim_func; }
+     // return flag that indicates whether to run a delimeter selected func.
+ 
  protected:
      void incr_stack();
      void incr_stack(int n);
***************
*** 312,317 ****
--- 329,340 ----
      int _stepflag;
      // true if single-stepping interpreter
  
+     boolean _echo_postfix;
+     // echos postfix tokens if true
+ 
+     boolean _delim_func;
+     // use delimeter selected func, passing symbol in ::command_symid()
+ 
      friend class ComFunc;
      friend class ComterpHandler;
      friend class ComTerpIOHandler;
Index: ComTerp/comterpserv.c
diff -c ComTerp/comterpserv.c:1.1 ComTerp/comterpserv.c:1.2
*** ComTerp/comterpserv.c:1.1	Wed Aug 29 10:37:48 2007
--- src/ComTerp/comterpserv.c	Sun Sep 23 09:11:27 2007
***************
*** 404,410 ****
      return status;
  }
  
! ComValue& ComTerpServ::run(const char* expression, boolean nested) {
      _errbuf[0] = '\0';
  
  #if 0
--- 404,410 ----
      return status;
  }
  
! ComValue ComTerpServ::run(const char* expression, boolean nested) {
      _errbuf[0] = '\0';
  
  #if 0
***************
*** 479,485 ****
      return *_errbuf ? ComValue::nullval() : pop_stack();
  }
  
! ComValue& ComTerpServ::run(postfix_token* tokens, int ntokens) {
      _errbuf[0] = '\0';
  
  #if 0
--- 479,485 ----
      return *_errbuf ? ComValue::nullval() : pop_stack();
  }
  
! ComValue ComTerpServ::run(postfix_token* tokens, int ntokens) {
      _errbuf[0] = '\0';
  
  #if 0
***************
*** 499,505 ****
      eval_expr();
      err_str(_errbuf, BUFSIZ, "comterp");
  
!     ComValue& retval = *_errbuf ? ComValue::nullval() : pop_stack();
  #if 0
      _pfbuf = save_pfbuf;
      _pfnum = save_pfnum;
--- 499,505 ----
      eval_expr();
      err_str(_errbuf, BUFSIZ, "comterp");
  
!     ComValue retval(*_errbuf ? ComValue::nullval() : pop_stack());
  #if 0
      _pfbuf = save_pfbuf;
      _pfnum = save_pfnum;
Index: ComTerp/comterpserv.h
diff -c ComTerp/comterpserv.h:1.1 ComTerp/comterpserv.h:1.2
*** ComTerp/comterpserv.h:1.1	Wed Aug 29 10:37:48 2007
--- src/ComTerp/comterpserv.h	Sun Sep 23 09:11:27 2007
***************
*** 57,67 ****
  
      virtual int run(boolean one_expr=false, boolean nested=false);
      // run this interpreter until quit or exit command.
!     virtual ComValue& run(const char*, boolean nested=false);
      // interpret and return value of expression.  'nested' flag used
      // to indicated nested call to the run() method, to avoid
      // re-initialization.
!     virtual ComValue& run(postfix_token*, int);
      // execute a buffer of postfix tokens and return the value.
      
      virtual int runfile(const char*);
--- 57,67 ----
  
      virtual int run(boolean one_expr=false, boolean nested=false);
      // run this interpreter until quit or exit command.
!     virtual ComValue run(const char*, boolean nested=false);
      // interpret and return value of expression.  'nested' flag used
      // to indicated nested call to the run() method, to avoid
      // re-initialization.
!     virtual ComValue run(postfix_token*, int);
      // execute a buffer of postfix tokens and return the value.
      
      virtual int runfile(const char*);
Index: ComTerp/comvalue.c
diff -c ComTerp/comvalue.c:1.1 ComTerp/comvalue.c:1.2
*** ComTerp/comvalue.c:1.1	Wed Aug 29 10:37:48 2007
--- src/ComTerp/comvalue.c	Sun Sep 23 09:11:27 2007
***************
*** 1,5 ****
  /*
!  * Copyright (c) 2000 IET Inc.
   * Copyright (c) 1994-1998 Vectaport Inc.
   *
   * Permission to use, copy, modify, distribute, and sell this software and
--- 1,5 ----
  /*
!  * Copyright (c) 2001-2007 Scott E. Johnston
   * Copyright (c) 1994-1998 Vectaport Inc.
   *
   * Permission to use, copy, modify, distribute, and sell this software and
***************
*** 117,123 ****
      }
      _narg = token->narg;
      _nkey = token->nkey;
!     _nids = token->nids;
      _command_symid = -1;
      _pedepth = 0;
      _bquote = 0;
--- 117,124 ----
      }
      _narg = token->narg;
      _nkey = token->nkey;
!     _nids = token->nids;  // nids not always used for number-of-ids
! 
      _command_symid = -1;
      _pedepth = 0;
      _bquote = 0;
***************
*** 130,136 ****
--- 131,139 ----
      _nids = sv._nids;
      _pedepth = sv._pedepth;
      _bquote = sv._bquote;
+     #if 0  // duplicated ref_as_needed call in assignval()
      ref_as_needed();
+     #endif
      return *this;
  }
      
Index: ComTerp/comvalue.h
diff -c ComTerp/comvalue.h:1.1 ComTerp/comvalue.h:1.2
*** ComTerp/comvalue.h:1.1	Wed Aug 29 10:37:48 2007
--- src/ComTerp/comvalue.h	Sun Sep 23 09:11:27 2007
***************
*** 1,4 ****
--- 1,5 ----
  /*
+  * Copyright (c) 2001-2007 Scott E. Johnston
   * Copyright (c) 1994-1999 Vectaport Inc.
   *
   * Permission to use, copy, modify, distribute, and sell this software and
Index: ComTerp/ctrlfunc.c
diff -c ComTerp/ctrlfunc.c:1.1 ComTerp/ctrlfunc.c:1.2
*** ComTerp/ctrlfunc.c:1.1	Wed Aug 29 10:37:48 2007
--- src/ComTerp/ctrlfunc.c	Sun Sep 23 09:11:27 2007
***************
*** 173,179 ****
        } while (i<BUFSIZ-1 && buf[i-1]!='\n');
        if (buf[i]=='\n') buf[i]==0;
  #endif
!       ComValue& retval = comterpserv()->run(buf, true);
        push_stack(retval);
      }
  
--- 173,179 ----
        } while (i<BUFSIZ-1 && buf[i-1]!='\n');
        if (buf[i]=='\n') buf[i]==0;
  #endif
!       ComValue retval(comterpserv()->run(buf, true));
        push_stack(retval);
      }
  
Index: ComTerp/listfunc.c
diff -c ComTerp/listfunc.c:1.1 ComTerp/listfunc.c:1.2
*** ComTerp/listfunc.c:1.1	Wed Aug 29 10:37:48 2007
--- src/ComTerp/listfunc.c	Sun Sep 23 09:11:27 2007
***************
*** 58,64 ****
  	boolean done = false;
  	while (!done) {
  	  NextFunc::execute_impl(comterp(), listv);
! 	  AttributeValue* newval = new AttributeValue(comterp()->pop_stack());
  	  if (newval->is_unknown()) {
  	    done = true;
  	    delete newval;
--- 58,65 ----
  	boolean done = false;
  	while (!done) {
  	  NextFunc::execute_impl(comterp(), listv);
! 	  ComValue topval(comterp()->pop_stack());
! 	  AttributeValue* newval = new AttributeValue(topval);
  	  if (newval->is_unknown()) {
  	    done = true;
  	    delete newval;
Index: ComTerp/numfunc.c
diff -c ComTerp/numfunc.c:1.1 ComTerp/numfunc.c:1.2
*** ComTerp/numfunc.c:1.1	Wed Aug 29 10:37:48 2007
--- src/ComTerp/numfunc.c	Sun Sep 23 09:11:27 2007
***************
*** 261,267 ****
      push_stack(*list1->GetAttrVal(it1));
      push_stack(*list2->GetAttrVal(it2));
      exec(2, 0);
!     sum->Append(new AttributeValue(comterp()->pop_stack()));
      list1->Next(it1);
      list2->Next(it2);
    }
--- 261,268 ----
      push_stack(*list1->GetAttrVal(it1));
      push_stack(*list2->GetAttrVal(it2));
      exec(2, 0);
!     ComValue topval(comterp()->pop_stack());
!     sum->Append(new AttributeValue(topval));
      list1->Next(it1);
      list2->Next(it2);
    }
***************
*** 530,536 ****
  	  if (row1) row1->Next(itj1);
  	}
  	
! 	prodrow->Append(new AttributeValue(comterp()->pop_stack()));
        }
        /* done looping over output columsn */
        
--- 531,538 ----
  	  if (row1) row1->Next(itj1);
  	}
  	
! 	ComValue topval(comterp()->pop_stack());
! 	prodrow->Append(new AttributeValue(topval));
        }
        /* done looping over output columsn */
        
***************
*** 560,566 ****
  	if (row1) row1->Next(itj1);
        }
        
!       prodrow->Append(new AttributeValue(comterp()->pop_stack()));
      }
  
      list1->Next(iti1);
--- 562,569 ----
  	if (row1) row1->Next(itj1);
        }
        
!       ComValue topval(comterp()->pop_stack());
!       prodrow->Append(new AttributeValue(topval));
      }
  
      list1->Next(iti1);
Index: ComUnidraw/grfunc.c
diff -c ComUnidraw/grfunc.c:1.1 ComUnidraw/grfunc.c:1.2
*** ComUnidraw/grfunc.c:1.1	Wed Aug 29 10:38:54 2007
--- src/ComUnidraw/grfunc.c	Sun Sep 23 09:11:33 2007
***************
*** 1222,1228 ****
  }
  
  void ZoomFunc::execute() {
!     ComValue& zoomv = pop_stack();
      double zoom = zoomv.double_val();
      reset_stack();
      
--- 1222,1228 ----
  }
  
  void ZoomFunc::execute() {
!     ComValue zoomv(pop_stack());
      double zoom = zoomv.double_val();
      reset_stack();
      
Index: ComUtil/_parser.c
diff -c ComUtil/_parser.c:1.1 ComUtil/_parser.c:1.2
*** ComUtil/_parser.c:1.1	Wed Aug 29 10:37:45 2007
--- src/ComUtil/_parser.c	Sun Sep 23 09:11:25 2007
***************
*** 1,5 ****
  /*
!  * Copyright (c) 2005 Scott E. Johnston
   * Copyright (c) 1993-1995 Vectaport Inc.
   * Copyright (c) 1989 Triple Vision, Inc.
   *
--- 1,5 ----
  /*
!  * Copyright (c) 2005-2007 Scott E. Johnston
   * Copyright (c) 1993-1995 Vectaport Inc.
   * Copyright (c) 1989 Triple Vision, Inc.
   *
***************
*** 44,49 ****
--- 44,50 ----
  int _skip_shell_comments = 0;
  infuncptr _oneshot_infunc = NULL;
  int _detail_matched_delims = 0;
+ int _sticky_matched_delims = 0;
  
  static int get_next_token(void *infile, char *(*infunc)(), int (*eoffunc)(),
  			  int (*errfunc)(), FILE *outfile, int (*outfunc)(),
***************
*** 1122,1131 ****
  			  ParenStack[TopOfParenStack].nids );
  		 } else {
  		   if (parens_symid==-1) {
! 		     parens_symid = symbol_add("parens");
! 		     brackets_symid = symbol_add("brackets");
! 		     braces_symid = symbol_add("braces");
! 		     angbracks_symid = symbol_add("angbracks");
  		   }
  		   int commandid = ParenStack[TopOfParenStack].comm_id;
  		   if (commandid<0) {
--- 1123,1132 ----
  			  ParenStack[TopOfParenStack].nids );
  		 } else {
  		   if (parens_symid==-1) {
! 		     parens_symid = symbol_add("()");
! 		     brackets_symid = symbol_add("[]");
! 		     braces_symid = symbol_add("{}");
! 		     angbracks_symid = symbol_add("<>");
  		   }
  		   int commandid = ParenStack[TopOfParenStack].comm_id;
  		   if (commandid<0) {
***************
*** 1202,1207 ****
--- 1203,1211 ----
     /*   3) The next token on the current line of input is separated by      */
     /*      whitespace from the current token.                               */
     /*   4) If the next token is an operator, it is not a binary operator    */
+    /*   5) If _sticky_matched_delims is true, and the next token is not an  */
+    /*      operator, then it can't be a matching delimeter.                 */
+    /*      and _delim_concatenation */
        if( !done && TopOfParenStack < 0 && expecting == OPTYPE_BINARY ) {
  
  	 if( NextToklen == 0 ) 
***************
*** 1219,1225 ****
  	 if( NextToktype == TOK_EOF )
  	    done = TRUE;
  
! 	 if( PROCEEDING_WHITESPACE( NextTokstart ) )
  
  	    if( NextToktype != TOK_OPERATOR )
  	       done = TRUE;
--- 1223,1230 ----
  	 if( NextToktype == TOK_EOF )
  	    done = TRUE;
  
! 	 if( (!_sticky_matched_delims || !LEFT_PAREN( NextToktype)) 
! 	     && PROCEEDING_WHITESPACE( NextTokstart ) )
  
  	    if( NextToktype != TOK_OPERATOR )
  	       done = TRUE;
Index: config_ivtools/params.def
diff -c config_ivtools/params.def:1.1 config_ivtools/params.def:1.2
*** config_ivtools/params.def:1.1	Wed Aug 29 10:39:32 2007
--- config/params.def	Sun Sep 23 09:11:39 2007
***************
*** 27,33 ****
   * Name of the software release
   */
  #ifndef Release
! #define	Release ivtools-1.2.4
  #endif
  
     RELEASE = Release
--- 27,33 ----
   * Name of the software release
   */
  #ifndef Release
! #define	Release ivtools-1.2.5
  #endif
  
     RELEASE = Release
***************
*** 36,42 ****
   * VersionNumber
   */
  #ifndef Version
! #define	Version 1.2.4
  #endif
  
     VERSION = Version
--- 36,42 ----
   * VersionNumber
   */
  #ifndef Version
! #define	Version 1.2.5
  #endif
  
     VERSION = Version
Index: DrawServ/drawcatalog.c
diff -c DrawServ/drawcatalog.c:1.1 DrawServ/drawcatalog.c:1.2
*** DrawServ/drawcatalog.c:1.1	Wed Aug 29 10:39:00 2007
--- src/DrawServ/drawcatalog.c	Sun Sep 23 09:11:36 2007
***************
*** 184,191 ****
--- 184,193 ----
      _edges[i]->Edge()->
        attach_nodes(start_id < 0 ? nil : _nodes[start_id]->Node(), 
  		   end_id < 0 ? nil : _nodes[end_id]->Node());
+     #if defined(GRAPH_OBSERVABLES)
      if (start_id >=0 && end_id >=0) 
        _edges[i]->NodeStart()->attach(_edges[i]->NodeEnd());
+     #endif
    }
    delete _startnode; _startnode = nil;
    delete _endnode; _endnode = nil;
Index: DrawServ/drawcatalog.h
diff -c DrawServ/drawcatalog.h:1.1 DrawServ/drawcatalog.h:1.2
*** DrawServ/drawcatalog.h:1.1	Wed Aug 29 10:39:00 2007
--- src/DrawServ/drawcatalog.h	Sun Sep 23 09:11:36 2007
***************
*** 43,50 ****
  
      virtual OverlayComp* ReadComp(const char*, istream&, OverlayComp* =nil);
  
!     void graph_init(DrawIdrawComp* comps, int num_edge, int num_node);
!     void graph_finish();
  
  protected:
      int* _startnode;
--- 43,50 ----
  
      virtual OverlayComp* ReadComp(const char*, istream&, OverlayComp* =nil);
  
!     virtual void graph_init(DrawIdrawComp* comps, int num_edge, int num_node);
!     virtual void graph_finish();
  
  protected:
      int* _startnode;
Index: DrawServ/drawcomps.c
diff -c DrawServ/drawcomps.c:1.1 DrawServ/drawcomps.c:1.2
*** DrawServ/drawcomps.c:1.1	Wed Aug 29 10:39:00 2007
--- src/DrawServ/drawcomps.c	Sun Sep 23 09:11:36 2007
***************
*** 127,133 ****
  }
  
  boolean DrawIdrawScript::Emit (ostream& out) {
!     out << "drawserv(";
  
      GraphicComp* comps = GetGraphicComp();
      Iterator i;
--- 127,133 ----
  }
  
  boolean DrawIdrawScript::Emit (ostream& out) {
!     out << script_name() << "(";
  
      GraphicComp* comps = GetGraphicComp();
      Iterator i;
Index: DrawServ/drawcomps.h
diff -c DrawServ/drawcomps.h:1.1 DrawServ/drawcomps.h:1.2
*** DrawServ/drawcomps.h:1.1	Wed Aug 29 10:39:00 2007
--- src/DrawServ/drawcomps.h	Sun Sep 23 09:11:36 2007
***************
*** 76,81 ****
--- 76,84 ----
      virtual boolean IsA(ClassId);
  
      static int ReadFrames(istream& in, void* addr1, void* addr2, void* addr3, void* addr4);
+ 
+     virtual const char* script_name() { return "drawserv"; }
+     // for overriding in derived classes
  };
  
  
Index: DrawServ/drawkit.c
diff -c DrawServ/drawkit.c:1.1 DrawServ/drawkit.c:1.2
*** DrawServ/drawkit.c:1.1	Wed Aug 29 10:39:00 2007
--- src/DrawServ/drawkit.c	Sun Sep 23 09:11:36 2007
***************
*** 58,63 ****
--- 58,64 ----
  #include <OverlayUnidraw/ovexport.h>
  #include <OverlayUnidraw/ovimport.h>
  #include <OverlayUnidraw/ovpolygon.h>
+ #include <OverlayUnidraw/ovprecise.h>
  #include <OverlayUnidraw/ovprint.h>
  #include <OverlayUnidraw/ovrect.h>
  #include <OverlayUnidraw/ovtext.h>
***************
*** 67,72 ****
--- 68,74 ----
  #include <UniIdraw/idarrows.h>
  #include <UniIdraw/idkybd.h>
  
+ #include <Unidraw/Commands/transforms.h>
  #include <Unidraw/Components/text.h>
  #include <Unidraw/Graphic/ellipses.h>
  #include <Unidraw/Graphic/polygons.h>
***************
*** 125,130 ****
--- 127,138 ----
      FrameKit::Init(comp, name);
  }
  
+ DrawKit* DrawKit::Instance() {
+     if (!_comkit)
+ 	_comkit = new DrawKit();
+     return _comkit;
+ }
+ 
  MenuItem * DrawKit::MakeFileMenu() {
      LayoutKit& lk = *LayoutKit::instance();
      WidgetKit& kit = *WidgetKit::instance();
***************
*** 160,169 ****
      return mbi;
  }
  
! DrawKit* DrawKit::Instance() {
!     if (!_comkit)
! 	_comkit = new DrawKit();
!     return _comkit;
  }
  
  MenuItem * DrawKit::MakeToolsMenu() {
--- 168,225 ----
      return mbi;
  }
  
! MenuItem* DrawKit::MakeEditMenu() {
!     LayoutKit& lk = *LayoutKit::instance();
!     WidgetKit& kit = *WidgetKit::instance();
!     
!     MenuItem *mbi = kit.menubar_item(kit.label("Edit"));
!     mbi->menu(kit.pulldown());
! 
!     MakeMenu(mbi, new UndoCmd(new ControlInfo("Undo", KLBL_UNDO, CODE_UNDO)),
! 	     "Undo   ");
!     MakeMenu(mbi, new RedoCmd(new ControlInfo("Redo", KLBL_REDO, CODE_REDO)),
! 	     "Redo   ");
!     MakeMenu(mbi, new GraphCutCmd(new ControlInfo("Cut", KLBL_CUT, CODE_CUT)),
! 	     "Cut   "); // overrides FrameCutCmd
!     MakeMenu(mbi, new GraphCopyCmd(new ControlInfo("Copy", KLBL_COPY, CODE_COPY)),
! 	     "Copy   ");
!     MakeMenu(mbi, new GraphPasteCmd(new ControlInfo("Paste", KLBL_PASTE, CODE_PASTE)),
! 	     "Paste   ");
!     MakeMenu(mbi, new GraphDupCmd(new ControlInfo("Duplicate", KLBL_DUP, CODE_DUP)),
! 	     "Duplicate   ");
!     MakeMenu(mbi, new GraphDeleteCmd(new ControlInfo("Delete", KLBL_DEL, CODE_DEL)),
! 	     "Delete   ");
!     MakeMenu(mbi, new OvSlctAllCmd(new ControlInfo("Select All", KLBL_SLCTALL, CODE_SLCTALL)),
! 	     "Select All   ");
!     MakeMenu(mbi, new SlctByAttrCmd(new ControlInfo("Select by Attribute", "$", "$")),
! 	     "Select by Attribute   ");
!     mbi->menu()->append_item(kit.menu_item_separator());
!     MakeMenu(mbi, new ScaleCmd(new ControlInfo("Flip Horizontal",
! 				       KLBL_HFLIP, CODE_HFLIP),
! 		       -1.0, 1.0),
! 	     "Flip Horizontal   ");
!     MakeMenu(mbi, new ScaleCmd(new ControlInfo("Flip Vertical",
! 				       KLBL_VFLIP, CODE_VFLIP),
! 		       1.0, -1.0),
! 	     "Flip Vertical   ");
!     MakeMenu(mbi, new RotateCmd(new ControlInfo("90 Clockwise", KLBL_CW90, CODE_CW90),
! 			-90.0),
! 	     "90 Clockwise   ");
!     MakeMenu(mbi, new RotateCmd(new ControlInfo("90 CounterCW", KLBL_CCW90, CODE_CCW90),
! 			90.0),
! 	     "90 CounterCW   ");
!     mbi->menu()->append_item(kit.menu_item_separator());
!     MakeMenu(mbi, new OvPreciseMoveCmd(new ControlInfo("Precise Move",
! 					     KLBL_PMOVE, CODE_PMOVE)),
! 	     "Precise Move   ");
!     MakeMenu(mbi, new OvPreciseScaleCmd(new ControlInfo("Precise Scale",
! 					      KLBL_PSCALE, CODE_PSCALE)),
! 	     "Precise Scale   ");
!     MakeMenu(mbi, new OvPreciseRotateCmd(new ControlInfo("Precise Rotate",
! 					       KLBL_PROTATE, CODE_PROTATE)),
! 	     "Precise Rotate   ");
! 
!     return mbi;
  }
  
  MenuItem * DrawKit::MakeToolsMenu() {
Index: DrawServ/drawkit.h
diff -c DrawServ/drawkit.h:1.1 DrawServ/drawkit.h:1.2
*** DrawServ/drawkit.h:1.1	Wed Aug 29 10:39:00 2007
--- src/DrawServ/drawkit.h	Sun Sep 23 09:11:36 2007
***************
*** 43,48 ****
--- 43,49 ----
  
      virtual void Init(OverlayComp*, const char* name);
      virtual MenuItem *MakeFileMenu();
+     virtual MenuItem *MakeEditMenu();
      virtual Glyph* MakeToolbar();
      virtual MenuItem* MakeToolsMenu();
      virtual MenuItem* MakeViewersMenu();
Index: DrawServ/linkselection.c
diff -c DrawServ/linkselection.c:1.1 DrawServ/linkselection.c:1.2
*** DrawServ/linkselection.c:1.1	Wed Aug 29 10:39:00 2007
--- src/DrawServ/linkselection.c	Sun Sep 23 09:11:36 2007
***************
*** 109,114 ****
--- 109,115 ----
  
    /* clear anything that was in the previous selection, but not in this one */
    Selection* lastsel = _editor->last_selection();
+   if (!lastsel) return;
    Iterator lt;
    lastsel->First(lt);
    Iterator it;
Index: DrawServ/rcdialog.h
diff -c DrawServ/rcdialog.h:1.1 DrawServ/rcdialog.h:1.2
*** DrawServ/rcdialog.h:1.1	Wed Aug 29 10:39:00 2007
--- src/DrawServ/rcdialog.h	Sun Sep 23 09:11:36 2007
***************
*** 55,61 ****
    StrEditDialog* _dialog;
  };
  
! #include <InterViews/dialog.h>
  
  class ConnectionsDialogImpl;
  class DrawLinkList;
--- 55,61 ----
    StrEditDialog* _dialog;
  };
  
! #include <IV-3_1/InterViews/dialog.h>
  
  class ConnectionsDialogImpl;
  class DrawLinkList;
Index: FrameUnidraw/framecmds.c
diff -c FrameUnidraw/framecmds.c:1.1 FrameUnidraw/framecmds.c:1.2
*** FrameUnidraw/framecmds.c:1.1	Wed Aug 29 10:38:56 2007
--- src/FrameUnidraw/framecmds.c	Sun Sep 23 09:11:34 2007
***************
*** 240,246 ****
      if (funcformat && comterp) {
        char buf[BUFSIZ];
        sprintf(buf, funcformat, _requestmotion);
!       ComValue& retval = comterp->run(buf);
      }
      unidraw->Update();
  }
--- 240,246 ----
      if (funcformat && comterp) {
        char buf[BUFSIZ];
        sprintf(buf, funcformat, _requestmotion);
!       ComValue retval(comterp->run(buf));
      }
      unidraw->Update();
  }
***************
*** 270,276 ****
      if (funcformat && comterp) {
        char buf[BUFSIZ];
        sprintf(buf, funcformat, -_requestmotion);
!       ComValue& retval = comterp->run(buf);
      }
      unidraw->Update();
  }
--- 270,276 ----
      if (funcformat && comterp) {
        char buf[BUFSIZ];
        sprintf(buf, funcformat, -_requestmotion);
!       ComValue retval(comterp->run(buf));
      }
      unidraw->Update();
  }
***************
*** 336,342 ****
      if (funcformat && comterp) {
        char buf[BUFSIZ];
        sprintf(buf, funcformat, _allowbg ? 0 : 1);
!       ComValue& retval = comterp->run(buf);
      }
      unidraw->Update();
  }
--- 336,342 ----
      if (funcformat && comterp) {
        char buf[BUFSIZ];
        sprintf(buf, funcformat, _allowbg ? 0 : 1);
!       ComValue retval (comterp->run(buf));
      }
      unidraw->Update();
  }
***************
*** 389,395 ****
      if (funcformat && comterp) {
        char buf[BUFSIZ];
        sprintf(buf, funcformat, fnum);
!       ComValue& retval = comterp->run(buf);
      }
      unidraw->Update();
  }
--- 389,395 ----
      if (funcformat && comterp) {
        char buf[BUFSIZ];
        sprintf(buf, funcformat, fnum);
!       ComValue retval(comterp->run(buf));
      }
      unidraw->Update();
  }
Index: FrameUnidraw/frameviewer.c
diff -c FrameUnidraw/frameviewer.c:1.1 FrameUnidraw/frameviewer.c:1.2
*** FrameUnidraw/frameviewer.c:1.1	Wed Aug 29 10:38:56 2007
--- src/FrameUnidraw/frameviewer.c	Sun Sep 23 09:11:34 2007
***************
*** 155,157 ****
--- 155,163 ----
  { 
    return GetFrameEditor()->GetFrame(); 
  }
+ 
+ GraphicView* FrameViewer::GetCurrentGraphicView()
+ {
+     OverlaysView* frame = ((FrameEditor*)GetEditor())->GetFrame();
+     return frame ? frame : GetGraphicView();
+ }
Index: FrameUnidraw/frameviewer.h
diff -c FrameUnidraw/frameviewer.h:1.1 FrameUnidraw/frameviewer.h:1.2
*** FrameUnidraw/frameviewer.h:1.1	Wed Aug 29 10:38:56 2007
--- src/FrameUnidraw/frameviewer.h	Sun Sep 23 09:11:34 2007
***************
*** 47,52 ****
--- 47,56 ----
  
      void Update();
      virtual void SetGraphicView(GraphicView*);
+ 
+     virtual GraphicView* GetCurrentGraphicView();
+     // allow for other than the top-level graphic view
+ 
      FrameEditor* GetFrameEditor() { return (FrameEditor*) GetEditor(); }
  
      virtual OverlayView* GetCurrent();
Index: GraphUnidraw/edgecomp.c
diff -c GraphUnidraw/edgecomp.c:1.1 GraphUnidraw/edgecomp.c:1.2
*** GraphUnidraw/edgecomp.c:1.1	Wed Aug 29 10:38:58 2007
--- src/GraphUnidraw/edgecomp.c	Sun Sep 23 09:11:35 2007
***************
*** 1,4 ****
--- 1,5 ----
  /*
+  * Copyright (c) 2007 Scott E. Johnston
   * Copyright (c) 1994-1996, 1999 Vectaport Inc.
   *
   * Permission to use, copy, modify, distribute, and sell this software and
***************
*** 97,107 ****
--- 98,110 ----
  
  EdgeComp::EdgeComp(istream& in, OverlayComp* parent) 
      : OverlayComp(nil, parent) {
+     _start_subedge = _end_subedge = -1;
      _edge = new TopoEdge(this);
      _valid = GetParamList()->read_args(in, this);
  }
      
  EdgeComp::EdgeComp(OverlayComp* parent) : OverlayComp(nil, parent) {
+     _start_subedge = _end_subedge = -1;
      _edge = new TopoEdge(this);
  }
  
***************
*** 133,139 ****
  }
  
  Component* EdgeComp::Copy() {
!     EdgeComp* comp = new EdgeComp((ArrowLine*) GetArrowLine()->Copy());
      if (attrlist()) comp->SetAttributeList(new AttributeList(attrlist()));
      comp->_start_node = _start_node;
      comp->_end_node = _end_node;
--- 136,142 ----
  }
  
  Component* EdgeComp::Copy() {
!     EdgeComp* comp = NewEdgeComp((ArrowLine*) GetArrowLine()->Copy());
      if (attrlist()) comp->SetAttributeList(new AttributeList(attrlist()));
      comp->_start_node = _start_node;
      comp->_end_node = _end_node;
***************
*** 272,281 ****
--- 275,286 ----
  	if(ecmd->Node1() && ecmd->Node2()) {
  	  NodeComp* start_node_comp = (NodeComp*)ecmd->Node1();
  	  NodeComp* end_node_comp = (NodeComp*)ecmd->Node2();
+ 	  #if 0
  	  if (start_node_comp && start_node_comp->IsA(NODE_COMP) &&
  	      end_node_comp && end_node_comp->IsA(NODE_COMP)) {
  	    start_node_comp->attach(end_node_comp);
  	  }
+ 	  #endif
  	}
          ArrowLine* subgr1 = ecmd->Node1() ? ecmd->Node1()->SubEdgeGraphic(_start_subedge) : nil;
          if (subgr1) {
***************
*** 299,312 ****
  	if (Edge()->start_node()) {
  	    float fx, fy;
  	    ((NodeComp*)Edge()->start_node()->value())
! 		->GetGraphic()->GetCenter(fx, fy);
  	    x0 = Math::round(fx);
  	    y0 = Math::round(fy);
  	}
  	if (Edge()->end_node()) {
  	    float fx, fy;
  	    ((NodeComp*)Edge()->end_node()->value())
! 		->GetGraphic()->GetCenter(fx, fy);
  	    x1 = Math::round(fx);
  	    y1 = Math::round(fy);
  	}
--- 304,317 ----
  	if (Edge()->start_node()) {
  	    float fx, fy;
  	    ((NodeComp*)Edge()->start_node()->value())
! 		->GetEllipse()->GetCenter(fx, fy);
  	    x0 = Math::round(fx);
  	    y0 = Math::round(fy);
  	}
  	if (Edge()->end_node()) {
  	    float fx, fy;
  	    ((NodeComp*)Edge()->end_node()->value())
! 		->GetEllipse()->GetCenter(fx, fy);
  	    x1 = Math::round(fx);
  	    y1 = Math::round(fy);
  	}
***************
*** 332,338 ****
--- 337,345 ----
  	    }
  	    if (newe)
  	      delete e1;
+ 	    #if defined(GRAPH_OBSERVABLES)
  	    ((NodeComp*)Edge()->start_node()->value())->notify();
+ 	    #endif
  	}
  	Coord nx1, ny1;
  	if (Edge()->end_node()) {
***************
*** 411,418 ****
--- 418,427 ----
  		    {
  			EdgeData* data = (EdgeData*)(*conn)();
  			Edge()->attach_nodes(data->start, data->end);
+ 			#if defined(GRAPH_OBSERVABLES)
  			if (data->start && data->end) 
  			  NodeStart()->attach(NodeEnd());
+ 			#endif
  			break;
  		    }
  		conn = conn->Next();
***************
*** 696,702 ****
                  line->SetColors(colVar->GetFgColor(), colVar->GetBgColor());
  	    }
  
! 	    EdgeComp* newedge = new EdgeComp(line, nil, start_subedge, end_subedge);
  	    if (gv0 || gv1)
  		cmd = new MacroCmd(
  		    ed,
--- 705,711 ----
                  line->SetColors(colVar->GetFgColor(), colVar->GetBgColor());
  	    }
  
! 	    EdgeComp* newedge = NewEdgeComp(line, nil, start_subedge, end_subedge);
  	    if (gv0 || gv1)
  		cmd = new MacroCmd(
  		    ed,
***************
*** 892,898 ****
      head = arrowline->Head();
      tail = arrowline->Tail();
  
!     out << "edge(";
      out << x0 << "," << y0 << "," << x1 << "," << y1;
      if (arrow_scale != 1 )
  	out << " :arrowscale " << arrow_scale;
--- 901,907 ----
      head = arrowline->Head();
      tail = arrowline->Tail();
  
!     out << script_name() << "(";
      out << x0 << "," << y0 << "," << x1 << "," << y1;
      if (arrow_scale != 1 )
  	out << " :arrowscale " << arrow_scale;
Index: GraphUnidraw/edgecomp.h
diff -c GraphUnidraw/edgecomp.h:1.1 GraphUnidraw/edgecomp.h:1.2
*** GraphUnidraw/edgecomp.h:1.1	Wed Aug 29 10:38:58 2007
--- src/GraphUnidraw/edgecomp.h	Sun Sep 23 09:11:35 2007
***************
*** 1,4 ****
--- 1,5 ----
  /*
+  * Copyright (c) 2007 Scott E. Johnston
   * Copyright (c) 1994, 1999 Vectaport Inc.
   *
   * Permission to use, copy, modify, distribute, and sell this software and
***************
*** 58,63 ****
--- 59,75 ----
      // construct edge component but defer anything graphical
      virtual ~EdgeComp();
  
+     virtual EdgeComp* NewEdgeComp(ArrowLine* al, OverlayComp* parent = nil, int start_subedge = -1, 
+ 	int end_subedge = -1)
+       { return new EdgeComp(al, parent, start_subedge, end_subedge); }
+     // virtual constructor for use of derived classes
+     virtual EdgeComp* NewEdgeComp(istream& strm, OverlayComp* parent = nil)
+       { return new EdgeComp(strm, parent); }
+     // virtual constructor for use of derived classes
+     virtual EdgeComp* NewEdgeComp(OverlayComp* parent = nil)
+       { return new EdgeComp(parent); }
+     // virtual constructor for use of derived classes
+ 
      virtual Component* Copy();
      virtual void Interpret(Command*);
      virtual void Uninterpret(Command*);
***************
*** 144,149 ****
--- 156,165 ----
      ArrowLine* GetArrowLine () { return (ArrowLine*) GetGraphic(); }
      // return pointer to view's ArrowLine graphic.
  
+     virtual EdgeComp* NewEdgeComp(ArrowLine* al, OverlayComp* parent = nil, int start_subedge = -1, 
+ 				  int end_subedge = -1)
+       { return new EdgeComp(al, parent, start_subedge, end_subedge); }
+     // virtual function to allow construction of specialized NodeComp's by specialized NodeView's
  protected:
      static FullGraphic* _ev_gs;
  };
***************
*** 178,183 ****
--- 194,202 ----
      int IndexNode (NodeComp *comp);
      // return index of given node.
  
+     virtual const char* script_name() { return "edge"; }
+     // for overriding in derived classes
+ 
      virtual ClassId GetClassId();
      virtual boolean IsA(ClassId);
  };
Index: GraphUnidraw/graphcmds.c
diff -c GraphUnidraw/graphcmds.c:1.1 GraphUnidraw/graphcmds.c:1.2
*** GraphUnidraw/graphcmds.c:1.1	Wed Aug 29 10:38:58 2007
--- src/GraphUnidraw/graphcmds.c	Sun Sep 23 09:11:35 2007
***************
*** 29,34 ****
--- 29,36 ----
  #include <GraphUnidraw/edgecomp.h>
  #include <GraphUnidraw/nodecomp.h>
  
+ #include <OverlayUnidraw/ovviewer.h>
+ 
  #include <TopoFace/topoedge.h>
  #include <TopoFace/toponode.h>
  
***************
*** 42,48 ****
  #include <Unidraw/statevars.h>
  #include <Unidraw/ulist.h>
  #include <Unidraw/unidraw.h>
- #include <Unidraw/viewer.h>
  
  #include <UniIdraw/idarrows.h>
  
--- 44,49 ----
***************
*** 466,472 ****
      Editor* editor = GetEditor();
      Selection* s = editor->GetSelection();
      Clipboard* cb = new Clipboard();
!     GraphicView* views = editor->GetViewer()->GetGraphicView();
      s->Sort(views);
      cb->CopyInit(s);
      index_clipboard(s, cb);
--- 467,473 ----
      Editor* editor = GetEditor();
      Selection* s = editor->GetSelection();
      Clipboard* cb = new Clipboard();
!     GraphicView* views = ((OverlayViewer*)editor->GetViewer())->GetCurrentGraphicView();
      s->Sort(views);
      cb->CopyInit(s);
      index_clipboard(s, cb);
Index: GraphUnidraw/graphcmds.h
diff -c GraphUnidraw/graphcmds.h:1.1 GraphUnidraw/graphcmds.h:1.2
*** GraphUnidraw/graphcmds.h:1.1	Wed Aug 29 10:38:58 2007
--- src/GraphUnidraw/graphcmds.h	Sun Sep 23 09:11:35 2007
***************
*** 186,191 ****
--- 186,192 ----
      virtual Command* Copy();
      virtual ClassId GetClassId();
      virtual boolean IsA(ClassId);
+ 
  };
  
  #endif
Index: GraphUnidraw/nodecomp.c
diff -c GraphUnidraw/nodecomp.c:1.1 GraphUnidraw/nodecomp.c:1.2
*** GraphUnidraw/nodecomp.c:1.1	Wed Aug 29 10:38:58 2007
--- src/GraphUnidraw/nodecomp.c	Sun Sep 23 09:11:35 2007
***************
*** 1,5 ****
  /*
!  * Copyright (c) 2006 Scott E. Johnston
   * Copyright (c) 1994-1996, 1999 Vectaport Inc.
   *
   * Permission to use, copy, modify, distribute, and sell this software and
--- 1,5 ----
  /*
!  * Copyright (c) 2006-2007 Scott E. Johnston
   * Copyright (c) 1994-1996, 1999 Vectaport Inc.
   *
   * Permission to use, copy, modify, distribute, and sell this software and
***************
*** 153,159 ****
      _node = new TopoNode(this);
      // kludge to fix ps: fonts are collected from comp\'s graphic, so we
      // need to add the font to the picture\'s gs
!     if (GetText()) pic->SetFont(GetText()->GetFont());
      _reqlabel = rl;
  }
  
--- 153,168 ----
      _node = new TopoNode(this);
      // kludge to fix ps: fonts are collected from comp\'s graphic, so we
      // need to add the font to the picture\'s gs
!     Iterator it;
!     pic->First(it);
!     Graphic* first = pic->GetGraphic(it);
!     if (first) {
!       pic->FillBg(first->BgFilled() && !first->GetBgColor()->None());
!       pic->SetColors(first->GetFgColor(), first->GetBgColor());
!       pic->SetPattern(first->GetPattern());
!       pic->SetBrush(first->GetBrush());
!       if (GetText()) pic->SetFont(GetText()->GetFont());
!     }
      _reqlabel = rl;
  }
  
***************
*** 218,226 ****
  Component* NodeComp::Copy() {
      NodeComp* comp = nil;
      if (GetGraph()) {
!         comp = new NodeComp((SF_Ellipse*)GetEllipse()->Copy(),
  	    (TextGraphic*)GetText()->Copy(), (SF_Ellipse*)GetEllipse2()->Copy(), 
! 	    (GraphComp*)GetGraph()->Copy());
  	if (attrlist()) comp->SetAttributeList(new AttributeList(attrlist()));
  
  	Picture* pic = (Picture*)GetGraphic();
--- 227,235 ----
  Component* NodeComp::Copy() {
      NodeComp* comp = nil;
      if (GetGraph()) {
!         comp = NewNodeComp((SF_Ellipse*)GetEllipse()->Copy(),
  	    (TextGraphic*)GetText()->Copy(), (SF_Ellipse*)GetEllipse2()->Copy(), 
! 	    GetGraph() ? (GraphComp*)GetGraph()->Copy() : nil);
  	if (attrlist()) comp->SetAttributeList(new AttributeList(attrlist()));
  
  	Picture* pic = (Picture*)GetGraphic();
***************
*** 246,252 ****
          }
  
      } else {
!         comp = new NodeComp((SF_Ellipse*)GetEllipse()->Copy(), 
              (TextGraphic*)GetText()->Copy());
      }
      return comp;
--- 255,261 ----
          }
  
      } else {
!         comp = NewNodeComp((SF_Ellipse*)GetEllipse()->Copy(), 
              (TextGraphic*)GetText()->Copy());
      }
      return comp;
***************
*** 590,595 ****
--- 599,605 ----
  	*(OverlayComp*)this == (OverlayComp&)comp;
  }
  
+ #if defined(GRAPH_OBSERVABLES)
  void NodeComp::update(Observable*) {
    AttributeList* al;
    if(al = attrlist()) {
***************
*** 642,647 ****
--- 652,658 ----
      }
    }
  }
+ #endif
  
  void NodeComp::Notify() {
    GraphicComp::Notify();
***************
*** 960,966 ****
  	    }
  
  	    textgr->Align(Center, ellipse, Center);
! 	    cmd = new PasteCmd(ed, new Clipboard(new NodeComp(ellipse, textgr)));
  	}
  	else {
  	    TextManip* tm = (TextManip*) m;
--- 971,977 ----
  	    }
  
  	    textgr->Align(Center, ellipse, Center);
! 	    cmd = new PasteCmd(ed, new Clipboard(NewNodeComp(ellipse, textgr)));
  	}
  	else {
  	    TextManip* tm = (TextManip*) m;
***************
*** 1000,1006 ****
  
  		textgr->Align(Center, ellipse, Center);
  
! 		cmd = new PasteCmd(ed, new Clipboard(new NodeComp(ellipse, textgr, true)));
  	    } else if (size == 0) {
  		Viewer* v = m->GetViewer();
  		v->Update();          // to repair text display-incurred damage
--- 1011,1017 ----
  
  		textgr->Align(Center, ellipse, Center);
  
! 		cmd = new PasteCmd(ed, new Clipboard(NewNodeComp(ellipse, textgr, true)));
  	    } else if (size == 0) {
  		Viewer* v = m->GetViewer();
  		v->Update();          // to repair text display-incurred damage
***************
*** 1142,1148 ****
  }
  
  boolean NodeScript::Definition (ostream& out) {
!     out << "node(";
      Attributes(out);
      out << ")";
      return out.good();
--- 1153,1159 ----
  }
  
  boolean NodeScript::Definition (ostream& out) {
!     out << script_name() << "(" ;
      Attributes(out);
      out << ")";
      return out.good();
Index: GraphUnidraw/nodecomp.h
diff -c GraphUnidraw/nodecomp.h:1.1 GraphUnidraw/nodecomp.h:1.2
*** GraphUnidraw/nodecomp.h:1.1	Wed Aug 29 10:38:58 2007
--- src/GraphUnidraw/nodecomp.h	Sun Sep 23 09:11:35 2007
***************
*** 1,5 ****
  /*
!  * Copyright (c) 2006 Scott E. Johnston
   * Copyright (c) 1994,1999 Vectaport Inc.
   *
   * Permission to use, copy, modify, distribute, and sell this software and
--- 1,5 ----
  /*
!  * Copyright (c) 2006-2007 Scott E. Johnston
   * Copyright (c) 1994,1999 Vectaport Inc.
   *
   * Permission to use, copy, modify, distribute, and sell this software and
***************
*** 25,30 ****
--- 25,31 ----
  #ifndef nodecomp_h
  #define nodecomp_h
  
+ #include <GraphUnidraw/graphcomp.h>
  #include <OverlayUnidraw/ovcomps.h>
  #include <OverlayUnidraw/ovviews.h>
  #include <OverlayUnidraw/scriptview.h>
***************
*** 71,76 ****
--- 72,98 ----
      // construct node component but defer anything graphical
      virtual ~NodeComp();
  
+     virtual NodeComp* NewNodeComp(SF_Ellipse* ell, TextGraphic* txt, 
+ 	boolean reqlabel = false, OverlayComp* parent = nil)
+       { return new NodeComp(ell, txt, reqlabel, parent); }
+     // virtual constructor for use of derived classes
+     virtual NodeComp* NewNodeComp(SF_Ellipse* ell1, TextGraphic* txt, SF_Ellipse* ell2, GraphComp* comp, 
+ 	boolean reqlabel = false, OverlayComp* parent = nil)
+       { return new NodeComp(ell1, txt, ell2, comp, reqlabel, parent); }
+     // virtual constructor for use of derived classes
+     virtual NodeComp* NewNodeComp(Picture* pict, boolean reqlabel =false, OverlayComp* parent = nil)
+       { return new NodeComp(pict, reqlabel, parent); }
+     // virtual constructor for use of derived classes
+     virtual NodeComp* NewNodeComp(GraphComp* comp)
+       { return new NodeComp(comp); }
+     // virtual constructor for use of derived classes
+     virtual NodeComp* NewNodeComp(istream& strm, OverlayComp* parent = nil)
+       { return new NodeComp(strm, parent); }
+     // virtual constructor for use of derived classes
+     virtual NodeComp* NewNodeComp(OverlayComp* parent = nil)
+       { return new NodeComp(parent); }
+     // virtual constructor for use of derived classes
+ 
      void SetGraph(GraphComp*);
      // set internal graph for this node.
      GraphComp* GetGraph();
***************
*** 106,113 ****
--- 128,137 ----
      boolean RequireLabel() { return _reqlabel; }
      // flag to indicate whether node must have label (text graphic).
  
+ #if 0
      void update(Observable*);
      // update notification received from Observable.
+ #endif
  
      virtual void Notify(); 	 
      // override OverlayComp::Notify, separating view update from 
***************
*** 143,149 ****
      CLASS_SYMID("NodeComp");
  };
  
! inline void NodeComp::SetGraph(GraphComp* comp) { _graph = comp; }
  inline GraphComp* NodeComp::GetGraph() { return _graph; }
  
  //: graphical view of NodeComp.
--- 167,173 ----
      CLASS_SYMID("NodeComp");
  };
  
! inline void NodeComp::SetGraph(GraphComp* comp) { if (_graph) delete _graph; _graph = comp; }
  inline GraphComp* NodeComp::GetGraph() { return _graph; }
  
  //: graphical view of NodeComp.
***************
*** 183,188 ****
--- 207,216 ----
      int SubEdgeIndex(ArrowLine*);
      // return index of ArrowLine graphic relative to edges on internal graph.
  
+     virtual NodeComp* NewNodeComp(SF_Ellipse* ellipse, TextGraphic* txt, boolean reqlabel = false) 
+       { return new NodeComp(ellipse, txt, reqlabel); }
+     // virtual function to allow construction of specialized NodeComp's by specialized NodeView's
+ 
  protected:
      static FullGraphic* _nv_gs;
  };
***************
*** 192,197 ****
--- 220,227 ----
  public:
      NodeScript(NodeComp* = nil);
  
+     virtual const char* script_name() { return "node"; }
+     // for overriding in derived classes
      virtual boolean Definition(ostream&);
      // output variable-length ASCII record that defines the component.
      void Attributes(ostream& out);
Index: include_interviews/layout.h
diff -c include_interviews/layout.h:1.1 include_interviews/layout.h:1.2
*** include_interviews/layout.h:1.1	Wed Aug 29 10:39:10 2007
--- src/include/InterViews/layout.h	Sun Sep 23 09:11:37 2007
***************
*** 29,35 ****
  #ifndef iv_layout_h
  #define iv_layout_h
  
! #include <InterViews/deck.h>
  #include <InterViews/monoglyph.h>
  #include <InterViews/polyglyph.h>
  #include <InterViews/scrbox.h>
--- 29,35 ----
  #ifndef iv_layout_h
  #define iv_layout_h
  
! #include <IV-3_1/InterViews/deck.h> // too avoid confusion with IV-2_6
  #include <InterViews/monoglyph.h>
  #include <InterViews/polyglyph.h>
  #include <InterViews/scrbox.h>
Index: include_interviews/resource.h
diff -c include_interviews/resource.h:1.1 include_interviews/resource.h:1.2
*** include_interviews/resource.h:1.1	Wed Aug 29 10:39:10 2007
--- src/include/InterViews/resource.h	Sun Sep 23 09:11:37 2007
***************
*** 55,61 ****
      /* for backward compatibility */
      virtual void Reference() const { ref(); }
      virtual void Unreference() const { unref(); }
! private:
      unsigned refcount_;
  private:
      /* prohibit default assignment */
--- 55,61 ----
      /* for backward compatibility */
      virtual void Reference() const { ref(); }
      virtual void Unreference() const { unref(); }
! 
      unsigned refcount_;
  private:
      /* prohibit default assignment */
Index: include_std/version.h
diff -c include_std/version.h:1.1 include_std/version.h:1.2
*** include_std/version.h:1.1	Wed Aug 29 10:39:19 2007
--- src/include/ivstd/version.h	Sun Sep 23 09:11:38 2007
***************
*** 1,3 ****
! #define IvtoolsVersion 1.2.4
! #define VersionString "1.2.4"
! #define ReleaseString "ivtools-1.2.4"
--- 1,3 ----
! #define IvtoolsVersion 1.2.5
! #define VersionString "1.2.5"
! #define ReleaseString "ivtools-1.2.5"
Index: IVGlyph/stredit.c
diff -c IVGlyph/stredit.c:1.1 IVGlyph/stredit.c:1.2
*** IVGlyph/stredit.c:1.1	Wed Aug 29 10:38:07 2007
--- src/IVGlyph/stredit.c	Sun Sep 23 09:11:29 2007
***************
*** 183,191 ****
      dialog_ = d;
      style_ = s;
      editor_ = nil;
      build(c1, c2, extra);
      editor_->select_all();
-     custom_ = custom;
  }
  
  void StrEditDialogImpl::build(const char* msg, const char* txt, Glyph* extra) {
--- 183,191 ----
      dialog_ = d;
      style_ = s;
      editor_ = nil;
+     custom_ = custom;
      build(c1, c2, extra);
      editor_->select_all();
  }
  
  void StrEditDialogImpl::build(const char* msg, const char* txt, Glyph* extra) {
Index: top_ivtools/CHANGES
diff -c top_ivtools/CHANGES:1.1 top_ivtools/CHANGES:1.2
*** top_ivtools/CHANGES:1.1	Wed Aug 29 10:37:43 2007
--- ./CHANGES	Sun Sep 23 09:11:24 2007
***************
*** 1,3 ****
--- 1,7 ----
+ August 31st, 2007  ivtools-1.2.5
+ 
+ - comterp parser evolution to support derived uses.
+ 
  July 20th, 2006  ivtools-1.2.4
  
  - changes for compiling with gcc-4.0
Index: top_ivtools/Copyright
diff -c top_ivtools/Copyright:1.2 top_ivtools/Copyright:1.4
*** top_ivtools/Copyright:1.2	Wed Aug 29 10:37:43 2007
--- ./Copyright	Sun Sep 23 09:11:24 2007
***************
*** 1,5 ****
  /*
!  * Copyright (c) 2001, 2002, 2003, 2004, 2005 Scott E. Johnston
   * Copyright (c) 2000  Vectaport Inc., IET Inc
   * Copyright (c) 1999  Vectaport Inc., IET Inc, R.B. Kissh and Associates
   * Copyright (c) 1998  Vectaport Inc., R.B. Kissh and Associates, Eric F. Kahler
--- 1,5 ----
  /*
!  * Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Scott E. Johnston
   * Copyright (c) 2000  Vectaport Inc., IET Inc
   * Copyright (c) 1999  Vectaport Inc., IET Inc, R.B. Kissh and Associates
   * Copyright (c) 1998  Vectaport Inc., R.B. Kissh and Associates, Eric F. Kahler
Index: top_ivtools/INSTALL
diff -c top_ivtools/INSTALL:1.1 top_ivtools/INSTALL:1.2
*** top_ivtools/INSTALL:1.1	Wed Aug 29 10:37:43 2007
--- ./INSTALL	Sun Sep 23 09:11:24 2007
***************
*** 1,7 ****
  
  			INSTALL for ivtools-1.2
  
! Instructions for building ivtools-1.2.4 from source, the short version:
  
  	./configure
  	make
--- 1,7 ----
  
  			INSTALL for ivtools-1.2
  
! Instructions for building ivtools-1.2.5 from source, the short version:
  
  	./configure
  	make
***************
*** 10,16 ****
  
  And if that doesn't work...
  
! Instructions for building ivtools-1.2.4 from source, the long version:
  
  0. Compilation Environment
  
--- 10,16 ----
  
  And if that doesn't work...
  
! Instructions for building ivtools-1.2.5 from source, the long version:
  
  0. Compilation Environment
  
Index: top_ivtools/MANIFEST
diff -c top_ivtools/MANIFEST:1.1 top_ivtools/MANIFEST:1.2
*** top_ivtools/MANIFEST:1.1	Wed Aug 29 10:37:43 2007
--- ./MANIFEST	Sun Sep 23 09:11:24 2007
***************
*** 632,638 ****
  ivtools-1.2/src/OverlayUnidraw/grloctool.h
  ivtools-1.2/src/OverlayUnidraw/indexmixins.c
  ivtools-1.2/src/OverlayUnidraw/indexmixins.h
- ivtools-1.2/src/OverlayUnidraw/leakchecker.h
  ivtools-1.2/src/OverlayUnidraw/ovabout.c
  ivtools-1.2/src/OverlayUnidraw/ovabout.h
  ivtools-1.2/src/OverlayUnidraw/ovadjuster.c
--- 632,637 ----
***************
*** 1571,1576 ****
--- 1570,1576 ----
  ivtools-1.2/src/include/ivstd/fstream.h
  ivtools-1.2/src/include/ivstd/iosfwd
  ivtools-1.2/src/include/ivstd/iostream.h
+ ivtools-1.2/src/include/ivstd/leakchecker.h
  ivtools-1.2/src/include/ivstd/malloc.h
  ivtools-1.2/src/include/ivstd/math.h
  ivtools-1.2/src/include/ivstd/nan.h
Index: top_ivtools/README
diff -c top_ivtools/README:1.1 top_ivtools/README:1.2
*** top_ivtools/README:1.1	Wed Aug 29 10:37:43 2007
--- ./README	Sun Sep 23 09:11:24 2007
***************
*** 2,8 ****
  			README for ivtools 1.2
  
  
! This directory contains a release of ivtools 1.2.4.  You should read
  the rest of this file for information on what ivtools is and the
  INSTALL file for instructions on how to build it.
  
--- 2,8 ----
  			README for ivtools 1.2
  
  
! This directory contains a release of ivtools 1.2.5.  You should read
  the rest of this file for information on what ivtools is and the
  INSTALL file for instructions on how to build it.
  
*** /dev/null	 Sun Sep 23 09:11:41 PDT 2007
--- patches/ivtools-070923-johnston-000
*************** patches/ivtools-070923-johnston-000
*** 0 ****
--- 1 ----
+ ivtools-070923-johnston-000

--Apple-Mail-5-869486645
Content-Disposition: attachment;
	filename=ivtools-070930-johnston-002
Content-Type: application/octet-stream; x-unix-mode=0644;
	name="ivtools-070930-johnston-002"
Content-Transfer-Encoding: 7bit

Patch:    ivtools-070930-johnston-002
For:      ivtools-1.2
Author:   [email protected]
Subject:  change all those min and max to ivmin and ivmax
Requires: 

This is an intermediate patch to ivtools-1.2.  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: ComTerp/comterpserv.c
diff -c ComTerp/comterpserv.c:1.2 ComTerp/comterpserv.c:1.3
*** ComTerp/comterpserv.c:1.2	Sun Sep 23 09:11:27 2007
--- src/ComTerp/comterpserv.c	Sun Sep 30 13:49:09 2007
***************
*** 23,29 ****
   */
  
  #include <ComTerp/comhandler.h>
- 
  #include <ComTerp/_comterp.h>
  #include <ComTerp/_comutil.h>
  #include <ComTerp/comterpserv.h>
--- 23,28 ----
***************
*** 161,167 ****
      fileptr_filebuf fbuf(ifptr, ios_base::in);
      istream in (&fbuf);
      in.get(instr, BUFSIZ, '\n');  // needs to be generalized with <vector.h>
! #elif __GNUC__>3
      char instr[BUFSIZ];
      FILE* ifptr = fd==0 ? stdin : server->handler()->rdfptr();
      fileptr_filebuf fbuf(ifptr, ios_base::in);
--- 160,166 ----
      fileptr_filebuf fbuf(ifptr, ios_base::in);
      istream in (&fbuf);
      in.get(instr, BUFSIZ, '\n');  // needs to be generalized with <vector.h>
! #elif __GNUC__>3 || defined(__CYGWIN__)
      char instr[BUFSIZ];
      FILE* ifptr = fd==0 ? stdin : server->handler()->rdfptr();
      fileptr_filebuf fbuf(ifptr, ios_base::in);
***************
*** 214,220 ****
  #elif (__GNUC__==3 && __GNUC_MINOR__<1)
      FILE* ofptr = fd==0 ? stdout : fdopen(fd, "w");
      fileptr_filebuf fbuf(ofptr, ios_base::out);
! #elif __GNUC__>3
      FILE* ofptr = fd==0 ? stdout : server->handler()->wrfptr();
      fileptr_filebuf fbuf(ofptr, ios_base::out);
  #else
--- 213,219 ----
  #elif (__GNUC__==3 && __GNUC_MINOR__<1)
      FILE* ofptr = fd==0 ? stdout : fdopen(fd, "w");
      fileptr_filebuf fbuf(ofptr, ios_base::out);
! #elif __GNUC__>3 || defined(__CYGWIN__)
      FILE* ofptr = fd==0 ? stdout : server->handler()->wrfptr();
      fileptr_filebuf fbuf(ofptr, ios_base::out);
  #else
***************
*** 335,341 ****
  #elif __GNUC__==3 && __GNUC_MINOR__<1
                  FILE* ofptr = handler() ? fdopen(handler()->get_handle(), "w") : stdout; 
  	        fileptr_filebuf obuf(ofptr, ios_base::out);
! #elif __GNUC__>3
                  FILE* ofptr = handler() ? handler()->wrfptr() : stdout; 
  	        fileptr_filebuf obuf(ofptr, ios_base::out);
  #else
--- 334,340 ----
  #elif __GNUC__==3 && __GNUC_MINOR__<1
                  FILE* ofptr = handler() ? fdopen(handler()->get_handle(), "w") : stdout; 
  	        fileptr_filebuf obuf(ofptr, ios_base::out);
! #elif __GNUC__>3 || defined(__CYGWIN__)
                  FILE* ofptr = handler() ? handler()->wrfptr() : stdout; 
  	        fileptr_filebuf obuf(ofptr, ios_base::out);
  #else
***************
*** 363,369 ****
  #elif __GNUC__==3 && __GNUC_MINOR__<1
            FILE* ofptr = handler() ? fdopen(handler()->get_handle(), "w") : stdout; 
  	  fileptr_filebuf obuf(ofptr, ios_base::out);
! #elif __GNUC__>3
            FILE* ofptr = handler() ? handler()->wrfptr() : stdout; 
  	  fileptr_filebuf obuf(ofptr, ios_base::out);
  #else
--- 362,368 ----
  #elif __GNUC__==3 && __GNUC_MINOR__<1
            FILE* ofptr = handler() ? fdopen(handler()->get_handle(), "w") : stdout; 
  	  fileptr_filebuf obuf(ofptr, ios_base::out);
! #elif __GNUC__>3 || defined(__CYGWIN__)
            FILE* ofptr = handler() ? handler()->wrfptr() : stdout; 
  	  fileptr_filebuf obuf(ofptr, ios_base::out);
  #else
Index: ComTerp/ctrlfunc.c
diff -c ComTerp/ctrlfunc.c:1.2 ComTerp/ctrlfunc.c:1.3
*** ComTerp/ctrlfunc.c:1.2	Sun Sep 23 09:11:27 2007
--- src/ComTerp/ctrlfunc.c	Sun Sep 30 13:49:09 2007
***************
*** 146,152 ****
  #if __GNUC__<3
      filebuf ofbuf;
      ofbuf.attach(socket.get_handle());
! #elif __GNUC__<4
      fileptr_filebuf ofbuf((int)socket.get_handle(), ios_base::out,
  			  false, static_cast<size_t>(BUFSIZ));
  #else
--- 146,152 ----
  #if __GNUC__<3
      filebuf ofbuf;
      ofbuf.attach(socket.get_handle());
! #elif __GNUC__<4 && !defined(__CYGWIN__)
      fileptr_filebuf ofbuf((int)socket.get_handle(), ios_base::out,
  			  false, static_cast<size_t>(BUFSIZ));
  #else
Index: ComUnidraw/unifunc.c
diff -c ComUnidraw/unifunc.c:1.1 ComUnidraw/unifunc.c:1.2
*** ComUnidraw/unifunc.c:1.1	Wed Aug 29 10:38:54 2007
--- src/ComUnidraw/unifunc.c	Sun Sep 30 13:49:20 2007
***************
*** 36,41 ****
--- 36,42 ----
  #include <OverlayUnidraw/ovimport.h>
  #include <OverlayUnidraw/ovselection.h>
  #include <OverlayUnidraw/ovpsview.h>
+ #include <OverlayUnidraw/ovunidraw.h>
  #include <OverlayUnidraw/ovviewer.h>
  #include <OverlayUnidraw/ovviews.h>
  #include <OverlayUnidraw/scriptview.h>
***************
*** 45,51 ****
  #include <Unidraw/creator.h>
  #include <Unidraw/globals.h>
  #include <Unidraw/iterator.h>
- #include <Unidraw/unidraw.h>
  #include <Unidraw/Commands/command.h>
  #include <Unidraw/Commands/edit.h>
  #include <Unidraw/Components/compview.h>
--- 46,51 ----
Index: dclock/data.c
diff -c dclock/data.c:1.1 dclock/data.c:1.2
*** dclock/data.c:1.1	Wed Aug 29 10:38:02 2007
--- src/dclock/data.c	Sun Sep 30 13:49:11 2007
***************
*** 111,122 ****
  void InitData() {
      FadeStep = FadeRate==0 ? 16 : 1;
      SegCode[9][SegD] = (JohnsFlag)? true : false;
!     Slant = min( max( 0,SlantPC ), 100 )/100.0;
!     HThick = min( max( 5,ThickPC ), 25 )/100.0;
!     VThick = min( max( 5,ThickPC ), 25 )/100.0 * 3.0/2.0;
  
!     Width = Coord( min( max( 100,Width ), 1024));
!     Height = Coord( min( max( 25,Height ), 865));
      YPos = YPos - Height + 1;// ypos is the TOP of clock; we need the bottom
  
      width = 2*BorderWidth+LMargin+4.0+2*DigitGap+SepGap+RMargin+Slant;
--- 111,122 ----
  void InitData() {
      FadeStep = FadeRate==0 ? 16 : 1;
      SegCode[9][SegD] = (JohnsFlag)? true : false;
!     Slant = ivmin( ivmax( 0,SlantPC ), 100 )/100.0;
!     HThick = ivmin( ivmax( 5,ThickPC ), 25 )/100.0;
!     VThick = ivmin( ivmax( 5,ThickPC ), 25 )/100.0 * 3.0/2.0;
  
!     Width = Coord( ivmin( ivmax( 100,Width ), 1024));
!     Height = Coord( ivmin( ivmax( 25,Height ), 865));
      YPos = YPos - Height + 1;// ypos is the TOP of clock; we need the bottom
  
      width = 2*BorderWidth+LMargin+4.0+2*DigitGap+SepGap+RMargin+Slant;
Index: dclock/dface.c
diff -c dclock/dface.c:1.1 dclock/dface.c:1.2
*** dclock/dface.c:1.1	Wed Aug 29 10:38:02 2007
--- src/dclock/dface.c	Sun Sep 30 13:49:11 2007
***************
*** 114,120 ****
  	}
      }
  
!     unsigned long fade = FadeDelay * (1 << (min(4,max(0,FadeRate))) );
      Event e;
      boolean done_fading = false;
      while (showTime && !done_fading && !done) {
--- 114,120 ----
  	}
      }
  
!     unsigned long fade = FadeDelay * (1 << (ivmin(4,ivmax(0,FadeRate))) );
      Event e;
      boolean done_fading = false;
      while (showTime && !done_fading && !done) {
Index: DrawServ/drawkit.c
diff -c DrawServ/drawkit.c:1.2 DrawServ/drawkit.c:1.3
*** DrawServ/drawkit.c:1.2	Sun Sep 23 09:11:36 2007
--- src/DrawServ/drawkit.c	Sun Sep 30 13:49:23 2007
***************
*** 100,105 ****
--- 100,107 ----
  implementActionCallback(DrawKit)
  
  static const int unit = 15;
+ static const int xradius = 35;
+ static const int yradius = 20;
  
  static int xClosed[] = { unit/5, unit, unit, unit*3/5, 0 };
  static int yClosed[] = { 0, unit/5, unit*3/5, unit, unit*2/5 };
***************
*** 444,450 ****
  					    protoedge),
  			layout.overlay(layout.hcenter(layout.hspace(maxwidth)),
  				       layout.hcenter(gedge)), _tg, _ed->MouseDocObservable(), GraphKit::mouse_edge));
!     SF_Ellipse* nellipse = new SF_Ellipse(0, 0, unit, unit*3/5, stdgraphic);
      nellipse->SetPattern(psnonepat);
      TextGraphic* ntext = new TextGraphic("___", stdgraphic);
      nellipse->Align(4, ntext, 4); // same as Center in IV-2_6/InterViews/alignment.h
--- 446,452 ----
  					    protoedge),
  			layout.overlay(layout.hcenter(layout.hspace(maxwidth)),
  				       layout.hcenter(gedge)), _tg, _ed->MouseDocObservable(), GraphKit::mouse_edge));
!     SF_Ellipse* nellipse = new SF_Ellipse(0, 0, xradius, yradius, stdgraphic);
      nellipse->SetPattern(psnonepat);
      TextGraphic* ntext = new TextGraphic("___", stdgraphic);
      nellipse->Align(4, ntext, 4); // same as Center in IV-2_6/InterViews/alignment.h
***************
*** 453,459 ****
  					    protonode),
  			layout.overlay(layout.hcenter(layout.hspace(maxwidth)),
  				       layout.hcenter(gnod1)), _tg, _ed->MouseDocObservable(), GraphKit::mouse_node));
!     SF_Ellipse* nellipse2 = new SF_Ellipse(0, 0, unit, unit*3/5, stdgraphic);
      nellipse2->SetPattern(psnonepat);
      TextGraphic* ntext2 = new TextGraphic("abc", stdgraphic);
      nellipse2->Align(4, ntext2, 4); // same as Center in IV-2_6/InterViews/alignment.h
--- 455,461 ----
  					    protonode),
  			layout.overlay(layout.hcenter(layout.hspace(maxwidth)),
  				       layout.hcenter(gnod1)), _tg, _ed->MouseDocObservable(), GraphKit::mouse_node));
!     SF_Ellipse* nellipse2 = new SF_Ellipse(0, 0, xradius, yradius, stdgraphic);
      nellipse2->SetPattern(psnonepat);
      TextGraphic* ntext2 = new TextGraphic("abc", stdgraphic);
      nellipse2->Align(4, ntext2, 4); // same as Center in IV-2_6/InterViews/alignment.h
Index: GraphUnidraw/graphkit.c
diff -c GraphUnidraw/graphkit.c:1.1 GraphUnidraw/graphkit.c:1.2
*** GraphUnidraw/graphkit.c:1.1	Wed Aug 29 10:38:58 2007
--- src/GraphUnidraw/graphkit.c	Sun Sep 30 13:49:22 2007
***************
*** 120,125 ****
--- 120,127 ----
  implementActionCallback(GraphKit)
  
  static const int unit = 15;
+ static const int xradius = 35;
+ static const int yradius = 20;
  
  static int xClosed[] = { unit/5, unit, unit, unit*3/5, 0 };
  static int yClosed[] = { 0, unit/5, unit*3/5, unit, unit*2/5 };
***************
*** 557,563 ****
  					    protoedge),
  			layout.overlay(layout.hcenter(layout.hspace(maxwidth)),
  				       layout.hcenter(gedge)), _tg, _ed->MouseDocObservable(), mouse_edge));
!     SF_Ellipse* nellipse = new SF_Ellipse(0, 0, unit, unit*3/5, stdgraphic);
      nellipse->SetPattern(psnonepat);
      TextGraphic* ntext = new TextGraphic("___", stdgraphic);
      nellipse->Align(4, ntext, 4); // same as Center in IV-2_6/InterViews/alignment.h
--- 559,565 ----
  					    protoedge),
  			layout.overlay(layout.hcenter(layout.hspace(maxwidth)),
  				       layout.hcenter(gedge)), _tg, _ed->MouseDocObservable(), mouse_edge));
!     SF_Ellipse* nellipse = new SF_Ellipse(0, 0, xradius, yradius, stdgraphic);
      nellipse->SetPattern(psnonepat);
      TextGraphic* ntext = new TextGraphic("___", stdgraphic);
      nellipse->Align(4, ntext, 4); // same as Center in IV-2_6/InterViews/alignment.h
***************
*** 566,572 ****
  					    protonode),
  			layout.overlay(layout.hcenter(layout.hspace(maxwidth)),
  				       layout.hcenter(gnod1)), _tg, _ed->MouseDocObservable(), mouse_node));
!     SF_Ellipse* nellipse2 = new SF_Ellipse(0, 0, unit, unit*3/5, stdgraphic);
      nellipse2->SetPattern(psnonepat);
      TextGraphic* ntext2 = new TextGraphic("abc", stdgraphic);
      nellipse2->Align(4, ntext2, 4); // same as Center in IV-2_6/InterViews/alignment.h
--- 568,574 ----
  					    protonode),
  			layout.overlay(layout.hcenter(layout.hspace(maxwidth)),
  				       layout.hcenter(gnod1)), _tg, _ed->MouseDocObservable(), mouse_node));
!     SF_Ellipse* nellipse2 = new SF_Ellipse(0, 0, xradius, yradius, stdgraphic);
      nellipse2->SetPattern(psnonepat);
      TextGraphic* ntext2 = new TextGraphic("abc", stdgraphic);
      nellipse2->Align(4, ntext2, 4); // same as Center in IV-2_6/InterViews/alignment.h
Index: GraphUnidraw/nodecomp.c
diff -c GraphUnidraw/nodecomp.c:1.3 GraphUnidraw/nodecomp.c:1.4
*** GraphUnidraw/nodecomp.c:1.3	Fri Sep 28 13:08:35 2007
--- src/GraphUnidraw/nodecomp.c	Sun Sep 30 13:49:22 2007
***************
*** 35,40 ****
--- 35,41 ----
  #include <OverlayUnidraw/ovcmds.h>
  #include <OverlayUnidraw/ovellipse.h>
  #include <OverlayUnidraw/ovtext.h>
+ #include <OverlayUnidraw/ovunidraw.h>
  #include <OverlayUnidraw/paramlist.h>
  
  #include <IVGlyph/observables.h>
***************
*** 56,62 ****
  #include <Unidraw/statevars.h>
  #include <Unidraw/ulist.h>
  #include <Unidraw/viewer.h>
- #include <Unidraw/unidraw.h>
  #include <UniIdraw/idarrows.h>
  #include <UniIdraw/ided.h>
  #include <IV-2_6/InterViews/painter.h>
--- 57,62 ----
***************
*** 657,663 ****
  #endif
  
  void NodeComp::Notify() {
!   GraphicComp::Notify();
  }
  
  EdgeComp* NodeComp::EdgeIn(int n) const {
--- 657,663 ----
  #endif
  
  void NodeComp::Notify() {
!     GraphicComp::Notify();
  }
  
  EdgeComp* NodeComp::EdgeIn(int n) const {
Index: iclass/iclass.c
diff -c iclass/iclass.c:1.1 iclass/iclass.c:1.2
*** iclass/iclass.c:1.1	Wed Aug 29 10:38:03 2007
--- src/iclass/iclass.c	Sun Sep 30 13:49:12 2007
***************
*** 196,202 ****
          if (f != nil) {
              struct stat filestats;
              stat(filename, &filestats);
!             _bufsize = max(Math::round(filestats.st_size * 1.2), MINTEXTSIZE);
              _buf = new char[_bufsize];
              char* b = _buf;
              int remaining = _bufsize;
--- 196,202 ----
          if (f != nil) {
              struct stat filestats;
              stat(filename, &filestats);
!             _bufsize = ivmax(Math::round(filestats.st_size * 1.2), MINTEXTSIZE);
              _buf = new char[_bufsize];
              char* b = _buf;
              int remaining = _bufsize;
Index: include_graphic/verts.h
diff -c include_graphic/verts.h:1.1 include_graphic/verts.h:1.2
*** include_graphic/verts.h:1.1	Wed Aug 29 10:39:17 2007
--- src/include/Unidraw/Graphic/verts.h	Sun Sep 30 13:49:26 2007
***************
*** 45,50 ****
--- 45,52 ----
      virtual MultiLineObj* GetOriginal();
      virtual void SetOriginal(MultiLineObj*);
  
+     boolean GetPoint(int index, Coord& x, Coord& y);
+ 
      virtual boolean operator == (Vertices&);
      virtual boolean operator != (Vertices&);
  
Index: include_iviv-2_6/minmax.h
diff -c include_iviv-2_6/minmax.h:1.1 include_iviv-2_6/minmax.h:1.2
*** include_iviv-2_6/minmax.h:1.1	Wed Aug 29 10:39:06 2007
--- src/include/IV-2_6/InterViews/minmax.h	Sun Sep 30 13:49:24 2007
***************
*** 27,37 ****
  
  #include <InterViews/boolean.h>
  
! #if !defined(min) && !defined(max)
  
  #define declare_2(T) \
! inline T min(T a, T b) { return a < b ? a : b; } \
! inline T max(T a, T b) { return a > b ? a : b; } \
  
  declare_2(int)
  declare_2(unsigned)
--- 27,37 ----
  
  #include <InterViews/boolean.h>
  
! #if !defined(ivmin) && !defined(ivmax)
  
  #define declare_2(T) \
! inline T ivmin(T a, T b) { return a < b ? a : b; } \
! inline T ivmax(T a, T b) { return a > b ? a : b; } \
  
  declare_2(int)
  declare_2(unsigned)
***************
*** 43,63 ****
   */
  
  #define declare_4(T) \
! inline T min(T a, T b, T c, T d) { \
!     T r1 = min(a, b), r2 = min(c, d); \
!     return min(r1, r2); \
  } \
  \
! inline T max(T a, T b, T c, T d) { \
!     T r1 = max(a, b), r2 = max(c, d); \
!     return max(r1, r2); \
  }
  
  declare_4(int)
  declare_4(float)
  declare_4(double)
  
! #endif /* !defined(min) && !defined(max) */
  
  #if __GNUC__<3 && 0 /* removed, used Math::round from now on */
  inline int round(double x) { return x > 0 ? int(x+0.5) : -int(-x+0.5); }
--- 43,63 ----
   */
  
  #define declare_4(T) \
! inline T ivmin(T a, T b, T c, T d) { \
!     T r1 = ivmin(a, b), r2 = ivmin(c, d); \
!     return ivmin(r1, r2); \
  } \
  \
! inline T ivmax(T a, T b, T c, T d) { \
!     T r1 = ivmax(a, b), r2 = ivmax(c, d); \
!     return ivmax(r1, r2); \
  }
  
  declare_4(int)
  declare_4(float)
  declare_4(double)
  
! #endif /* !defined(ivmin) && !defined(ivmax) */
  
  #if __GNUC__<3 && 0 /* removed, used Math::round from now on */
  inline int round(double x) { return x > 0 ? int(x+0.5) : -int(-x+0.5); }
Index: IVGlyph/figure.c
diff -c IVGlyph/figure.c:1.1 IVGlyph/figure.c:1.2
*** IVGlyph/figure.c:1.1	Wed Aug 29 10:38:07 2007
--- src/IVGlyph/figure.c	Sun Sep 30 13:49:13 2007
***************
*** 134,140 ****
  void Graphic31::ctrlpts (Coord* x, Coord* y, int count) {
      delete _x;
      delete _y;
!     _ctrlpts = max(count+1, buf_size);
      _x = new Coord[_ctrlpts];
      _y = new Coord[_ctrlpts];
      for (int i = 0; i < count; i++) {
--- 134,140 ----
  void Graphic31::ctrlpts (Coord* x, Coord* y, int count) {
      delete _x;
      delete _y;
!     _ctrlpts = ivmax(count+1, buf_size);
      _x = new Coord[_ctrlpts];
      _y = new Coord[_ctrlpts];
      for (int i = 0; i < count; i++) {
Index: IVGlyph/globals.c
diff -c IVGlyph/globals.c:1.1 IVGlyph/globals.c:1.2
*** IVGlyph/globals.c:1.1	Wed Aug 29 10:38:07 2007
--- src/IVGlyph/globals.c	Sun Sep 30 13:49:13 2007
***************
*** 30,37 ****
  }
  boolean LineObj::Contains (PointObj& p) {
      return
! 	(p._x >= min(_p1._x, _p2._x)) && (p._x <= max(_p1._x, _p2._x)) &&
! 	(p._y >= min(_p1._y, _p2._y)) && (p._y <= max(_p1._y, _p2._y)) && (
              (p._y - _p1._y)*(_p2._x - _p1._x) - 
              (_p2._y - _p1._y)*(p._x - _p1._x)
          ) == 0;
--- 30,37 ----
  }
  boolean LineObj::Contains (PointObj& p) {
      return
! 	(p._x >= ivmin(_p1._x, _p2._x)) && (p._x <= ivmax(_p1._x, _p2._x)) &&
! 	(p._y >= ivmin(_p1._y, _p2._y)) && (p._y <= ivmax(_p1._y, _p2._y)) && (
              (p._y - _p1._y)*(_p2._x - _p1._x) - 
              (_p2._y - _p1._y)*(p._x - _p1._x)
          ) == 0;
***************
*** 72,79 ****
  /*****************************************************************************/
  
  BoxObj::BoxObj (Coord x0, Coord y0, Coord x1, Coord y1) {
!     _left = min(x0, x1); _bottom = min(y0, y1); 
!     _right = max(x0, x1); _top = max(y0, y1);
  }
  
  BoxObj::BoxObj (BoxObj* b) {
--- 72,79 ----
  /*****************************************************************************/
  
  BoxObj::BoxObj (Coord x0, Coord y0, Coord x1, Coord y1) {
!     _left = ivmin(x0, x1); _bottom = ivmin(y0, y1); 
!     _right = ivmax(x0, x1); _top = ivmax(y0, y1);
  }
  
  BoxObj::BoxObj (BoxObj* b) {
***************
*** 104,113 ****
  }
  
  boolean BoxObj::Intersects (LineObj& l) {
!     Coord x1 = min(l._p1._x, l._p2._x);
!     Coord x2 = max(l._p1._x, l._p2._x);
!     Coord y1 = min(l._p1._y, l._p2._y);
!     Coord y2 = max(l._p1._y, l._p2._y);
      BoxObj lbox(x1, y1, x2, y2);
      boolean intersects = false;
  
--- 104,113 ----
  }
  
  boolean BoxObj::Intersects (LineObj& l) {
!     Coord x1 = ivmin(l._p1._x, l._p2._x);
!     Coord x2 = ivmax(l._p1._x, l._p2._x);
!     Coord y1 = ivmin(l._p1._y, l._p2._y);
!     Coord y2 = ivmax(l._p1._y, l._p2._y);
      BoxObj lbox(x1, y1, x2, y2);
      boolean intersects = false;
  
***************
*** 130,139 ****
      BoxObj i;
  
      if (Intersects(b)) {
!         i._left = max(_left, b._left);
! 	i._bottom = max(_bottom, b._bottom);
! 	i._right = min(_right, b._right);
! 	i._top = min(_top, b._top);
      }
      return i;
  }
--- 130,139 ----
      BoxObj i;
  
      if (Intersects(b)) {
!         i._left = ivmax(_left, b._left);
! 	i._bottom = ivmax(_bottom, b._bottom);
! 	i._right = ivmin(_right, b._right);
! 	i._top = ivmin(_top, b._top);
      }
      return i;
  }
***************
*** 141,150 ****
  BoxObj BoxObj::operator+ (BoxObj& b) {
      BoxObj m;
      
!     m._left = min(_left, b._left);
!     m._bottom = min(_bottom, b._bottom);
!     m._right = max(_right, b._right);
!     m._top = max(_top, b._top);
      return m;
  }
  
--- 141,150 ----
  BoxObj BoxObj::operator+ (BoxObj& b) {
      BoxObj m;
      
!     m._left = ivmin(_left, b._left);
!     m._bottom = ivmin(_bottom, b._bottom);
!     m._right = ivmax(_right, b._right);
!     m._top = ivmax(_top, b._top);
      return m;
  }
  
***************
*** 347,356 ****
      b._bottom = b._top = _y[0];
  
      for (int i = 1; i < _count; ++i) {
! 	b._left = min(b._left, _x[i]);
! 	b._bottom = min(b._bottom, _y[i]);
! 	b._right = max(b._right, _x[i]);
! 	b._top = max(b._top, _y[i]);
      }
  }
  
--- 347,356 ----
      b._bottom = b._top = _y[0];
  
      for (int i = 1; i < _count; ++i) {
! 	b._left = ivmin(b._left, _x[i]);
! 	b._bottom = ivmin(b._bottom, _y[i]);
! 	b._right = ivmax(b._right, _x[i]);
! 	b._top = ivmax(b._top, _y[i]);
      }
  }
  
***************
*** 592,607 ****
      }
  
  void Extent::Merge (Extent& e) {
!     float nl = min(_left, e._left);
!     float nb = min(_bottom, e._bottom);
  
      if (Undefined()) {
  	_left = e._left; _bottom = e._bottom; _cx = e._cx; _cy = e._cy;
      } else if (!e.Undefined()) {
! 	_cx = (nl + max(2*_cx - _left, 2*e._cx - e._left)) / 2;
! 	_cy = (nb + max(2*_cy - _bottom, 2*e._cy - e._bottom)) / 2;
  	_left = nl;
  	_bottom = nb;
      }
!     _tol = max(_tol, e._tol);
  }
--- 592,607 ----
      }
  
  void Extent::Merge (Extent& e) {
!     float nl = ivmin(_left, e._left);
!     float nb = ivmin(_bottom, e._bottom);
  
      if (Undefined()) {
  	_left = e._left; _bottom = e._bottom; _cx = e._cx; _cy = e._cy;
      } else if (!e.Undefined()) {
! 	_cx = (nl + ivmax(2*_cx - _left, 2*e._cx - e._left)) / 2;
! 	_cy = (nb + ivmax(2*_cy - _bottom, 2*e._cy - e._bottom)) / 2;
  	_left = nl;
  	_bottom = nb;
      }
!     _tol = ivmax(_tol, e._tol);
  }
Index: OverlayUnidraw/ovarrow.c
diff -c OverlayUnidraw/ovarrow.c:1.1 OverlayUnidraw/ovarrow.c:1.2
*** OverlayUnidraw/ovarrow.c:1.1	Wed Aug 29 10:38:50 2007
--- src/OverlayUnidraw/ovarrow.c	Sun Sep 30 13:49:19 2007
***************
*** 667,673 ****
      int cnt = 0;
      for (int v=0; v<numverts; v+=limit-1) {
  
! 	int n = min(numverts-cnt,limit);
  
  	if (v==0)
  	    aml->SetArrows(head, false);
--- 667,673 ----
      int cnt = 0;
      for (int v=0; v<numverts; v+=limit-1) {
  
! 	int n = ivmin(numverts-cnt,limit);
  
  	if (v==0)
  	    aml->SetArrows(head, false);
Index: OverlayUnidraw/ovcomps.c
diff -c OverlayUnidraw/ovcomps.c:1.1 OverlayUnidraw/ovcomps.c:1.2
*** OverlayUnidraw/ovcomps.c:1.1	Wed Aug 29 10:38:50 2007
--- src/OverlayUnidraw/ovcomps.c	Sun Sep 30 13:49:19 2007
***************
*** 32,37 ****
--- 32,38 ----
  #include <OverlayUnidraw/oved.h>
  #include <OverlayUnidraw/ovpainter.h>
  #include <OverlayUnidraw/ovselection.h>
+ #include <OverlayUnidraw/ovunidraw.h>
  #include <OverlayUnidraw/ovviewer.h>
  #include <OverlayUnidraw/ovviews.h>
  #include <OverlayUnidraw/paramlist.h>
***************
*** 45,51 ****
  #include <Unidraw/clipboard.h>
  #include <Unidraw/iterator.h>
  #include <Unidraw/ulist.h>
- #include <Unidraw/unidraw.h>
  
  #include <Unidraw/Commands/datas.h>
  #include <Unidraw/Commands/struct.h>
--- 46,51 ----
***************
*** 95,100 ****
--- 95,101 ----
      _parent = parent;
      _anno = nil;
      _attrlist = nil;
+     _notify_deferred = 0;
  }
  
  OverlayComp::OverlayComp (istream& in) { 
***************
*** 102,107 ****
--- 103,109 ----
      _parent = nil;
      _anno = nil;
      _attrlist = nil;
+     _notify_deferred = 0;
      _valid = GetParamList()->read_args(in, this);
  }
  
***************
*** 347,354 ****
--- 349,366 ----
    Notify();
  }
  
+ void OverlayComp::NotifyLater() {
+   Observable::notify();
+ 
+   if (OverlayUnidraw::deferred_notifications()) 
+     _notify_deferred = 1;
+   else 
+     GraphicComp::Notify();
+ }
+ 
  void OverlayComp::Notify() {
    Observable::notify();
+ 
    GraphicComp::Notify();
  }
  
***************
*** 378,383 ****
--- 390,402 ----
      return nil;
  }
  
+ void OverlayComp::DeferredNotify() {
+   if (_notify_deferred) {
+     GraphicComp::Notify();
+     _notify_deferred = false;
+   }
+ }
+ 
  /*****************************************************************************/
  
  ParamList* OverlaysComp::_overlay_comps_params = nil;
***************
*** 1173,1178 ****
--- 1192,1211 ----
    return nil;
  }
  
+ void OverlaysComp::DeferredNotify() {
+   if (_notify_deferred) {
+     GraphicComp::Notify();
+     _notify_deferred = false;
+   } else {
+     Iterator i;
+     for (First(i); !Done(i); Next(i)) {
+       OverlayComp* comp = (OverlayComp*)GetComp(i);
+       if (!comp->GetGraphic()->Hidden())
+ 	((OverlayComp*)GetComp(i))->DeferredNotify();
+     }
+   }
+ }
+ 
  /*****************************************************************************/
  
  ParamList* OverlayIdrawComp::_overlay_idraw_params = nil;
Index: OverlayUnidraw/ovcomps.h
diff -c OverlayUnidraw/ovcomps.h:1.1 OverlayUnidraw/ovcomps.h:1.2
*** OverlayUnidraw/ovcomps.h:1.1	Wed Aug 29 10:38:50 2007
--- src/OverlayUnidraw/ovcomps.h	Sun Sep 30 13:49:19 2007
***************
*** 156,161 ****
--- 156,166 ----
      virtual void Notify(); 
      // method specialized from Component that incorporates the Observer/Observable
      // notification with the original Unidraw notification.
+     virtual void NotifyLater();
+     // defers notifications when enabled
+ 
+     virtual void DeferredNotify();
+     // do all deferred Notify's
  protected:
      ParamList* GetParamList();
      // return ParamList of required/optional/keyword arguments to be read
***************
*** 175,180 ****
--- 180,186 ----
      char* _anno;
      OverlayComp* _parent;
      AttributeList* _attrlist;
+     boolean _notify_deferred;
  
  friend class OverlayScript;
  friend class OverlaysScript;
***************
*** 274,279 ****
--- 280,288 ----
      // default argument mode implemented so far -- return first occurence found
      // with a downward depth-first search.
  
+     virtual void DeferredNotify();
+     // do all deferred Notify's
+ 
  protected:
      OverlayComp* Comp(UList*);
      UList* Elem(Iterator);
Index: OverlayUnidraw/ovimport.c
diff -c OverlayUnidraw/ovimport.c:1.1 OverlayUnidraw/ovimport.c:1.2
*** OverlayUnidraw/ovimport.c:1.1	Wed Aug 29 10:38:50 2007
--- src/OverlayUnidraw/ovimport.c	Sun Sep 30 13:49:19 2007
***************
*** 525,531 ****
      int h = rr->GetOverlayRaster()->pheight();
      int w = rr->GetOverlayRaster()->pwidth();
      int xbeg = 0;
!     int yend = min(_itr->ycur() + (int)ceil(1./mag), h-1);
      _itr->getPixels(in); 
      int xend = w-1;
      int ybeg = _itr->ycur() + 1;
--- 525,531 ----
      int h = rr->GetOverlayRaster()->pheight();
      int w = rr->GetOverlayRaster()->pwidth();
      int xbeg = 0;
!     int yend = ivmin(_itr->ycur() + (int)ceil(1./mag), h-1);
      _itr->getPixels(in); 
      int xend = w-1;
      int ybeg = _itr->ycur() + 1;
***************
*** 550,556 ****
  	   // << sxend << "," << syend << "\n";
        
  //      if ( _lastmag == mag ) 
! 	viewer->GetDamage()->Incur(min(sxbeg,sxend)-1,min(sybeg,syend)-1, max(sxend, sxbeg)+1, max(syend, sybeg)+1);
  //      else {
  //	cerr << "ReadImageHandler::process -- damaging entire raster\n";
  //	cerr << "ReadImageHandler::process -- mag is now " << mag << "\n";
--- 550,556 ----
  	   // << sxend << "," << syend << "\n";
        
  //      if ( _lastmag == mag ) 
! 	viewer->GetDamage()->Incur(ivmin(sxbeg,sxend)-1,ivmin(sybeg,syend)-1, ivmax(sxend, sxbeg)+1, ivmax(syend, sybeg)+1);
  //      else {
  //	cerr << "ReadImageHandler::process -- damaging entire raster\n";
  //	cerr << "ReadImageHandler::process -- mag is now " << mag << "\n";
***************
*** 2316,2325 ****
      boolean compressed, boolean tiled, boolean delayed, OverlayRaster* raster,
      IntCoord xbeg, IntCoord xend, IntCoord ybeg, IntCoord yend
  ) {
!     xbeg = xbeg < 0 ? 0 : min(xbeg, ncols-1);
!     xend = xend < 0 ? ncols-1 : min(xend, ncols-1);
!     ybeg = ybeg < 0 ? 0 : min(ybeg, nrows-1);
!     yend = yend < 0 ? nrows-1 : min(yend, nrows-1);
  
      if (!raster) 
  	raster = pih->create_raster(xend-xbeg+1, yend-ybeg+1);
--- 2316,2325 ----
      boolean compressed, boolean tiled, boolean delayed, OverlayRaster* raster,
      IntCoord xbeg, IntCoord xend, IntCoord ybeg, IntCoord yend
  ) {
!     xbeg = xbeg < 0 ? 0 : ivmin(xbeg, ncols-1);
!     xend = xend < 0 ? ncols-1 : ivmin(xend, ncols-1);
!     ybeg = ybeg < 0 ? 0 : ivmin(ybeg, nrows-1);
!     yend = yend < 0 ? nrows-1 : ivmin(yend, nrows-1);
  
      if (!raster) 
  	raster = pih->create_raster(xend-xbeg+1, yend-ybeg+1);
Index: OverlayUnidraw/ovraster.c
diff -c OverlayUnidraw/ovraster.c:1.1 OverlayUnidraw/ovraster.c:1.2
*** OverlayUnidraw/ovraster.c:1.1	Wed Aug 29 10:38:51 2007
--- src/OverlayUnidraw/ovraster.c	Sun Sep 30 13:49:19 2007
***************
*** 1783,1791 ****
  	    newr = grayfract < 0.5 ? 0.0 : (grayfract-.5)*2;
  	    newg = grayfract < 0.5 ? grayfract*2 : 1.0 - (grayfract-.5)*2;
  	    newb = grayfract < 0.5 ? 1.0 - (grayfract-.5)*2 : 0.0;
! 	    newr = max((float)0.0, newr);
! 	    newg = max((float)0.0, newg);
! 	    newb = max((float)0.0, newb);
  #endif
  
  	    color->poke(w, h, newr, newg, newb, 1.0);
--- 1783,1791 ----
  	    newr = grayfract < 0.5 ? 0.0 : (grayfract-.5)*2;
  	    newg = grayfract < 0.5 ? grayfract*2 : 1.0 - (grayfract-.5)*2;
  	    newb = grayfract < 0.5 ? 1.0 - (grayfract-.5)*2 : 0.0;
! 	    newr = ivmax((float)0.0, newr);
! 	    newg = ivmax((float)0.0, newg);
! 	    newb = ivmax((float)0.0, newb);
  #endif
  
  	    color->poke(w, h, newr, newg, newb, 1.0);
***************
*** 1853,1859 ****
          dists[i] = dist(x, y, xside[i], yside[i]);
      }
  
!     float side = min(min(dists[0], dists[1]), min(dists[2], dists[3]));
  
      RampAlignment align;
      if ( side == dists[0] ) {
--- 1853,1859 ----
          dists[i] = dist(x, y, xside[i], yside[i]);
      }
  
!     float side = ivmin(ivmin(dists[0], dists[1]), ivmin(dists[2], dists[3]));
  
      RampAlignment align;
      if ( side == dists[0] ) {
Index: OverlayUnidraw/ovunidraw.c
diff -c OverlayUnidraw/ovunidraw.c:1.1 OverlayUnidraw/ovunidraw.c:1.2
*** OverlayUnidraw/ovunidraw.c:1.1	Wed Aug 29 10:38:51 2007
--- src/OverlayUnidraw/ovunidraw.c	Sun Sep 30 13:49:19 2007
***************
*** 62,67 ****
--- 62,68 ----
  boolean* OverlayUnidraw::_updated_ptr = nil;
  ComTerpServ* OverlayUnidraw::_comterp = nil;
  int OverlayUnidraw::_npause = nil;
+ boolean OverlayUnidraw::_deferred_notifications = 0;
  
  /*****************************************************************************/
  
***************
*** 213,222 ****
    }
  }
  
  
  
! 
! 
! 
! 
  
--- 214,231 ----
    }
  }
  
+ void OverlayUnidraw::DeferredNotify() {
+     UList* e = _editors->First();
+     ((OverlayComp*)editor(e)->GetComponent())->DeferredNotify();
+ }
  
+ void OverlayUnidraw::Update (boolean immediate) {
+   if (deferred_notifications())
+     DeferredNotify();
  
!     if (immediate) {
!         DoUpdate();
!     }
!     updated(!immediate);
! }
  
Index: OverlayUnidraw/ovunidraw.h
diff -c OverlayUnidraw/ovunidraw.h:1.1 OverlayUnidraw/ovunidraw.h:1.2
*** OverlayUnidraw/ovunidraw.h:1.1	Wed Aug 29 10:38:51 2007
--- src/OverlayUnidraw/ovunidraw.h	Sun Sep 30 13:49:19 2007
***************
*** 49,54 ****
--- 49,55 ----
      OverlayUnidraw(Catalog*, World*);
      virtual ~OverlayUnidraw();
  
+     virtual void Update(boolean immediate = false);
      virtual void Run();
      virtual void Log(Command*, boolean dirty);
  
***************
*** 70,75 ****
--- 71,85 ----
  
      ComTerpServ* comterp() { return _comterp; }
      void comterp(ComTerpServ* comterp) { _comterp = comterp; }
+ 
+     void DeferredNotify();
+     // do all deferred notifications
+ 
+     static boolean deferred_notifications() { return _deferred_notifications; }
+     // return flag that indicates deferred notifications
+ 
+     static void deferred_notifications(boolean flag) { _deferred_notifications = flag; }
+     // set flag that indicates deferred notifications
      
  protected:
      static MacroCmd* _cmdq;
***************
*** 77,82 ****
--- 87,93 ----
      OverlayViewer* _ovviewer;
      static ComTerpServ* _comterp;
      static int _npause;
+     static boolean _deferred_notifications;
  };
  
  #endif
Index: TopoFace/fgeomobjs.c
diff -c TopoFace/fgeomobjs.c:1.1 TopoFace/fgeomobjs.c:1.2
*** TopoFace/fgeomobjs.c:1.1	Wed Aug 29 10:37:47 2007
--- src/TopoFace/fgeomobjs.c	Sun Sep 30 13:49:08 2007
***************
*** 72,79 ****
  
  boolean FLineObj::Contains (FPointObj& p) {
      return
! 	(p._x >= min(_p1._x, _p2._x)) && (p._x <= max(_p1._x, _p2._x)) &&
! 	(p._y >= min(_p1._y, _p2._y)) && (p._y <= max(_p1._y, _p2._y)) && (
              (p._y - _p1._y)*(_p2._x - _p1._x) - 
              (_p2._y - _p1._y)*(p._x - _p1._x)
          ) == 0;
--- 72,79 ----
  
  boolean FLineObj::Contains (FPointObj& p) {
      return
! 	(p._x >= ivmin(_p1._x, _p2._x)) && (p._x <= ivmax(_p1._x, _p2._x)) &&
! 	(p._y >= ivmin(_p1._y, _p2._y)) && (p._y <= ivmax(_p1._y, _p2._y)) && (
              (p._y - _p1._y)*(_p2._x - _p1._x) - 
              (_p2._y - _p1._y)*(p._x - _p1._x)
          ) == 0;
***************
*** 167,174 ****
  /*****************************************************************************/
  
  FBoxObj::FBoxObj (float x0, float y0, float x1, float y1) {
!     _left = min(x0, x1); _bottom = min(y0, y1); 
!     _right = max(x0, x1); _top = max(y0, y1);
  }
  
  FBoxObj::FBoxObj (FBoxObj* b) {
--- 167,174 ----
  /*****************************************************************************/
  
  FBoxObj::FBoxObj (float x0, float y0, float x1, float y1) {
!     _left = ivmin(x0, x1); _bottom = ivmin(y0, y1); 
!     _right = ivmax(x0, x1); _top = ivmax(y0, y1);
  }
  
  FBoxObj::FBoxObj (FBoxObj* b) {
***************
*** 189,198 ****
  }
  
  boolean FBoxObj::Intersects (FLineObj& l) {
!     float x1 = min(l._p1._x, l._p2._x);
!     float x2 = max(l._p1._x, l._p2._x);
!     float y1 = min(l._p1._y, l._p2._y);
!     float y2 = max(l._p1._y, l._p2._y);
      FBoxObj lbox(x1, y1, x2, y2);
      boolean intersects = false;
  
--- 189,198 ----
  }
  
  boolean FBoxObj::Intersects (FLineObj& l) {
!     float x1 = ivmin(l._p1._x, l._p2._x);
!     float x2 = ivmax(l._p1._x, l._p2._x);
!     float y1 = ivmin(l._p1._y, l._p2._y);
!     float y2 = ivmax(l._p1._y, l._p2._y);
      FBoxObj lbox(x1, y1, x2, y2);
      boolean intersects = false;
  
***************
*** 215,224 ****
      FBoxObj i;
  
      if (Intersects(b)) {
!         i._left = max(_left, b._left);
! 	i._bottom = max(_bottom, b._bottom);
! 	i._right = min(_right, b._right);
! 	i._top = min(_top, b._top);
      }
      return i;
  }
--- 215,224 ----
      FBoxObj i;
  
      if (Intersects(b)) {
!         i._left = ivmax(_left, b._left);
! 	i._bottom = ivmax(_bottom, b._bottom);
! 	i._right = ivmin(_right, b._right);
! 	i._top = ivmin(_top, b._top);
      }
      return i;
  }
***************
*** 226,235 ****
  FBoxObj FBoxObj::operator+ (FBoxObj& b) {
      FBoxObj m;
      
!     m._left = min(_left, b._left);
!     m._bottom = min(_bottom, b._bottom);
!     m._right = max(_right, b._right);
!     m._top = max(_top, b._top);
      return m;
  }
  
--- 226,235 ----
  FBoxObj FBoxObj::operator+ (FBoxObj& b) {
      FBoxObj m;
      
!     m._left = ivmin(_left, b._left);
!     m._bottom = ivmin(_bottom, b._bottom);
!     m._right = ivmax(_right, b._right);
!     m._top = ivmax(_top, b._top);
      return m;
  }
  
***************
*** 483,492 ****
      b._bottom = b._top = _y[0];
  
      for (int i = 1; i < _count; ++i) {
! 	b._left = min(b._left, _x[i]);
! 	b._bottom = min(b._bottom, _y[i]);
! 	b._right = max(b._right, _x[i]);
! 	b._top = max(b._top, _y[i]);
      }
  }
  
--- 483,492 ----
      b._bottom = b._top = _y[0];
  
      for (int i = 1; i < _count; ++i) {
! 	b._left = ivmin(b._left, _x[i]);
! 	b._bottom = ivmin(b._bottom, _y[i]);
! 	b._right = ivmax(b._right, _x[i]);
! 	b._top = ivmax(b._top, _y[i]);
      }
  }
  
***************
*** 571,577 ****
  	    _pts_by_n[i] = nil;
      }
      if (npts>=_pts_by_n_size) {
! 	int new_size = max(_pts_by_n_size*2, npts+1);
  	UList** new_pts_by_n = new UList*[new_size];
  	int i = 0;
  	for (;i<_pts_by_n_size; i++) 
--- 571,577 ----
  	    _pts_by_n[i] = nil;
      }
      if (npts>=_pts_by_n_size) {
! 	int new_size = ivmax(_pts_by_n_size*2, npts+1);
  	UList** new_pts_by_n = new UList*[new_size];
  	int i = 0;
  	for (;i<_pts_by_n_size; i++) 
***************
*** 995,1011 ****
      }
  
  void Extent::Merge (Extent& e) {
!     float nl = min(_left, e._left);
!     float nb = min(_bottom, e._bottom);
  
      if (Undefined()) {
  	_left = e._left; _bottom = e._bottom; _cx = e._cx; _cy = e._cy;
      } else if (!e.Undefined()) {
! 	_cx = (nl + max(2*_cx - _left, 2*e._cx - e._left)) / 2;
! 	_cy = (nb + max(2*_cy - _bottom, 2*e._cy - e._bottom)) / 2;
  	_left = nl;
  	_bottom = nb;
      }
!     _tol = max(_tol, e._tol);
  }
  #endif
--- 995,1011 ----
      }
  
  void Extent::Merge (Extent& e) {
!     float nl = ivmin(_left, e._left);
!     float nb = ivmin(_bottom, e._bottom);
  
      if (Undefined()) {
  	_left = e._left; _bottom = e._bottom; _cx = e._cx; _cy = e._cy;
      } else if (!e.Undefined()) {
! 	_cx = (nl + ivmax(2*_cx - _left, 2*e._cx - e._left)) / 2;
! 	_cy = (nb + ivmax(2*_cy - _bottom, 2*e._cy - e._bottom)) / 2;
  	_left = nl;
  	_bottom = nb;
      }
!     _tol = ivmax(_tol, e._tol);
  }
  #endif
Index: Unidraw/csolver.c
diff -c Unidraw/csolver.c:1.1 Unidraw/csolver.c:1.2
*** Unidraw/csolver.c:1.1	Wed Aug 29 10:38:45 2007
--- src/Unidraw/csolver.c	Sun Sep 30 13:49:17 2007
***************
*** 109,119 ****
  CSGlue* CSGlue::Parallel (CSGlue* g) {
      CSGlue* combo = new CSGlue;
  
!     combo->_natural = max(_natural, g->_natural);
!     combo->_stretch = min(_stretch, g->_stretch);
!     combo->_shrink = min(_shrink, g->_shrink);
!     combo->_strlim = min(_strlim, g->_strlim);
!     combo->_shrlim = min(_shrlim, g->_shrlim);
  
      return combo;
  }
--- 109,119 ----
  CSGlue* CSGlue::Parallel (CSGlue* g) {
      CSGlue* combo = new CSGlue;
  
!     combo->_natural = ivmax(_natural, g->_natural);
!     combo->_stretch = ivmin(_stretch, g->_stretch);
!     combo->_shrink = ivmin(_shrink, g->_shrink);
!     combo->_strlim = ivmin(_strlim, g->_strlim);
!     combo->_shrlim = ivmin(_shrlim, g->_shrlim);
  
      return combo;
  }
***************
*** 122,129 ****
      CSGlue* combo = new CSGlue;
  
      combo->_natural = _natural + b->_natural;
!     combo->_stretch = min(_stretch + b->_stretch, c->_stretch);
!     combo->_shrink = min(_shrink + b->_shrink, c->_shrink);
      combo->_strlim = _strlim + b->_strlim;
      combo->_shrlim = _shrlim + b->_shrlim;
  
--- 122,129 ----
      CSGlue* combo = new CSGlue;
  
      combo->_natural = _natural + b->_natural;
!     combo->_stretch = ivmin(_stretch + b->_stretch, c->_stretch);
!     combo->_shrink = ivmin(_shrink + b->_shrink, c->_shrink);
      combo->_strlim = _strlim + b->_strlim;
      combo->_shrlim = _shrlim + b->_shrlim;
  
***************
*** 134,141 ****
      CSGlue* combo = new CSGlue;
  
      combo->_natural = c->_natural - b->_natural;
!     combo->_stretch = min(b->_stretch + c->_stretch, _stretch);
!     combo->_shrink = min(b->_shrink + c->_shrink, _shrink);
      combo->_strlim = c->_strlim - b->_strlim;
      combo->_shrlim = c->_shrlim - b->_shrlim;
  
--- 134,141 ----
      CSGlue* combo = new CSGlue;
  
      combo->_natural = c->_natural - b->_natural;
!     combo->_stretch = ivmin(b->_stretch + c->_stretch, _stretch);
!     combo->_shrink = ivmin(b->_shrink + c->_shrink, _shrink);
      combo->_strlim = c->_strlim - b->_strlim;
      combo->_shrlim = c->_shrlim - b->_shrlim;
  
***************
*** 146,153 ****
      CSGlue* combo = new CSGlue;
  
      combo->_natural = _natural + c->_natural;
!     combo->_stretch = min(_stretch + c->_stretch, b->_stretch);
!     combo->_shrink = min(_shrink + c->_shrink, b->_shrink);
      combo->_strlim = _strlim + c->_strlim;
      combo->_shrlim = _shrlim + c->_shrlim;
  
--- 146,153 ----
      CSGlue* combo = new CSGlue;
  
      combo->_natural = _natural + c->_natural;
!     combo->_stretch = ivmin(_stretch + c->_stretch, b->_stretch);
!     combo->_shrink = ivmin(_shrink + c->_shrink, b->_shrink);
      combo->_strlim = _strlim + c->_strlim;
      combo->_shrlim = _shrlim + c->_shrlim;
  
***************
*** 155,161 ****
  }
  
  void CSGlue::Limit (float& deform) {
!     deform = min(max(-_shrlim, deform), _strlim);
  }
  
  void CSGlue::Reverse () {
--- 155,161 ----
  }
  
  void CSGlue::Limit (float& deform) {
!     deform = ivmin(ivmax(-_shrlim, deform), _strlim);
  }
  
  void CSGlue::Reverse () {
Index: Unidraw/damage.c
diff -c Unidraw/damage.c:1.1 Unidraw/damage.c:1.2
*** Unidraw/damage.c:1.1	Wed Aug 29 10:38:45 2007
--- src/Unidraw/damage.c	Sun Sep 30 13:49:17 2007
***************
*** 101,107 ****
      diff1 = area1 + newArea - Area(merge1);
      diff2 = area2 + newArea - Area(merge2);
      diff3 = area1 + area2 - Area(merge3);
!     maximum = max(max(diff1, diff2), diff3);
  
      if (maximum == diff1) {
  	if (a2->Intersects(merge1)) {
--- 101,107 ----
      diff1 = area1 + newArea - Area(merge1);
      diff2 = area2 + newArea - Area(merge2);
      diff3 = area1 + area2 - Area(merge3);
!     maximum = ivmax(ivmax(diff1, diff2), diff3);
  
      if (maximum == diff1) {
  	if (a2->Intersects(merge1)) {
Index: Unidraw/geomobjs.c
diff -c Unidraw/geomobjs.c:1.1 Unidraw/geomobjs.c:1.2
*** Unidraw/geomobjs.c:1.1	Wed Aug 29 10:38:45 2007
--- src/Unidraw/geomobjs.c	Sun Sep 30 13:49:17 2007
***************
*** 66,73 ****
  }
  boolean LineObj::Contains (PointObj& p) {
      return
! 	(p._x >= min(_p1._x, _p2._x)) && (p._x <= max(_p1._x, _p2._x)) &&
! 	(p._y >= min(_p1._y, _p2._y)) && (p._y <= max(_p1._y, _p2._y)) && (
              (p._y - _p1._y)*(_p2._x - _p1._x) - 
              (_p2._y - _p1._y)*(p._x - _p1._x)
          ) == 0;
--- 66,73 ----
  }
  boolean LineObj::Contains (PointObj& p) {
      return
! 	(p._x >= ivmin(_p1._x, _p2._x)) && (p._x <= ivmax(_p1._x, _p2._x)) &&
! 	(p._y >= ivmin(_p1._y, _p2._y)) && (p._y <= ivmax(_p1._y, _p2._y)) && (
              (p._y - _p1._y)*(_p2._x - _p1._x) - 
              (_p2._y - _p1._y)*(p._x - _p1._x)
          ) == 0;
***************
*** 108,115 ****
  /*****************************************************************************/
  
  BoxObj::BoxObj (Coord x0, Coord y0, Coord x1, Coord y1) {
!     _left = min(x0, x1); _bottom = min(y0, y1); 
!     _right = max(x0, x1); _top = max(y0, y1);
  }
  
  BoxObj::BoxObj (BoxObj* b) {
--- 108,115 ----
  /*****************************************************************************/
  
  BoxObj::BoxObj (Coord x0, Coord y0, Coord x1, Coord y1) {
!     _left = ivmin(x0, x1); _bottom = ivmin(y0, y1); 
!     _right = ivmax(x0, x1); _top = ivmax(y0, y1);
  }
  
  BoxObj::BoxObj (BoxObj* b) {
***************
*** 130,139 ****
  }
  
  boolean BoxObj::Intersects (LineObj& l) {
!     Coord x1 = min(l._p1._x, l._p2._x);
!     Coord x2 = max(l._p1._x, l._p2._x);
!     Coord y1 = min(l._p1._y, l._p2._y);
!     Coord y2 = max(l._p1._y, l._p2._y);
      BoxObj lbox(x1, y1, x2, y2);
      boolean intersects = false;
  
--- 130,139 ----
  }
  
  boolean BoxObj::Intersects (LineObj& l) {
!     Coord x1 = ivmin(l._p1._x, l._p2._x);
!     Coord x2 = ivmax(l._p1._x, l._p2._x);
!     Coord y1 = ivmin(l._p1._y, l._p2._y);
!     Coord y2 = ivmax(l._p1._y, l._p2._y);
      BoxObj lbox(x1, y1, x2, y2);
      boolean intersects = false;
  
***************
*** 156,165 ****
      BoxObj i;
  
      if (Intersects(b)) {
!         i._left = max(_left, b._left);
! 	i._bottom = max(_bottom, b._bottom);
! 	i._right = min(_right, b._right);
! 	i._top = min(_top, b._top);
      }
      return i;
  }
--- 156,165 ----
      BoxObj i;
  
      if (Intersects(b)) {
!         i._left = ivmax(_left, b._left);
! 	i._bottom = ivmax(_bottom, b._bottom);
! 	i._right = ivmin(_right, b._right);
! 	i._top = ivmin(_top, b._top);
      }
      return i;
  }
***************
*** 167,176 ****
  BoxObj BoxObj::operator+ (BoxObj& b) {
      BoxObj m;
      
!     m._left = min(_left, b._left);
!     m._bottom = min(_bottom, b._bottom);
!     m._right = max(_right, b._right);
!     m._top = max(_top, b._top);
      return m;
  }
  
--- 167,176 ----
  BoxObj BoxObj::operator+ (BoxObj& b) {
      BoxObj m;
      
!     m._left = ivmin(_left, b._left);
!     m._bottom = ivmin(_bottom, b._bottom);
!     m._right = ivmax(_right, b._right);
!     m._top = ivmax(_top, b._top);
      return m;
  }
  
***************
*** 388,397 ****
      b._bottom = b._top = _y[0];
  
      for (int i = 1; i < _count; ++i) {
! 	b._left = min(b._left, _x[i]);
! 	b._bottom = min(b._bottom, _y[i]);
! 	b._right = max(b._right, _x[i]);
! 	b._top = max(b._top, _y[i]);
      }
  }
  
--- 388,397 ----
      b._bottom = b._top = _y[0];
  
      for (int i = 1; i < _count; ++i) {
! 	b._left = ivmin(b._left, _x[i]);
! 	b._bottom = ivmin(b._bottom, _y[i]);
! 	b._right = ivmax(b._right, _x[i]);
! 	b._top = ivmax(b._top, _y[i]);
      }
  }
  
***************
*** 467,473 ****
  	    _pts_by_n[i] = nil;
      }
      if (npts>=_pts_by_n_size) {
! 	int new_size = max(_pts_by_n_size*2, npts+1);
  	UList** new_pts_by_n = new UList*[new_size];
  	int i = 0;
  	for (;i<_pts_by_n_size; i++) 
--- 467,473 ----
  	    _pts_by_n[i] = nil;
      }
      if (npts>=_pts_by_n_size) {
! 	int new_size = ivmax(_pts_by_n_size*2, npts+1);
  	UList** new_pts_by_n = new UList*[new_size];
  	int i = 0;
  	for (;i<_pts_by_n_size; i++) 
***************
*** 691,706 ****
      }
  
  void Extent::Merge (Extent& e) {
!     float nl = min(_left, e._left);
!     float nb = min(_bottom, e._bottom);
  
      if (Undefined()) {
  	_left = e._left; _bottom = e._bottom; _cx = e._cx; _cy = e._cy;
      } else if (!e.Undefined()) {
! 	_cx = (nl + max(2*_cx - _left, 2*e._cx - e._left)) / 2;
! 	_cy = (nb + max(2*_cy - _bottom, 2*e._cy - e._bottom)) / 2;
  	_left = nl;
  	_bottom = nb;
      }
!     _tol = max(_tol, e._tol);
  }
--- 691,706 ----
      }
  
  void Extent::Merge (Extent& e) {
!     float nl = ivmin(_left, e._left);
!     float nb = ivmin(_bottom, e._bottom);
  
      if (Undefined()) {
  	_left = e._left; _bottom = e._bottom; _cx = e._cx; _cy = e._cy;
      } else if (!e.Undefined()) {
! 	_cx = (nl + ivmax(2*_cx - _left, 2*e._cx - e._left)) / 2;
! 	_cy = (nb + ivmax(2*_cy - _bottom, 2*e._cy - e._bottom)) / 2;
  	_left = nl;
  	_bottom = nb;
      }
!     _tol = ivmax(_tol, e._tol);
  }
Index: Unidraw/globals.c
diff -c Unidraw/globals.c:1.1 Unidraw/globals.c:1.2
*** Unidraw/globals.c:1.1	Wed Aug 29 10:38:45 2007
--- src/Unidraw/globals.c	Sun Sep 30 13:49:17 2007
***************
*** 60,71 ****
  void NormalRect (Coord& left, Coord& bottom, Coord& right, Coord& top) {
      Coord tempx, tempy;
      
!     tempx = min(left, right);
!     right = max(left, right);
      left = tempx;
      
!     tempy = min(bottom, top);
!     top = max(bottom, top);
      bottom = tempy;
  }
  
--- 60,71 ----
  void NormalRect (Coord& left, Coord& bottom, Coord& right, Coord& top) {
      Coord tempx, tempy;
      
!     tempx = ivmin(left, right);
!     right = ivmax(left, right);
      left = tempx;
      
!     tempy = ivmin(bottom, top);
!     top = ivmax(bottom, top);
      bottom = tempy;
  }
  
Index: Unidraw/grblock.c
diff -c Unidraw/grblock.c:1.1 Unidraw/grblock.c:1.2
*** Unidraw/grblock.c:1.1	Wed Aug 29 10:38:45 2007
--- src/Unidraw/grblock.c	Sun Sep 30 13:49:17 2007
***************
*** 493,500 ****
  
          s.curx -= dx;
          s.cury -= dy;
!         s.curx = min(max(s.x0, s.curx), s.x0 + s.width - s.curwidth);
!         s.cury = min(max(s.y0, s.cury), s.y0 + s.height - s.curheight);
  
          Adjust(s);
          Poll(e);
--- 493,500 ----
  
          s.curx -= dx;
          s.cury -= dy;
!         s.curx = ivmin(ivmax(s.x0, s.curx), s.x0 + s.width - s.curwidth);
!         s.cury = ivmin(ivmax(s.y0, s.cury), s.y0 + s.height - s.curheight);
  
          Adjust(s);
          Poll(e);
Index: Unidraw/lines.c
diff -c Unidraw/lines.c:1.1 Unidraw/lines.c:1.2
*** Unidraw/lines.c:1.1	Wed Aug 29 10:38:45 2007
--- src/Unidraw/lines.c	Sun Sep 30 13:49:17 2007
***************
*** 164,171 ****
      transform(float(_x0+_x1)/2, float(_y0+_y1)/2, cx, cy, gs);
      transform(float(_x0), float(_y0), l, b, gs);
      transform(float(_x1), float(_y1), r, t, gs);
!     l = min(l, r);
!     b = min(b, t);
  }
  
  boolean Line::contains (PointObj& po, Graphic* gs) {
--- 164,171 ----
      transform(float(_x0+_x1)/2, float(_y0+_y1)/2, cx, cy, gs);
      transform(float(_x0), float(_y0), l, b, gs);
      transform(float(_x1), float(_y1), r, t, gs);
!     l = ivmin(l, r);
!     b = ivmin(b, t);
  }
  
  boolean Line::contains (PointObj& po, Graphic* gs) {
Index: Unidraw/manips.c
diff -c Unidraw/manips.c:1.1 Unidraw/manips.c:1.2
*** Unidraw/manips.c:1.1	Wed Aug 29 10:38:45 2007
--- src/Unidraw/manips.c	Sun Sep 30 13:49:17 2007
***************
*** 729,744 ****
  }
  
  void TextManip::BeginningOfSelection () {
!     Select(min(_mark, _dot));
  }
  
  void TextManip::EndOfSelection () {
!     Select(max(_mark, _dot));
  }
  
  void TextManip::BeginningOfWord () {
      if (_dot != _mark) {
!         Select(min(_mark, _dot));
      } else {
          Select(_text->BeginningOfWord(_dot));
      }
--- 729,744 ----
  }
  
  void TextManip::BeginningOfSelection () {
!     Select(ivmin(_mark, _dot));
  }
  
  void TextManip::EndOfSelection () {
!     Select(ivmax(_mark, _dot));
  }
  
  void TextManip::BeginningOfWord () {
      if (_dot != _mark) {
!         Select(ivmin(_mark, _dot));
      } else {
          Select(_text->BeginningOfWord(_dot));
      }
***************
*** 746,752 ****
  
  void TextManip::EndOfWord () {
      if (_dot != _mark) {
!         Select(max(_mark, _dot));
      } else {
          Select(_text->EndOfWord(_dot));
      }
--- 746,752 ----
  
  void TextManip::EndOfWord () {
      if (_dot != _mark) {
!         Select(ivmax(_mark, _dot));
      } else {
          Select(_text->EndOfWord(_dot));
      }
***************
*** 754,760 ****
  
  void TextManip::BeginningOfLine () {
      if (_dot != _mark) {
!         Select(min(_mark, _dot));
      } else {
          Select(_text->BeginningOfLine(_dot));
      }
--- 754,760 ----
  
  void TextManip::BeginningOfLine () {
      if (_dot != _mark) {
!         Select(ivmin(_mark, _dot));
      } else {
          Select(_text->BeginningOfLine(_dot));
      }
***************
*** 762,768 ****
  
  void TextManip::EndOfLine () {
      if (_dot != _mark) {
!         Select(max(_mark, _dot));
      } else {
          Select(_text->EndOfLine(_dot));
      }
--- 762,768 ----
  
  void TextManip::EndOfLine () {
      if (_dot != _mark) {
!         Select(ivmax(_mark, _dot));
      } else {
          Select(_text->EndOfLine(_dot));
      }
***************
*** 778,784 ****
  
  void TextManip::ForwardCharacter (int count) {
      if (_mark != _dot) {
!         Select(max(_mark, _dot));
      } else {
          int d = _dot;
          while (count > 0) {
--- 778,784 ----
  
  void TextManip::ForwardCharacter (int count) {
      if (_mark != _dot) {
!         Select(ivmax(_mark, _dot));
      } else {
          int d = _dot;
          while (count > 0) {
***************
*** 791,797 ****
  
  void TextManip::BackwardCharacter (int count) {
      if (_dot != _mark) {
!         Select(min(_mark, _dot));
      } else {
          int d = _dot;
          while (count > 0) {
--- 791,797 ----
  
  void TextManip::BackwardCharacter (int count) {
      if (_dot != _mark) {
!         Select(ivmin(_mark, _dot));
      } else {
          int d = _dot;
          while (count > 0) {
***************
*** 804,810 ****
  
  void TextManip::ForwardLine (int count) {
      if (_dot != _mark) {
!         Select(max(_mark, _dot));
      } else {
          int d = _dot;
          while (count > 0) {
--- 804,810 ----
  
  void TextManip::ForwardLine (int count) {
      if (_dot != _mark) {
!         Select(ivmax(_mark, _dot));
      } else {
          int d = _dot;
          while (count > 0) {
***************
*** 817,823 ****
  
  void TextManip::BackwardLine (int count) {
      if (_dot != _mark) {
!         Select(min(_mark, _dot));
      } else {
          int d = _dot;
          while (count > 0) {
--- 817,823 ----
  
  void TextManip::BackwardLine (int count) {
      if (_dot != _mark) {
!         Select(ivmin(_mark, _dot));
      } else {
          int d = _dot;
          while (count > 0) {
***************
*** 830,836 ****
  
  void TextManip::ForwardWord (int count) {
      if (_dot != _mark) {
!         Select(max(_mark, _dot));
      } else {
          int d = _dot;
          while (count > 0) {
--- 830,836 ----
  
  void TextManip::ForwardWord (int count) {
      if (_dot != _mark) {
!         Select(ivmax(_mark, _dot));
      } else {
          int d = _dot;
          while (count > 0) {
***************
*** 843,849 ****
  
  void TextManip::BackwardWord (int count) {
      if (_dot != _mark) {
!         Select(min(_mark, _dot));
      } else {
          int d = _dot;
          while (count > 0) {
--- 843,849 ----
  
  void TextManip::BackwardWord (int count) {
      if (_dot != _mark) {
!         Select(ivmin(_mark, _dot));
      } else {
          int d = _dot;
          while (count > 0) {
***************
*** 867,876 ****
  }
  
  void TextManip::Select (int d, int m) {
!     int oldl = min(_dot, _mark);
!     int oldr = max(_dot, _mark);
!     int newl = min(d, m);
!     int newr = max(d, m);
      if (oldl == oldr && newl != newr) {
          _display->CaretStyle(NoCaret);
      }
--- 867,876 ----
  }
  
  void TextManip::Select (int d, int m) {
!     int oldl = ivmin(_dot, _mark);
!     int oldr = ivmax(_dot, _mark);
!     int newl = ivmin(d, m);
!     int newr = ivmax(d, m);
      if (oldl == oldr && newl != newr) {
          _display->CaretStyle(NoCaret);
      }
Index: Unidraw/polygons.c
diff -c Unidraw/polygons.c:1.1 Unidraw/polygons.c:1.2
*** Unidraw/polygons.c:1.1	Wed Aug 29 10:38:45 2007
--- src/Unidraw/polygons.c	Sun Sep 30 13:49:17 2007
***************
*** 36,45 ****
  /*****************************************************************************/
  
  Rect::Rect (Coord x0, Coord y0, Coord x1, Coord y1, Graphic* gr) : Graphic(gr){
!     _x0 = min(x0, x1);
!     _y0 = min(y0, y1);
!     _x1 = max(x0, x1);
!     _y1 = max(y0, y1);
  }
  
  void Rect::GetOriginal (Coord& x0, Coord& y0, Coord& x1, Coord& y1) {
--- 36,45 ----
  /*****************************************************************************/
  
  Rect::Rect (Coord x0, Coord y0, Coord x1, Coord y1, Graphic* gr) : Graphic(gr){
!     _x0 = ivmin(x0, x1);
!     _y0 = ivmin(y0, y1);
!     _x1 = ivmax(x0, x1);
!     _y1 = ivmax(y0, y1);
  }
  
  void Rect::GetOriginal (Coord& x0, Coord& y0, Coord& x1, Coord& y1) {
Index: Unidraw/stateviews.c
diff -c Unidraw/stateviews.c:1.1 Unidraw/stateviews.c:1.2
*** Unidraw/stateviews.c:1.1	Wed Aug 29 10:38:45 2007
--- src/Unidraw/stateviews.c	Sun Sep 30 13:49:17 2007
***************
*** 412,419 ****
      Unref(tmp);
  
      const Font* f = output->GetFont();
!     shape->width = max(f->Width(NONE) + 2*HPAD, VIEW_WIDTH);
!     shape->height = max(f->Height() + 2*VPAD, VIEW_HEIGHT);
  
      shape->Rigid(shape->width/2, shape->width, shape->height/2, shape->height);
  }
--- 412,419 ----
      Unref(tmp);
  
      const Font* f = output->GetFont();
!     shape->width = ivmax(f->Width(NONE) + 2*HPAD, VIEW_WIDTH);
!     shape->height = ivmax(f->Height() + 2*VPAD, VIEW_HEIGHT);
  
      shape->Rigid(shape->width/2, shape->width, shape->height/2, shape->height);
  }
***************
*** 565,572 ****
      Unref(tmp);
  
      const Font* f = output->GetFont();
!     shape->width = max(f->Width(NONE) + 2*HPAD, VIEW_WIDTH);
!     shape->height = max(f->Height() + 2*VPAD, VIEW_HEIGHT);
  
      shape->Rigid(shape->width/2, shape->width, shape->height/2, shape->height);
  }
--- 565,572 ----
      Unref(tmp);
  
      const Font* f = output->GetFont();
!     shape->width = ivmax(f->Width(NONE) + 2*HPAD, VIEW_WIDTH);
!     shape->height = ivmax(f->Height() + 2*VPAD, VIEW_HEIGHT);
  
      shape->Rigid(shape->width/2, shape->width, shape->height/2, shape->height);
  }
Index: Unidraw/text.c
diff -c Unidraw/text.c:1.1 Unidraw/text.c:1.2
*** Unidraw/text.c:1.1	Wed Aug 29 10:38:45 2007
--- src/Unidraw/text.c	Sun Sep 30 13:49:17 2007
***************
*** 389,395 ****
      
      for (beg = 0; beg < size; beg = nextBeg) {
          GetLine(s, size, beg, end, lineSize, nextBeg);
!         r = max(r, f->Width(&s[beg], lineSize) - 1);
          b -= _lineHt;
      }
  }
--- 389,395 ----
      
      for (beg = 0; beg < size; beg = nextBeg) {
          GetLine(s, size, beg, end, lineSize, nextBeg);
!         r = ivmax(r, f->Width(&s[beg], lineSize) - 1);
          b -= _lineHt;
      }
  }
Index: Unidraw/uctrls.c
diff -c Unidraw/uctrls.c:1.1 Unidraw/uctrls.c:1.2
*** Unidraw/uctrls.c:1.1	Wed Aug 29 10:38:45 2007
--- src/Unidraw/uctrls.c	Sun Sep 30 13:49:17 2007
***************
*** 172,183 ****
  
      _label->GetBox(x0, y0, x1, y1);
      shape->width = 2*HPAD + x1 - x0;
!     shape->height = max(2*VPAD + y1 - y0, MINHT);
  
      if (*kl != '\0') {
  	Font* f = stdgraphic->GetFont();
  	shape->width += f->Width(kl) + SEP;
! 	shape->height = max(shape->height, f->Height() + 2*VPAD);
      }
      shape->Rigid(shape->width, hfil, 0, 0);
  }
--- 172,183 ----
  
      _label->GetBox(x0, y0, x1, y1);
      shape->width = 2*HPAD + x1 - x0;
!     shape->height = ivmax(2*VPAD + y1 - y0, MINHT);
  
      if (*kl != '\0') {
  	Font* f = stdgraphic->GetFont();
  	shape->width += f->Width(kl) + SEP;
! 	shape->height = ivmax(shape->height, f->Height() + 2*VPAD);
      }
      shape->Rigid(shape->width, hfil, 0, 0);
  }
***************
*** 250,256 ****
  	shape->width += 2 * f->Width(kl) + HPAD;
  	shape->height += f->Height();
      }
!     shape->height = max(shape->height, MINHT);
  
      if (_orient == Horizontal) {
          shape->Rigid(0, shape->width, 0, vfil);
--- 250,256 ----
  	shape->width += 2 * f->Width(kl) + HPAD;
  	shape->height += f->Height();
      }
!     shape->height = ivmax(shape->height, MINHT);
  
      if (_orient == Horizontal) {
          shape->Rigid(0, shape->width, 0, vfil);
Index: Unidraw/verts.c
diff -c Unidraw/verts.c:1.1 Unidraw/verts.c:1.2
*** Unidraw/verts.c:1.1	Wed Aug 29 10:38:45 2007
--- src/Unidraw/verts.c	Sun Sep 30 13:49:17 2007
***************
*** 27,32 ****
--- 27,33 ----
  
  #include <Unidraw/Graphic/util.h>
  #include <Unidraw/Graphic/verts.h>
+ #include <InterViews/transformer.h>
  
  #include <IV-2_6/_enter.h>
  
***************
*** 129,138 ****
  	by0 = by1 = y() ? y()[0] : 0.0;
  
  	for (int i = 1; i < count(); ++i) {
! 	    bx0 = min(bx0, float(x()[i]));
! 	    by0 = min(by0, float(y()[i]));
! 	    bx1 = max(bx1, float(x()[i]));
! 	    by1 = max(by1, float(y()[i]));
  	}
  	tcx = (bx0 + bx1) / 2;
  	tcy = (by0 + by1) / 2;
--- 130,139 ----
  	by0 = by1 = y() ? y()[0] : 0.0;
  
  	for (int i = 1; i < count(); ++i) {
! 	    bx0 = ivmin(bx0, float(x()[i]));
! 	    by0 = ivmin(by0, float(y()[i]));
! 	    bx1 = ivmax(bx1, float(x()[i]));
! 	    by1 = ivmax(by1, float(y()[i]));
  	}
  	tcx = (bx0 + bx1) / 2;
  	tcy = (by0 + by1) / 2;
***************
*** 156,165 ****
  	bx0 = bx1 = x()[0]; by0 = by1 = y()[0];
  
  	for (int i = 1; i < count(); ++i) {
! 	    bx0 = min(bx0, float(x()[i]));
! 	    by0 = min(by0, float(y()[i]));
! 	    bx1 = max(bx1, float(x()[i]));
! 	    by1 = max(by1, float(y()[i]));
  	}
  	tcx = (bx0 + bx1) / 2;
  	tcy = (by0 + by1) / 2;
--- 157,166 ----
  	bx0 = bx1 = x()[0]; by0 = by1 = y()[0];
  
  	for (int i = 1; i < count(); ++i) {
! 	    bx0 = ivmin(bx0, float(x()[i]));
! 	    by0 = ivmin(by0, float(y()[i]));
! 	    bx1 = ivmax(bx1, float(x()[i]));
! 	    by1 = ivmax(by1, float(y()[i]));
  	}
  	tcx = (bx0 + bx1) / 2;
  	tcy = (by0 + by1) / 2;
***************
*** 181,183 ****
--- 182,196 ----
  Coord* Vertices::y() { 
      return _pts ? _pts->y() : nil; 
  }
+ 
+ boolean Vertices::GetPoint (int index, Coord& px, Coord& py) {
+     if (index<0 || index>=count()) return false;
+     Coord tx, ty;
+     Transformer t;
+     tx = x()[index];
+     ty = y()[index];
+     TotalTransformation(t);
+     t.Transform(tx, ty, px, py);
+     return true;
+ }
+ 
Index: UniIdraw/idcatalog.c
diff -c UniIdraw/idcatalog.c:1.1 UniIdraw/idcatalog.c:1.2
*** UniIdraw/idcatalog.c:1.1	Wed Aug 29 10:38:46 2007
--- src/UniIdraw/idcatalog.c	Sun Sep 30 13:49:18 2007
***************
*** 746,752 ****
      if (n > sizepoints) {
          delete xcoords;
          delete ycoords;
!         sizepoints = max(n, INITIALSIZE);
          xcoords = new Coord[sizepoints];
          ycoords = new Coord[sizepoints];
      }
--- 746,752 ----
      if (n > sizepoints) {
          delete xcoords;
          delete ycoords;
!         sizepoints = ivmax(n, INITIALSIZE);
          xcoords = new Coord[sizepoints];
          ycoords = new Coord[sizepoints];
      }
*** /dev/null	 Sun Sep 30 13:49:28 PDT 2007
--- patches/ivtools-070930-johnston-002
*************** patches/ivtools-070930-johnston-002
*** 0 ****
--- 1 ----
+ ivtools-070930-johnston-002

--Apple-Mail-5-869486645
Content-Disposition: attachment;
	filename=ivtools-070928-johnston-001
Content-Type: application/octet-stream; x-unix-mode=0644;
	name="ivtools-070928-johnston-001"
Content-Transfer-Encoding: 7bit

Patch:    ivtools-070928-johnston-001
For:      ivtools-1.2
Author:   [email protected]
Subject:  bringing up to red/blue animation
Requires: 

This is an intermediate patch to ivtools-1.2.  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/attrlist.c
diff -c Attribute/attrlist.c:1.2 Attribute/attrlist.c:1.3
*** Attribute/attrlist.c:1.2	Sun Sep 23 09:11:26 2007
--- src/Attribute/attrlist.c	Fri Sep 28 13:08:24 2007
***************
*** 41,47 ****
  
  #include <IV-2_6/_enter.h>
  
! #define LEAKCHECK
  
  #ifdef LEAKCHECK
  #include <ivstd/leakchecker.h>
--- 41,47 ----
  
  #include <IV-2_6/_enter.h>
  
! //#define LEAKCHECK
  
  #ifdef LEAKCHECK
  #include <ivstd/leakchecker.h>
Index: Attribute/attrvalue.c
diff -c Attribute/attrvalue.c:1.2 Attribute/attrvalue.c:1.3
*** Attribute/attrvalue.c:1.2	Sun Sep 23 09:11:26 2007
--- src/Attribute/attrvalue.c	Fri Sep 28 13:08:25 2007
***************
*** 35,41 ****
  #include <stdio.h>
  #include <string.h>
  
! #define LEAKCHECK
  
  #ifdef LEAKCHECK
  #include <ivstd/leakchecker.h>
--- 35,41 ----
  #include <stdio.h>
  #include <string.h>
  
! //#define LEAKCHECK
  
  #ifdef LEAKCHECK
  #include <ivstd/leakchecker.h>
***************
*** 1141,1148 ****
--- 1141,1150 ----
  
  void AttributeValue::unref_as_needed() {
    if (_type == AttributeValue::ArrayType) {
+       #if 0
        if (_v.arrayval.ptr->refcount_==1) 
  	fprintf(stderr, "AttributeValue::ArrayType about to be deleted.\n");
+       #endif
        Resource::unref(_v.arrayval.ptr);
    }
    else if (_type == AttributeValue::StreamType)
Index: ComTerp/comfunc.c
diff -c ComTerp/comfunc.c:1.2 ComTerp/comfunc.c:1.3
*** ComTerp/comfunc.c:1.2	Sun Sep 23 09:11:27 2007
--- src/ComTerp/comfunc.c	Fri Sep 28 13:08:26 2007
***************
*** 31,37 ****
  
  #define TITLE "ComFunc"
  
! #define LEAKCHECK
  
  #ifdef LEAKCHECK
  #include <ivstd/leakchecker.h>
--- 31,37 ----
  
  #define TITLE "ComFunc"
  
! //#define LEAKCHECK
  
  #ifdef LEAKCHECK
  #include <ivstd/leakchecker.h>
Index: ComTerp/comterp.c
diff -c ComTerp/comterp.c:1.2 ComTerp/comterp.c:1.3
*** ComTerp/comterp.c:1.2	Sun Sep 23 09:11:27 2007
--- src/ComTerp/comterp.c	Fri Sep 28 13:08:26 2007
***************
*** 75,81 ****
  #include <fstream.h>
  #endif
  
! #define LEAKCHECK
  
  #ifdef LEAKCHECK
  #include <ivstd/leakchecker.h>
--- 75,81 ----
  #include <fstream.h>
  #endif
  
! // #define LEAKCHECK
  
  #ifdef LEAKCHECK
  #include <ivstd/leakchecker.h>
Index: GraphUnidraw/edgecomp.c
diff -c GraphUnidraw/edgecomp.c:1.2 GraphUnidraw/edgecomp.c:1.3
*** GraphUnidraw/edgecomp.c:1.2	Sun Sep 23 09:11:35 2007
--- src/GraphUnidraw/edgecomp.c	Fri Sep 28 13:08:35 2007
***************
*** 189,195 ****
  }
  
  boolean EdgeComp::clipline(Coord x0, Coord y0, Coord x1, Coord y1, Ellipse* ell,
! 	       Coord &nx0, Coord &ny0)
  {
      Coord x[8], y[8];
      FullGraphic gs;
--- 189,195 ----
  }
  
  boolean EdgeComp::clipline(Coord x0, Coord y0, Coord x1, Coord y1, Ellipse* ell,
! 	       boolean clip1, Coord &nx0, Coord &ny0)
  {
      Coord x[8], y[8];
      FullGraphic gs;
***************
*** 240,251 ****
  		nx0 = Math::round((c2 - c1) / (b2 - b1));
  	    }
  	    else if (!origslopegood) {
! 		nx0 = x0;
  		ny0 = lineobj._p1._y;
  	    }
  	    else {
  		nx0 = lineobj._p1._x;
! 		ny0 = y0;
  	    }
  	    return true;
  	}
--- 240,251 ----
  		nx0 = Math::round((c2 - c1) / (b2 - b1));
  	    }
  	    else if (!origslopegood) {
! 		nx0 = clip1? x1 : x0;
  		ny0 = lineobj._p1._y;
  	    }
  	    else {
  		nx0 = lineobj._p1._x;
! 		ny0 = clip1 ? y1 : y0;
  	    }
  	    return true;
  	}
***************
*** 261,267 ****
--- 261,269 ----
  	    ((GraphDeleteCmd*)cmd)->connections->Append(new UList(
  		new EdgeData(this, (TopoNode*)Edge()->start_node(),
  			     (TopoNode*)Edge()->end_node())));
+ 	#if defined(GRAPH_OBSERVABLES)
  	if (NodeStart() && NodeEnd()) NodeStart()->detach(NodeEnd());
+ 	#endif
  	Edge()->attach_nodes(nil, nil);
      }
      else if (cmd->IsA(EDGECONNECT_CMD)) {
***************
*** 275,281 ****
  	if(ecmd->Node1() && ecmd->Node2()) {
  	  NodeComp* start_node_comp = (NodeComp*)ecmd->Node1();
  	  NodeComp* end_node_comp = (NodeComp*)ecmd->Node2();
! 	  #if 0
  	  if (start_node_comp && start_node_comp->IsA(NODE_COMP) &&
  	      end_node_comp && end_node_comp->IsA(NODE_COMP)) {
  	    start_node_comp->attach(end_node_comp);
--- 277,283 ----
  	if(ecmd->Node1() && ecmd->Node2()) {
  	  NodeComp* start_node_comp = (NodeComp*)ecmd->Node1();
  	  NodeComp* end_node_comp = (NodeComp*)ecmd->Node2();
! 	  #if defined(GRAPH_OBSERVABLES)
  	  if (start_node_comp && start_node_comp->IsA(NODE_COMP) &&
  	      end_node_comp && end_node_comp->IsA(NODE_COMP)) {
  	    start_node_comp->attach(end_node_comp);
***************
*** 303,316 ****
  	GetArrowLine()->GetOriginal(x0, y0, x1, y1);
  	if (Edge()->start_node()) {
  	    float fx, fy;
! 	    ((NodeComp*)Edge()->start_node()->value())
  		->GetEllipse()->GetCenter(fx, fy);
  	    x0 = Math::round(fx);
  	    y0 = Math::round(fy);
  	}
  	if (Edge()->end_node()) {
  	    float fx, fy;
! 	    ((NodeComp*)Edge()->end_node()->value())
  		->GetEllipse()->GetCenter(fx, fy);
  	    x1 = Math::round(fx);
  	    y1 = Math::round(fy);
--- 305,318 ----
  	GetArrowLine()->GetOriginal(x0, y0, x1, y1);
  	if (Edge()->start_node()) {
  	    float fx, fy;
! 	    ((NodeComp*)NodeStart())
  		->GetEllipse()->GetCenter(fx, fy);
  	    x0 = Math::round(fx);
  	    y0 = Math::round(fy);
  	}
  	if (Edge()->end_node()) {
  	    float fx, fy;
! 	    ((NodeComp*)NodeEnd())
  		->GetEllipse()->GetCenter(fx, fy);
  	    x1 = Math::round(fx);
  	    y1 = Math::round(fy);
***************
*** 319,371 ****
  	if (Edge()->start_node()) {
  	  SF_Ellipse* e1;
  	  boolean newe = false;
! 	  if (((NodeComp*)Edge()->start_node()->value())->GetClassId() == NODE_COMP)
! 	    e1 = ((NodeComp*)Edge()->start_node()->value())->GetEllipse();
  	  else {
  	    int ex0, ey0, ex1, ey1;
! 	    ((NodeComp*)Edge()->start_node()->value())->GetGraphic()->
  	      GetBox(ex0, ey0, ex1, ey1);
  	    e1 = new SF_Ellipse(ex0+(ex1-ex0)/2, ey0+(ey1-ey0)/2,
! 			     (ex1-ex0)/2, (ey1-ey0)/2);
  	    newe = true;
  	  }
! 
! 	    if (clipline(x0, y0, x1, y1, e1,
! 			 nx0, ny0)) {
! 		x0 = nx0;
! 		y0 = ny0;
! 	    }
! 	    if (newe)
! 	      delete e1;
! 	    #if defined(GRAPH_OBSERVABLES)
! 	    ((NodeComp*)Edge()->start_node()->value())->notify();
! 	    #endif
  	}
  	Coord nx1, ny1;
  	if (Edge()->end_node()) {
  	  SF_Ellipse* e2;
  	  boolean newe = false;
! 	  if (((NodeComp*)Edge()->end_node()->value())->GetClassId() == NODE_COMP)
! 	    e2 = ((NodeComp*)Edge()->end_node()->value())->GetEllipse();
  	  else {
  	    int ex0, ey0, ex1, ey1;
! 	    ((NodeComp*)Edge()->end_node()->value())->GetGraphic()->
  	      GetBox(ex0, ey0, ex1, ey1);
  	    e2 = new SF_Ellipse(ex0+(ex1-ex0)/2, ey0+(ey1-ey0)/2,
  			     (ex1-ex0)/2, (ey1-ey0)/2);
  	    newe = true;
  	  }
! 	    if (clipline(x0, y0, x1, y1, e2,
! 			 nx1, ny1)) {
! 		x1 = nx1;
! 		y1 = ny1;
! 	    }
! 	    if (newe)
! 	      delete e2;
  	}
  	GetArrowLine()->SetOriginal(x0, y0, x1, y1);
  	Notify();
! 
      } else if (cmd->IsA(MOVE_CMD)) {
          float dx, dy;
          ((MoveCmd*) cmd)->GetMovement(dx, dy);
--- 321,373 ----
  	if (Edge()->start_node()) {
  	  SF_Ellipse* e1;
  	  boolean newe = false;
! 	  if (((NodeComp*)NodeStart())->GetClassId() == NODE_COMP)
! 	    e1 = ((NodeComp*)NodeStart())->GetEllipse();
  	  else {
  	    int ex0, ey0, ex1, ey1;
! 	    ((NodeComp*)NodeStart())->GetGraphic()->
  	      GetBox(ex0, ey0, ex1, ey1);
  	    e1 = new SF_Ellipse(ex0+(ex1-ex0)/2, ey0+(ey1-ey0)/2,
! 				(ex1-ex0)/2, (ey1-ey0)/2);
  	    newe = true;
  	  }
! 	  
! 	  if (clipline(x0, y0, x1, y1, e1, false /* clip x0, y0 */,
! 		       nx0, ny0)) {
! 	    x0 = nx0;
! 	    y0 = ny0;
! 	  }
! 	  if (newe)
! 	    delete e1;
! #if defined(GRAPH_OBSERVABLES)
! 	  ((NodeComp*)Edge()->NodeStart())->notify();
! #endif
  	}
  	Coord nx1, ny1;
  	if (Edge()->end_node()) {
  	  SF_Ellipse* e2;
  	  boolean newe = false;
! 	  if (((NodeComp*)NodeEnd())->GetClassId() == NODE_COMP)
! 	    e2 = ((NodeComp*)NodeEnd())->GetEllipse();
  	  else {
  	    int ex0, ey0, ex1, ey1;
! 	    ((NodeComp*)NodeEnd())->GetGraphic()->
  	      GetBox(ex0, ey0, ex1, ey1);
  	    e2 = new SF_Ellipse(ex0+(ex1-ex0)/2, ey0+(ey1-ey0)/2,
  			     (ex1-ex0)/2, (ey1-ey0)/2);
  	    newe = true;
  	  }
! 	  if (clipline(x0, y0, x1, y1, e2, true /* clip x1,y1 */,
! 		       nx1, ny1)) {
! 	    x1 = nx1;
! 	    y1 = ny1;
! 	  }
! 	  if (newe)
! 	    delete e2;
  	}
  	GetArrowLine()->SetOriginal(x0, y0, x1, y1);
  	Notify();
! 	
      } else if (cmd->IsA(MOVE_CMD)) {
          float dx, dy;
          ((MoveCmd*) cmd)->GetMovement(dx, dy);
***************
*** 549,561 ****
  	rubgroup->Append(rub);
  	TopoEdge* edge = ((EdgeComp*)GetGraphicComp())->Edge();
  	if (edge->start_node()) {
! 	    NodeComp* nodecmp = (NodeComp*)edge->start_node()->value();
  	    NodeView* nodeview = nodecmp->GetNodeView(GetViewer());
! 	    nodeview->GetEllipse()->GetBox(l, b, r, t);
! 	    rub = new SlidingEllipse(nil, nil, l+(r-l)/2, b+(t-b)/2,
! 				     Math::round(xradius * v->GetMagnification()),
! 				     Math::round(yradius * v->GetMagnification()),
! 				     e.x, e.y);
  	    rubgroup->Append(rub);
  	    Iterator i;
  	    TopoNode* node = nodecmp->Node();
--- 551,559 ----
  	rubgroup->Append(rub);
  	TopoEdge* edge = ((EdgeComp*)GetGraphicComp())->Edge();
  	if (edge->start_node()) {
! 	    NodeComp* nodecmp = (NodeComp*)((EdgeComp*)GetGraphicComp())->NodeStart();
  	    NodeView* nodeview = nodecmp->GetNodeView(GetViewer());
! 	    rub = nodeview->MakeRubberband(e.x, e.y);
  	    rubgroup->Append(rub);
  	    Iterator i;
  	    TopoNode* node = nodecmp->Node();
***************
*** 583,595 ****
  	    }
  	}
  	if (edge->end_node()) {
! 	    NodeComp* nodecmp = (NodeComp*)edge->end_node()->value();
  	    NodeView* nodeview = nodecmp->GetNodeView(GetViewer());
! 	    nodeview->GetEllipse()->GetBox(l, b, r, t);
! 	    rub = new SlidingEllipse(nil, nil, l+(r-l)/2, b+(t-b)/2,
! 				     Math::round(xradius * v->GetMagnification()),
! 				     Math::round(yradius * v->GetMagnification()),
! 				     e.x, e.y);
  	    rubgroup->Append(rub);
  	    Iterator i;
  	    TopoNode* node = nodecmp->Node();
--- 581,589 ----
  	    }
  	}
  	if (edge->end_node()) {
! 	    NodeComp* nodecmp = ((EdgeComp*)GetGraphicComp())->NodeEnd();
  	    NodeView* nodeview = nodecmp->GetNodeView(GetViewer());
! 	    rub = nodeview->MakeRubberband(e.x, e.y);
  	    rubgroup->Append(rub);
  	    Iterator i;
  	    TopoNode* node = nodecmp->Node();
***************
*** 734,745 ****
          ((MacroCmd*)cmd)->Append(new MoveCmd(ed, fx1 - fx0, fy1 - fy0));
  	TopoEdge* edge = ((EdgeComp*)GetGraphicComp())->Edge();
  	if (edge->start_node()) {
! 	    NodeComp* nodecmp = (NodeComp*)edge->start_node()->value();
  	    NodeView* nodeview = nodecmp->GetNodeView(GetViewer());
  	    v->GetSelection()->Append(nodeview);
  	}
  	if (edge->end_node()) {
! 	    NodeComp* nodecmp = (NodeComp*)edge->end_node()->value();
  	    NodeView* nodeview = nodecmp->GetNodeView(GetViewer());
  	    v->GetSelection()->Append(nodeview);
  	}
--- 728,739 ----
          ((MacroCmd*)cmd)->Append(new MoveCmd(ed, fx1 - fx0, fy1 - fy0));
  	TopoEdge* edge = ((EdgeComp*)GetGraphicComp())->Edge();
  	if (edge->start_node()) {
! 	    NodeComp* nodecmp = (NodeComp*)((EdgeComp*)GetGraphicComp())->NodeStart();
  	    NodeView* nodeview = nodecmp->GetNodeView(GetViewer());
  	    v->GetSelection()->Append(nodeview);
  	}
  	if (edge->end_node()) {
! 	    NodeComp* nodecmp = (NodeComp*)((EdgeComp*)GetGraphicComp())->NodeEnd();
  	    NodeView* nodeview = nodecmp->GetNodeView(GetViewer());
  	    v->GetSelection()->Append(nodeview);
  	}
***************
*** 856,865 ****
  void EdgePS::IndexNodes(int &start, int &end) {
      TopoEdge* edge = ((EdgeComp*)_subject)->Edge();
      const TopoNode* node;
!     if (node = edge->start_node())
! 	start = IndexNode((NodeComp*)node->value());
!     if (node = edge->end_node())
! 	end  = IndexNode((NodeComp*)node->value());
      return;
  }
  
--- 850,859 ----
  void EdgePS::IndexNodes(int &start, int &end) {
      TopoEdge* edge = ((EdgeComp*)_subject)->Edge();
      const TopoNode* node;
!     if (edge->start_node())
! 	start = IndexNode(((EdgeComp*)_subject)->NodeStart());
!     if (edge->end_node())
! 	end  = IndexNode(((EdgeComp*)_subject)->NodeEnd());
      return;
  }
  
***************
*** 920,929 ****
  void EdgeScript::IndexNodes(int &start, int &end) {
      TopoEdge* edge = ((EdgeComp*)_subject)->Edge();
      const TopoNode* node;
!     if (node = edge->start_node())
! 	start = IndexNode((NodeComp*)node->value());
!     if (node = edge->end_node())
! 	end  = IndexNode((NodeComp*)node->value());
      return;
  }
  
--- 914,923 ----
  void EdgeScript::IndexNodes(int &start, int &end) {
      TopoEdge* edge = ((EdgeComp*)_subject)->Edge();
      const TopoNode* node;
!     if (edge->start_node())
! 	start = IndexNode(((EdgeComp*)_subject)->NodeStart());
!     if (edge->end_node())
! 	end = IndexNode(((EdgeComp*)_subject)->NodeEnd());
      return;
  }
  
Index: GraphUnidraw/edgecomp.h
diff -c GraphUnidraw/edgecomp.h:1.2 GraphUnidraw/edgecomp.h:1.3
*** GraphUnidraw/edgecomp.h:1.2	Sun Sep 23 09:11:35 2007
--- src/GraphUnidraw/edgecomp.h	Fri Sep 28 13:08:35 2007
***************
*** 89,103 ****
      void SetStartNode(int n) { _start_node = n; }
      // set index of node on tail end of arrow.
  
!     int GetEndNode() { return _end_node; }
      // get index of node on head end of arrow.
!     void SetEndNode(int n) { _end_node = n; }
      // set index of node on head end of arrow.
  
!     NodeComp* NodeStart() const;
      // return pointer to start node.
  
!     NodeComp* NodeEnd() const;
      // return pointer to end node.
  
      int StartSubEdge() { return _start_subedge; }
--- 89,103 ----
      void SetStartNode(int n) { _start_node = n; }
      // set index of node on tail end of arrow.
  
!     virtual int GetEndNode() { return _end_node; }
      // get index of node on head end of arrow.
!     virtual void SetEndNode(int n) { _end_node = n; }
      // set index of node on head end of arrow.
  
!     virtual NodeComp* NodeStart() const;
      // return pointer to start node.
  
!     virtual NodeComp* NodeEnd() const;
      // return pointer to end node.
  
      int StartSubEdge() { return _start_subedge; }
***************
*** 107,113 ****
  
      virtual boolean operator == (OverlayComp&);
  
!     static boolean clipline(Coord, Coord, Coord, Coord, Ellipse*, Coord&, Coord&);
      // clip edge graphic with node's ellipse graphic 
  
  protected:
--- 107,113 ----
  
      virtual boolean operator == (OverlayComp&);
  
!     static boolean clipline(Coord, Coord, Coord, Coord, Ellipse*, boolean, Coord&, Coord&);
      // clip edge graphic with node's ellipse graphic 
  
  protected:
Index: GraphUnidraw/graphcmds.c
diff -c GraphUnidraw/graphcmds.c:1.2 GraphUnidraw/graphcmds.c:1.3
*** GraphUnidraw/graphcmds.c:1.2	Sun Sep 23 09:11:35 2007
--- src/GraphUnidraw/graphcmds.c	Fri Sep 28 13:08:35 2007
***************
*** 101,113 ****
              GraphicComp* cbgcomp = cb->GetComp(j);
  	    EdgeComp* comp = (EdgeComp*)gcomp;
              TopoEdge* topoedge = comp->Edge();
-             const TopoNode* node;
              int start = -1;
              int end = -1;
!             if ((node = topoedge->start_node()) && selected(s, (NodeComp*)node->value()))
! 	        start = node_index(s, (NodeComp*)node->value());
!             if ((node = topoedge->end_node()) && selected(s, (NodeComp*)node->value()))
! 	        end = node_index(s, (NodeComp*)node->value());
  
  	    EdgeComp* cbcomp = (EdgeComp*)cbgcomp;
  	    cbcomp->SetStartNode(start);
--- 101,112 ----
              GraphicComp* cbgcomp = cb->GetComp(j);
  	    EdgeComp* comp = (EdgeComp*)gcomp;
              TopoEdge* topoedge = comp->Edge();
              int start = -1;
              int end = -1;
!             if ((topoedge->start_node()) && selected(s,  comp->NodeStart()))
! 	        start = node_index(s, comp->NodeStart());
!             if ((topoedge->end_node()) && selected(s, comp->NodeEnd()))
! 	        end = node_index(s, comp->NodeEnd());
  
  	    EdgeComp* cbcomp = (EdgeComp*)cbgcomp;
  	    cbcomp->SetStartNode(start);
Index: GraphUnidraw/graphcomp.c
diff -c GraphUnidraw/graphcomp.c:1.1 GraphUnidraw/graphcomp.c:1.2
*** GraphUnidraw/graphcomp.c:1.1	Wed Aug 29 10:38:58 2007
--- src/GraphUnidraw/graphcomp.c	Fri Sep 28 13:08:35 2007
***************
*** 589,596 ****
--- 589,598 ----
      edges[i]->Edge()->
        attach_nodes(start_id < 0 ? nil : nodes[start_id]->Node(), 
  		   end_id < 0 ? nil : nodes[end_id]->Node());
+     #if defined(GRAPH_OBSERVABLES)
      if (start_id >=0 && end_id >=0) 
        edges[i]->NodeStart()->attach(edges[i]->NodeEnd());
+     #endif
    }
    return 0;
  }
Index: GraphUnidraw/graphtools.c
diff -c GraphUnidraw/graphtools.c:1.1 GraphUnidraw/graphtools.c:1.2
*** GraphUnidraw/graphtools.c:1.1	Wed Aug 29 10:38:58 2007
--- src/GraphUnidraw/graphtools.c	Fri Sep 28 13:08:35 2007
***************
*** 78,89 ****
  	      TopoEdge* edge2 = e2comp->Edge();
  	      if (edge1->start_node() == edge2->end_node() ||
  		  edge1->start_node() == edge2->start_node()) {
! 		NodeComp* ncomp = (NodeComp*) edge1->start_node()->value();
  		NodeView* nview = (NodeView*)ncomp->FindView(m->GetViewer());
  		ns.Append(nview);
  	      } else if (edge1->end_node() == edge2->end_node() ||
  			 edge1->end_node() == edge2->start_node()) {
! 		  NodeComp* ncomp = (NodeComp*) edge1->end_node()->value();
  		  NodeView* nview = (NodeView*)ncomp->FindView(m->GetViewer());
  		  ns.Append(nview);
  		}
--- 78,89 ----
  	      TopoEdge* edge2 = e2comp->Edge();
  	      if (edge1->start_node() == edge2->end_node() ||
  		  edge1->start_node() == edge2->start_node()) {
! 		NodeComp* ncomp = (NodeComp*) e1comp->NodeStart();
  		NodeView* nview = (NodeView*)ncomp->FindView(m->GetViewer());
  		ns.Append(nview);
  	      } else if (edge1->end_node() == edge2->end_node() ||
  			 edge1->end_node() == edge2->start_node()) {
! 		  NodeComp* ncomp = (NodeComp*) e1comp->NodeEnd();
  		  NodeView* nview = (NodeView*)ncomp->FindView(m->GetViewer());
  		  ns.Append(nview);
  		}
Index: GraphUnidraw/nodecomp.c
diff -c GraphUnidraw/nodecomp.c:1.2 GraphUnidraw/nodecomp.c:1.3
*** GraphUnidraw/nodecomp.c:1.2	Sun Sep 23 09:11:35 2007
--- src/GraphUnidraw/nodecomp.c	Fri Sep 28 13:08:35 2007
***************
*** 312,323 ****
  	    x1 = x0 + dx;
  	    y1 = y0 + dy;
         	    arrow = new ArrowLine(x0, y0, x1, y1, false, true, 1.5);
! 	    if (EdgeComp::clipline(x0, y0, x1, y1, ellipse2, nx, ny)) {
  	        x0 = nx;
  	        y0 = ny;
  		arrow->SetOriginal(x0, y0, x1, y1);
  	    } 
! 	    if (EdgeComp::clipline(x0, y0, x1, y1, ellipse3, nx, ny)) {
  	        x1 = nx;
  	        y1 = ny;
  		arrow->SetOriginal(x0, y0, x1, y1);
--- 312,323 ----
  	    x1 = x0 + dx;
  	    y1 = y0 + dy;
         	    arrow = new ArrowLine(x0, y0, x1, y1, false, true, 1.5);
! 	    if (EdgeComp::clipline(x0, y0, x1, y1, ellipse2, false, nx, ny)) {
  	        x0 = nx;
  	        y0 = ny;
  		arrow->SetOriginal(x0, y0, x1, y1);
  	    } 
! 	    if (EdgeComp::clipline(x0, y0, x1, y1, ellipse3, true, nx, ny)) {
  	        x1 = nx;
  	        y1 = ny;
  		arrow->SetOriginal(x0, y0, x1, y1);
***************
*** 329,340 ****
  	    x0 = x1 - dx;
  	    y0 = y1 - dy;
         	    arrow = new ArrowLine(x1, y1, x0, y0, false, true, 1.5);
! 	    if (EdgeComp::clipline(x0, y0, x1, y1, ellipse2, nx, ny)) {
  	        x1 = nx;
  	        y1 = ny;
  		arrow->SetOriginal(x0, y0, x1, y1);
  	    }
! 	    if (EdgeComp::clipline(x0, y0, x1, y1, ellipse, nx, ny)) {
  	        x0 = nx;
  	        y0 = ny;
  		arrow->SetOriginal(x0, y0, x1, y1);
--- 329,340 ----
  	    x0 = x1 - dx;
  	    y0 = y1 - dy;
         	    arrow = new ArrowLine(x1, y1, x0, y0, false, true, 1.5);
! 	    if (EdgeComp::clipline(x0, y0, x1, y1, ellipse2, true, nx, ny)) {
  	        x1 = nx;
  	        y1 = ny;
  		arrow->SetOriginal(x0, y0, x1, y1);
  	    }
! 	    if (EdgeComp::clipline(x0, y0, x1, y1, ellipse, false, nx, ny)) {
  	        x0 = nx;
  	        y0 = ny;
  		arrow->SetOriginal(x0, y0, x1, y1);
***************
*** 386,393 ****
--- 386,395 ----
  
  SF_Ellipse* NodeComp::GetEllipse() {
      Picture* pic = (Picture*)GetGraphic();
+     if (!pic) return nil;
      Iterator i;
      pic->First(i);
+     if (pic->Done(i)) return nil;
      return (SF_Ellipse*)pic->GetGraphic(i);
  }
  
***************
*** 690,696 ****
    if (edgecomp) {
      TopoEdge* edge = edgecomp->Edge();
      if (edge && edge->start_node()) {
!       return (NodeComp*)edge->start_node()->value();
      }
    }  
    return nil;
--- 692,698 ----
    if (edgecomp) {
      TopoEdge* edge = edgecomp->Edge();
      if (edge && edge->start_node()) {
!       return (NodeComp*)edgecomp->NodeStart();
      }
    }  
    return nil;
***************
*** 701,707 ****
    if (edgecomp) {
      TopoEdge* edge = edgecomp->Edge();
      if (edge && edge->end_node()) {
!       return (NodeComp*)edge->end_node()->value();
      }
    }  
    return nil;
--- 703,709 ----
    if (edgecomp) {
      TopoEdge* edge = edgecomp->Edge();
      if (edge && edge->end_node()) {
!       return (NodeComp*)edgecomp->NodeEnd();
      }
    }  
    return nil;
***************
*** 865,875 ****
      } else if (tool->IsA(MOVE_TOOL)) {
  	RubberGroup* rubgroup = new RubberGroup(nil,nil);
          v->Constrain(e.x, e.y);
!         v->GetSelection()->GetBox(l, b, r, t);
!         rub = new SlidingEllipse(nil, nil, l+(r-l)/2, b+(t-b)/2, 
! 				 Math::round(xradius * v->GetMagnification()),
! 				 Math::round(yradius * v->GetMagnification()),
! 				 e.x, e.y);
  	rubgroup->Append(rub);
  	Iterator i;
  	TopoNode* node = ((NodeComp*)GetGraphicComp())->Node();
--- 867,873 ----
      } else if (tool->IsA(MOVE_TOOL)) {
  	RubberGroup* rubgroup = new RubberGroup(nil,nil);
          v->Constrain(e.x, e.y);
! 	rub = MakeRubberband(e.x, e.y);
  	rubgroup->Append(rub);
  	Iterator i;
  	TopoNode* node = ((NodeComp*)GetGraphicComp())->Node();
***************
*** 928,940 ****
      return m;
  }
  
  Command* NodeView::InterpretManipulator(Manipulator* m) {
      Tool* tool = m->GetTool();
      Command* cmd = nil;
  
      if (tool->IsA(GRAPHIC_COMP_TOOL)) {
!         Graphic* tpg = ((NodeComp*)GetGraphicComp())->GetText();
!         Graphic* epg = ((NodeComp*)GetGraphicComp())->GetEllipse();
          TextGraphic* textgr;
  	SF_Ellipse* ellipse;
  	Coord xpos, ypos;
--- 926,953 ----
      return m;
  }
  
+ 
+ Rubberband* NodeView::MakeRubberband(IntCoord x, IntCoord y) {
+   Coord l, r, b, t;
+   Viewer* v = GetViewer();
+   GetEllipse()->GetBox(l, b, r, t);
+   Coord cx, cy;
+   int rx, ry;
+   GetEllipse()->GetOriginal(cx, cy, rx, ry);
+   Rubberband* rub = new SlidingEllipse(nil, nil, l+(r-l)/2, b+(t-b)/2,
+ 				       Math::round(rx * v->GetMagnification()),
+ 				       Math::round(ry * v->GetMagnification()),
+ 				       x, y);
+   return rub;
+ }
+ 
  Command* NodeView::InterpretManipulator(Manipulator* m) {
      Tool* tool = m->GetTool();
      Command* cmd = nil;
  
      if (tool->IsA(GRAPHIC_COMP_TOOL)) {
!         TextGraphic* tpg = (TextGraphic*)((NodeComp*)GetGraphicComp())->GetText();
!         SF_Ellipse* epg = (SF_Ellipse*)((NodeComp*)GetGraphicComp())->GetEllipse();
          TextGraphic* textgr;
  	SF_Ellipse* ellipse;
  	Coord xpos, ypos;
***************
*** 955,961 ****
              textgr->SetTransformer(nil);
              textgr->Translate(xpos, ypos);
  
! 	    ellipse = new SF_Ellipse(xpos, ypos, xradius, yradius, epg);
  	    ellipse->SetTransformer(nil);
  	    BrushVar* brVar = (BrushVar*) ed->GetState("BrushVar");
  	    PatternVar* patVar = (PatternVar*) ed->GetState("PatternVar");
--- 968,978 ----
              textgr->SetTransformer(nil);
              textgr->Translate(xpos, ypos);
  
!  	    Coord expos, eypos;
! 	    int exradius, eyradius;
! 	    epg->GetOriginal(expos, eypos, exradius, eyradius);
! 
! 	    ellipse = new SF_Ellipse(xpos, ypos, exradius, eyradius, epg);
  	    ellipse->SetTransformer(nil);
  	    BrushVar* brVar = (BrushVar*) ed->GetState("BrushVar");
  	    PatternVar* patVar = (PatternVar*) ed->GetState("PatternVar");
***************
*** 970,976 ****
--- 987,996 ----
  		ellipse->SetColors(colVar->GetFgColor(), colVar->GetBgColor());
  	    }
  
+ 	    #if 0
  	    textgr->Align(Center, ellipse, Center);
+ 	    #else	    ellipse->Align(Center, textgr, Center);
+ 	    #endif
  	    cmd = new PasteCmd(ed, new Clipboard(NewNodeComp(ellipse, textgr)));
  	}
  	else {
***************
*** 1009,1015 ****
--- 1029,1039 ----
  		    ellipse->SetColors(colVar->GetFgColor(), colVar->GetBgColor());
  		}
  
+ 		#if 0
  		textgr->Align(Center, ellipse, Center);
+ 		#else
+ 		ellipse->Align(Center, textgr, Center);
+ 		#endif
  
  		cmd = new PasteCmd(ed, new Clipboard(NewNodeComp(ellipse, textgr, true)));
  	    } else if (size == 0) {
Index: GraphUnidraw/nodecomp.h
diff -c GraphUnidraw/nodecomp.h:1.2 GraphUnidraw/nodecomp.h:1.3
*** GraphUnidraw/nodecomp.h:1.2	Sun Sep 23 09:11:35 2007
--- src/GraphUnidraw/nodecomp.h	Fri Sep 28 13:08:35 2007
***************
*** 40,45 ****
--- 40,46 ----
  class GraphComp;
  class NodeView;
  class Picture;
+ class Rubberband;
  class SF_Ellipse;
  class TextGraphic;
  class TopoNode;
***************
*** 211,216 ****
--- 212,220 ----
        { return new NodeComp(ellipse, txt, reqlabel); }
      // virtual function to allow construction of specialized NodeComp's by specialized NodeView's
  
+     virtual Rubberband* MakeRubberband(IntCoord x, IntCoord y);
+     // make Rubberband specific to this node.
+ 
  protected:
      static FullGraphic* _nv_gs;
  };
Index: include_std/leakchecker.h
diff -c /dev/null include_std/leakchecker.h:1.1
*** /dev/null	Fri Sep 28 13:08:40 2007
--- src/include/ivstd/leakchecker.h	Fri Sep 28 13:08:39 2007
***************
*** 0 ****
--- 1,54 ----
+ /*
+  * Copyright (c) 1998-1999 Vectaport Inc.
+  * Copyright (c) 1997 Vectaport Inc., R.B. Kissh & Associates
+  *
+  * 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 leak_checker_h
+ #define leak_checker_h
+ 
+ #include <stream.h>
+ 
+ //: utility for counting undestroyed instances of a class.
+ // To use create a static instance initialized with the class name, i.e.
+ // 'static LeakChecker checker("OverlayRaster")', then add a 'checker.create()'
+ // call to each constructor and a 'checker.destroy()' call to each
+ // destructor.  When the program is terminated the static instance of the
+ // leak checker will be destructed, and a count of un-destructed (alive)
+ // instances will be printed to stderr.
+ class LeakChecker {
+ public:
+     void create() { _alive++; }
+     // increment count of instances, to be called from constructors.
+     void destroy() { _alive--; }
+     // decrement count of instances, to be called from destructors.
+ 
+     LeakChecker(const char* c) : _alive(0), _class(c) {}
+     ~LeakChecker();
+ private:
+     int _alive;
+     const char* _class;
+ };
+ 
+ inline LeakChecker::~LeakChecker() {
+     cerr << "LEAKCHECKER: " << _class << ", " << _alive << "\n";
+ }
+ 
+ #endif
Index: OverlayUnidraw/leakchecker.h
diff -c OverlayUnidraw/leakchecker.h:1.1 OverlayUnidraw/leakchecker.h:removed
*** OverlayUnidraw/leakchecker.h:1.1	Wed Aug 29 10:38:49 2007
--- src/OverlayUnidraw/leakchecker.h	Fri Sep 28 13:08:34 2007
***************
*** 1,54 ****
- /*
-  * Copyright (c) 1998-1999 Vectaport Inc.
-  * Copyright (c) 1997 Vectaport Inc., R.B. Kissh & Associates
-  *
-  * 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 leak_checker_h
- #define leak_checker_h
- 
- #include <stream.h>
- 
- //: utility for counting undestroyed instances of a class.
- // To use create a static instance initialized with the class name, i.e.
- // 'static LeakChecker checker("OverlayRaster")', then add a 'checker.create()'
- // call to each constructor and a 'checker.destroy()' call to each
- // destructor.  When the program is terminated the static instance of the
- // leak checker will be destructed, and a count of un-destructed (alive)
- // instances will be printed to stderr.
- class LeakChecker {
- public:
-     void create() { _alive++; }
-     // increment count of instances, to be called from constructors.
-     void destroy() { _alive--; }
-     // decrement count of instances, to be called from destructors.
- 
-     LeakChecker(const char* c) : _alive(0), _class(c) {}
-     ~LeakChecker();
- private:
-     int _alive;
-     const char* _class;
- };
- 
- inline LeakChecker::~LeakChecker() {
-     cerr << "LEAKCHECKER: " << _class << ", " << _alive << "\n";
- }
- 
- #endif
--- 0 ----
Index: OverlayUnidraw/ovprecise.c
diff -c OverlayUnidraw/ovprecise.c:1.1 OverlayUnidraw/ovprecise.c:1.2
*** OverlayUnidraw/ovprecise.c:1.1	Wed Aug 29 10:38:50 2007
--- src/OverlayUnidraw/ovprecise.c	Fri Sep 28 13:08:33 2007
***************
*** 84,90 ****
      char* movestr = 
        StrEditDialog::post(GetEditor()->GetWindow(),
  			  "Enter X and Y movement:",
! 			  _default_movestr, nil, unit_buttons());
  
      int cur_unit = _unit_enum->intvalue();
      _default_enumval = cur_unit;
--- 84,90 ----
      char* movestr = 
        StrEditDialog::post(GetEditor()->GetWindow(),
  			  "Enter X and Y movement:",
! 			  _default_movestr, "Precise Move", unit_buttons());
  
      int cur_unit = _unit_enum->intvalue();
      _default_enumval = cur_unit;
***************
*** 133,139 ****
      char* scalestr = 
        StrEditDialog::post(GetEditor()->GetWindow(),
  			  "Enter X and Y scaling:",
! 			  default_scalestr);
      if (scalestr) {
        std::istrstream in(scalestr);
        float xscale = 0.0, yscale = 0.0;
--- 133,139 ----
      char* scalestr = 
        StrEditDialog::post(GetEditor()->GetWindow(),
  			  "Enter X and Y scaling:",
! 			  default_scalestr, "Precise Scale");
      if (scalestr) {
        std::istrstream in(scalestr);
        float xscale = 0.0, yscale = 0.0;
***************
*** 171,177 ****
      char* rotatestr = 
        StrEditDialog::post(GetEditor()->GetWindow(),
  			  "Enter rotation in degrees:",
! 			  default_rotatestr);
      if (rotatestr) {
        std::istrstream in(rotatestr);
        float angle = 0.0;
--- 171,177 ----
      char* rotatestr = 
        StrEditDialog::post(GetEditor()->GetWindow(),
  			  "Enter rotation in degrees:",
! 			  default_rotatestr, "Precise Rotate");
      if (rotatestr) {
        std::istrstream in(rotatestr);
        float angle = 0.0;
Index: OverlayUnidraw/ovviewer.h
diff -c OverlayUnidraw/ovviewer.h:1.1 OverlayUnidraw/ovviewer.h:1.2
*** OverlayUnidraw/ovviewer.h:1.1	Wed Aug 29 10:38:51 2007
--- src/OverlayUnidraw/ovviewer.h	Fri Sep 28 13:08:33 2007
***************
*** 48,53 ****
--- 48,56 ----
      );
      virtual ~OverlayViewer();
  
+     virtual GraphicView* GetCurrentGraphicView() { return GetGraphicView(); }
+     // allow for other than the top-level graphic view
+ 
      void Update();
      // double-buffered damage repair.
      void Draw();
*** /dev/null	 Fri Sep 28 13:08:42 PDT 2007
--- patches/ivtools-070928-johnston-001
*************** patches/ivtools-070928-johnston-001
*** 0 ****
--- 1 ----
+ ivtools-070928-johnston-001

--Apple-Mail-5-869486645
Content-Disposition: attachment;
	filename=ivtools-071204-johnston-009
Content-Type: application/octet-stream; x-unix-mode=0644;
	name="ivtools-071204-johnston-009"
Content-Transfer-Encoding: 7bit

Patch:    ivtools-071204-johnston-009
For:      ivtools-1.2
Author:   [email protected]
Subject:  LeafWalker
Requires: 

This is an intermediate patch to ivtools-1.2.  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: OverlayUnidraw/Imakefile
diff -c OverlayUnidraw/Imakefile:1.1 OverlayUnidraw/Imakefile:1.2
*** OverlayUnidraw/Imakefile:1.1	Wed Aug 29 10:38:49 2007
--- src/OverlayUnidraw/Imakefile	Tue Dec  4 11:44:51 2007
***************
*** 23,28 ****
--- 23,29 ----
  Obj26(clipline)
  Obj26(grayraster)
  Obj26(indexmixins)
+ Obj26(leafwalker)
  Obj26(ovadjuster)
  Obj26(ovarrow)
  Obj26(ovcatalog)
Index: OverlayUnidraw/leafwalker.c
diff -c /dev/null OverlayUnidraw/leafwalker.c:1.1
*** /dev/null	Tue Dec  4 11:44:52 2007
--- src/OverlayUnidraw/leafwalker.c	Tue Dec  4 11:44:51 2007
***************
*** 0 ****
--- 1,48 ----
+ /*
+  * Copyright (c) 2007 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 LeafWalker
+  */
+ 
+ #include <OverlayUnidraw/leafwalker.h>
+ #include <OverlayUnidraw/ovclasses.h>
+ 
+ /*****************************************************************************/
+ 
+ LeafWalker::LeafWalker(OverlaysComp* start) {
+   _before = nil;
+   _curr = start;
+   _start = start;
+ }
+ 
+ OverlayComp* LeafWalker::NextLeaf() {
+   do {
+     OverlayComp* after = _curr->DepthNext(_before);
+     _before = _curr;
+     _curr = after;
+   } while (_curr && _curr->IsA(OVERLAYS_COMP) && _curr != _start->GetParent());
+   if (_curr == _start->GetParent()) return nil;
+   else return _curr;
+ }
+   
Index: OverlayUnidraw/leafwalker.h
diff -c /dev/null OverlayUnidraw/leafwalker.h:1.1
*** /dev/null	Tue Dec  4 11:44:52 2007
--- src/OverlayUnidraw/leafwalker.h	Tue Dec  4 11:44:51 2007
***************
*** 0 ****
--- 1,49 ----
+ /*
+  * Copyright (c) 2007 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 depth first OverlayComps leaf walking algorithm
+  */
+ 
+ #ifndef leafwalker_h
+ #define leafwalke_h
+ 
+ #include <OverlayUnidraw/ovcomps.h>
+ 
+ //: walk the leafs of an OverlaysComp tree
+ class LeafWalker {
+ public:
+   LeafWalker(OverlaysComp* start);
+   OverlayComp* NextLeaf();
+   // returns next leaf in tree or nil when done
+ 
+ protected:
+   OverlayComp* _before;
+   OverlayComp* _curr;
+   OverlaysComp* _start;
+ };
+ 
+ #endif
+ 
+ 
+ 
Index: top_ivtools/MANIFEST
diff -c top_ivtools/MANIFEST:1.2 top_ivtools/MANIFEST:1.3
*** top_ivtools/MANIFEST:1.2	Sun Sep 23 09:11:24 2007
--- ./MANIFEST	Tue Dec  4 11:44:46 2007
***************
*** 632,637 ****
--- 632,639 ----
  ivtools-1.2/src/OverlayUnidraw/grloctool.h
  ivtools-1.2/src/OverlayUnidraw/indexmixins.c
  ivtools-1.2/src/OverlayUnidraw/indexmixins.h
+ ivtools-1.2/src/OverlayUnidraw/leafwalker.c
+ ivtools-1.2/src/OverlayUnidraw/leafwalker.h
  ivtools-1.2/src/OverlayUnidraw/ovabout.c
  ivtools-1.2/src/OverlayUnidraw/ovabout.h
  ivtools-1.2/src/OverlayUnidraw/ovadjuster.c
Index: top_ivtools/MANIFEST.perceps
diff -c top_ivtools/MANIFEST.perceps:1.1 top_ivtools/MANIFEST.perceps:1.2
*** top_ivtools/MANIFEST.perceps:1.1	Wed Aug 29 10:37:43 2007
--- ./MANIFEST.perceps	Tue Dec  4 11:44:46 2007
***************
*** 154,159 ****
--- 154,160 ----
  OverlayUnidraw/grayraster.h
  OverlayUnidraw/grloctool.h
  OverlayUnidraw/indexmixins.h
+ OverlayUnidraw/leafwalker.h
  OverlayUnidraw/leakchecker.h
  OverlayUnidraw/ovabout.h
  OverlayUnidraw/ovadjuster.h
*** /dev/null	 Tue Dec 4 11:44:55 PST 2007
--- patches/ivtools-071204-johnston-009
*************** patches/ivtools-071204-johnston-009
*** 0 ****
--- 1 ----
+ ivtools-071204-johnston-009

--Apple-Mail-5-869486645
Content-Disposition: attachment;
	filename=ivtools-071115-johnston-008
Content-Type: application/octet-stream; x-unix-mode=0644;
	name="ivtools-071115-johnston-008"
Content-Transfer-Encoding: 7bit

Patch:    ivtools-071115-johnston-008
For:      ivtools-1.2
Author:   [email protected]
Subject:  
Requires: 

This is an intermediate patch to ivtools-1.2.  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: ComTerp/comfunc.c
diff -c ComTerp/comfunc.c:1.3 ComTerp/comfunc.c:1.4
*** ComTerp/comfunc.c:1.3	Fri Sep 28 13:08:26 2007
--- src/ComTerp/comfunc.c	Thu Nov 15 14:18:04 2007
***************
*** 44,49 ****
--- 44,50 ----
  
  ComFunc::ComFunc(ComTerp* comterp) {
      _comterp = comterp;
+     _context = nil;
  }
  
  void ComFunc::reset_stack() {
Index: ComTerp/comfunc.h
diff -c ComTerp/comfunc.h:1.2 ComTerp/comfunc.h:1.3
*** ComTerp/comfunc.h:1.2	Sun Sep 23 09:11:27 2007
--- src/ComTerp/comfunc.h	Thu Nov 15 14:18:04 2007
***************
*** 34,43 ****
  #include <OS/types.h>
  #include <ComTerp/comvalue.h>
  #include <Attribute/classid.h>
  
  class AttributeList;
  class ComFuncState;
! class ComTerp;
  class ComTerpServ;
  
  
--- 34,44 ----
  #include <OS/types.h>
  #include <ComTerp/comvalue.h>
  #include <Attribute/classid.h>
+ #include <Unidraw/Components/component.h>
  
  class AttributeList;
  class ComFuncState;
! class Component;
  class ComTerpServ;
  
  
***************
*** 171,176 ****
--- 172,179 ----
      // print contents to ostream, brief or not depending on
      // associated ComTerp brief flag.
  
+     Component* context() { return _context; }
+     void context(Component* comp) { _context = comp; }
  
  protected:
  
***************
*** 211,216 ****
--- 214,220 ----
  
      ComTerp* _comterp;
      int _funcid;
+     Component* _context;
  
      CLASS_SYMID("ComFunc");
  };
Index: ComUnidraw/comeditor.c
diff -c ComUnidraw/comeditor.c:1.2 ComUnidraw/comeditor.c:1.3
*** ComUnidraw/comeditor.c:1.2	Wed Nov  7 07:55:13 2007
--- src/ComUnidraw/comeditor.c	Thu Nov 15 14:18:09 2007
***************
*** 226,231 ****
--- 226,233 ----
      comterp->add_command("pclip", new PixelClipFunc(comterp, this));
      comterp->add_command("alpha", new AlphaTransFunc(comterp, this));
  
+     comterp->add_command("trans", new TransformerFunc(comterp, this));
+ 
  }
  
  /* virtual */ void ComEditor::ExecuteCmd(Command* cmd) {
Index: ComUnidraw/grfunc.c
diff -c ComUnidraw/grfunc.c:1.3 ComUnidraw/grfunc.c:1.4
*** ComUnidraw/grfunc.c:1.3	Wed Nov  7 07:55:13 2007
--- src/ComUnidraw/grfunc.c	Thu Nov 15 14:18:09 2007
***************
*** 1,5 ****
  /*
!  * Copyright (c) 2001 Scott E. Johnston
   * Copyright (c) 2000 IET Inc.
   * Copyright (c) 1994-1997 Vectaport Inc.
   *
--- 1,5 ----
  /*
!  * Copyright (c) 2001-2007 Scott E. Johnston
   * Copyright (c) 2000 IET Inc.
   * Copyright (c) 1994-1997 Vectaport Inc.
   *
***************
*** 1303,1305 ****
--- 1303,1372 ----
      }
  }
  
+ /*****************************************************************************/
+ 
+ TransformerFunc::TransformerFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) {
+ }
+ 
+ void TransformerFunc::execute() {
+     
+     ComValue objv(stack_arg(0));
+     ComValue transv(stack_arg(0));
+     reset_stack();
+     if (objv.object_compview()) {
+       ComponentView* compview = (ComponentView*)objv.obj_val();
+       if (compview && compview->GetSubject()) {
+ 	OverlayComp* comp = (OverlayComp*)compview->GetSubject();
+ 	Graphic* gr = comp->GetGraphic();
+ 	if (gr) {
+ 	  Transformer* trans = gr->GetTransformer();
+ 	  if (transv.is_unknown() || !transv.is_array() || transv.array_val()->Number()!=6) {
+ 	    AttributeValueList* avl = new AttributeValueList();
+ 	    float a00, a01, a10, a11, a20, a21;
+ 	    trans->matrix(a00, a01, a10, a11, a20, a21);
+ 	    avl->Append(new AttributeValue(a00));
+ 	    avl->Append(new AttributeValue(a01));
+ 	    avl->Append(new AttributeValue(a10));
+ 	    avl->Append(new AttributeValue(a11));
+ 	    avl->Append(new AttributeValue(a20));
+ 	    avl->Append(new AttributeValue(a21));
+ 	    ComValue retval(avl);
+ 	    push_stack(retval);
+ 
+ 	  } else {
+ 	    float a00, a01, a10, a11, a20, a21;
+ 	    AttributeValueList* avl = transv.array_val();
+ 	    Iterator it;
+ 	    AttributeValue* av;
+ 
+ 	    avl->First(it);
+ 	    av = avl->GetAttrVal(it);
+ 	    a00 = av->float_val();
+ 	    avl->Next(it);
+ 	    av = avl->GetAttrVal(it);
+ 	    a01 = av->float_val();
+ 	    avl->Next(it);
+ 	    av = avl->GetAttrVal(it);
+ 	    a10 = av->float_val();
+ 	    avl->Next(it);
+ 	    av = avl->GetAttrVal(it);
+ 	    a11 = av->float_val();
+ 	    avl->Next(it);
+ 	    av = avl->GetAttrVal(it);
+ 	    a20 = av->float_val();
+ 	    avl->Next(it);
+ 	    av = avl->GetAttrVal(it);
+ 	    a21 = av->float_val();
+ 
+ 	    Transformer t(a00, a01, a10, a11, a20, a21);
+ 	    *gr->GetTransformer()=t;
+ 
+ 	    ComValue compval(comp->class_symid(), new ComponentView(comp));
+ 	    compval.object_compview(true);
+ 	    push_stack(compval);
+ 	  }
+ 	}
+       } 	
+     }
+ }
+ 
Index: ComUnidraw/grfunc.h
diff -c ComUnidraw/grfunc.h:1.1 ComUnidraw/grfunc.h:1.2
*** ComUnidraw/grfunc.h:1.1	Wed Aug 29 10:38:54 2007
--- src/ComUnidraw/grfunc.h	Thu Nov 15 14:18:09 2007
***************
*** 1,4 ****
--- 1,5 ----
  /*
+  * Copyright (c) 2001-2007 Scott E. Johnston
   * Copyright (c) 2000 IET Inc.
   * Copyright (c) 1994-1997,1999 Vectaport Inc.
   *
***************
*** 372,375 ****
--- 373,386 ----
  	return "%s(inpath outpath [xsize] [ysiz]) -- tile pgm or ppm image file"; }
  };
  
+ //: command to access a graphic's transformer
+ // a00,a01,a10,a11,a20,a21=trans(compview [a00,a01,a10,a11,a20,a21]) -- set/get transformer associated with a graphic
+ class TransformerFunc : public UnidrawFunc {
+ public:
+     TransformerFunc(ComTerp*,Editor*);
+     virtual void execute();
+     virtual const char* docstring() { 
+       return "[compview|a00,a01,a10,a11,a20,a21]=trans(compview [a00,a01,a10,a11,a20,a21]) -- set/get transformer associated with a graphic"; }
+ };
+ 
  #endif /* !defined(_grfunc_h) */
Index: GraphUnidraw/edgecomp.c
diff -c GraphUnidraw/edgecomp.c:1.4 GraphUnidraw/edgecomp.c:1.5
*** GraphUnidraw/edgecomp.c:1.4	Thu Oct 18 10:54:23 2007
--- src/GraphUnidraw/edgecomp.c	Thu Nov 15 14:18:10 2007
***************
*** 303,308 ****
--- 303,309 ----
      else if (cmd->IsA(EDGEUPDATE_CMD)) {
  	int x0, y0, x1, y1;
  	GetArrowLine()->GetOriginal(x0, y0, x1, y1);
+ 	GetArrowLine()->SetTransformer(new Transformer());
  	if (Edge()->start_node()) {
  	    float fx, fy;
  	    ((NodeComp*)NodeStart())
Index: GraphUnidraw/nodecomp.c
diff -c GraphUnidraw/nodecomp.c:1.7 GraphUnidraw/nodecomp.c:1.8
*** GraphUnidraw/nodecomp.c:1.7	Thu Oct 18 10:54:23 2007
--- src/GraphUnidraw/nodecomp.c	Thu Nov 15 14:18:10 2007
***************
*** 419,428 ****
--- 419,432 ----
  
  void NodeComp::SetText(TextGraphic* tg) {
    TextGraphic* oldtg = GetText();
+   Transformer t;
    if (oldtg) {
+     if (oldtg->GetTransformer()) 
+       t = *oldtg->GetTransformer();
      ((Picture*)GetGraphic())->Remove(oldtg);
      delete oldtg;
    }
+   tg->SetTransformer(new Transformer(t));
    Iterator it;
    GetGraphic()->First(it);
    GetGraphic()->InsertAfter(it, tg);
Index: include_interviews/transformer.h
diff -c include_interviews/transformer.h:1.1 include_interviews/transformer.h:1.2
*** include_interviews/transformer.h:1.1	Wed Aug 29 10:39:10 2007
--- src/include/InterViews/transformer.h	Thu Nov 15 14:18:12 2007
***************
*** 83,88 ****
--- 83,93 ----
      virtual void matrix(
  	float& a00, float& a01, float& a10, float& a11, float& a20, float& a21
      ) const;
+ 
+     void flipx() {mat00 *= -1.0;} 
+     void flipy() {mat11 *= -1.0;}
+     boolean xflipped(float = 1e-6) const;
+     boolean yflipped(float = 1e-6) const;
  private:
      boolean identity_;
      float mat00, mat01, mat10, mat11, mat20, mat21;
***************
*** 158,164 ****
  
  inline boolean Transformer::Rotated90(float tol) const {
      return Rotated(tol) && -tol <= mat00 && mat00 <= tol && 
!         -tol <= mat11 && mat11 <= tol;
  }
  
  inline void Transformer::GetEntries(
--- 163,177 ----
  
  inline boolean Transformer::Rotated90(float tol) const {
      return Rotated(tol) && -tol <= mat00 && mat00 <= tol && 
!       -tol <= mat11 && mat11 <= tol;
! }
! 
! inline boolean Transformer::xflipped(float tol) const {
!   return Rotated90(tol) ? mat10 > 0.0 : mat00 < 0.0;
! }
! 
! inline boolean Transformer::yflipped(float tol) const {
!   return Rotated90(tol) ? mat01 < 0.0 : mat11 < 0.0;
  }
  
  inline void Transformer::GetEntries(
*** /dev/null	 Thu Nov 15 14:18:14 PST 2007
--- patches/ivtools-071115-johnston-008
*************** patches/ivtools-071115-johnston-008
*** 0 ****
--- 1 ----
+ ivtools-071115-johnston-008

--Apple-Mail-5-869486645
Content-Disposition: attachment;
	filename=ivtools-080215-johnston-010
Content-Type: application/octet-stream; x-unix-mode=0644;
	name="ivtools-080215-johnston-010"
Content-Transfer-Encoding: 7bit

Patch:    ivtools-080215-johnston-010
For:      ivtools-1.2
Author:   [email protected]
Subject:  
Requires: 

This is an intermediate patch to ivtools-1.2.  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.3 Attribute/attrvalue.c:1.4
*** Attribute/attrvalue.c:1.3	Fri Sep 28 13:08:25 2007
--- src/Attribute/attrvalue.c	Fri Feb 15 10:42:46 2008
***************
*** 515,520 ****
--- 515,522 ----
  	return (unsigned int) boolean_val();
      case AttributeValue::SymbolType:
  	return (unsigned int) int_val();
+     case AttributeValue::ObjectType:
+         return (unsigned int)obj_val();
      default:
  	return 0;
      }
***************
*** 546,551 ****
--- 548,555 ----
  	return (int) boolean_val();
      case AttributeValue::SymbolType:
  	return int_ref();
+     case AttributeValue::ObjectType:
+         return (int)obj_val();
      default:
  	return 0;
      }
***************
*** 577,582 ****
--- 581,588 ----
  	return (unsigned long) boolean_val();
      case AttributeValue::SymbolType:
  	return (unsigned long) int_val();
+     case AttributeValue::ObjectType:
+         return (unsigned long)obj_val();
      default:
  	return 0L;
      }
***************
*** 608,613 ****
--- 614,621 ----
  	return (long) boolean_val();
      case AttributeValue::SymbolType:
  	return (long) int_val();
+     case AttributeValue::ObjectType:
+         return (long)obj_val();
      default:
  	return 0L;
      }
Index: ComTerp/comterp.c
diff -c ComTerp/comterp.c:1.4 ComTerp/comterp.c:1.5
*** ComTerp/comterp.c:1.4	Sat Oct  6 11:10:28 2007
--- src/ComTerp/comterp.c	Fri Feb 15 10:42:47 2008
***************
*** 336,341 ****
--- 336,347 ----
        pop_stack();
      }
  
+     int stack_base = _stack_top;
+     if (!func->post_eval()) 
+       stack_base -= sv.narg()+sv.nkey();
+     else
+       stack_base -= 1;
+ 
      func->execute();
      func->pop_funcstate();
  
***************
*** 343,348 ****
--- 349,359 ----
        push_stack(ComValue::blankval());
        _just_reset = false;
      }
+ 
+     if (stack_base+1 < _stack_top)
+       fprintf(stderr, "func \"%s\" failed to push a single value on stack\n", symbol_pntr(func->funcid()));
+     else if (stack_base+1 > _stack_top)
+       fprintf(stderr, "func \"%s\" pushed more than a single value on stack\n", symbol_pntr(func->funcid()));
      
    } else if (sv.type() == ComValue::SymbolType) {
  
***************
*** 1145,1150 ****
--- 1156,1162 ----
  
      add_command("print", new PrintFunc(this));
  
+     add_command("usleep", new USleepFunc(this));
  #ifdef HAVE_ACE
      add_command("timeexpr", new TimeExprFunc(this));
  #endif
Index: ComTerp/ctrlfunc.c
diff -c ComTerp/ctrlfunc.c:1.3 ComTerp/ctrlfunc.c:1.4
*** ComTerp/ctrlfunc.c:1.3	Sun Sep 30 13:49:09 2007
--- src/ComTerp/ctrlfunc.c	Fri Feb 15 10:42:47 2008
***************
*** 269,274 ****
--- 269,287 ----
      return;
  }
  
+ USleepFunc::USleepFunc(ComTerp* comterp) : ComFunc(comterp) {
+ }
+ 
+ void USleepFunc::execute() {
+     ComValue msecv(stack_arg(0));
+     reset_stack();
+ 
+     if (msecv.int_val()>0) 
+     usleep(msecv.int_val());
+     push_stack(msecv);
+     return;
+ }
+ 
  /*****************************************************************************/
  
  NilFunc::NilFunc(ComTerp* comterp) : ComFunc(comterp) {
Index: ComTerp/ctrlfunc.h
diff -c ComTerp/ctrlfunc.h:1.1 ComTerp/ctrlfunc.h:1.2
*** ComTerp/ctrlfunc.h:1.1	Wed Aug 29 10:37:48 2007
--- src/ComTerp/ctrlfunc.h	Fri Feb 15 10:42:47 2008
***************
*** 113,118 ****
--- 113,130 ----
  
  };
  
+ //: usleep sleep microseconds
+ // usleep(cmdstr) -- sleep microseconds
+ class USleepFunc : public ComFunc {
+ public:
+     USleepFunc(ComTerp*);
+ 
+     virtual void execute();
+     virtual const char* docstring() { 
+       return "%s(msec) -- sleep microseconds"; }
+ 
+ };
+ 
  //: nil command for ComTerp.
  // nil([...]) -- accept any arguments and return nil.
  class NilFunc : public ComFunc {
Index: ComTerp/debugfunc.c
diff -c ComTerp/debugfunc.c:1.1 ComTerp/debugfunc.c:1.2
*** ComTerp/debugfunc.c:1.1	Wed Aug 29 10:37:48 2007
--- src/ComTerp/debugfunc.c	Fri Feb 15 10:42:48 2008
***************
*** 76,93 ****
  
    comterp()->npause()++;
  
-  if (msgstrv.is_string()) {
-     std::ostrstream sbuf1_s;
-     sbuf1_s << (stepfunc() ? "step(" : "pause(") << comterp()->npause() << "): " 
- 	    << msgstrv.string_ptr() << "\n";
-     sbuf1_s.put('\0');
-     cerr << sbuf1_s.str();
-  }
-   std::ostrstream sbuf2_s;
-   sbuf2_s << (stepfunc() ? "step(" : "pause(") << comterp()->npause() << "): enter command or press C/R to continue\n";
-   sbuf2_s.put('\0');
-   cerr << sbuf2_s.str();
- 
    comterp()->push_servstate();
  #if __GNUC__<3
    filebuf fbufin;
--- 76,81 ----
***************
*** 113,118 ****
--- 101,121 ----
  		  ? comterp()->handler()->wrfptr() : stdout, ios_base::out);
  #endif
    ostream out(&fbufout);
+ 
+  if (msgstrv.is_string()) {
+     std::ostrstream sbuf1_s;
+     sbuf1_s << (stepfunc() ? "step(" : "pause(") << comterp()->npause() << "): " 
+ 	    << msgstrv.string_ptr() << "\n";
+     sbuf1_s.put('\0');
+     out << sbuf1_s.str();
+     out.flush();
+  }
+   std::ostrstream sbuf2_s;
+   sbuf2_s << (stepfunc() ? "step(" : "pause(") << comterp()->npause() << "): enter command or press C/R to continue\n";
+   sbuf2_s.put('\0');
+   out << sbuf2_s.str();
+   out.flush();
+ 
  #if __GNUC__==2 && __GNUC_MINOR__<=7
    char cvect[BUFSIZ];
    int cvect_cnt = 0;
***************
*** 127,132 ****
--- 130,137 ----
  #else
      cvect.erase(cvect.begin(), cvect.end());
  #endif
+ 
+ 
      /* need to handle embedded newlines differently */
  #if __GNUC__==2 && __GNUC_MINOR__<=7
      do {
***************
*** 140,159 ****
        cvect.push_back(ch);
      } while (in.good() && ch != '\n');
  #endif
!     if (cvect[0] != '\n') {
        if (comterpserv()) {
  	retval.assignval(comterpserv()->run(&cvect[0]));
  	out << retval << "\n";
        } else {
  	cerr << "execution of commands during step requires comterp in server or remote mode\n";
        }
      }
!   } while (cvect[0] != '\n');
    comterp()->pop_servstate();
    std::ostrstream sbuf_e;
    sbuf_e << (stepfunc() ? "end of step(" : "end of pause(") << comterp()->npause()-- << ")\n";
    sbuf_e.put('\0');
!   cerr << sbuf_e.str();
    push_stack(retval);
  }
  
--- 145,166 ----
        cvect.push_back(ch);
      } while (in.good() && ch != '\n');
  #endif
!     if (cvect[0] != '\n' && (cvect[0] != '\r' || cvect[1] != '\n')) {
        if (comterpserv()) {
  	retval.assignval(comterpserv()->run(&cvect[0]));
+ 	ComValue::comterp(comterpserv());
  	out << retval << "\n";
+ 	out.flush();
        } else {
  	cerr << "execution of commands during step requires comterp in server or remote mode\n";
        }
      }
!   } while (cvect[0] != '\n' && (cvect[0] != '\r' || cvect[1] != '\n'));
    comterp()->pop_servstate();
    std::ostrstream sbuf_e;
    sbuf_e << (stepfunc() ? "end of step(" : "end of pause(") << comterp()->npause()-- << ")\n";
    sbuf_e.put('\0');
!   out << sbuf_e.str();
    push_stack(retval);
  }
  
Index: ComTerp/debugfunc.h
diff -c ComTerp/debugfunc.h:1.1 ComTerp/debugfunc.h:1.2
*** ComTerp/debugfunc.h:1.1	Wed Aug 29 10:37:48 2007
--- src/ComTerp/debugfunc.h	Fri Feb 15 10:42:48 2008
***************
*** 68,75 ****
      virtual boolean stepfunc() { return true; }
  };
  
! //: command to toggle step script execution 
! // pause -- toggle stepwise script execution
  class ComterpStackHeightFunc : public ComFunc {
  public:
      ComterpStackHeightFunc(ComTerp*);
--- 68,75 ----
      virtual boolean stepfunc() { return true; }
  };
  
! //: command to return stack height for debugging
! // stackheight -- return stack height for debug purposes
  class ComterpStackHeightFunc : public ComFunc {
  public:
      ComterpStackHeightFunc(ComTerp*);
Index: OverlayUnidraw/ovkit.c
diff -c OverlayUnidraw/ovkit.c:1.1 OverlayUnidraw/ovkit.c:1.2
*** OverlayUnidraw/ovkit.c:1.1	Wed Aug 29 10:38:50 2007
--- src/OverlayUnidraw/ovkit.c	Fri Feb 15 10:42:53 2008
***************
*** 1641,1647 ****
--- 1641,1651 ----
    char combuf[BUFSIZ];
    // the echo -n $PATH is to workaround a mysterious problem on MacOS X
    // whereby the which sometime returns nothing
+ #if 0
    sprintf( combuf, "echo -n $PATH; which %s", command );
+ #else
+   sprintf( combuf, "which %s", command );
+ #endif
    FILE* fptr = popen(combuf, "r");
    char testbuf[BUFSIZ];	
    fgets(testbuf, BUFSIZ, fptr);  
*** /dev/null	 Fri Feb 15 10:42:58 PST 2008
--- patches/ivtools-080215-johnston-010
*************** patches/ivtools-080215-johnston-010
*** 0 ****
--- 1 ----
+ ivtools-080215-johnston-010

--Apple-Mail-5-869486645
Content-Disposition: attachment;
	filename=ivtools-071018-johnston-006
Content-Type: application/octet-stream; x-unix-mode=0644;
	name="ivtools-071018-johnston-006"
Content-Transfer-Encoding: 7bit

Patch:    ivtools-071018-johnston-006
For:      ivtools-1.2
Author:   [email protected]
Subject:  don't new EdgeUpdateCmd's
Requires: 

This is an intermediate patch to ivtools-1.2.  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: GraphUnidraw/edgecomp.c
diff -c GraphUnidraw/edgecomp.c:1.3 GraphUnidraw/edgecomp.c:1.4
*** GraphUnidraw/edgecomp.c:1.3	Fri Sep 28 13:08:35 2007
--- src/GraphUnidraw/edgecomp.c	Thu Oct 18 10:54:23 2007
***************
*** 297,304 ****
  	    ecmd->Node2()->Notify();
          }
  
! 	EdgeUpdateCmd* eucmd = new EdgeUpdateCmd(ecmd->GetEditor(), this);
! 	eucmd->Execute();
      }
      else if (cmd->IsA(EDGEUPDATE_CMD)) {
  	int x0, y0, x1, y1;
--- 297,304 ----
  	    ecmd->Node2()->Notify();
          }
  
! 	EdgeUpdateCmd eucmd(ecmd->GetEditor(), this);
! 	eucmd.Execute();
      }
      else if (cmd->IsA(EDGEUPDATE_CMD)) {
  	int x0, y0, x1, y1;
Index: GraphUnidraw/nodecomp.c
diff -c GraphUnidraw/nodecomp.c:1.6 GraphUnidraw/nodecomp.c:1.7
*** GraphUnidraw/nodecomp.c:1.6	Fri Oct 12 08:11:29 2007
--- src/GraphUnidraw/nodecomp.c	Thu Oct 18 10:54:23 2007
***************
*** 505,512 ****
  	Editor* ed = cmd->GetEditor();
  	for (node->first(i); !node->done(i); node->next(i)) {
  	    TopoEdge* edge = node->edge(node->elem(i));
! 	    EdgeUpdateCmd* eucmd = new EdgeUpdateCmd(ed, (EdgeComp*)edge->value());
! 	    eucmd->Execute();
  	}
      }
      else if (cmd->IsA(NODETEXT_CMD)) {
--- 505,512 ----
  	Editor* ed = cmd->GetEditor();
  	for (node->first(i); !node->done(i); node->next(i)) {
  	    TopoEdge* edge = node->edge(node->elem(i));
! 	    EdgeUpdateCmd eucmd(ed, (EdgeComp*)edge->value());
! 	    eucmd.Execute();
  	}
      }
      else if (cmd->IsA(NODETEXT_CMD)) {
***************
*** 515,520 ****
--- 515,530 ----
  	SetText(tg);
  	Notify();
  	unidraw->Update();
+     } else if (cmd->IsA(ALIGN_CMD)) {
+         OverlayComp::Interpret(cmd);
+ 	Iterator i;
+ 	TopoNode* node = Node();
+ 	Editor* ed = cmd->GetEditor();
+ 	for (node->first(i); !node->done(i); node->next(i)) {
+ 	    TopoEdge* edge = node->edge(node->elem(i));
+ 	    EdgeUpdateCmd eucmd(ed, (EdgeComp*)edge->value());
+ 	    eucmd.Execute();
+ 	}
      }
      else
  	OverlayComp::Interpret(cmd);
***************
*** 547,554 ****
  	Editor* ed = cmd->GetEditor();
  	for (node->first(i); !node->done(i); node->next(i)) {
  	    TopoEdge* edge = node->edge(node->elem(i));
! 	    EdgeUpdateCmd* eucmd = new EdgeUpdateCmd(ed, (EdgeComp*)edge->value());
! 	    eucmd->Execute();
  	}
      }
      else if (cmd->IsA(GRAPHDELETE_CMD)) {
--- 557,564 ----
  	Editor* ed = cmd->GetEditor();
  	for (node->first(i); !node->done(i); node->next(i)) {
  	    TopoEdge* edge = node->edge(node->elem(i));
! 	    EdgeUpdateCmd eucmd(ed, (EdgeComp*)edge->value());
! 	    eucmd.Execute();
  	}
      }
      else if (cmd->IsA(GRAPHDELETE_CMD)) {
***************
*** 570,575 ****
--- 580,595 ----
  		}
  	    conn = conn->Next();
  	}
+     } else if (cmd->IsA(ALIGN_CMD)) {
+         OverlayComp::Uninterpret(cmd);
+ 	Iterator i;
+ 	TopoNode* node = Node();
+ 	Editor* ed = cmd->GetEditor();
+ 	for (node->first(i); !node->done(i); node->next(i)) {
+ 	    TopoEdge* edge = node->edge(node->elem(i));
+ 	    EdgeUpdateCmd eucmd(ed, (EdgeComp*)edge->value());
+ 	    eucmd.Execute();
+ 	}
      }
      else
  	OverlayComp::Uninterpret(cmd);
*** /dev/null	 Thu Oct 18 10:54:26 PDT 2007
--- patches/ivtools-071018-johnston-006
*************** patches/ivtools-071018-johnston-006
*** 0 ****
--- 1 ----
+ ivtools-071018-johnston-006

--Apple-Mail-5-869486645
Content-Disposition: attachment;
	filename=ivtools-070930-johnston-003
Content-Type: application/octet-stream; x-unix-mode=0644;
	name="ivtools-070930-johnston-003"
Content-Transfer-Encoding: 7bit

Patch:    ivtools-070930-johnston-003
For:      ivtools-1.2
Author:   [email protected]
Subject:  restoring min/max the way it was
Requires: 

This is an intermediate patch to ivtools-1.2.  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: dclock/data.c
diff -c dclock/data.c:1.2 dclock/data.c:1.3
*** dclock/data.c:1.2	Sun Sep 30 13:49:11 2007
--- src/dclock/data.c	Sun Sep 30 22:22:02 2007
***************
*** 111,122 ****
  void InitData() {
      FadeStep = FadeRate==0 ? 16 : 1;
      SegCode[9][SegD] = (JohnsFlag)? true : false;
!     Slant = ivmin( ivmax( 0,SlantPC ), 100 )/100.0;
!     HThick = ivmin( ivmax( 5,ThickPC ), 25 )/100.0;
!     VThick = ivmin( ivmax( 5,ThickPC ), 25 )/100.0 * 3.0/2.0;
  
!     Width = Coord( ivmin( ivmax( 100,Width ), 1024));
!     Height = Coord( ivmin( ivmax( 25,Height ), 865));
      YPos = YPos - Height + 1;// ypos is the TOP of clock; we need the bottom
  
      width = 2*BorderWidth+LMargin+4.0+2*DigitGap+SepGap+RMargin+Slant;
--- 111,122 ----
  void InitData() {
      FadeStep = FadeRate==0 ? 16 : 1;
      SegCode[9][SegD] = (JohnsFlag)? true : false;
!     Slant = min( max( 0,SlantPC ), 100 )/100.0;
!     HThick = min( max( 5,ThickPC ), 25 )/100.0;
!     VThick = min( max( 5,ThickPC ), 25 )/100.0 * 3.0/2.0;
  
!     Width = Coord( min( max( 100,Width ), 1024));
!     Height = Coord( min( max( 25,Height ), 865));
      YPos = YPos - Height + 1;// ypos is the TOP of clock; we need the bottom
  
      width = 2*BorderWidth+LMargin+4.0+2*DigitGap+SepGap+RMargin+Slant;
Index: dclock/dface.c
diff -c dclock/dface.c:1.2 dclock/dface.c:1.3
*** dclock/dface.c:1.2	Sun Sep 30 13:49:11 2007
--- src/dclock/dface.c	Sun Sep 30 22:22:02 2007
***************
*** 114,120 ****
  	}
      }
  
!     unsigned long fade = FadeDelay * (1 << (ivmin(4,ivmax(0,FadeRate))) );
      Event e;
      boolean done_fading = false;
      while (showTime && !done_fading && !done) {
--- 114,120 ----
  	}
      }
  
!     unsigned long fade = FadeDelay * (1 << (min(4,max(0,FadeRate))) );
      Event e;
      boolean done_fading = false;
      while (showTime && !done_fading && !done) {
Index: iclass/iclass.c
diff -c iclass/iclass.c:1.2 iclass/iclass.c:1.3
*** iclass/iclass.c:1.2	Sun Sep 30 13:49:12 2007
--- src/iclass/iclass.c	Sun Sep 30 22:22:03 2007
***************
*** 196,202 ****
          if (f != nil) {
              struct stat filestats;
              stat(filename, &filestats);
!             _bufsize = ivmax(Math::round(filestats.st_size * 1.2), MINTEXTSIZE);
              _buf = new char[_bufsize];
              char* b = _buf;
              int remaining = _bufsize;
--- 196,202 ----
          if (f != nil) {
              struct stat filestats;
              stat(filename, &filestats);
!             _bufsize = max(Math::round(filestats.st_size * 1.2), MINTEXTSIZE);
              _buf = new char[_bufsize];
              char* b = _buf;
              int remaining = _bufsize;
Index: include_iviv-2_6/minmax.h
diff -c include_iviv-2_6/minmax.h:1.2 include_iviv-2_6/minmax.h:1.3
*** include_iviv-2_6/minmax.h:1.2	Sun Sep 30 13:49:24 2007
--- src/include/IV-2_6/InterViews/minmax.h	Sun Sep 30 22:22:11 2007
***************
*** 27,37 ****
  
  #include <InterViews/boolean.h>
  
! #if !defined(ivmin) && !defined(ivmax)
  
  #define declare_2(T) \
! inline T ivmin(T a, T b) { return a < b ? a : b; } \
! inline T ivmax(T a, T b) { return a > b ? a : b; } \
  
  declare_2(int)
  declare_2(unsigned)
--- 27,37 ----
  
  #include <InterViews/boolean.h>
  
! #if !defined(min) && !defined(max)
  
  #define declare_2(T) \
! inline T min(T a, T b) { return a < b ? a : b; } \
! inline T max(T a, T b) { return a > b ? a : b; } \
  
  declare_2(int)
  declare_2(unsigned)
***************
*** 43,63 ****
   */
  
  #define declare_4(T) \
! inline T ivmin(T a, T b, T c, T d) { \
!     T r1 = ivmin(a, b), r2 = ivmin(c, d); \
!     return ivmin(r1, r2); \
  } \
  \
! inline T ivmax(T a, T b, T c, T d) { \
!     T r1 = ivmax(a, b), r2 = ivmax(c, d); \
!     return ivmax(r1, r2); \
  }
  
  declare_4(int)
  declare_4(float)
  declare_4(double)
  
! #endif /* !defined(ivmin) && !defined(ivmax) */
  
  #if __GNUC__<3 && 0 /* removed, used Math::round from now on */
  inline int round(double x) { return x > 0 ? int(x+0.5) : -int(-x+0.5); }
--- 43,63 ----
   */
  
  #define declare_4(T) \
! inline T min(T a, T b, T c, T d) { \
!     T r1 = min(a, b), r2 = min(c, d); \
!     return min(r1, r2); \
  } \
  \
! inline T max(T a, T b, T c, T d) { \
!     T r1 = max(a, b), r2 = max(c, d); \
!     return max(r1, r2); \
  }
  
  declare_4(int)
  declare_4(float)
  declare_4(double)
  
! #endif /* !defined(min) && !defined(max) */
  
  #if __GNUC__<3 && 0 /* removed, used Math::round from now on */
  inline int round(double x) { return x > 0 ? int(x+0.5) : -int(-x+0.5); }
Index: IVGlyph/figure.c
diff -c IVGlyph/figure.c:1.2 IVGlyph/figure.c:1.3
*** IVGlyph/figure.c:1.2	Sun Sep 30 13:49:13 2007
--- src/IVGlyph/figure.c	Sun Sep 30 22:22:04 2007
***************
*** 134,140 ****
  void Graphic31::ctrlpts (Coord* x, Coord* y, int count) {
      delete _x;
      delete _y;
!     _ctrlpts = ivmax(count+1, buf_size);
      _x = new Coord[_ctrlpts];
      _y = new Coord[_ctrlpts];
      for (int i = 0; i < count; i++) {
--- 134,140 ----
  void Graphic31::ctrlpts (Coord* x, Coord* y, int count) {
      delete _x;
      delete _y;
!     _ctrlpts = max(count+1, buf_size);
      _x = new Coord[_ctrlpts];
      _y = new Coord[_ctrlpts];
      for (int i = 0; i < count; i++) {
Index: IVGlyph/globals.c
diff -c IVGlyph/globals.c:1.2 IVGlyph/globals.c:1.3
*** IVGlyph/globals.c:1.2	Sun Sep 30 13:49:13 2007
--- src/IVGlyph/globals.c	Sun Sep 30 22:22:04 2007
***************
*** 30,37 ****
  }
  boolean LineObj::Contains (PointObj& p) {
      return
! 	(p._x >= ivmin(_p1._x, _p2._x)) && (p._x <= ivmax(_p1._x, _p2._x)) &&
! 	(p._y >= ivmin(_p1._y, _p2._y)) && (p._y <= ivmax(_p1._y, _p2._y)) && (
              (p._y - _p1._y)*(_p2._x - _p1._x) - 
              (_p2._y - _p1._y)*(p._x - _p1._x)
          ) == 0;
--- 30,37 ----
  }
  boolean LineObj::Contains (PointObj& p) {
      return
! 	(p._x >= min(_p1._x, _p2._x)) && (p._x <= max(_p1._x, _p2._x)) &&
! 	(p._y >= min(_p1._y, _p2._y)) && (p._y <= max(_p1._y, _p2._y)) && (
              (p._y - _p1._y)*(_p2._x - _p1._x) - 
              (_p2._y - _p1._y)*(p._x - _p1._x)
          ) == 0;
***************
*** 72,79 ****
  /*****************************************************************************/
  
  BoxObj::BoxObj (Coord x0, Coord y0, Coord x1, Coord y1) {
!     _left = ivmin(x0, x1); _bottom = ivmin(y0, y1); 
!     _right = ivmax(x0, x1); _top = ivmax(y0, y1);
  }
  
  BoxObj::BoxObj (BoxObj* b) {
--- 72,79 ----
  /*****************************************************************************/
  
  BoxObj::BoxObj (Coord x0, Coord y0, Coord x1, Coord y1) {
!     _left = min(x0, x1); _bottom = min(y0, y1); 
!     _right = max(x0, x1); _top = max(y0, y1);
  }
  
  BoxObj::BoxObj (BoxObj* b) {
***************
*** 104,113 ****
  }
  
  boolean BoxObj::Intersects (LineObj& l) {
!     Coord x1 = ivmin(l._p1._x, l._p2._x);
!     Coord x2 = ivmax(l._p1._x, l._p2._x);
!     Coord y1 = ivmin(l._p1._y, l._p2._y);
!     Coord y2 = ivmax(l._p1._y, l._p2._y);
      BoxObj lbox(x1, y1, x2, y2);
      boolean intersects = false;
  
--- 104,113 ----
  }
  
  boolean BoxObj::Intersects (LineObj& l) {
!     Coord x1 = min(l._p1._x, l._p2._x);
!     Coord x2 = max(l._p1._x, l._p2._x);
!     Coord y1 = min(l._p1._y, l._p2._y);
!     Coord y2 = max(l._p1._y, l._p2._y);
      BoxObj lbox(x1, y1, x2, y2);
      boolean intersects = false;
  
***************
*** 130,139 ****
      BoxObj i;
  
      if (Intersects(b)) {
!         i._left = ivmax(_left, b._left);
! 	i._bottom = ivmax(_bottom, b._bottom);
! 	i._right = ivmin(_right, b._right);
! 	i._top = ivmin(_top, b._top);
      }
      return i;
  }
--- 130,139 ----
      BoxObj i;
  
      if (Intersects(b)) {
!         i._left = max(_left, b._left);
! 	i._bottom = max(_bottom, b._bottom);
! 	i._right = min(_right, b._right);
! 	i._top = min(_top, b._top);
      }
      return i;
  }
***************
*** 141,150 ****
  BoxObj BoxObj::operator+ (BoxObj& b) {
      BoxObj m;
      
!     m._left = ivmin(_left, b._left);
!     m._bottom = ivmin(_bottom, b._bottom);
!     m._right = ivmax(_right, b._right);
!     m._top = ivmax(_top, b._top);
      return m;
  }
  
--- 141,150 ----
  BoxObj BoxObj::operator+ (BoxObj& b) {
      BoxObj m;
      
!     m._left = min(_left, b._left);
!     m._bottom = min(_bottom, b._bottom);
!     m._right = max(_right, b._right);
!     m._top = max(_top, b._top);
      return m;
  }
  
***************
*** 347,356 ****
      b._bottom = b._top = _y[0];
  
      for (int i = 1; i < _count; ++i) {
! 	b._left = ivmin(b._left, _x[i]);
! 	b._bottom = ivmin(b._bottom, _y[i]);
! 	b._right = ivmax(b._right, _x[i]);
! 	b._top = ivmax(b._top, _y[i]);
      }
  }
  
--- 347,356 ----
      b._bottom = b._top = _y[0];
  
      for (int i = 1; i < _count; ++i) {
! 	b._left = min(b._left, _x[i]);
! 	b._bottom = min(b._bottom, _y[i]);
! 	b._right = max(b._right, _x[i]);
! 	b._top = max(b._top, _y[i]);
      }
  }
  
***************
*** 592,607 ****
      }
  
  void Extent::Merge (Extent& e) {
!     float nl = ivmin(_left, e._left);
!     float nb = ivmin(_bottom, e._bottom);
  
      if (Undefined()) {
  	_left = e._left; _bottom = e._bottom; _cx = e._cx; _cy = e._cy;
      } else if (!e.Undefined()) {
! 	_cx = (nl + ivmax(2*_cx - _left, 2*e._cx - e._left)) / 2;
! 	_cy = (nb + ivmax(2*_cy - _bottom, 2*e._cy - e._bottom)) / 2;
  	_left = nl;
  	_bottom = nb;
      }
!     _tol = ivmax(_tol, e._tol);
  }
--- 592,607 ----
      }
  
  void Extent::Merge (Extent& e) {
!     float nl = min(_left, e._left);
!     float nb = min(_bottom, e._bottom);
  
      if (Undefined()) {
  	_left = e._left; _bottom = e._bottom; _cx = e._cx; _cy = e._cy;
      } else if (!e.Undefined()) {
! 	_cx = (nl + max(2*_cx - _left, 2*e._cx - e._left)) / 2;
! 	_cy = (nb + max(2*_cy - _bottom, 2*e._cy - e._bottom)) / 2;
  	_left = nl;
  	_bottom = nb;
      }
!     _tol = max(_tol, e._tol);
  }
Index: OverlayUnidraw/ovarrow.c
diff -c OverlayUnidraw/ovarrow.c:1.2 OverlayUnidraw/ovarrow.c:1.3
*** OverlayUnidraw/ovarrow.c:1.2	Sun Sep 30 13:49:19 2007
--- src/OverlayUnidraw/ovarrow.c	Sun Sep 30 22:22:09 2007
***************
*** 667,673 ****
      int cnt = 0;
      for (int v=0; v<numverts; v+=limit-1) {
  
! 	int n = ivmin(numverts-cnt,limit);
  
  	if (v==0)
  	    aml->SetArrows(head, false);
--- 667,673 ----
      int cnt = 0;
      for (int v=0; v<numverts; v+=limit-1) {
  
! 	int n = min(numverts-cnt,limit);
  
  	if (v==0)
  	    aml->SetArrows(head, false);
Index: OverlayUnidraw/ovimport.c
diff -c OverlayUnidraw/ovimport.c:1.2 OverlayUnidraw/ovimport.c:1.3
*** OverlayUnidraw/ovimport.c:1.2	Sun Sep 30 13:49:19 2007
--- src/OverlayUnidraw/ovimport.c	Sun Sep 30 22:22:09 2007
***************
*** 525,531 ****
      int h = rr->GetOverlayRaster()->pheight();
      int w = rr->GetOverlayRaster()->pwidth();
      int xbeg = 0;
!     int yend = ivmin(_itr->ycur() + (int)ceil(1./mag), h-1);
      _itr->getPixels(in); 
      int xend = w-1;
      int ybeg = _itr->ycur() + 1;
--- 525,531 ----
      int h = rr->GetOverlayRaster()->pheight();
      int w = rr->GetOverlayRaster()->pwidth();
      int xbeg = 0;
!     int yend = min(_itr->ycur() + (int)ceil(1./mag), h-1);
      _itr->getPixels(in); 
      int xend = w-1;
      int ybeg = _itr->ycur() + 1;
***************
*** 550,556 ****
  	   // << sxend << "," << syend << "\n";
        
  //      if ( _lastmag == mag ) 
! 	viewer->GetDamage()->Incur(ivmin(sxbeg,sxend)-1,ivmin(sybeg,syend)-1, ivmax(sxend, sxbeg)+1, ivmax(syend, sybeg)+1);
  //      else {
  //	cerr << "ReadImageHandler::process -- damaging entire raster\n";
  //	cerr << "ReadImageHandler::process -- mag is now " << mag << "\n";
--- 550,556 ----
  	   // << sxend << "," << syend << "\n";
        
  //      if ( _lastmag == mag ) 
! 	viewer->GetDamage()->Incur(min(sxbeg,sxend)-1,min(sybeg,syend)-1, max(sxend, sxbeg)+1, max(syend, sybeg)+1);
  //      else {
  //	cerr << "ReadImageHandler::process -- damaging entire raster\n";
  //	cerr << "ReadImageHandler::process -- mag is now " << mag << "\n";
***************
*** 2316,2325 ****
      boolean compressed, boolean tiled, boolean delayed, OverlayRaster* raster,
      IntCoord xbeg, IntCoord xend, IntCoord ybeg, IntCoord yend
  ) {
!     xbeg = xbeg < 0 ? 0 : ivmin(xbeg, ncols-1);
!     xend = xend < 0 ? ncols-1 : ivmin(xend, ncols-1);
!     ybeg = ybeg < 0 ? 0 : ivmin(ybeg, nrows-1);
!     yend = yend < 0 ? nrows-1 : ivmin(yend, nrows-1);
  
      if (!raster) 
  	raster = pih->create_raster(xend-xbeg+1, yend-ybeg+1);
--- 2316,2325 ----
      boolean compressed, boolean tiled, boolean delayed, OverlayRaster* raster,
      IntCoord xbeg, IntCoord xend, IntCoord ybeg, IntCoord yend
  ) {
!     xbeg = xbeg < 0 ? 0 : min(xbeg, ncols-1);
!     xend = xend < 0 ? ncols-1 : min(xend, ncols-1);
!     ybeg = ybeg < 0 ? 0 : min(ybeg, nrows-1);
!     yend = yend < 0 ? nrows-1 : min(yend, nrows-1);
  
      if (!raster) 
  	raster = pih->create_raster(xend-xbeg+1, yend-ybeg+1);
Index: OverlayUnidraw/ovraster.c
diff -c OverlayUnidraw/ovraster.c:1.2 OverlayUnidraw/ovraster.c:1.3
*** OverlayUnidraw/ovraster.c:1.2	Sun Sep 30 13:49:19 2007
--- src/OverlayUnidraw/ovraster.c	Sun Sep 30 22:22:09 2007
***************
*** 1783,1791 ****
  	    newr = grayfract < 0.5 ? 0.0 : (grayfract-.5)*2;
  	    newg = grayfract < 0.5 ? grayfract*2 : 1.0 - (grayfract-.5)*2;
  	    newb = grayfract < 0.5 ? 1.0 - (grayfract-.5)*2 : 0.0;
! 	    newr = ivmax((float)0.0, newr);
! 	    newg = ivmax((float)0.0, newg);
! 	    newb = ivmax((float)0.0, newb);
  #endif
  
  	    color->poke(w, h, newr, newg, newb, 1.0);
--- 1783,1791 ----
  	    newr = grayfract < 0.5 ? 0.0 : (grayfract-.5)*2;
  	    newg = grayfract < 0.5 ? grayfract*2 : 1.0 - (grayfract-.5)*2;
  	    newb = grayfract < 0.5 ? 1.0 - (grayfract-.5)*2 : 0.0;
! 	    newr = max((float)0.0, newr);
! 	    newg = max((float)0.0, newg);
! 	    newb = max((float)0.0, newb);
  #endif
  
  	    color->poke(w, h, newr, newg, newb, 1.0);
***************
*** 1853,1859 ****
          dists[i] = dist(x, y, xside[i], yside[i]);
      }
  
!     float side = ivmin(ivmin(dists[0], dists[1]), ivmin(dists[2], dists[3]));
  
      RampAlignment align;
      if ( side == dists[0] ) {
--- 1853,1859 ----
          dists[i] = dist(x, y, xside[i], yside[i]);
      }
  
!     float side = min(min(dists[0], dists[1]), min(dists[2], dists[3]));
  
      RampAlignment align;
      if ( side == dists[0] ) {
Index: top_ivtools/configure
diff -c top_ivtools/configure:1.1 top_ivtools/configure:1.2
*** top_ivtools/configure:1.1	Wed Aug 29 10:37:43 2007
--- ./configure	Sun Sep 30 22:21:59 2007
***************
*** 779,784 ****
--- 779,818 ----
  Installation directories:
    --prefix=PREFIX         install architecture-independent files in PREFIX
  			  [$ac_default_prefix]
+   --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+ 			  [PREFIX]
+ 
+ By default, \`make install' will install all the files in
+ \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+ an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+ for instance \`--prefix=\$HOME'.
+ 
+ For better control, use the options below.
+ 
+ Fine tuning of the installation directories:
+   --bindir=DIR           user executables [EPREFIX/bin]
+   --sbindir=DIR          system admin executables [EPREFIX/sbin]
+   --libexecdir=DIR       program executables [EPREFIX/libexec]
+   --datadir=DIR          read-only architecture-independent data [PREFIX/share]
+   --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
+   --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
+   --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
+   --libdir=DIR           object code libraries [EPREFIX/lib]
+   --includedir=DIR       C header files [PREFIX/include]
+   --oldincludedir=DIR    C header files for non-gcc [/usr/include]
+   --infodir=DIR          info documentation [PREFIX/info]
+   --mandir=DIR           man documentation [PREFIX/man]
+ _ACEOF
+ 
+   cat <<\_ACEOF
+ 
+ X features:
+   --x-includes=DIR    X include files are in DIR
+   --x-libraries=DIR   X library files are in DIR
+ 
+ System types:
+   --build=BUILD     configure for building on BUILD [guessed]
+   --host=HOST       cross-compile to build programs to run on HOST [BUILD]
  _ACEOF
  fi
  
***************
*** 1393,1404 ****
  	echo ""
  else
  	echo "Building with ACE support ACE=$ACE"
! 	if test -f $ACE_LIBS/libACE.a -o -f $ACE_LIBS/libACE.so -o -f $ACE_LIBS/libACE.dylib ; then
  		echo "$as_me:$LINENO: result: Found libACE.* in $ACE_LIBS " >&5
  echo "${ECHO_T}Found libACE.* in $ACE_LIBS " >&6
  	        ACE_ENABLED=1
  	else
! 	        if test -f $ACE/ace/libACE.a -o -f $ACE/ace/libACE.so -o -f $ACE/ace/libACE.dylib ; then
  			echo "$as_me:$LINENO: result: Found libACE.* in $ACE/ace " >&5
  echo "${ECHO_T}Found libACE.* in $ACE/ace " >&6
  		        ACE_ENABLED=1
--- 1427,1438 ----
  	echo ""
  else
  	echo "Building with ACE support ACE=$ACE"
! 	if test -f $ACE_LIBS/libACE.a -o -f $ACE_LIBS/libACE.so -o -f $ACE_LIBS/libACE.dll.a -o -f $ACE_LIBS/libACE.dylib ; then
  		echo "$as_me:$LINENO: result: Found libACE.* in $ACE_LIBS " >&5
  echo "${ECHO_T}Found libACE.* in $ACE_LIBS " >&6
  	        ACE_ENABLED=1
  	else
! 	        if test -f $ACE/ace/libACE.a -o -f $ACE/ace/libACE.so -o -f $ACE/ace/libACE.dll.a -o -f $ACE/ace/libACE.dylib ; then
  			echo "$as_me:$LINENO: result: Found libACE.* in $ACE/ace " >&5
  echo "${ECHO_T}Found libACE.* in $ACE/ace " >&6
  		        ACE_ENABLED=1
Index: top_ivtools/configure.in
diff -c top_ivtools/configure.in:1.1 top_ivtools/configure.in:1.2
*** top_ivtools/configure.in:1.1	Wed Aug 29 10:37:43 2007
--- ./configure.in	Sun Sep 30 22:22:00 2007
***************
*** 49,59 ****
  	echo ""
  else
  	echo "Building with ACE support ACE=$ACE"
! 	if test -f $ACE_LIBS/libACE.a -o -f $ACE_LIBS/libACE.so -o -f $ACE_LIBS/libACE.dylib ; then
  		AC_MSG_RESULT( Found libACE.* in $ACE_LIBS )
  	        ACE_ENABLED=1
  	else
! 	        if test -f $ACE/ace/libACE.a -o -f $ACE/ace/libACE.so -o -f $ACE/ace/libACE.dylib ; then
  			AC_MSG_RESULT( Found libACE.* in $ACE/ace )
  		        ACE_ENABLED=1
  			ACE_LIBS=$ACE/ace
--- 49,59 ----
  	echo ""
  else
  	echo "Building with ACE support ACE=$ACE"
! 	if test -f $ACE_LIBS/libACE.a -o -f $ACE_LIBS/libACE.so -o -f $ACE_LIBS/libACE.dll.a -o -f $ACE_LIBS/libACE.dylib ; then
  		AC_MSG_RESULT( Found libACE.* in $ACE_LIBS )
  	        ACE_ENABLED=1
  	else
! 	        if test -f $ACE/ace/libACE.a -o -f $ACE/ace/libACE.so -o -f $ACE/ace/libACE.dll.a -o -f $ACE/ace/libACE.dylib ; then
  			AC_MSG_RESULT( Found libACE.* in $ACE/ace )
  		        ACE_ENABLED=1
  			ACE_LIBS=$ACE/ace
Index: TopoFace/fgeomobjs.c
diff -c TopoFace/fgeomobjs.c:1.2 TopoFace/fgeomobjs.c:1.3
*** TopoFace/fgeomobjs.c:1.2	Sun Sep 30 13:49:08 2007
--- src/TopoFace/fgeomobjs.c	Sun Sep 30 22:22:01 2007
***************
*** 72,79 ****
  
  boolean FLineObj::Contains (FPointObj& p) {
      return
! 	(p._x >= ivmin(_p1._x, _p2._x)) && (p._x <= ivmax(_p1._x, _p2._x)) &&
! 	(p._y >= ivmin(_p1._y, _p2._y)) && (p._y <= ivmax(_p1._y, _p2._y)) && (
              (p._y - _p1._y)*(_p2._x - _p1._x) - 
              (_p2._y - _p1._y)*(p._x - _p1._x)
          ) == 0;
--- 72,79 ----
  
  boolean FLineObj::Contains (FPointObj& p) {
      return
! 	(p._x >= min(_p1._x, _p2._x)) && (p._x <= max(_p1._x, _p2._x)) &&
! 	(p._y >= min(_p1._y, _p2._y)) && (p._y <= max(_p1._y, _p2._y)) && (
              (p._y - _p1._y)*(_p2._x - _p1._x) - 
              (_p2._y - _p1._y)*(p._x - _p1._x)
          ) == 0;
***************
*** 167,174 ****
  /*****************************************************************************/
  
  FBoxObj::FBoxObj (float x0, float y0, float x1, float y1) {
!     _left = ivmin(x0, x1); _bottom = ivmin(y0, y1); 
!     _right = ivmax(x0, x1); _top = ivmax(y0, y1);
  }
  
  FBoxObj::FBoxObj (FBoxObj* b) {
--- 167,174 ----
  /*****************************************************************************/
  
  FBoxObj::FBoxObj (float x0, float y0, float x1, float y1) {
!     _left = min(x0, x1); _bottom = min(y0, y1); 
!     _right = max(x0, x1); _top = max(y0, y1);
  }
  
  FBoxObj::FBoxObj (FBoxObj* b) {
***************
*** 189,198 ****
  }
  
  boolean FBoxObj::Intersects (FLineObj& l) {
!     float x1 = ivmin(l._p1._x, l._p2._x);
!     float x2 = ivmax(l._p1._x, l._p2._x);
!     float y1 = ivmin(l._p1._y, l._p2._y);
!     float y2 = ivmax(l._p1._y, l._p2._y);
      FBoxObj lbox(x1, y1, x2, y2);
      boolean intersects = false;
  
--- 189,198 ----
  }
  
  boolean FBoxObj::Intersects (FLineObj& l) {
!     float x1 = min(l._p1._x, l._p2._x);
!     float x2 = max(l._p1._x, l._p2._x);
!     float y1 = min(l._p1._y, l._p2._y);
!     float y2 = max(l._p1._y, l._p2._y);
      FBoxObj lbox(x1, y1, x2, y2);
      boolean intersects = false;
  
***************
*** 215,224 ****
      FBoxObj i;
  
      if (Intersects(b)) {
!         i._left = ivmax(_left, b._left);
! 	i._bottom = ivmax(_bottom, b._bottom);
! 	i._right = ivmin(_right, b._right);
! 	i._top = ivmin(_top, b._top);
      }
      return i;
  }
--- 215,224 ----
      FBoxObj i;
  
      if (Intersects(b)) {
!         i._left = max(_left, b._left);
! 	i._bottom = max(_bottom, b._bottom);
! 	i._right = min(_right, b._right);
! 	i._top = min(_top, b._top);
      }
      return i;
  }
***************
*** 226,235 ****
  FBoxObj FBoxObj::operator+ (FBoxObj& b) {
      FBoxObj m;
      
!     m._left = ivmin(_left, b._left);
!     m._bottom = ivmin(_bottom, b._bottom);
!     m._right = ivmax(_right, b._right);
!     m._top = ivmax(_top, b._top);
      return m;
  }
  
--- 226,235 ----
  FBoxObj FBoxObj::operator+ (FBoxObj& b) {
      FBoxObj m;
      
!     m._left = min(_left, b._left);
!     m._bottom = min(_bottom, b._bottom);
!     m._right = max(_right, b._right);
!     m._top = max(_top, b._top);
      return m;
  }
  
***************
*** 483,492 ****
      b._bottom = b._top = _y[0];
  
      for (int i = 1; i < _count; ++i) {
! 	b._left = ivmin(b._left, _x[i]);
! 	b._bottom = ivmin(b._bottom, _y[i]);
! 	b._right = ivmax(b._right, _x[i]);
! 	b._top = ivmax(b._top, _y[i]);
      }
  }
  
--- 483,492 ----
      b._bottom = b._top = _y[0];
  
      for (int i = 1; i < _count; ++i) {
! 	b._left = min(b._left, _x[i]);
! 	b._bottom = min(b._bottom, _y[i]);
! 	b._right = max(b._right, _x[i]);
! 	b._top = max(b._top, _y[i]);
      }
  }
  
***************
*** 571,577 ****
  	    _pts_by_n[i] = nil;
      }
      if (npts>=_pts_by_n_size) {
! 	int new_size = ivmax(_pts_by_n_size*2, npts+1);
  	UList** new_pts_by_n = new UList*[new_size];
  	int i = 0;
  	for (;i<_pts_by_n_size; i++) 
--- 571,577 ----
  	    _pts_by_n[i] = nil;
      }
      if (npts>=_pts_by_n_size) {
! 	int new_size = max(_pts_by_n_size*2, npts+1);
  	UList** new_pts_by_n = new UList*[new_size];
  	int i = 0;
  	for (;i<_pts_by_n_size; i++) 
***************
*** 995,1011 ****
      }
  
  void Extent::Merge (Extent& e) {
!     float nl = ivmin(_left, e._left);
!     float nb = ivmin(_bottom, e._bottom);
  
      if (Undefined()) {
  	_left = e._left; _bottom = e._bottom; _cx = e._cx; _cy = e._cy;
      } else if (!e.Undefined()) {
! 	_cx = (nl + ivmax(2*_cx - _left, 2*e._cx - e._left)) / 2;
! 	_cy = (nb + ivmax(2*_cy - _bottom, 2*e._cy - e._bottom)) / 2;
  	_left = nl;
  	_bottom = nb;
      }
!     _tol = ivmax(_tol, e._tol);
  }
  #endif
--- 995,1011 ----
      }
  
  void Extent::Merge (Extent& e) {
!     float nl = min(_left, e._left);
!     float nb = min(_bottom, e._bottom);
  
      if (Undefined()) {
  	_left = e._left; _bottom = e._bottom; _cx = e._cx; _cy = e._cy;
      } else if (!e.Undefined()) {
! 	_cx = (nl + max(2*_cx - _left, 2*e._cx - e._left)) / 2;
! 	_cy = (nb + max(2*_cy - _bottom, 2*e._cy - e._bottom)) / 2;
  	_left = nl;
  	_bottom = nb;
      }
!     _tol = max(_tol, e._tol);
  }
  #endif
Index: Unidraw/csolver.c
diff -c Unidraw/csolver.c:1.2 Unidraw/csolver.c:1.3
*** Unidraw/csolver.c:1.2	Sun Sep 30 13:49:17 2007
--- src/Unidraw/csolver.c	Sun Sep 30 22:22:07 2007
***************
*** 109,119 ****
  CSGlue* CSGlue::Parallel (CSGlue* g) {
      CSGlue* combo = new CSGlue;
  
!     combo->_natural = ivmax(_natural, g->_natural);
!     combo->_stretch = ivmin(_stretch, g->_stretch);
!     combo->_shrink = ivmin(_shrink, g->_shrink);
!     combo->_strlim = ivmin(_strlim, g->_strlim);
!     combo->_shrlim = ivmin(_shrlim, g->_shrlim);
  
      return combo;
  }
--- 109,119 ----
  CSGlue* CSGlue::Parallel (CSGlue* g) {
      CSGlue* combo = new CSGlue;
  
!     combo->_natural = max(_natural, g->_natural);
!     combo->_stretch = min(_stretch, g->_stretch);
!     combo->_shrink = min(_shrink, g->_shrink);
!     combo->_strlim = min(_strlim, g->_strlim);
!     combo->_shrlim = min(_shrlim, g->_shrlim);
  
      return combo;
  }
***************
*** 122,129 ****
      CSGlue* combo = new CSGlue;
  
      combo->_natural = _natural + b->_natural;
!     combo->_stretch = ivmin(_stretch + b->_stretch, c->_stretch);
!     combo->_shrink = ivmin(_shrink + b->_shrink, c->_shrink);
      combo->_strlim = _strlim + b->_strlim;
      combo->_shrlim = _shrlim + b->_shrlim;
  
--- 122,129 ----
      CSGlue* combo = new CSGlue;
  
      combo->_natural = _natural + b->_natural;
!     combo->_stretch = min(_stretch + b->_stretch, c->_stretch);
!     combo->_shrink = min(_shrink + b->_shrink, c->_shrink);
      combo->_strlim = _strlim + b->_strlim;
      combo->_shrlim = _shrlim + b->_shrlim;
  
***************
*** 134,141 ****
      CSGlue* combo = new CSGlue;
  
      combo->_natural = c->_natural - b->_natural;
!     combo->_stretch = ivmin(b->_stretch + c->_stretch, _stretch);
!     combo->_shrink = ivmin(b->_shrink + c->_shrink, _shrink);
      combo->_strlim = c->_strlim - b->_strlim;
      combo->_shrlim = c->_shrlim - b->_shrlim;
  
--- 134,141 ----
      CSGlue* combo = new CSGlue;
  
      combo->_natural = c->_natural - b->_natural;
!     combo->_stretch = min(b->_stretch + c->_stretch, _stretch);
!     combo->_shrink = min(b->_shrink + c->_shrink, _shrink);
      combo->_strlim = c->_strlim - b->_strlim;
      combo->_shrlim = c->_shrlim - b->_shrlim;
  
***************
*** 146,153 ****
      CSGlue* combo = new CSGlue;
  
      combo->_natural = _natural + c->_natural;
!     combo->_stretch = ivmin(_stretch + c->_stretch, b->_stretch);
!     combo->_shrink = ivmin(_shrink + c->_shrink, b->_shrink);
      combo->_strlim = _strlim + c->_strlim;
      combo->_shrlim = _shrlim + c->_shrlim;
  
--- 146,153 ----
      CSGlue* combo = new CSGlue;
  
      combo->_natural = _natural + c->_natural;
!     combo->_stretch = min(_stretch + c->_stretch, b->_stretch);
!     combo->_shrink = min(_shrink + c->_shrink, b->_shrink);
      combo->_strlim = _strlim + c->_strlim;
      combo->_shrlim = _shrlim + c->_shrlim;
  
***************
*** 155,161 ****
  }
  
  void CSGlue::Limit (float& deform) {
!     deform = ivmin(ivmax(-_shrlim, deform), _strlim);
  }
  
  void CSGlue::Reverse () {
--- 155,161 ----
  }
  
  void CSGlue::Limit (float& deform) {
!     deform = min(max(-_shrlim, deform), _strlim);
  }
  
  void CSGlue::Reverse () {
Index: Unidraw/damage.c
diff -c Unidraw/damage.c:1.2 Unidraw/damage.c:1.3
*** Unidraw/damage.c:1.2	Sun Sep 30 13:49:17 2007
--- src/Unidraw/damage.c	Sun Sep 30 22:22:07 2007
***************
*** 101,107 ****
      diff1 = area1 + newArea - Area(merge1);
      diff2 = area2 + newArea - Area(merge2);
      diff3 = area1 + area2 - Area(merge3);
!     maximum = ivmax(ivmax(diff1, diff2), diff3);
  
      if (maximum == diff1) {
  	if (a2->Intersects(merge1)) {
--- 101,107 ----
      diff1 = area1 + newArea - Area(merge1);
      diff2 = area2 + newArea - Area(merge2);
      diff3 = area1 + area2 - Area(merge3);
!     maximum = max(max(diff1, diff2), diff3);
  
      if (maximum == diff1) {
  	if (a2->Intersects(merge1)) {
Index: Unidraw/geomobjs.c
diff -c Unidraw/geomobjs.c:1.2 Unidraw/geomobjs.c:1.3
*** Unidraw/geomobjs.c:1.2	Sun Sep 30 13:49:17 2007
--- src/Unidraw/geomobjs.c	Sun Sep 30 22:22:07 2007
***************
*** 66,73 ****
  }
  boolean LineObj::Contains (PointObj& p) {
      return
! 	(p._x >= ivmin(_p1._x, _p2._x)) && (p._x <= ivmax(_p1._x, _p2._x)) &&
! 	(p._y >= ivmin(_p1._y, _p2._y)) && (p._y <= ivmax(_p1._y, _p2._y)) && (
              (p._y - _p1._y)*(_p2._x - _p1._x) - 
              (_p2._y - _p1._y)*(p._x - _p1._x)
          ) == 0;
--- 66,73 ----
  }
  boolean LineObj::Contains (PointObj& p) {
      return
! 	(p._x >= min(_p1._x, _p2._x)) && (p._x <= max(_p1._x, _p2._x)) &&
! 	(p._y >= min(_p1._y, _p2._y)) && (p._y <= max(_p1._y, _p2._y)) && (
              (p._y - _p1._y)*(_p2._x - _p1._x) - 
              (_p2._y - _p1._y)*(p._x - _p1._x)
          ) == 0;
***************
*** 108,115 ****
  /*****************************************************************************/
  
  BoxObj::BoxObj (Coord x0, Coord y0, Coord x1, Coord y1) {
!     _left = ivmin(x0, x1); _bottom = ivmin(y0, y1); 
!     _right = ivmax(x0, x1); _top = ivmax(y0, y1);
  }
  
  BoxObj::BoxObj (BoxObj* b) {
--- 108,115 ----
  /*****************************************************************************/
  
  BoxObj::BoxObj (Coord x0, Coord y0, Coord x1, Coord y1) {
!     _left = min(x0, x1); _bottom = min(y0, y1); 
!     _right = max(x0, x1); _top = max(y0, y1);
  }
  
  BoxObj::BoxObj (BoxObj* b) {
***************
*** 130,139 ****
  }
  
  boolean BoxObj::Intersects (LineObj& l) {
!     Coord x1 = ivmin(l._p1._x, l._p2._x);
!     Coord x2 = ivmax(l._p1._x, l._p2._x);
!     Coord y1 = ivmin(l._p1._y, l._p2._y);
!     Coord y2 = ivmax(l._p1._y, l._p2._y);
      BoxObj lbox(x1, y1, x2, y2);
      boolean intersects = false;
  
--- 130,139 ----
  }
  
  boolean BoxObj::Intersects (LineObj& l) {
!     Coord x1 = min(l._p1._x, l._p2._x);
!     Coord x2 = max(l._p1._x, l._p2._x);
!     Coord y1 = min(l._p1._y, l._p2._y);
!     Coord y2 = max(l._p1._y, l._p2._y);
      BoxObj lbox(x1, y1, x2, y2);
      boolean intersects = false;
  
***************
*** 156,165 ****
      BoxObj i;
  
      if (Intersects(b)) {
!         i._left = ivmax(_left, b._left);
! 	i._bottom = ivmax(_bottom, b._bottom);
! 	i._right = ivmin(_right, b._right);
! 	i._top = ivmin(_top, b._top);
      }
      return i;
  }
--- 156,165 ----
      BoxObj i;
  
      if (Intersects(b)) {
!         i._left = max(_left, b._left);
! 	i._bottom = max(_bottom, b._bottom);
! 	i._right = min(_right, b._right);
! 	i._top = min(_top, b._top);
      }
      return i;
  }
***************
*** 167,176 ****
  BoxObj BoxObj::operator+ (BoxObj& b) {
      BoxObj m;
      
!     m._left = ivmin(_left, b._left);
!     m._bottom = ivmin(_bottom, b._bottom);
!     m._right = ivmax(_right, b._right);
!     m._top = ivmax(_top, b._top);
      return m;
  }
  
--- 167,176 ----
  BoxObj BoxObj::operator+ (BoxObj& b) {
      BoxObj m;
      
!     m._left = min(_left, b._left);
!     m._bottom = min(_bottom, b._bottom);
!     m._right = max(_right, b._right);
!     m._top = max(_top, b._top);
      return m;
  }
  
***************
*** 388,397 ****
      b._bottom = b._top = _y[0];
  
      for (int i = 1; i < _count; ++i) {
! 	b._left = ivmin(b._left, _x[i]);
! 	b._bottom = ivmin(b._bottom, _y[i]);
! 	b._right = ivmax(b._right, _x[i]);
! 	b._top = ivmax(b._top, _y[i]);
      }
  }
  
--- 388,397 ----
      b._bottom = b._top = _y[0];
  
      for (int i = 1; i < _count; ++i) {
! 	b._left = min(b._left, _x[i]);
! 	b._bottom = min(b._bottom, _y[i]);
! 	b._right = max(b._right, _x[i]);
! 	b._top = max(b._top, _y[i]);
      }
  }
  
***************
*** 467,473 ****
  	    _pts_by_n[i] = nil;
      }
      if (npts>=_pts_by_n_size) {
! 	int new_size = ivmax(_pts_by_n_size*2, npts+1);
  	UList** new_pts_by_n = new UList*[new_size];
  	int i = 0;
  	for (;i<_pts_by_n_size; i++) 
--- 467,473 ----
  	    _pts_by_n[i] = nil;
      }
      if (npts>=_pts_by_n_size) {
! 	int new_size = max(_pts_by_n_size*2, npts+1);
  	UList** new_pts_by_n = new UList*[new_size];
  	int i = 0;
  	for (;i<_pts_by_n_size; i++) 
***************
*** 691,706 ****
      }
  
  void Extent::Merge (Extent& e) {
!     float nl = ivmin(_left, e._left);
!     float nb = ivmin(_bottom, e._bottom);
  
      if (Undefined()) {
  	_left = e._left; _bottom = e._bottom; _cx = e._cx; _cy = e._cy;
      } else if (!e.Undefined()) {
! 	_cx = (nl + ivmax(2*_cx - _left, 2*e._cx - e._left)) / 2;
! 	_cy = (nb + ivmax(2*_cy - _bottom, 2*e._cy - e._bottom)) / 2;
  	_left = nl;
  	_bottom = nb;
      }
!     _tol = ivmax(_tol, e._tol);
  }
--- 691,706 ----
      }
  
  void Extent::Merge (Extent& e) {
!     float nl = min(_left, e._left);
!     float nb = min(_bottom, e._bottom);
  
      if (Undefined()) {
  	_left = e._left; _bottom = e._bottom; _cx = e._cx; _cy = e._cy;
      } else if (!e.Undefined()) {
! 	_cx = (nl + max(2*_cx - _left, 2*e._cx - e._left)) / 2;
! 	_cy = (nb + max(2*_cy - _bottom, 2*e._cy - e._bottom)) / 2;
  	_left = nl;
  	_bottom = nb;
      }
!     _tol = max(_tol, e._tol);
  }
Index: Unidraw/globals.c
diff -c Unidraw/globals.c:1.2 Unidraw/globals.c:1.3
*** Unidraw/globals.c:1.2	Sun Sep 30 13:49:17 2007
--- src/Unidraw/globals.c	Sun Sep 30 22:22:07 2007
***************
*** 60,71 ****
  void NormalRect (Coord& left, Coord& bottom, Coord& right, Coord& top) {
      Coord tempx, tempy;
      
!     tempx = ivmin(left, right);
!     right = ivmax(left, right);
      left = tempx;
      
!     tempy = ivmin(bottom, top);
!     top = ivmax(bottom, top);
      bottom = tempy;
  }
  
--- 60,71 ----
  void NormalRect (Coord& left, Coord& bottom, Coord& right, Coord& top) {
      Coord tempx, tempy;
      
!     tempx = min(left, right);
!     right = max(left, right);
      left = tempx;
      
!     tempy = min(bottom, top);
!     top = max(bottom, top);
      bottom = tempy;
  }
  
Index: Unidraw/grblock.c
diff -c Unidraw/grblock.c:1.2 Unidraw/grblock.c:1.3
*** Unidraw/grblock.c:1.2	Sun Sep 30 13:49:17 2007
--- src/Unidraw/grblock.c	Sun Sep 30 22:22:07 2007
***************
*** 493,500 ****
  
          s.curx -= dx;
          s.cury -= dy;
!         s.curx = ivmin(ivmax(s.x0, s.curx), s.x0 + s.width - s.curwidth);
!         s.cury = ivmin(ivmax(s.y0, s.cury), s.y0 + s.height - s.curheight);
  
          Adjust(s);
          Poll(e);
--- 493,500 ----
  
          s.curx -= dx;
          s.cury -= dy;
!         s.curx = min(max(s.x0, s.curx), s.x0 + s.width - s.curwidth);
!         s.cury = min(max(s.y0, s.cury), s.y0 + s.height - s.curheight);
  
          Adjust(s);
          Poll(e);
Index: Unidraw/lines.c
diff -c Unidraw/lines.c:1.2 Unidraw/lines.c:1.3
*** Unidraw/lines.c:1.2	Sun Sep 30 13:49:17 2007
--- src/Unidraw/lines.c	Sun Sep 30 22:22:07 2007
***************
*** 164,171 ****
      transform(float(_x0+_x1)/2, float(_y0+_y1)/2, cx, cy, gs);
      transform(float(_x0), float(_y0), l, b, gs);
      transform(float(_x1), float(_y1), r, t, gs);
!     l = ivmin(l, r);
!     b = ivmin(b, t);
  }
  
  boolean Line::contains (PointObj& po, Graphic* gs) {
--- 164,171 ----
      transform(float(_x0+_x1)/2, float(_y0+_y1)/2, cx, cy, gs);
      transform(float(_x0), float(_y0), l, b, gs);
      transform(float(_x1), float(_y1), r, t, gs);
!     l = min(l, r);
!     b = min(b, t);
  }
  
  boolean Line::contains (PointObj& po, Graphic* gs) {
Index: Unidraw/manips.c
diff -c Unidraw/manips.c:1.2 Unidraw/manips.c:1.3
*** Unidraw/manips.c:1.2	Sun Sep 30 13:49:17 2007
--- src/Unidraw/manips.c	Sun Sep 30 22:22:07 2007
***************
*** 729,744 ****
  }
  
  void TextManip::BeginningOfSelection () {
!     Select(ivmin(_mark, _dot));
  }
  
  void TextManip::EndOfSelection () {
!     Select(ivmax(_mark, _dot));
  }
  
  void TextManip::BeginningOfWord () {
      if (_dot != _mark) {
!         Select(ivmin(_mark, _dot));
      } else {
          Select(_text->BeginningOfWord(_dot));
      }
--- 729,744 ----
  }
  
  void TextManip::BeginningOfSelection () {
!     Select(min(_mark, _dot));
  }
  
  void TextManip::EndOfSelection () {
!     Select(max(_mark, _dot));
  }
  
  void TextManip::BeginningOfWord () {
      if (_dot != _mark) {
!         Select(min(_mark, _dot));
      } else {
          Select(_text->BeginningOfWord(_dot));
      }
***************
*** 746,752 ****
  
  void TextManip::EndOfWord () {
      if (_dot != _mark) {
!         Select(ivmax(_mark, _dot));
      } else {
          Select(_text->EndOfWord(_dot));
      }
--- 746,752 ----
  
  void TextManip::EndOfWord () {
      if (_dot != _mark) {
!         Select(max(_mark, _dot));
      } else {
          Select(_text->EndOfWord(_dot));
      }
***************
*** 754,760 ****
  
  void TextManip::BeginningOfLine () {
      if (_dot != _mark) {
!         Select(ivmin(_mark, _dot));
      } else {
          Select(_text->BeginningOfLine(_dot));
      }
--- 754,760 ----
  
  void TextManip::BeginningOfLine () {
      if (_dot != _mark) {
!         Select(min(_mark, _dot));
      } else {
          Select(_text->BeginningOfLine(_dot));
      }
***************
*** 762,768 ****
  
  void TextManip::EndOfLine () {
      if (_dot != _mark) {
!         Select(ivmax(_mark, _dot));
      } else {
          Select(_text->EndOfLine(_dot));
      }
--- 762,768 ----
  
  void TextManip::EndOfLine () {
      if (_dot != _mark) {
!         Select(max(_mark, _dot));
      } else {
          Select(_text->EndOfLine(_dot));
      }
***************
*** 778,784 ****
  
  void TextManip::ForwardCharacter (int count) {
      if (_mark != _dot) {
!         Select(ivmax(_mark, _dot));
      } else {
          int d = _dot;
          while (count > 0) {
--- 778,784 ----
  
  void TextManip::ForwardCharacter (int count) {
      if (_mark != _dot) {
!         Select(max(_mark, _dot));
      } else {
          int d = _dot;
          while (count > 0) {
***************
*** 791,797 ****
  
  void TextManip::BackwardCharacter (int count) {
      if (_dot != _mark) {
!         Select(ivmin(_mark, _dot));
      } else {
          int d = _dot;
          while (count > 0) {
--- 791,797 ----
  
  void TextManip::BackwardCharacter (int count) {
      if (_dot != _mark) {
!         Select(min(_mark, _dot));
      } else {
          int d = _dot;
          while (count > 0) {
***************
*** 804,810 ****
  
  void TextManip::ForwardLine (int count) {
      if (_dot != _mark) {
!         Select(ivmax(_mark, _dot));
      } else {
          int d = _dot;
          while (count > 0) {
--- 804,810 ----
  
  void TextManip::ForwardLine (int count) {
      if (_dot != _mark) {
!         Select(max(_mark, _dot));
      } else {
          int d = _dot;
          while (count > 0) {
***************
*** 817,823 ****
  
  void TextManip::BackwardLine (int count) {
      if (_dot != _mark) {
!         Select(ivmin(_mark, _dot));
      } else {
          int d = _dot;
          while (count > 0) {
--- 817,823 ----
  
  void TextManip::BackwardLine (int count) {
      if (_dot != _mark) {
!         Select(min(_mark, _dot));
      } else {
          int d = _dot;
          while (count > 0) {
***************
*** 830,836 ****
  
  void TextManip::ForwardWord (int count) {
      if (_dot != _mark) {
!         Select(ivmax(_mark, _dot));
      } else {
          int d = _dot;
          while (count > 0) {
--- 830,836 ----
  
  void TextManip::ForwardWord (int count) {
      if (_dot != _mark) {
!         Select(max(_mark, _dot));
      } else {
          int d = _dot;
          while (count > 0) {
***************
*** 843,849 ****
  
  void TextManip::BackwardWord (int count) {
      if (_dot != _mark) {
!         Select(ivmin(_mark, _dot));
      } else {
          int d = _dot;
          while (count > 0) {
--- 843,849 ----
  
  void TextManip::BackwardWord (int count) {
      if (_dot != _mark) {
!         Select(min(_mark, _dot));
      } else {
          int d = _dot;
          while (count > 0) {
***************
*** 867,876 ****
  }
  
  void TextManip::Select (int d, int m) {
!     int oldl = ivmin(_dot, _mark);
!     int oldr = ivmax(_dot, _mark);
!     int newl = ivmin(d, m);
!     int newr = ivmax(d, m);
      if (oldl == oldr && newl != newr) {
          _display->CaretStyle(NoCaret);
      }
--- 867,876 ----
  }
  
  void TextManip::Select (int d, int m) {
!     int oldl = min(_dot, _mark);
!     int oldr = max(_dot, _mark);
!     int newl = min(d, m);
!     int newr = max(d, m);
      if (oldl == oldr && newl != newr) {
          _display->CaretStyle(NoCaret);
      }
Index: Unidraw/polygons.c
diff -c Unidraw/polygons.c:1.2 Unidraw/polygons.c:1.3
*** Unidraw/polygons.c:1.2	Sun Sep 30 13:49:17 2007
--- src/Unidraw/polygons.c	Sun Sep 30 22:22:07 2007
***************
*** 36,45 ****
  /*****************************************************************************/
  
  Rect::Rect (Coord x0, Coord y0, Coord x1, Coord y1, Graphic* gr) : Graphic(gr){
!     _x0 = ivmin(x0, x1);
!     _y0 = ivmin(y0, y1);
!     _x1 = ivmax(x0, x1);
!     _y1 = ivmax(y0, y1);
  }
  
  void Rect::GetOriginal (Coord& x0, Coord& y0, Coord& x1, Coord& y1) {
--- 36,45 ----
  /*****************************************************************************/
  
  Rect::Rect (Coord x0, Coord y0, Coord x1, Coord y1, Graphic* gr) : Graphic(gr){
!     _x0 = min(x0, x1);
!     _y0 = min(y0, y1);
!     _x1 = max(x0, x1);
!     _y1 = max(y0, y1);
  }
  
  void Rect::GetOriginal (Coord& x0, Coord& y0, Coord& x1, Coord& y1) {
Index: Unidraw/stateviews.c
diff -c Unidraw/stateviews.c:1.2 Unidraw/stateviews.c:1.3
*** Unidraw/stateviews.c:1.2	Sun Sep 30 13:49:17 2007
--- src/Unidraw/stateviews.c	Sun Sep 30 22:22:07 2007
***************
*** 412,419 ****
      Unref(tmp);
  
      const Font* f = output->GetFont();
!     shape->width = ivmax(f->Width(NONE) + 2*HPAD, VIEW_WIDTH);
!     shape->height = ivmax(f->Height() + 2*VPAD, VIEW_HEIGHT);
  
      shape->Rigid(shape->width/2, shape->width, shape->height/2, shape->height);
  }
--- 412,419 ----
      Unref(tmp);
  
      const Font* f = output->GetFont();
!     shape->width = max(f->Width(NONE) + 2*HPAD, VIEW_WIDTH);
!     shape->height = max(f->Height() + 2*VPAD, VIEW_HEIGHT);
  
      shape->Rigid(shape->width/2, shape->width, shape->height/2, shape->height);
  }
***************
*** 565,572 ****
      Unref(tmp);
  
      const Font* f = output->GetFont();
!     shape->width = ivmax(f->Width(NONE) + 2*HPAD, VIEW_WIDTH);
!     shape->height = ivmax(f->Height() + 2*VPAD, VIEW_HEIGHT);
  
      shape->Rigid(shape->width/2, shape->width, shape->height/2, shape->height);
  }
--- 565,572 ----
      Unref(tmp);
  
      const Font* f = output->GetFont();
!     shape->width = max(f->Width(NONE) + 2*HPAD, VIEW_WIDTH);
!     shape->height = max(f->Height() + 2*VPAD, VIEW_HEIGHT);
  
      shape->Rigid(shape->width/2, shape->width, shape->height/2, shape->height);
  }
Index: Unidraw/text.c
diff -c Unidraw/text.c:1.2 Unidraw/text.c:1.3
*** Unidraw/text.c:1.2	Sun Sep 30 13:49:17 2007
--- src/Unidraw/text.c	Sun Sep 30 22:22:07 2007
***************
*** 389,395 ****
      
      for (beg = 0; beg < size; beg = nextBeg) {
          GetLine(s, size, beg, end, lineSize, nextBeg);
!         r = ivmax(r, f->Width(&s[beg], lineSize) - 1);
          b -= _lineHt;
      }
  }
--- 389,395 ----
      
      for (beg = 0; beg < size; beg = nextBeg) {
          GetLine(s, size, beg, end, lineSize, nextBeg);
!         r = max(r, f->Width(&s[beg], lineSize) - 1);
          b -= _lineHt;
      }
  }
Index: Unidraw/uctrls.c
diff -c Unidraw/uctrls.c:1.2 Unidraw/uctrls.c:1.3
*** Unidraw/uctrls.c:1.2	Sun Sep 30 13:49:17 2007
--- src/Unidraw/uctrls.c	Sun Sep 30 22:22:07 2007
***************
*** 172,183 ****
  
      _label->GetBox(x0, y0, x1, y1);
      shape->width = 2*HPAD + x1 - x0;
!     shape->height = ivmax(2*VPAD + y1 - y0, MINHT);
  
      if (*kl != '\0') {
  	Font* f = stdgraphic->GetFont();
  	shape->width += f->Width(kl) + SEP;
! 	shape->height = ivmax(shape->height, f->Height() + 2*VPAD);
      }
      shape->Rigid(shape->width, hfil, 0, 0);
  }
--- 172,183 ----
  
      _label->GetBox(x0, y0, x1, y1);
      shape->width = 2*HPAD + x1 - x0;
!     shape->height = max(2*VPAD + y1 - y0, MINHT);
  
      if (*kl != '\0') {
  	Font* f = stdgraphic->GetFont();
  	shape->width += f->Width(kl) + SEP;
! 	shape->height = max(shape->height, f->Height() + 2*VPAD);
      }
      shape->Rigid(shape->width, hfil, 0, 0);
  }
***************
*** 250,256 ****
  	shape->width += 2 * f->Width(kl) + HPAD;
  	shape->height += f->Height();
      }
!     shape->height = ivmax(shape->height, MINHT);
  
      if (_orient == Horizontal) {
          shape->Rigid(0, shape->width, 0, vfil);
--- 250,256 ----
  	shape->width += 2 * f->Width(kl) + HPAD;
  	shape->height += f->Height();
      }
!     shape->height = max(shape->height, MINHT);
  
      if (_orient == Horizontal) {
          shape->Rigid(0, shape->width, 0, vfil);
Index: Unidraw/verts.c
diff -c Unidraw/verts.c:1.2 Unidraw/verts.c:1.3
*** Unidraw/verts.c:1.2	Sun Sep 30 13:49:17 2007
--- src/Unidraw/verts.c	Sun Sep 30 22:22:07 2007
***************
*** 27,33 ****
  
  #include <Unidraw/Graphic/util.h>
  #include <Unidraw/Graphic/verts.h>
- #include <InterViews/transformer.h>
  
  #include <IV-2_6/_enter.h>
  
--- 27,32 ----
***************
*** 130,139 ****
  	by0 = by1 = y() ? y()[0] : 0.0;
  
  	for (int i = 1; i < count(); ++i) {
! 	    bx0 = ivmin(bx0, float(x()[i]));
! 	    by0 = ivmin(by0, float(y()[i]));
! 	    bx1 = ivmax(bx1, float(x()[i]));
! 	    by1 = ivmax(by1, float(y()[i]));
  	}
  	tcx = (bx0 + bx1) / 2;
  	tcy = (by0 + by1) / 2;
--- 129,138 ----
  	by0 = by1 = y() ? y()[0] : 0.0;
  
  	for (int i = 1; i < count(); ++i) {
! 	    bx0 = min(bx0, float(x()[i]));
! 	    by0 = min(by0, float(y()[i]));
! 	    bx1 = max(bx1, float(x()[i]));
! 	    by1 = max(by1, float(y()[i]));
  	}
  	tcx = (bx0 + bx1) / 2;
  	tcy = (by0 + by1) / 2;
***************
*** 157,166 ****
  	bx0 = bx1 = x()[0]; by0 = by1 = y()[0];
  
  	for (int i = 1; i < count(); ++i) {
! 	    bx0 = ivmin(bx0, float(x()[i]));
! 	    by0 = ivmin(by0, float(y()[i]));
! 	    bx1 = ivmax(bx1, float(x()[i]));
! 	    by1 = ivmax(by1, float(y()[i]));
  	}
  	tcx = (bx0 + bx1) / 2;
  	tcy = (by0 + by1) / 2;
--- 156,165 ----
  	bx0 = bx1 = x()[0]; by0 = by1 = y()[0];
  
  	for (int i = 1; i < count(); ++i) {
! 	    bx0 = min(bx0, float(x()[i]));
! 	    by0 = min(by0, float(y()[i]));
! 	    bx1 = max(bx1, float(x()[i]));
! 	    by1 = max(by1, float(y()[i]));
  	}
  	tcx = (bx0 + bx1) / 2;
  	tcy = (by0 + by1) / 2;
***************
*** 182,196 ****
  Coord* Vertices::y() { 
      return _pts ? _pts->y() : nil; 
  }
- 
- boolean Vertices::GetPoint (int index, Coord& px, Coord& py) {
-     if (index<0 || index>=count()) return false;
-     Coord tx, ty;
-     Transformer t;
-     tx = x()[index];
-     ty = y()[index];
-     TotalTransformation(t);
-     t.Transform(tx, ty, px, py);
-     return true;
- }
- 
--- 181,183 ----
Index: UniIdraw/idcatalog.c
diff -c UniIdraw/idcatalog.c:1.2 UniIdraw/idcatalog.c:1.3
*** UniIdraw/idcatalog.c:1.2	Sun Sep 30 13:49:18 2007
--- src/UniIdraw/idcatalog.c	Sun Sep 30 22:22:08 2007
***************
*** 746,752 ****
      if (n > sizepoints) {
          delete xcoords;
          delete ycoords;
!         sizepoints = ivmax(n, INITIALSIZE);
          xcoords = new Coord[sizepoints];
          ycoords = new Coord[sizepoints];
      }
--- 746,752 ----
      if (n > sizepoints) {
          delete xcoords;
          delete ycoords;
!         sizepoints = max(n, INITIALSIZE);
          xcoords = new Coord[sizepoints];
          ycoords = new Coord[sizepoints];
      }
*** /dev/null	 Sun Sep 30 22:22:14 PDT 2007
--- patches/ivtools-070930-johnston-003
*************** patches/ivtools-070930-johnston-003
*** 0 ****
--- 1 ----
+ ivtools-070930-johnston-003

--Apple-Mail-5-869486645
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
--Apple-Mail-5-869486645
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Ivtools-patch mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ivtools-patch

--Apple-Mail-5-869486645--