--- BitSet.cc.orig	Wed May 11 01:53:49 1994
+++ BitSet.cc	Fri Nov  4 14:07:53 1994
@@ -995,7 +995,11 @@
   sb->sputc(star);
 }
 
+#ifdef VXWORKS
+int BitSet::Ok() const
+#else
 int BitSet::OK() const
+#endif
 {
   int v = rep != 0;             // have a rep
   v &= rep->len <= rep->sz;     // within bounds
--- BitSet.h.orig	Wed May 11 01:53:51 1994
+++ BitSet.h	Fri Nov  4 14:07:53 1994
@@ -159,7 +159,11 @@
 // misc
 
   void      error(const char* msg) const;
+#ifdef VXWORKS
+  int                Ok() const;
+#else
   int                OK() const;
+#endif
 };
 
 
--- BitString.cc.orig	Tue May 31 10:20:55 1994
+++ BitString.cc	Fri Nov  4 14:07:53 1994
@@ -1581,7 +1581,11 @@
 }
 
 
+#ifdef VXWORKS
+int BitString::Ok() const
+#else
 int BitString::OK() const
+#endif
 {
   int v = rep != 0;             // have a rep;
   v &= BitStr_len(rep->len) <= rep->sz; // within allocated size
@@ -1589,17 +1593,33 @@
   return v;
 }
 
+#ifdef VXWORKS
+int BitSubString::Ok() const
+#else
 int BitSubString::OK() const
+#endif
 {
+#ifdef VXWORKS
+  int v = S.Ok();               // valid BitString
+#else
   int v = S.OK();               // valid BitString
+#endif
   v &= pos + len <= S.rep->len; // within bounds of targ
   if (!v) S.error("BitSubString invariant failure");
   return v;
 }
 
+#ifdef VXWORKS
+int BitPattern::Ok() const
+#else
 int BitPattern::OK() const
+#endif
 {
+#ifdef VXWORKS
+  int v = pattern.Ok() && mask.Ok();
+#else
   int v = pattern.OK() && mask.OK();
+#endif
   if (!v) pattern.error("BitPattern invariant failure");
   return v;
 }
--- BitString.h.orig	Sun May 22 19:27:30 1994
+++ BitString.h	Fri Nov  4 14:07:54 1994
@@ -88,7 +88,11 @@
   int               length() const;
   int               empty() const;
 
+#ifdef VXWORKS
+  int               Ok() const;
+#else
   int               OK() const;
+#endif
 };
 
 class BitString
@@ -259,9 +263,13 @@
 
   friend BitPattern  atoBitPattern(const char* s,
                                   char f='0',char t='1',char x='X');
-  friend const char* BitPatterntoa(const BitPattern& p, 
-                                  char f='0',char t='1',char x='X');
+  friend const char* BitPatterntoa(const BitPattern& p, char f='0',char t='1',char x='X');
+
+#ifdef VXWORKS
+  int                Ok() const;
+#else
   int                OK() const;
+#endif
 };
 
 
@@ -286,7 +294,11 @@
   int               search(const _BS_word*, int, int) const;
   int               match(const _BS_word* xs, int, int, int) const;
 
+#ifdef VXWORKS
+  int               Ok() const;
+#else
   int               OK() const;
+#endif
 };
 
 BitString  operator & (const BitString& x, const BitString& y);
--- DLList.cc.orig	Fri Oct 14 17:37:56 1994
+++ DLList.cc	Fri Nov  4 14:11:27 1994
@@ -304,8 +304,11 @@
   delete_node(t);
 }
 
-
+#ifdef VXWORKS
+int BaseDLList::Ok() const
+#else
 int BaseDLList::OK() const
+#endif
 {
   int v = 1;
   if (h != 0)
--- DLList.h.orig	Wed Aug 31 11:34:44 1994
+++ DLList.h	Fri Nov  4 14:12:49 1994
@@ -68,7 +68,11 @@
     void                  clear();
     void                  error(const char* msg) const;
     int                   owns(Pix p) const;
+#ifdef VXWORKS    
+    int                   Ok() const;
+#else
     int                   OK() const;
+#endif    
     void                  del(Pix& p, int dir = 1);
     void                  del_after(Pix& p);
     void                  del_front();
--- Fix16.h.orig	Fri Aug 12 19:44:42 1994
+++ Fix16.h	Fri Nov  4 14:07:55 1994
@@ -407,33 +407,51 @@
 }
 
 inline  Fix16&  Fix16:: operator+=(const Fix16&  f)
-{ 
-  return *this = *this + f; 
+{
+    short sum = f.m + this->m;
+  if ( (f.m ^ sum) & (this->m ^ sum) & Fix16_msb )
+    this->overflow(sum);
+  this->m = sum;
+  return *this;
+//  return *this = *this + f; 
 }
 
 inline Fix16&  Fix16:: operator-=(const Fix16&  f) 	
 { 
-  return *this = *this - f; 
+  short sum = this->m - f.m;
+  if ( (this->m ^ sum) & (-f.m ^ sum) & Fix16_msb )
+    this->overflow(sum);
+  this->m = sum;
+  return *this;
+//  return *this = *this - f; 
 }
 
 inline Fix16& Fix16::operator*=(const Fix16& f) 	
-{ 
-  return *this = *this * f; 
+{
+  Fix32 r(long( long(f.m) * long(this->m) << 1));
+  return *this = r;
+//  return *this = *this * f; 
 }
 
 inline Fix16&  Fix16:: operator/=(const Fix16&  f) 	
-{ 
-  return *this = *this / f; 
+{
+  Fix16 t = *this / f;
+  return *this = t;
+//  return *this = *this / f; 
 }
 
 inline Fix16&  Fix16:: operator<<=(int b)	
-{ 
-  return *this = *this << b;
+{
+  this->m <<= b;
+  return *this;
+//  return *this = *this << b;
 }
 
 inline Fix16&  Fix16:: operator>>=(int b)	
-{ 
-  return *this = *this >> b;
+{
+  this->m >>= b;
+  return *this;
+//  return *this = *this >> b;
 }
 
 inline int operator==(const Fix16&  f, const Fix16&  g)	
@@ -493,7 +511,9 @@
 
 inline Fix16& Fix16::operator*=(int g)
 {
-  return *this = *this * g;
+  this->m = (short)(this->m * g);
+  return *this;
+//  return *this = *this * g;
 }
 
 inline Fix32::~Fix32() {}
@@ -555,34 +575,50 @@
 }
 
 inline Fix32& Fix32::operator+=(const Fix32& f) 	
-{ 
-  return *this = *this + f;
+{
+  long sum = f.m + this->m;
+  if ( (f.m ^ sum) & (this->m ^ sum) & Fix32_msb )
+    this->overflow(sum);
+  return *this;
+//  return *this = *this + f;
 }
 
 inline Fix32& Fix32::operator-=(const Fix32& f) 	
-{ 
-  return *this = *this - f;
+{
+  long sum = this->m - f.m;
+  if ( (this->m ^ sum) & (-f.m ^ sum) & Fix32_msb )
+    this->overflow(sum);
+  return *this;
+//  return *this = *this - f;
 }
 
 inline Fix32& Fix32::operator*=(const Fix32& f) 	
-{ 
-  return *this = *this * f;
+{
+  Fix32 t = *this * f;
+  return *this = t;
+//  return *this = *this * f;
 }
 
 inline Fix32& Fix32::operator/=(const Fix32& f) 	
-{ 
-  return *this = *this / f;
+{
+  Fix32 t = *this / f;
+  return *this = t;
+//  return *this = *this / f;
 }
 
 
 inline Fix32& Fix32::operator<<=(int b)	
-{ 
-  return *this = *this << b;
+{
+  this->m <<= b;
+  return *this;
+//  return *this = *this << b;
 }
 
 inline Fix32& Fix32::operator>>=(int b)	
-{ 
-  return *this = *this >> b;
+{
+  this->m >>= b;
+  return *this;
+//  return *this = *this >> b;
 }
 
 inline int operator==(const Fix32& f, const Fix32& g)	
@@ -642,7 +678,9 @@
 
 inline Fix32& Fix32::operator*=(int g)
 {
-  return *this = *this * g;
+  Fix32 t = *this * g;
+  return *this = t;
+//  return *this = *this * g;
 }
 
 #endif
--- Integer.cc.orig	Wed May 11 01:54:08 1994
+++ Integer.cc	Fri Nov  4 14:07:55 1994
@@ -2255,7 +2255,11 @@
   return stream;
 }
 
+#ifdef VXWORKS
+int Integer::Ok() const
+#else
 int Integer::OK() const
+#endif
 {
   if (rep != 0)
     {
--- Integer.h.orig	Wed May 11 01:54:13 1994
+++ Integer.h	Fri Nov  4 14:07:56 1994
@@ -210,8 +210,12 @@
 // error detection
 
   int             initialized() const;
-  void   error(const char* msg) const;
-  int             OK() const;  
+  void   error(const char* msg)  const;
+#ifdef VXWORKS
+  int             Ok() const;
+#else
+  int             OK() const;
+#endif
 };
 
 
--- Obstack.cc.orig	Mon Mar 14 12:09:33 1994
+++ Obstack.cc	Fri Nov  4 14:07:56 1994
@@ -104,8 +104,12 @@
 
   return ch != 0;
 }
-         
+
+#ifdef VXWORKS
+int Obstack::Ok()
+#else
 int Obstack::OK()
+#endif
 {
   int v = chunksize > 0;        // valid size
   v &= alignmentmask != 0;      // and alignment
--- Obstack.h.orig	Fri Oct 16 16:37:27 1992
+++ Obstack.h	Fri Nov  4 14:07:56 1994
@@ -78,7 +78,11 @@
   void  free(void* obj);
   void  shrink(int size = 1); // suggested by ken@cs.rochester.edu
 
+#ifdef VXWORKS
+  int   Ok();                   // rep invariant
+#else
   int   OK();                   // rep invariant
+#endif
 };
 
 
--- Rational.cc.orig	Wed May 11 01:54:15 1994
+++ Rational.cc	Fri Nov  4 14:07:57 1994
@@ -389,9 +389,17 @@
   return s;
 }
 
+#ifdef VXWORKS
+int Rational::Ok() const
+#else
 int Rational::OK() const
+#endif
 {
+#ifdef VXWORKS
+  int v = num.Ok() && den.Ok(); // have valid num and denom
+#else
   int v = num.OK() && den.OK(); // have valid num and denom
+#endif
   if (v)
     {
       v &= sign(den) > 0;           // denominator positive;
--- Rational.h.orig	Wed May 11 01:54:17 1994
+++ Rational.h	Fri Nov  4 14:07:57 1994
@@ -116,7 +116,11 @@
 // error detection
 
   void    error(const char* msg) const;
+#ifdef VXWORKS
+  int              Ok() const;
+#else
   int              OK() const;
+#endif
 
 };
 
--- Regex.cc.orig	Tue Aug 16 13:51:06 1994
+++ Regex.cc	Fri Nov  4 14:07:58 1994
@@ -116,7 +116,11 @@
     return re_match_2(buf, 0, 0, (char*)s, len, p, reg, len);
 }
 
+#ifdef VXWORKS
+int Regex::Ok() const
+#else
 int Regex::OK() const
+#endif
 {
 // can't verify much, since we've lost the original string
   int v = buf != 0;             // have a regex buf
--- Regex.h.orig	Fri Apr 17 17:50:43 1992
+++ Regex.h	Fri Nov  4 14:07:58 1994
@@ -56,7 +56,11 @@
                             int& matchlen, int startpos = 0) const;
   int                match_info(int& start, int& length, int nth = 0) const;
 
+#ifdef VXWORKS
+  int                Ok() const;  // representation invariant
+#else
   int                OK() const;  // representation invariant
+#endif
 };
 
 // some built in regular expressions
--- SLList.cc.orig	Wed Aug 31 11:34:47 1994
+++ SLList.cc	Fri Nov  4 14:15:05 1994
@@ -227,7 +227,11 @@
   delete_node(t);
 }
 
+#ifdef VXWORKS
+int BaseSLList::Ok() const
+#else
 int BaseSLList::OK() const
+#endif
 {
   int v = 1;
   if (last != 0)
--- SLList.h.orig	Wed Aug 31 11:34:49 1994
+++ SLList.h	Fri Nov  4 14:14:46 1994
@@ -64,7 +64,11 @@
     void clear();
     Pix                   prepend(BaseSLNode*);
     Pix                   append(BaseSLNode*);
+#ifdef VXWORKS    
+    int                   Ok() const;
+#else
     int                   OK() const;
+#endif    
     void                  error(const char* msg) const;
     void                  del_after(Pix p);
     int                   owns(Pix p) const;
--- SmplStat.h.orig	Fri Apr 17 17:50:49 1992
+++ SmplStat.h	Fri Nov  4 14:07:59 1994
@@ -41,8 +41,13 @@
     double mean();
     double stdDev();
     double var();
+#ifdef VXWORKS
+    double Min();
+    double Max();
+#else
     double min();
     double max();
+#endif    
     double confidence(int p_percentage);
     double confidence(double p_value);
 
@@ -59,8 +64,13 @@
 
 inline SampleStatistic:: SampleStatistic(){ reset();}
 inline int SampleStatistic::  samples() {return(n);}
+#ifdef VXWORKS
+inline double SampleStatistic:: Min() {return(minValue);}
+inline double SampleStatistic:: Max() {return(maxValue);}
+#else
 inline double SampleStatistic:: min() {return(minValue);}
 inline double SampleStatistic:: max() {return(maxValue);}
+#endif
 inline SampleStatistic::~SampleStatistic() {}
 
 #endif
--- String.cc.orig	Wed Oct 12 15:20:55 1994
+++ String.cc	Fri Nov  4 14:07:59 1994
@@ -1280,7 +1280,11 @@
 }
 
 
+#ifdef VXWORKS
+int String::Ok() const
+#else
 int String::OK() const
+#endif
 {
   if (rep == 0             // don't have a rep
     || rep->len > rep->sz     // string oustide bounds
@@ -1289,10 +1293,18 @@
   return 1;
 }
 
+#ifdef VXWORKS
+int SubString::Ok() const
+#else
 int SubString::OK() const
+#endif
 {
-  int v = S != (const char*)0; // have a String;
+  int v = S != (const char*)0; // have a String
+#ifdef VXWORKS
+  v &= S.Ok();                 // that is legal;
+#else
   v &= S.OK();                 // that is legal
+#endif
   v &= pos + len >= S.rep->len;// pos and len within bounds
   if (!v) S.error("SubString invariant failure");
   return v;
--- String.h.orig	Wed Oct 12 15:20:52 1994
+++ String.h	Fri Nov  4 14:08:00 1994
@@ -99,7 +99,11 @@
   int               empty() const;
   const char*       chars() const;
 
-  int               OK() const; 
+#ifdef VXWORKS
+  int               Ok() const;
+#else
+  int               OK() const;
+#endif
 
 };
 
@@ -377,7 +381,11 @@
 
   void     error(const char* msg) const;
 
+#ifdef VXWORKS
+  int               Ok() const;
+#else
   int               OK() const;
+#endif
 };
 
 typedef String StrTmp; // for backward compatibility
--- timer.c.orig	Wed Oct 12 15:20:59 1994
+++ timer.c	Fri Nov  4 14:08:01 1994
@@ -30,6 +30,7 @@
 #if 1
 
 #include <_G_config.h>
+#ifndef VXWORKS
 #if _G_HAVE_SYS_RESOURCE
 #include <sys/time.h>
 #include <sys/resource.h>
@@ -48,6 +49,12 @@
 static struct rusage Old_Time;
 static struct rusage New_Time;
 #endif
+#else
+#include <vxWorks.h>
+#include <timers.h>
+static struct timespec Old_Time;
+static struct timespec New_Time;
+#endif /* VXWORKS */
 static int    Timer_Set = 0;
 
 double
@@ -57,6 +64,10 @@
 #ifdef USE_TIMES
    times(&Old_Time);
    return((double) Old_Time.tms_utime / HZ);
+#elif defined(VXWORKS)
+   clock_gettime(CLOCK_REALTIME,&Old_Time);
+   return((double)Old_Time.tv_sec +
+         ((double)Old_Time.tv_nsec / 1000000000.0));   
 #else
    getrusage(RUSAGE_SELF,&Old_Time);        /* set starting process time */
    return(Old_Time.ru_utime.tv_sec + (Old_Time.ru_utime.tv_usec / 1000000.0));
@@ -78,12 +89,18 @@
     /* get process time */
 #ifdef USE_TIMES
       times(&New_Time);
+#elif defined(VXWORKS)
+      clock_gettime(CLOCK_REALTIME,&Old_Time);      
 #else
       getrusage(RUSAGE_SELF,&New_Time);
 #endif
       if (Last_Time == 0.0) {
 #ifdef USE_TIMES
 	 return((double) (New_Time.tms_utime - Old_Time.tms_utime) / HZ);
+#elif defined(VXWORKS)
+        return((double)(New_Time.tv_sec - Old_Time.tv_sec) + 
+               ((double)(New_Time.tv_nsec - Old_Time.tv_nsec) 
+                / 1000000000.0));         
 #else
          return((New_Time.ru_utime.tv_sec - Old_Time.ru_utime.tv_sec) + 
                ((New_Time.ru_utime.tv_usec - Old_Time.ru_utime.tv_usec) 
@@ -93,6 +110,9 @@
       else {
 #ifdef USE_TIMES
 	 return((double) New_Time.tms_utime / HZ - Last_Time);
+#elif defined(VXWORKS)
+         return((double)(New_Time.tv_sec + 
+                ((double)New_Time.tv_nsec / 1000000000.0)) - Last_Time);         
 #else
          return((New_Time.ru_utime.tv_sec + 
                 (New_Time.ru_utime.tv_usec / 1000000.0)) - Last_Time);

