This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Bug report - part 2/2


Submitted-by: jjb@mercury.cs.wayne.edu
Archive-name: BugRpt/part02

---- Cut Here and feed the following to sh ----
#!/bin/sh
# This is part 02 of BugRpt.
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
  if test "$gettext_dir" = FAILED && test -f $dir/gettext \
     && ($dir/gettext --version >/dev/null 2>&1)
  then
    set `$dir/gettext --version 2>&1`
    if test "$3" = GNU
    then
      gettext_dir=$dir
    fi
  fi
  if test "$locale_dir" = FAILED && test -f $dir/shar \
     && ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
  then
    locale_dir=`$dir/shar --print-text-domain-dir`
  fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
  echo=echo
else
  TEXTDOMAINDIR=$locale_dir
  export TEXTDOMAINDIR
  TEXTDOMAIN=sharutils
  export TEXTDOMAIN
  echo="$gettext_dir/gettext -s"
fi
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
  shar_touch=touch
else
  shar_touch=:
  echo
  $echo 'WARNING: not restoring timestamps.  Consider getting and'
  $echo "installing GNU \`touch', distributed in GNU File Utilities..."
  echo
fi
rm -f 1231235999 $$.touch
#
if mkdir _sh12579; then
  $echo 'x -' 'creating lock directory'
else
  $echo 'failed to create lock directory'
  exit 1
fi
# ============= protopeptide.h ==============
if test -f 'protopeptide.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'protopeptide.h' '(file already exists)'
else
  $echo 'x -' extracting 'protopeptide.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'protopeptide.h' &&
#ifndef _PROTOPEPTIDE_H_
#define _PROTOPEPTIDE_H_
#include "peptidestring.h"
#include "fptr.h"
#include <ctype.h>
#include <assert.h>
X
/*
**  SCCSID = %W%   -=EVOLVE IV=-   %H%
**
**  Protopeptides are reference strings that allow us
**  to interpret the function of a protein, based on
**  its linear arrangement.  They're no different than
**  other PeptideStrings except in their use.
**
**  The iterator class makes it possible to hide the
**  implementation details of the critical section from
**  the string-matching routine.
*/
class Protopeptide : public PeptideString {
X  friend ostream& operator<<(ostream&, Protopeptide&);
X  static Protopeptide Library[];
X  static int functions[NStruct];  //translate "structural" proteins to functions
X  static char* description[];
X  friend class ProtopeptideIterator;
X public:
X  Protopeptide(){}
X  Protopeptide(Peptide* pep) : PeptideString(pep) {}
X  Protopeptide(Protopeptide& pr) : PeptideString((PeptideString&)pr) {}
X  ~Protopeptide() {
X    if(length)
X      delete[] pstring;
X  }
X  static int delta(char, char);
X  static void lookup(Peptide*, List<FunctionPtr*>&);
X  static int CanMove() {return functions[0];}
X  static int CanSenseLight() {return functions[1];}
X  static int CanSenseEnv1() {return functions[2];}
X  static int CanSenseEnv2() {return functions[3];}
X  static int CanSenseEnv3() {return functions[4];}
X  static int CanSenseEnv4() {return functions[5];}
X  static int CanConjugate() {return functions[6];}
X  static int CanSecreteSugar() {return functions[7];}
X  static int CanSecreteA() {return functions[8];}
X  static int CanSecreteB() {return functions[9];}
X  static int CanSecreteC() {return functions[10];}
X  static int ControlsSecretion(int fn) {
X    return (fn == functions[7] || fn == functions[8] || fn == functions[9] || functions[10]);
X  }
X  static int CanPickUp() {return functions[11];}
X  static int setFunction(int i, int v) {return functions[i]=v;}
X  static int getFunction(int i) {return functions[i];}
X  static char* getSFn(int f) {
X    for(int i=0; i<NStruct; i++) {
X      if(f == functions[i])
X	return description[i];
X    }
X    return "No function";
X  }
X
X  int match(Protopeptide* const);
X  int isNull() {return !length;}
X  static void readIn(char*);
};
X
class ProtopeptideIterator {
X  Protopeptide* which;
X  char* p; /* pointer into peptideString */
X  int criticalFlag;
X public:
X  ProtopeptideIterator(){which=NULL;}
X  ProtopeptideIterator(Protopeptide* const subject) : which(subject){
X    assert(which != NULL);
X    p = &(which->pstring[0]);
X  }
X  int criticalP() {return isupper(*p);}
X  char getCurrent() {return *p;}
X  /*
X   **  Get the i-th character
X   */
X  char getNext(int i=1) {
X    assert(i>=0);
X    
X    if(*p == '\0')
X      return ('\0');
X    for(;i>0;i--) {
X      if(*(++p) == '\0')
X	break;
X    }
X    return isupper(*p)?tolower(*p):*p;
X  }
X  char getPrev(int i=1) {
X    assert(i>=0);
X
X    if(*p=='\0')
X      return *p;
X    if(p==which->pstring)
X      return isupper(*p)?tolower(*p):*p;
X    for(;i>0;i--) {
X      if((--p)==which->pstring)
X	return isupper(*p)?tolower(*p):*p;
X    }
X    return isupper(*p)?tolower(*p):*p;
X  }
};
X
#endif
SHAR_EOF
  $shar_touch -am 0506230599 'protopeptide.h' &&
  chmod 0644 'protopeptide.h' ||
  $echo 'restore of' 'protopeptide.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo './protopeptide.h:' 'MD5 check failed'
165384bf7f48ff80f934c19f78680ff6  ./protopeptide.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'protopeptide.h'`"
    test 3130 -eq "$shar_count" ||
    $echo 'protopeptide.h:' 'original size' '3130,' 'current size' "$shar_count!"
  fi
fi
# ============= sys/ddi.h ==============
if test ! -d 'sys'; then
  $echo 'x -' 'creating directory' 'sys'
  mkdir 'sys'
fi
if test -f 'sys/ddi.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'sys/ddi.h' '(file already exists)'
else
  $echo 'x -' extracting 'sys/ddi.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'sys/ddi.h' &&
/*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
/*	  All Rights Reserved  	*/
X
/*	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T	*/
/*	The copyright notice above does not evidence any   	*/
/*	actual or intended publication of such source code.	*/
X
/*
X * Copyright (c) 1996 Sun Microsystems, Inc.
X * All Rights Reserved.
X */
X
#ifndef _SYS_DDI_H
#define	_SYS_DDI_H
X
#pragma ident	"@(#)ddi.h	1.29	96/09/24 SMI"	/* SVr4.0 1.19	*/
X
#include <sys/types.h>
#include <sys/map.h>
#include <sys/buf.h>
#include <sys/uio.h>
#include <sys/stream.h>
X
#ifdef	__cplusplus
extern "C" {
#endif
X
/*
X * ddi.h -- the flag and function definitions needed by DDI-conforming
X * drivers.  This header file contains #undefs to undefine macros that
X * drivers would otherwise pick up in order that function definitions
X * may be used. Programmers should place the include of "sys/ddi.h"
X * after any header files that define the macros #undef'ed or the code
X * may compile incorrectly.
X */
X
/*
X * define min() and max() as macros so that drivers will not pick up the
X * min() and max() kernel functions since they do unsigned comparison only.
X */
#ifdef	min
#undef	min
#endif	/* min */
#define	min(a, b)	((a) < (b) ? (a) : (b))
X
#ifdef	max
#undef	max
#endif	/* max */
#define	max(a, b)	((a) < (b) ? (b) : (a))
X
#define	TIME	1
#define	UPROCP	2
#define	PPGRP	3
#define	LBOLT	4
#define	SYSRINT	5
#define	SYSXINT	6
#define	SYSMINT	7
#define	SYSRAWC	8
#define	SYSCANC	9
#define	SYSOUTC	10
#define	PPID	11
#define	PSID	12
#define	UCRED	13
X
#ifdef __STDC__
extern int drv_getparm(uint_t, void *);
extern int drv_setparm(uint_t, ulong_t);
extern void drv_usecwait(clock_t);
extern clock_t drv_hztousec(clock_t);
extern clock_t drv_usectohz(clock_t);
extern void delay(clock_t);
extern void time_to_wait(clock_t *, clock_t);
X
#else
X
extern int drv_getparm();
extern int drv_setparm();
extern void drv_usecwait();
extern clock_t drv_hztousec();
extern clock_t drv_usectohz();
extern void delay();
extern time_to_wait();
#endif	/* __STDC__ */
X
/* XXX -- should be changed to major_t */
/* convert external to internal major number */
X
#ifdef __STDC__
extern int etoimajor(major_t);
/* convert internal to extern major number */
extern int itoemajor(major_t, int);
X
#else
X
extern int etoimajor();
/* convert internal to extern major number */
extern int itoemajor();
#endif	/* __STDC__ */
X
#if defined(__STDC__)
X
extern int drv_priv(struct cred *);
X
#else
X
extern int drv_priv();
X
#endif
X
/*
X * The following declarations take the place of macros in
X * sysmacros.h The undefs are for any case where a driver includes
X * sysmacros.h, even though DDI conforming drivers must not.
X */
#undef getemajor
#undef geteminor
#undef getmajor
#undef getminor
#undef makedevice
#undef cmpdev
#undef expdev
X
X
#ifdef __STDC__
extern major_t getemajor(dev_t);
extern minor_t geteminor(dev_t);
extern major_t getmajor(dev_t);
extern minor_t getminor(dev_t);
extern dev_t makedevice(major_t, minor_t);
extern o_dev_t cmpdev(dev_t);
extern dev_t expdev(dev_t);
#else
extern major_t getemajor();
extern minor_t geteminor();
extern major_t getmajor();
extern minor_t getminor();
extern dev_t makedevice();
extern o_dev_t cmpdev();
extern dev_t expdev();
#endif	/* __STDC__ */
X
/*
X * The following macros from param.h are also being converted to
X * functions and #undefs must be done here as well since param.h
X * will be included by most if not every driver
X */
X
#undef btop
#undef btopr
#undef ptob
X
X
#ifdef __STDC__
extern unsigned long btop(unsigned long);
extern unsigned long btopr(unsigned long);
extern unsigned long ptob(unsigned long);
#else
extern unsigned long btop();
extern unsigned long btopr();
extern unsigned long ptob();
#endif	/* __STDC__ */
X
X
/* STREAMS drivers and modules must include stream.h to pick up the */
/* needed structure and flag definitions. As was the case with map.h, */
/* macros used by both the kernel and drivers in times past now have */
/* a macro definition for the kernel and a function definition for */
/* drivers. The following #undefs allow drivers to include stream.h */
/* but call the functions rather than macros. */
X
#undef OTHERQ
#undef RD
#undef WR
#undef SAMESTR
#undef datamsg
#undef splstr
X
X
#ifdef __STDC__
extern struct queue *OTHERQ(queue_t *);	/* stream.h */
extern struct queue *RD(queue_t *);
extern struct queue *WR(queue_t *);
extern int SAMESTR(queue_t *);
extern int datamsg(unsigned char);
extern int splstr(void);
X
#else
X
extern struct queue *OTHERQ();	/* stream.h */
extern struct queue *RD();
extern struct queue *WR();
extern int SAMESTR();
extern int datamsg();
extern int splstr();
#endif	/* __STDC__ */
X
/* declarations of functions for allocating and deallocating the space */
/* for a buffer header (just a header, not the associated buffer) */
X
#ifdef __STDC__
extern struct buf *getrbuf(int);
extern void freerbuf(struct buf *);
#else
extern struct buf *getrbuf();
extern void freerbuf();
#endif	/* __STDC__ */
X
#ifdef	_KERNEL
/*
X * SVR4MP replacement for hat_getkpfnum()
X */
#define	NOPAGE	(-1)	/* value returned for invalid addresses */
X
typedef u_int	ppid_t;	/* a 'physical page identifier' - no math allowed! */
X
#ifdef	__STDC__
extern ppid_t kvtoppid(caddr_t);
#else	/* __STDC__ */
extern ppid_t kvtoppid();
#endif	/* __STDC__ */
X
#endif	/* _KERNEL */
X
#ifdef	__cplusplus
}
#endif
X
#endif	/* _SYS_DDI_H */
SHAR_EOF
  $shar_touch -am 0506230599 'sys/ddi.h' &&
  chmod 0644 'sys/ddi.h' ||
  $echo 'restore of' 'sys/ddi.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo './sys/ddi.h:' 'MD5 check failed'
76c63bc907089ab7fd4a2f42dae5071a  ./sys/ddi.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'sys/ddi.h'`"
    test 5345 -eq "$shar_count" ||
    $echo 'sys/ddi.h:' 'original size' '5345,' 'current size' "$shar_count!"
  fi
fi
# ============= sys/ddi.h ==============
if test -f 'sys/ddi.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'sys/ddi.h' '(file already exists)'
else
  $echo 'x -' extracting 'sys/ddi.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'sys/ddi.h' &&
/*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
/*	  All Rights Reserved  	*/
X
/*	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T	*/
/*	The copyright notice above does not evidence any   	*/
/*	actual or intended publication of such source code.	*/
X
/*
X * Copyright (c) 1996 Sun Microsystems, Inc.
X * All Rights Reserved.
X */
X
#ifndef _SYS_DDI_H
#define	_SYS_DDI_H
X
#pragma ident	"@(#)ddi.h	1.29	96/09/24 SMI"	/* SVr4.0 1.19	*/
X
#include <sys/types.h>
#include <sys/map.h>
#include <sys/buf.h>
#include <sys/uio.h>
#include <sys/stream.h>
X
#ifdef	__cplusplus
extern "C" {
#endif
X
/*
X * ddi.h -- the flag and function definitions needed by DDI-conforming
X * drivers.  This header file contains #undefs to undefine macros that
X * drivers would otherwise pick up in order that function definitions
X * may be used. Programmers should place the include of "sys/ddi.h"
X * after any header files that define the macros #undef'ed or the code
X * may compile incorrectly.
X */
X
/*
X * define min() and max() as macros so that drivers will not pick up the
X * min() and max() kernel functions since they do unsigned comparison only.
X */
#ifdef	min
#undef	min
#endif	/* min */
#define	min(a, b)	((a) < (b) ? (a) : (b))
X
#ifdef	max
#undef	max
#endif	/* max */
#define	max(a, b)	((a) < (b) ? (b) : (a))
X
#define	TIME	1
#define	UPROCP	2
#define	PPGRP	3
#define	LBOLT	4
#define	SYSRINT	5
#define	SYSXINT	6
#define	SYSMINT	7
#define	SYSRAWC	8
#define	SYSCANC	9
#define	SYSOUTC	10
#define	PPID	11
#define	PSID	12
#define	UCRED	13
X
#ifdef __STDC__
extern int drv_getparm(uint_t, void *);
extern int drv_setparm(uint_t, ulong_t);
extern void drv_usecwait(clock_t);
extern clock_t drv_hztousec(clock_t);
extern clock_t drv_usectohz(clock_t);
extern void delay(clock_t);
extern void time_to_wait(clock_t *, clock_t);
X
#else
X
extern int drv_getparm();
extern int drv_setparm();
extern void drv_usecwait();
extern clock_t drv_hztousec();
extern clock_t drv_usectohz();
extern void delay();
extern time_to_wait();
#endif	/* __STDC__ */
X
/* XXX -- should be changed to major_t */
/* convert external to internal major number */
X
#ifdef __STDC__
extern int etoimajor(major_t);
/* convert internal to extern major number */
extern int itoemajor(major_t, int);
X
#else
X
extern int etoimajor();
/* convert internal to extern major number */
extern int itoemajor();
#endif	/* __STDC__ */
X
#if defined(__STDC__)
X
extern int drv_priv(struct cred *);
X
#else
X
extern int drv_priv();
X
#endif
X
/*
X * The following declarations take the place of macros in
X * sysmacros.h The undefs are for any case where a driver includes
X * sysmacros.h, even though DDI conforming drivers must not.
X */
#undef getemajor
#undef geteminor
#undef getmajor
#undef getminor
#undef makedevice
#undef cmpdev
#undef expdev
X
X
#ifdef __STDC__
extern major_t getemajor(dev_t);
extern minor_t geteminor(dev_t);
extern major_t getmajor(dev_t);
extern minor_t getminor(dev_t);
extern dev_t makedevice(major_t, minor_t);
extern o_dev_t cmpdev(dev_t);
extern dev_t expdev(dev_t);
#else
extern major_t getemajor();
extern minor_t geteminor();
extern major_t getmajor();
extern minor_t getminor();
extern dev_t makedevice();
extern o_dev_t cmpdev();
extern dev_t expdev();
#endif	/* __STDC__ */
X
/*
X * The following macros from param.h are also being converted to
X * functions and #undefs must be done here as well since param.h
X * will be included by most if not every driver
X */
X
#undef btop
#undef btopr
#undef ptob
X
X
#ifdef __STDC__
extern unsigned long btop(unsigned long);
extern unsigned long btopr(unsigned long);
extern unsigned long ptob(unsigned long);
#else
extern unsigned long btop();
extern unsigned long btopr();
extern unsigned long ptob();
#endif	/* __STDC__ */
X
X
/* STREAMS drivers and modules must include stream.h to pick up the */
/* needed structure and flag definitions. As was the case with map.h, */
/* macros used by both the kernel and drivers in times past now have */
/* a macro definition for the kernel and a function definition for */
/* drivers. The following #undefs allow drivers to include stream.h */
/* but call the functions rather than macros. */
X
#undef OTHERQ
#undef RD
#undef WR
#undef SAMESTR
#undef datamsg
#undef splstr
X
X
#ifdef __STDC__
extern struct queue *OTHERQ(queue_t *);	/* stream.h */
extern struct queue *RD(queue_t *);
extern struct queue *WR(queue_t *);
extern int SAMESTR(queue_t *);
extern int datamsg(unsigned char);
extern int splstr(void);
X
#else
X
extern struct queue *OTHERQ();	/* stream.h */
extern struct queue *RD();
extern struct queue *WR();
extern int SAMESTR();
extern int datamsg();
extern int splstr();
#endif	/* __STDC__ */
X
/* declarations of functions for allocating and deallocating the space */
/* for a buffer header (just a header, not the associated buffer) */
X
#ifdef __STDC__
extern struct buf *getrbuf(int);
extern void freerbuf(struct buf *);
#else
extern struct buf *getrbuf();
extern void freerbuf();
#endif	/* __STDC__ */
X
#ifdef	_KERNEL
/*
X * SVR4MP replacement for hat_getkpfnum()
X */
#define	NOPAGE	(-1)	/* value returned for invalid addresses */
X
typedef u_int	ppid_t;	/* a 'physical page identifier' - no math allowed! */
X
#ifdef	__STDC__
extern ppid_t kvtoppid(caddr_t);
#else	/* __STDC__ */
extern ppid_t kvtoppid();
#endif	/* __STDC__ */
X
#endif	/* _KERNEL */
X
#ifdef	__cplusplus
}
#endif
X
#endif	/* _SYS_DDI_H */
SHAR_EOF
  $shar_touch -am 0506230599 'sys/ddi.h' &&
  chmod 0644 'sys/ddi.h' ||
  $echo 'restore of' 'sys/ddi.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo './sys/ddi.h:' 'MD5 check failed'
76c63bc907089ab7fd4a2f42dae5071a  ./sys/ddi.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'sys/ddi.h'`"
    test 5345 -eq "$shar_count" ||
    $echo 'sys/ddi.h:' 'original size' '5345,' 'current size' "$shar_count!"
  fi
fi
# ============= mylist.h ==============
if test -f 'mylist.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'mylist.h' '(file already exists)'
else
  $echo 'x -' extracting 'mylist.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'mylist.h' &&
#ifndef _MYLIST_H_
#define _MYLIST_H_
#include "defs.h"
#include "Pix.h"
#include <iostream.h>
#include <fstream.h>
//extern ofstream& cerr;
X
class BaseNode {
X public:
X  BaseNode* fd;
X  BaseNode() {fd = 0;}
X  Pix getNext() {return fd;}
};
class BaseList {
X public:
//  friend template<class T> class List;
X  BaseNode* listHead;
X  BaseList() {listHead = (BaseNode*)0;}
X  virtual ~BaseList() { }
X  void clear() {
X    BaseNode* q,*p = listHead;
X    while(p) {
X      q=(BaseNode*)getNext(p);
X      delete p;
X      p=q;
X    }
X    listHead=0;
X  }
X  void prepend(Pix);
X  void append(Pix);
X  BaseNode* remove(Pix);
X  Pix getLast();
X  Pix removeLast(){return remove(getLast());}
X  Pix getFirst() {return (Pix)listHead;}
X  Pix removeFirst() {return remove(getFirst());}
X  Pix getNth(int);
X  Pix getSome();
X  Pix removeNth(int i) {return remove(getNth(i));}
X  Pix getNext(Pix p){return ((BaseNode*)p)->fd;}
X  int length();
X  empty(){return listHead==0;}
};
template<class T>
class Node : public BaseNode {
X public:
X  T datum;
X  Node() {};
X  Node(T d, Node* n = 0) : datum(d) {fd = n;}
X  T operator()() {return datum;}
X  Node(Node<T>& nr) {
X    datum = nr.datum;
X    fd = 0;
X  }
};
template<class T>
class List : public BaseList {
X  friend ostream& operator<<(ostream&, List<T>&);
X public:
X  Pix find(T t) {
X    Node<T>* ptr = (Node<T>*)listHead;
X    while(ptr && (ptr->datum != t)) {
X      ptr = (Node<T>*)ptr->fd;
X    }
X    if(!ptr)
X      cerr<<"Find failed to find " <<t<<endl;
X    return (Pix)ptr;
X  }
X  List() {}
X  List(List&);
X  virtual ~List(){ 
//    cout<<"<LX>";
X    clear();
X  }
X  void prepend(T d) {
X  BaseList::prepend((Pix)new Node<T>(d));
X  }
X  void append(T d) {
X  BaseList::append((Pix) new Node<T>(d));
X  }
X  BaseNode* remove(T t) {
X    return BaseList::remove(find(t));
X  }
X  T operator()(Pix p) {
X    if(p)
X      return ((Node<T>*)p)->datum;
X    else {
X      cerr << "List::operator() Null Pix" << endl;
X      exit;
X    }
X  }
X  T getRand() {
X    Pix p = getSome();
X    return (*this)(p);
X  }
X  void concat(List<T>&);
X  void merge(List<T>& lr) {
X  BaseList::append(lr.listHead);
X    lr.listHead = 0;
X  }
X  
};
X
template <class T>
ostream& operator<<(ostream& os, List<T>& lr) {
X
X  Node<T>* ptr;
X  ptr = (Node<T>*)lr.getFirst();
X  while(ptr) {
X    cerr << ptr->datum << " ";
X    ptr = (Node<T>*)ptr->fd;
X  }
X  return cerr << endl;
}/**/
template <class T>
List<T>::List(List<T>& lr) {
X  if(lr.listHead == 0) {
X    listHead = 0;
X    return;
X  }
X  Node<T>* ptr = (Node<T>*)lr.getFirst();
X  Node<T>* n = new Node<T> (ptr->datum);
X  listHead = (BaseNode*)n;
X  ptr = (Node<T>*)(ptr->fd);
X  while(ptr) {
X    n->fd = new Node<T>(ptr->datum);
X    n = (Node<T>*) n->fd;
X    ptr = (Node<T>*)(ptr->fd);
X  }
}
template<class T>
void List<T>::concat(List<T>& lr) {
X  if (lr.listHead == 0)
X    return;
X  Pix ptr = lr.getFirst();
X  while(ptr) {
X    append(lr.ptr);
X    ptr = lr.getNext(ptr);
X  }
}
X
X    
#endif
SHAR_EOF
  $shar_touch -am 0506231099 'mylist.h' &&
  chmod 0444 'mylist.h' ||
  $echo 'restore of' 'mylist.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo './mylist.h:' 'MD5 check failed'
952a0db0b4cfeffd0ad3bf0693275cb9  ./mylist.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'mylist.h'`"
    test 2902 -eq "$shar_count" ||
    $echo 'mylist.h:' 'original size' '2902,' 'current size' "$shar_count!"
  fi
fi
# ============= chemgen.h ==============
if test -f 'chemgen.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'chemgen.h' '(file already exists)'
else
  $echo 'x -' extracting 'chemgen.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'chemgen.h' &&
#ifndef _CHEMGEN_H_
#define _CHEMGEN_H_
#define GeneFile "genes.txt"
#define MatlFile "matls.txt"
#define ProteinFile "proteins.txt"
/*
**  Gene strings are drawn from [a-u], with a
**  length GLEN +- GLENTOL,
**  having GCRIT critical sections, +- GCRITTOL
**  of at most length CGLEN.
**  We will define a total of NGene such strings
*/
X
#define GLEN 100
#define GTOL 20
#define GCRIT 3
#define GCRITTOL 2
#define GCLEN 10
#define START 's'
#define STOP 'u'
#define Galphabet "abcdefghijklmnopqrst"
/*
**  That's twenty amino acids plus the stop codon
*/
X
X
X
#endif //_CHEMGEN_H_
X
SHAR_EOF
  $shar_touch -am 0506230599 'chemgen.h' &&
  chmod 0444 'chemgen.h' ||
  $echo 'restore of' 'chemgen.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo './chemgen.h:' 'MD5 check failed'
980e212bd7f16e641cf4883434615043  ./chemgen.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'chemgen.h'`"
    test 582 -eq "$shar_count" ||
    $echo 'chemgen.h:' 'original size' '582,' 'current size' "$shar_count!"
  fi
fi
# ============= chromosome.C ==============
if test -f 'chromosome.C' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'chromosome.C' '(file already exists)'
else
  $echo 'x -' extracting 'chromosome.C' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'chromosome.C' &&
static char SCCSID[] = "%W%   -=EVOLVE IV=-   %H%";
#include "chromosome.h"
#include "fptr.h"
#include "macro.h"
#include <stdlib.h>
#include "protopeptide.h"
#include <strstream.h>
#include <string.h>
X
extern int Sugars[NStorage];
extern ReactionTable RTable;
const int Chromosome::RegLen=RSL;
const int Chromosome::IntegerLen = 6;
const int Chromosome::DecimalLen = 2;
const char Chromosome::PAD='0';
X
int isSugar(int c) {
X  for(int i=0; i<NStorage; i++) {
X    if(Sugars[i] == c) {
X      return 1;
X    }
X  }
X  return 0;
}  
void Chromosome::ftos(float in, char* workspace, int len) {
X
X  if(in>9999999 || (in<.01 && in!=0))
X    cerr << "ftos(): representational bounds exceeded: " << in << endl;
X  char integer[Chromosome::RegLen+2], decimal[Chromosome::RegLen+2];
X  for(int i=0; i<Chromosome::RegLen+2; i++)
X    integer[i] = decimal[i] = '0';
X  for(int i=0; i<len; i++)
X     workspace[i]=Chromosome::PAD;
X  ostrstream integerStream (integer, Chromosome::RegLen+1);
X  ostrstream decimalStream (decimal, Chromosome::RegLen+1);
X  integerStream << int(in) << ends;
X  decimalStream << remainder(in) << ends;
//  cout << "(" << integer << " : " << decimal << ") ";
X  int iPad = Chromosome::IntegerLen - strlen(integer);
X  strcpy(workspace+iPad, integer);
X  strncat(workspace+Chromosome::IntegerLen, decimal+2, Chromosome::DecimalLen);
X  for(int i=strlen(workspace); i<len; i++)
X    workspace[i] = '0';
X  for(int i=0; i<Chromosome::RegLen; i++)
X     workspace[i] += ('a'-'0');
}
/*
** Input string is null-terminated
*/
float  Chromosome::stof(char* in, int len) {
X  if(len>Chromosome::RegLen)
X    warn("stof(): input string too long. Truncating");
X  char temp[Chromosome::RegLen+2];
X  for(int i=0; i<Chromosome::IntegerLen; i++)
X    temp[i]=in[i];
X  for(int i=Chromosome::IntegerLen; i<Chromosome::RegLen; i++)
X     temp[i+1]=in[i];
X  temp[Chromosome::RegLen+1] = '\0';
X  for(int i=0; i<Chromosome::RegLen+1; i++)
X     temp[i] += ('0'-'a');
X  temp[Chromosome::IntegerLen] = '.';
X  return atof(temp);
}
/*
**  This constructor is used to create the initial
**  chromosome.  It needs to set up initial values for
**  enzyme end product inhibition (EPI) as well as creating the 
**  chromosome itself.
*/
Chromosome::Chromosome(Peptide* pp) : PeptideString(pp), Material(pp) {
X  int np = geneCount();
X  Peptide* geneBuffer;
X  Peptide* peptidePtr = pstring;
X  Peptide* tmpPtr = pstring;
//  Vector<Material_t> epi = *new Vector<Material_t>(np);
X  List<FunctionPtr*> functionList;
X  float epiValue;
X  int cat,product;
X  char epiBuf[RegLen + 1];
/*
**  For each gene
**   -copy the gene to a buffer
**   -look up gene function
**   -find enzyme product
**   -if not enzyme, set default EPI value
**   -if enzyme, set EPI to N * product level
**    in chromosome.  (N = 2)
**   -write EPI value into regulation section
*/  
X  while(*peptidePtr) {
X    nextGene(&peptidePtr);
X    int geneLength = peptidePtr - tmpPtr;
X    geneBuffer = new char[geneLength + 1];
X    strncpy(geneBuffer, tmpPtr, geneLength);
X    geneBuffer[geneLength] = '\0';
X    Protopeptide::lookup(geneBuffer, functionList);
X    if(functionList.getFirst()) {
X      cat = functionList(functionList.getFirst())->getIndex();
X      product = RTable.findProduct(cat);
/*
** Product -2 is a non-catalyst
**
** old levels were 100 for digestion and 400 for synthesis.
*/
X      if(product == -2) {  /* Not an enzyme */
X	if(Protopeptide::ControlsSecretion(cat))
X	  epiValue = DefaultSecretionLevel;
X	else
X	  epiValue = DefaultEPILevel;
X      }
X      else { /* It's an enzyme */
X	if(isSugar(abs(product))) {
X	  if(cat < 0){
X	    epiValue = 100;
X	  }
X	  else
X	    epiValue = 400;
X	}
X	else {  /* It's an enzyme, but not sugar-associated */
X	  if(product >= 0)  /* synthesis */
X	    epiValue = float(((Chromosome&) *this)[product] * (2+SetPtFunctional));
X	  else   /* decomposition */
X	    epiValue = float(((Chromosome&) *this)[-product] * 2.1);
X	  if(epiValue == 0) // catalyst for other than amino acid
X	    epiValue = DefaultEPILevel;
X	}
X      }
X    } /* end of if(functionList.getFirst()... functional gene */
X    else
X      epiValue = 0;
X    ftos(epiValue, epiBuf, RegLen);
X    strncpy(tmpPtr, epiBuf, RegLen);
X    tmpPtr = peptidePtr;
X    if(geneBuffer[RegLen] != START) {
X      cerr << "Initial chromosome is corrupt.\nGiving up." << endl;
X      abort();
X    } 
X    delete[] geneBuffer;
X  } /* end of while(*peptidePtr)  */
}
/*
** It is essential that the number of returns from
** getGene() agree with the value returned by
** PeptideString::geneCount().  Otherwise, the
** vector, Organism.protein, won't have the right
** length.  geneCount() returns the number of
** of START codons that follow a STOP codon, plus
** the initial START codon.  That is the same as the
** number of genes bounded by both START and STOP 
** codons plus, potentially, the string bounded by
** a START codon and the string's terminating null.
**
** PeptideString::nextGene() just advances the
** pointer to the first character in the next
** gene, or to the terminating null character.
** getGene()'s algorithm needs to check for a
** START codon in nextGene()'s return and prune
** the head of the string back to RegLen chars before
** the START codon.  If there is no START, we skip
** to the next return from nextGene().
**
*/
Peptide*
Chromosome::getGene(Peptide** mem) {
X  if(! *mem)     /* Starting with a NULL pointer begins at start */
X    *mem = pstring;
X  Peptide* startPtr = *mem;
X  Peptide* endPtr;
X  Peptide* EPIStart = startPtr;
X  int geneLength;
X  Peptide* geneBuffer;
/*
** keep at this until we find either a START codon
** (and nextGene() has found the STOP) or the terminating NULL.  
*/
X  do {
X    nextGene(mem);  /* advance past STOP or to NULL */
X    endPtr = *mem;
/*
** search current gene from start to new end
** startPtr will either point to a START codon, or to 
** the thing pointed at by endPtr: the first codon of
** the next gene or to a NULL.
*/
X    while((*startPtr != START) && (startPtr < endPtr))
X      startPtr++;
X    switch(*startPtr) {
X    case START: 
X      EPIStart = ((startPtr-EPIStart) > RegLen)? (startPtr-RegLen): EPIStart;
X      geneLength = endPtr - EPIStart;
X      geneBuffer = new Peptide[geneLength + 1];
X      strncpy(geneBuffer, EPIStart, geneLength);
X      geneBuffer[geneLength] = '\0';
X      return geneBuffer;
X      break;
X    case STOP: /* double (or more) STOP.  Keep trying */
X      break;
X    case NULL: /* no START before end of peptide string */
X      return NULL;
X      break;
X    default: /* no START; try next gene */
X             /* what do you call a gene with no START */
X      break;
X    } /* end of switch */
X  } while(1);
}
X
X
X
SHAR_EOF
  $shar_touch -am 0506230799 'chromosome.C' &&
  chmod 0644 'chromosome.C' ||
  $echo 'restore of' 'chromosome.C' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo './chromosome.C:' 'MD5 check failed'
8a39cff5374870aabebe3bffa9a9cb51  ./chromosome.C
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'chromosome.C'`"
    test 6633 -eq "$shar_count" ||
    $echo 'chromosome.C:' 'original size' '6633,' 'current size' "$shar_count!"
  fi
fi
# ============= peptidestring.h ==============
if test -f 'peptidestring.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'peptidestring.h' '(file already exists)'
else
  $echo 'x -' extracting 'peptidestring.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'peptidestring.h' &&
#ifndef _PEPTIDE_STRING_
#define _PEPTIDE_STRING_
#include "defs.h"
#include <iostream.h>
#include <assert.h>
/*
**   SCCSID = %W%   -=EVOLVE IV=-   %H%
**
**  Peptide strings are represented by character strings
**
*/
X
class PeptideString {
X  friend ostream& operator<<(ostream&, const PeptideString&);
X  friend class PSIterator;
X  void randomInsertion(char* = defaultAlphabet);
X  void randomDeletion();
X protected:
X  int length;
X  Peptide* pstring;
X public:
X  PeptideString() {
X    pstring=0;
X    length = 0;
X  }
X  PeptideString(Peptide* p) {
X    length = strlen(p);
X    pstring = new Peptide[length+1];
X    strcpy(pstring, p);
X  }
X  PeptideString(PeptideString& pr) {
X    length = pr.length;
X    pstring = new Peptide[length+1];
X    strcpy(pstring, pr.pstring);
X  }
X  PeptideString(PeptideString* ps) {
X    length = ps->length;
X    pstring = new Peptide[length+1];
X    strcpy(pstring, ps->pstring);
X  }
X  PeptideString(int, char* = defaultAlphabet);
X  ~PeptideString() {
X    if(length)
X      delete[] pstring;
X  }
X  PeptideString* subString(int, int=0) const;
/*
** Hamming distance, insDel, alphabet
*/
X  void mutate(const int=1, const double = MUTRATE, const char* = defaultAlphabet);
X  PeptideString* insert(PeptideString*, int=-1);
X  void insertChar(int, char);
X  int countChar(char);
X  void replaceChar(int i, char c){pstring[i] = c;}
X  void upCase(int, int);
X  int geneCount() const;
X  Peptide getNext(Peptide** p) const {
X    if(! *p)
X      *p = pstring;
X    if(! **p)
X      return **p;
X    return *((*p)++);
X  }
X  Peptide* skipGene(Peptide*, int = 1);
X  void replaceGene(Peptide*, Peptide*, PeptideString*);
X  void prependGene(PeptideString*);
X  PeptideString* getFrag(int start, int len) {return subString(start, len);}
X  void nextGene(Peptide**);
X  PeptideString& split(int=0);
X  int plen() const {return length;}
X  Peptide& operator[](int i) {
X    assert(i>-1 && i<length);
X    return pstring[i];
X  }
};
X
char rChar(const char* = defaultAlphabet);
X
#endif
SHAR_EOF
  $shar_touch -am 0506230599 'peptidestring.h' &&
  chmod 0644 'peptidestring.h' ||
  $echo 'restore of' 'peptidestring.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo './peptidestring.h:' 'MD5 check failed'
7349c7f2f8df55d349e91c8e08d07b53  ./peptidestring.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'peptidestring.h'`"
    test 1970 -eq "$shar_count" ||
    $echo 'peptidestring.h:' 'original size' '1970,' 'current size' "$shar_count!"
  fi
fi
# ============= material.h ==============
if test -f 'material.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'material.h' '(file already exists)'
else
  $echo 'x -' extracting 'material.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'material.h' &&
/*
X *  SCCSID = @(#)material.h	3.3   -=EVOLVE IV=-   05/05/99
X */
#ifndef MATERIAL_H
#define MATERIAL_H
#include "defs.h"
#include "vector.h"
#include <fstream.h>
#include <iostream.h>
#include <assert.h>
X
class EnVar;
//class Organism;
class PeptideString;
X
extern ofstream& ofile;
X
class Material : public Vector<Material_t> {
X  friend ostream& operator<< (ostream&, const Material&);
X  static int atwt[NMat];
X public:
X  Material(Material_t x=0): Vector<Material_t>(NMat+1) {
X    for(int i=0; i<NMat+1; i++)
X      (*this)[i] = x;
X  }
X  Material(Material& mr) : Vector<Material_t>((Vector<Material_t>&) mr){
//    ofile << "Material (copy): " << *this << endl;
X  }
X  Material(Material_t amt[NMat+1]):Vector<Material_t>(NMat+1, amt) {
//    ofile << "Material (vector): " << amt << endl;
X  }
X  Material(const Peptide*);
X  Material(const PeptideString*);
X  Material(const Vector<Material_t>& mr) : Vector<Material_t>(mr) {
//    cout << "Material constructor--vector class" << endl;
X    assert(mr.getSize() == NMat+1);
X  }
// Here endeth the constructors
/*
**  Operators
*/
X  Material operator=(const Material_t x) {
X    for(int i=0; i<(NMat+1); i++){
X      (*this)[i] = x;
X    }
X  }
X  Material operator+(const Material& mr) const {
X    Material retval;
X    for(int i=0; i<(NMat+1); i++)
X      retval[i] = (*this)[i] + mr[i];
X    return retval;
X  }
X  Material operator-(const Material& mr) const {
X    Material retval;
X    for(int i=0; i<(NMat+1); i++)
X      retval[i] = (*this)[i] - mr[i];
X    return retval;
X  }
X  Material operator*(const Material_t factor) const {
X    Material retval;
X    for(int i=0; i< (NMat+1); i++)
X      retval[i] = (*this)[i] * factor;
X    return retval;
X  }
X  Material operator*(const double factor) const {
X    Material retval;
X    for(int i=0; i< (NMat+1); i++)
X      retval[i] = (Material_t)((*this)[i] * factor);
X    return retval;
X  }
X      
X  Material operator/(const Material_t divisor) const {
X    assert(divisor != 0);
X    Material retval;
X    for(int i=0; i< (NMat+1); i++)
X      retval[i] = (*this)[i] / divisor;
X    return retval;
X  }
X  Material& operator+=(const Material& vr) {
X    for(int i=0; i<(NMat+1); i++)
X      (*this)[i] += vr[i];
X    return *this;
X  }
X  Material& operator-=(const Material& vr) {
X    for(int i=0; i<(NMat+1); i++)
X      (*this)[i] -= vr[i];
X    return *this;
X  }
X  Material& operator*=(const Material_t mult) {
X    for(int i=0; i< (NMat+1); i++)
X      (*this)[i] *= mult;
X    return *this;
X  }
X  Material& operator*=(const float mult) {
X    for(int i=0; i< (NMat+1); i++)
X      (*this)[i] = (Material_t) ((*this)[i] * mult);
X    return *this;
X  }
X  Material& operator/=(const Material_t divisor) {
X    for(int i=0; i< (NMat+1); i++)
X      (*this)[i] /= divisor;
X    return *this;
X  }
/*
**  Relational operators
*/
X  int operator==(const Material& vr) const {
X    for(int i=0; i<(NMat+1); i++)
X      if((*this)[i] != vr[i])
X	return 0;
X    return 1;
X  }
X
X  int operator<(const Material& vr) const {
X    for(int i=0; i<(NMat+1); i++)
X      if((*this)[i] >= vr[i])
X	return 0;
X    return 1;
X  }
X  int operator>(const Material& vr) const {
X    for(int i=0; i<(NMat+1); i++)
X      if((*this)[i] <= vr[i]) {
X	return 0;
X      }
X    return 1;
X  }
X  int operator<=(const Material& vr) const {
X    for(int i=0; i<(NMat+1); i++)
X      if((*this)[i] > vr[i])
X	return 0;
X    return 1;
X  }
X  int operator>=(const Material& vr) const {
X    for(int i=0; i<(NMat+1); i++)
X      if((*this)[i] < vr[i])
X	return 0;
X    return 1;
X  }
// Returns true if any element is unequal
X  int operator!=(const Material& vr) const {
X    for(int i=0; i<(NMat+1); i++)
X      if((*this)[i] != vr[i])
X	return 1;
X    return 0;
X  }
X  int operator==(const Material_t val) const {
X    for(int i=0; i<(NMat+1); i++)
X      if((*this)[i] != val)
X	return 0;
X    return 1;
X  }
X
X  int operator<(const Material_t val) const {
X    for(int i=0; i<(NMat+1); i++)
X      if((*this)[i] >= val)
X	return 0;
X    return 1;
X  }
X  int operator>(const Material_t val) const {
X    for(int i=0; i<(NMat+1); i++)
X      if((*this)[i] <= val)
X	return 0;
X    return 1;
X  }
X  int operator<=(const Material_t val) const {
X    for(int i=0; i<(NMat+1); i++)
X      if((*this)[i] > val)
X	return 0;
X    return 1;
X  }
X  int operator>=(const Material_t val) const {
X    for(int i=0; i<(NMat+1); i++)
X      if((*this)[i] < val)
X	return 0;
X    return 1;
X  }
X  int operator!=(const Material_t val) const {
X    for(int i=0; i<(NMat+1); i++)
X      if((*this)[i] != val)
X	return 1;
X    return 0;
X  }
/*
** End of operators
*/  
X  int readIn(istream&);
X  int threshold(int=0, int=NMat, Material_t=0);
//smallest amino acid ratio
X  float minRat(Material&); 
//find product: negative is substrate for decomposition
X  int findProduct();
//returns index of smallest item
X  int findMin(int=FirstElem, int=LastComplex);
//returns index of largest item
X  int findMax(int=FirstElem, int=LastComplex);
/*
** Reduce this to a maximum of limit
*/
X  void ceil(Material&);
/*
** Limit this to a mimimum of limit
*/
X  void floor(Material&);
X  static int getwt(int i) {return atwt[i];}
X  static void setwt(int i, int v) {atwt[i] = v;}
X  Material_t getMass();
X  Material_t getMassT();
X  float getMassF();
X  Material_t set(int i, Material_t v) {return ((*this)[i] = v);}
X  Material_t get(int i) {return ((*this)[i]);}
X  Material_t incr(int i, Material_t n = 1) {return (*this)[i] += n;}
X  void excess(Material*, Material*);
X  int negCheck(Material_t = 0);
X  void totalDecompose();
X  void clear(Material_t x = 0) {for(int i=0; i<(NMat+1); i++) (*this)[i] = x;}
};
/*
** Enhancers are environmental conditions that influence
** reaction rate.  The low order byte of the value is
** the index of the environmental variable.  The rest of
** the integer is the amount of enhancement.  Negative
** enhancements are understood to degrade reaction rates.
**
** The getEnhancer() function should return something more
** elegant than an integer.
*/
class Reaction : public Material {
X  friend ostream& operator <<(ostream&, Reaction&);
X  int light;
X  int catalyst;
X  int enhancer;
X  int inhibitor;
X public:
X  static Reaction ReTable[];
X  Reaction(){catalyst=enhancer=inhibitor = 0;}
X  Reaction(const Reaction& rr) : Material(rr) {
X    light = rr.light;
X    catalyst = rr.catalyst;
X    enhancer = rr.enhancer;
X    inhibitor = rr.inhibitor;
X  }    
X  Reaction(Material_t m[], int l, int c, int p, int i): Material(m),
X                light(l), catalyst(c), enhancer(p), inhibitor(i) {}
X  Reaction& operator=(const Reaction& rr) {
X    (Material&) *this = (Material&) rr;
X    light = rr.light;
X    catalyst = rr.catalyst;
X    enhancer = rr.enhancer;
X    inhibitor = rr.inhibitor;
//    cout<<"op="<<(Reaction&)rr<<"-->"<<*this<<endl;
X    return *this;
X  }
X  int   setCatalyst(int c) {
X    return (catalyst = c);
X  }
X  int readIn(istream& is);
X  void setEnhancer(int, int);
X  void setInhibitor(int c) {
X    (inhibitor = c);
X  }
X  int   setLight(int c) {
X    return (light = c);
X  }
X  int   getCatalyst() {
X    return catalyst>0?catalyst:0;
X  }
X  int   getEnhancer() {
X    return (enhancer);
X  }
X  int   getInhibitor() {
X    return (inhibitor);
X  }
X  int   getLight() {
X    return (light);
X  }
};
class ReactionTable {
X  friend ostream& operator<<(ostream&, ReactionTable&);
X  int size;
X  Reaction* table;
X  int catalysts[NGene];    /*index is catalyst, value is ptr into RTable */
X public:
X  ReactionTable(int rs=0): size(rs) {
X    table = new Reaction[rs];
X  }
X  ReactionTable(Reaction[], int rs=NReactions);
X  ~ReactionTable() {
X    if(size)
X      delete[] table;
X  }
//find reaction with arg as product
X  Reaction& findSynthesis(int);
//return reaction catalyzed by i
X  Reaction& ReactionIndex(int i) {
X    assert(i>=0);
X    assert(i<NGene);
X    return table[catalysts[i]];
X  }
X  //return index into RTable of reaction catalyzed by i
X  //note that entries that have no corresponding reaction
X  //have a value of -1
X  int catalyst(int i) {
X    assert(i>=0 && i<NGene);
X    return catalysts[i];
X  }
//Return coefficient of product catalyzed by arg
X  Material_t findProductCoefficient(int);
//find product of reaction catalyzed by arg
X  int findProduct(int);
X  Material_t productCoefficient(int);
X  int readIn(char* = RFile);
X  Reaction& operator[] (int indx) {
X    if(indx < 0 || indx >= size) {
X      ofile<<"ReactionTable index "<< indx <<" out of bounds." << endl;
X      abort();
X    }
X    return table[indx];
X  }
//find reaction that decomposes i
X  Reaction& findDecomposition(int);
};
X
#endif /*MATERIAL*/
X
X
X
SHAR_EOF
  $shar_touch -am 0506225699 'material.h' &&
  chmod 0444 'material.h' ||
  $echo 'restore of' 'material.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo './material.h:' 'MD5 check failed'
955b199925f8e10fbf54c771f924b3f0  ./material.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'material.h'`"
    test 8468 -eq "$shar_count" ||
    $echo 'material.h:' 'original size' '8468,' 'current size' "$shar_count!"
  fi
fi
# ============= random.h ==============
if test -f 'random.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'random.h' '(file already exists)'
else
  $echo 'x -' extracting 'random.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'random.h' &&
#ifndef _RANDOM_H_
#define _RANDOM_H_
/*
**  SCCSID = @(#)random.h	1.2   -=EVOLVE IV=-   08/16/98
*/
class z1_Rnd {
X public:
X  static z1_Rnd* RNG;
X  z1_Rnd( long s );
X  ~z1_Rnd();
X  
X  float Gen1();
X  
X private:
X  long seed;
X  
X  long ia;
X  long im;
X  float am;
X  long iq;
X  long ir;
X  int ntab;
X  float ndiv;
X  float eps;
X  float rnmax;
X
X  long iy;
X  long *iv;
};
X
X
#endif
SHAR_EOF
  $shar_touch -am 0506225699 'random.h' &&
  chmod 0444 'random.h' ||
  $echo 'restore of' 'random.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo './random.h:' 'MD5 check failed'
1585ebf7abd83d83b9a907478bc5abe0  ./random.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'random.h'`"
    test 374 -eq "$shar_count" ||
    $echo 'random.h:' 'original size' '374,' 'current size' "$shar_count!"
  fi
fi
# ============= Pix.h ==============
if test -f 'Pix.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'Pix.h' '(file already exists)'
else
  $echo 'x -' extracting 'Pix.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'Pix.h' &&
X
#ifndef _Pix_h
#define _Pix_h 1
typedef void* Pix;
#endif
SHAR_EOF
  $shar_touch -am 0506225799 'Pix.h' &&
  chmod 0444 'Pix.h' ||
  $echo 'restore of' 'Pix.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo './Pix.h:' 'MD5 check failed'
aeff36ea04825d761360c7b2cc91d38c  ./Pix.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'Pix.h'`"
    test 59 -eq "$shar_count" ||
    $echo 'Pix.h:' 'original size' '59,' 'current size' "$shar_count!"
  fi
fi
# ============= defs.h ==============
if test -f 'defs.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'defs.h' '(file already exists)'
else
  $echo 'x -' extracting 'defs.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'defs.h' &&
#ifndef DEFS_H
#define DEFS_H
/*
X *  SCCSID = %W%   -=EVOLVE IV=-   %H%
X */
#ifdef NULL
#undef NULL
#endif
#define NULL 0
#include <values.h>
#define MaxHistory 100 /*  maximum number of history frames */
#define MODE 0600
#define MaxProduct 5   /*  maximum product coefficient */
#define MaxCoef 5      /*  maximum coefficient for any reagent  */
#define MINClen 2      /*  minimum compound length  */
#define Clen 12        /*  NINClen + Clen = maximum compound length  */
#define MINEnergy 3    /*  Minimum energy in compound formation  */
#define ERange 15      /*  MINEnergy + ERange = max energy  */
#define MinLight 4     /*  Minimum light for photosynthetic compounds  */
#define LightRange 14  /*  MINL + Light = max light  */
#define NPhoto 3       /* Number of photosynthetic reactions  */
#define NBStorage 1    /*  Number of basic storage molecules  */
#define NCStorage 1    /*  Number of complex storage molecules  */
#define NStorage (NBStorage+NCStorage)
#define StoredEnergy 1000 /* Amount of energy per molecule */
#define NPromo 3
#define NInhib 2
#define RFile "matls.txt"  /* File containing reaction definitions */
#define LibFile "stdgene.txt" /* File containing gene "library" */
#define InitGeneFile "initGene.txt" /* File containing initial chromosome */
X
#define StorageLevel 60    // Setpoint level for storage molecule
X
/*
**  nbasic + NCompound = 2NGene - NStruct - Redundancy
**
**  NGene = NEnzyme + NStruct
**
**  so NBasic + NCompound = NEnzyme + NStruct - Redundancy
**
**  What must not happen:
**
**  A) Some compound can be synthesized and never degraded
**
**  B) Some compound can be synthesized with energy e1 and
**  degraded with energy  -e2, and e2 > e1.  e1 > e2 is ok.
**
**  C) A compound is the only catalyst for a reaction that produces
**  one of its components.
**
**  D) Every non-elemental must appear in the reaction table
**  as the starting point (positive coefficient) for a
**  degradation reaction at least once.
**
*/
#define MaxMismatch 25  // Max error before no match is declared
#define criticalWeight 10  // weight of errors in critical section
#define MUTRATE 0.5         /*  rate of point mutations  */
#define RSL 8     // Regulation section length
X
#define NElem 4        /*  Number of elements  */
#define NAmino 20
#define NStruct 12      /*  Number of structural genes  */
#define NBasic NAmino+4   /* compounds with elemental reagents */
X                          /*  Amino acids are basic compounds  */
#define FirstElem 0
#define NElem 4
#define LastElem (NElem-1)
#define FirstBasic NElem
#define FirstAmino FirstBasic
#define LastAmino (LastElem + NAmino)
#define LastBasic NElem + (NBasic-1)
#define NComplex 4     /* Complex compounds, based on basic & elements  */
#define FirstComplex (LastBasic + 1)
#define LastComplex (FirstComplex+NComplex-1)
#define NSynth 28  // NBasic+NComplex
#define NDecomp NSynth  /*  See B)  */
#define NFunction (NDecomp+NStruct+NSynth)   /*  Total number of functions  */
#define NGene NFunction
#define NMat (NElem+NBasic+NComplex)  /*  Number of materials represented  */
#define NReactions (NSynth+NDecomp)
#define FirstReaction 0
#define LastReaction (NReactions -1)
#define FirstSynth FirstReaction
#define LastSynth (NSynth-1)
#define FirstDecomp (LastSynth+1)
#define ProteinAssemblyConstant 0.2
#define ATWT 0
#define ENERGY NMat
#define MaxEnhancement 200  /* Max percentage of enhancement */
typedef int Material_t;
#define MaxMatl MAXINT
typedef char Peptide;
#define INVESTMENT 50 // percent
#define DefaultCapacity 8000
#define DefaultDecompositionRate 0.5
#define ElementCapacity 80000
#define MoveCost 1.0
#define ReproductiveCost 45
#define ReproTime 1.2 /* seconds per peptide */
#define MaxSecretion 10  // Max percentage that can be secreted
#define RollThreshold 1.2
#define ReproductiveThreshold 10000
#define LifeThreshold 25
#define Lifespan 5
#define MinEnergy 10
#define DegradationConstant 10  // Percentage
#define ProteinDegradationConstant 0.0
#define DefaultEPILevel 200
#define DefaultSecretionLevel 10 // Percentage
#define auxMargin 25
#define defaultAlphabet "abcdefghijklmnopqrst"
#define START 's'
#define STOP 'u'
#define EPI_Broken -1
#define HD 15 /* Hamming distance for neighboring genes */
#define NHealthData 1
/*
** chromosome length
*/
/*
**  Protein target levels
*/
#define SetPtFunctional 5
#define SetPtSugar 4
#define SetPtNonFunctional 1
typedef short Function_t;
typedef int Health_t;
#define NHealth 5
/*
** From chemgen
*/
#define GLEN 100
#define GTOL 20
#define GCRIT 3
#define GCRITTOL 2
#define GCLEN 10
#define START 's'
#define STOP 'u'
/*
** Protein functionality
*/
#define Motile 0
#define SenseLight 1
#define SenseEnv1 2
#define SenseEnv2 3
#define SenseEnv3 4
#define SenseEnv4 5
#define Conjugate 6
#define SecreteSugars 7
#define SecreteA 8
#define SecreteB 9
#define SecreteC 10
#define Scavenge 11
#define MinCapital 300
#define DefaultCarryingCapacity 20 /* per location */
const int NoCheck = 0;
const int FunctionCheck = 1;
const int MetaCheck = 2;
const int SecretionCheck = 4;
const int UptakeCheck = 8;
const int ReproCheck = 16;
#define runDescriptionSize 512
#define ClockTick 600 //Visit organisms every 10 min.
#define TINY 0.001
#define DefaultPIDFile "/dev/null"
#define DefaultHistoryFile "history.dat"
#define HistoryLockFile "history.lck"
#define DefaultOutputFile "/dev/null"
#define DefaultDataFile "data"
#define KILO 1024
#define MEGA KILO*KILO
#define DefaultExtension 1*MEGA
#define MaxQuerySize 32
#define max(a, b) (a>b?a:b)
#define max3(a, b, c) (a>b?((a>c)?a:c):(b>c)?b:c)
#define min(a, b) (a<b?a:b)
#endif _DEFS_H_
SHAR_EOF
  $shar_touch -am 0506230599 'defs.h' &&
  chmod 0644 'defs.h' ||
  $echo 'restore of' 'defs.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo './defs.h:' 'MD5 check failed'
94a0d92cfe970b023f01b47f318ac9d5  ./defs.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'defs.h'`"
    test 5625 -eq "$shar_count" ||
    $echo 'defs.h:' 'original size' '5625,' 'current size' "$shar_count!"
  fi
fi
# ============= Makefile ==============
if test -f 'Makefile' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'Makefile' '(file already exists)'
else
  $echo 'x -' extracting 'Makefile' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'Makefile' &&
#  SCCSID = @(#)Makefile	3.2   -=EvolveIV=-   05/05/99
#
X.SUFFIXES : .C .o 
CC=g++
LD=
#  Solaris 2.X
LIBS= -lm -lstdc++
#  SunOS 4.1.X
#LIBS= -lm -lg++
CFLAGS= -g  -fguiding-decls
BINDIR= ../bin
X
INCLUDES= chemgen.h date.h env.h envars.h material.h mylist.h \
X	organism.h position.h random.h serial.h stringgen.h urn.h \
X	protein.h chromosome.h fptr.h peptidestring.h \
X	health.h 
X
OBJS=	date.o env.o main.o material.o mylist.o protopeptide.o \
X	organism.o position.o random.o serial.o \
X	chromosome.o protein.o fptr.o peptidestring.o \
X	health.o parse.o vector.o record.o allocator.o
all:	evolve utils
X
evolve: $(INCLUDES) $(OBJS) 
X	$(CC) -o evolve $(CFLAGS) $(OBJS) $(LIBS)
X
parse.o: lex.yy.c y.tab.c
X	gcc -c -o parse.o y.tab.c
utils: lookup sgen scmp chemgen eplot
lookup: lookup.o $(INCLUDES) $(OBJS)
X	$(CC) -o $@ $(CFLAGS) lookup.o material.o protopeptide.o fptr.o mylist.o \
X	random.o $(LIBS)
sgen: 	sgen.o $(INCLUDES) $(OBJS)
X	$(CC) -o $@ $(CFLAGS) $@.o peptidestring.o protopeptide.o fptr.o mylist.o random.o $(LIBS)
scmp: 	scmp.o $(INCLUDES) $(OBJS)
X	$(CC) -o $@ $(CFLAGS) $@.o peptidestring.o protopeptide.o fptr.o mylist.o random.o $(LIBS)
X
chemgen: lex.yy.c y.tab.c material.h random.h stringgen.h random.o chemgen.o \
X	peptidestring.o material.o date.o\
X	mylist.o env.o position.o serial.o
X	$(CC) -o $@ $(CFLAGS) chemgen.o peptidestring.o material.o \
X	random.o  date.o  mylist.o\
X	position.o serial.o $(LIBS)
X
eplot:  extractor.o trace.h eplot.o defs.h mylist.o random.o
X	$(CC) -o $@ $(CFLAGS) extractor.o eplot.o mylist.o random.o $(LIBS)
X.C.o :
X	$(CC) -c $(CFLAGS) $< 
X
lex.yy.c: lex.txt
X	lex lex.txt
X
y.tab.c: yacc.txt
X	yacc yacc.txt
clean:
X	rm -f *.o y.tab.c lex.yy.c *~ \
X	evolve core eplot sgen lookup chemgen scmp
install: evolve utils
X	install --mode 0755 evolve ../bin
X	install --mode 0755 chemgen ../bin
X	install --mode 0755 lookup ../bin
X	install --mode 0755 sgen ../bin
X	install --mode 0755 scmp ../bin
X	install --mode 0755 eplot ../bin
SHAR_EOF
  $shar_touch -am 0506225899 'Makefile' &&
  chmod 0444 'Makefile' ||
  $echo 'restore of' 'Makefile' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo './Makefile:' 'MD5 check failed'
e9281a98093d221832c75466723f3b53  ./Makefile
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'Makefile'`"
    test 1964 -eq "$shar_count" ||
    $echo 'Makefile:' 'original size' '1964,' 'current size' "$shar_count!"
  fi
fi
# ============= date.h ==============
if test -f 'date.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'date.h' '(file already exists)'
else
  $echo 'x -' extracting 'date.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'date.h' &&
#ifndef _DATE_H_
#define _DATE_H_
/*
X *  @(#)date.h	3.1   -=EVOLVE IV=-   05/05/99
X */
#include <iostream.h>
#include <math.h>
#define MINUTE 60
#define HOUR (MINUTE * 60)
#define DAY (HOUR * 24)
#define YEAR (DAY * 365)
X
class Date {
X  friend ostream& operator<<(ostream&, const Date&);
X  static int currentYear;     /* Since time began  */
X  static int currentTime;     /* Seconds since Jan. 1 */
X  static int currentDay;      /* Julian date */
X  int day;
X  int year;
X  int time;
X public:
X  Date() {
X    day = currentDay;
X    year = currentYear;
X    time = currentTime;
X  }
X  Date(int Year, int Time) {
X    year = Year + Time/YEAR;
X    time = Time%YEAR;
X    day = time/DAY;
X  }
X  Date(float Year) {
X    year = (int)floor(Year);
X    time = (int)((Year - (float)year) * YEAR);
X    day = time/DAY;
X  }
X    
X  static int theTime() {return currentTime;}
X  void reset() {
X    currentYear = currentTime = currentDay = 0;
X  }
X  int age() {
X    return currentTime-time+YEAR*(currentYear-year);
X  }
X  Date& operator *=(int n) {
X    time = n*time;
X    year = n*year + time/YEAR;
X    time = time%YEAR;
X    day = time/DAY;
X    return *this;
X  }
/*
** true if *this is after dr
*/
X  int afterp(Date& dr) {
X    if(year>dr.year)
X      return 1;
X    if(year < dr.year)
X      return 0;
X    return (time>dr.time);
X  }
X  void incrementDate(const Date& dr) {
X    time += dr.time;
X    year += dr.year + time/YEAR;
X    time = time%YEAR;
X    day =  time/DAY;
X  }
X  static void advanceDate(const int incr) {
X    currentTime += incr;
X    currentYear += currentTime/YEAR;
X    currentTime = currentTime%YEAR;
X    currentDay =  currentTime/DAY;
X  }
X  void refresh() {
X    day = currentDay;
X    year = currentYear;
X    time = currentTime;
X  }
};
X
X  
X
#endif _DATE_H_
SHAR_EOF
  $shar_touch -am 0506230599 'date.h' &&
  chmod 0444 'date.h' ||
  $echo 'restore of' 'date.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo './date.h:' 'MD5 check failed'
7dda335156135497c67305a3c8024b22  ./date.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'date.h'`"
    test 1739 -eq "$shar_count" ||
    $echo 'date.h:' 'original size' '1739,' 'current size' "$shar_count!"
  fi
fi
# ============= env.h ==============
if test -f 'env.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'env.h' '(file already exists)'
else
  $echo 'x -' extracting 'env.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'env.h' &&
#ifndef _ENV_H_
#define _ENV_H_
#include <iostream.h>
#include "mylist.h"
#include "position.h"
#include "material.h"
#include "envars.h"
//#include "record.h"
#define defaultX 10
#define defaultY 10
#define MeanMass 176468
X
/*  SCCSID   @(#)env.h	3.3   -=EVOLVE IV=-   05/05/99
X *
X *  The environment comprises a series of locations,
X *  each of which has a set of biota that currently occupy
X *  that position, a set of materials that exist at that
X *  position and a vector of environmental variables that
X *  describe the environment at that particular location.
X */
X
typedef double EnVar_t;
X
class Location;
X
class Organism;
X
class EnVar {
X  friend ostream& operator<<(ostream&, const Location&); 
X
X  friend ostream& operator<<(ostream&, const EnVar&); 
X  friend class ERecord;
X private:
X  static EnVar_t defaults[ENVSIZE];
X  EnVar_t vars[ENVSIZE];
X public:
X  EnVar(){setDefaults(vars);}
X  EnVar(EnVar_t p[]) {
X    for(int i=0; i<ENVSIZE; i++)
X      vars[i] = p[i];
X  }
X  EnVar operator=(EnVar B) {
X    for(int i=0; i<ENVSIZE; i++)
X      vars[i] = B.vars[i];
X  }
X  EnVar operator=(EnVar_t* B) {
X    for(int i=0; i<ENVSIZE; i++)
X      vars[i] = B[i];
X  }
X  EnVar_t Eset(int i, EnVar_t v) {return vars[i] = v;}
X  EnVar_t Eget(int i) const {return vars[i];}
X  static void setDefaults(double* vars) {
X    for(int i=0; i<ENVSIZE; i++) 
X      vars[i]=defaults[i];
X  }
X  EnVar operator+(EnVar);
X  EnVar operator*(EnVar);
X  EnVar operator-(EnVar);
X  EnVar operator/(EnVar);
X  EnVar operator+(float);
X  EnVar operator*(float);
X  EnVar operator-(float);
X  EnVar operator/(float);
X  static void  getDefaults(double[]);
X  EnVar_t gradient(EnVar& er, int i) {  // Increasing gradient is > 0
X    return vars[i] - er.vars[i];
X  }
};
X
X
class Location : 
//public PeptideBag,
public Position,
public EnVar,
public Material
{
X  friend class Literator;
X  friend class BiotaIterator;
X  friend class LocationHdr;
X private:
X  Material share;
X  static char envfile[];
X  static int NLoc;
X  List<Organism*> biota;
X  friend void parse();
X public:
X  static void materialSummary();
X  static Material biomassSummary();
X  static Material resourceSummary();
X  static void doUptake();
X  void uptake();
X  static void materialReport();
X  static void envReport();
X  void biotaReport();
X  static long int WorldPop();
X  int locationPop() {return biota.length();}
X  static setNLoc(int n) {NLoc = n;}
X  friend ostream& operator<<(ostream&, Location&); 
X  static Location* theWorld;
X  Location(){}
X  Location(int X, int Y, double* er, const Material& mr) :
X    Position(X,Y),
X    EnVar(er),
X    Material(mr){
//      ofile << "Loc: " << *this << endl;
X    }
X  insertBiota(Organism* op){biota.prepend(op);}
X  BaseNode* removeBiota(Organism*);
X  ~Location() {biota.~List();}
X  static void printWorld();
X  Material* fairShare(Material*, float);
X  void recycle(const Material& mr) {
X    *this += mr;
X  }
X  Organism* getPartner(){ return (Organism*) biota.getRand();}
X  int blen() {return biota.length();}
};
class Literator {
X  int* used;
X public:
X  Literator();
X  ~Literator() {delete[] used;}
X  int getOne();
X  void reset();
};
class BiotaIterator {
X  Location* here;
X  Pix nextOne;
X public:
X  BiotaIterator(){}
X  BiotaIterator(Location* h) {here = h; nextOne=h->biota.getFirst();}
X  Organism* getNext();
X  Organism* getFirst(){
X    reset();
X    return getNext();
X  }
X  void reset(){nextOne=here->biota.getFirst();}
};
#endif
SHAR_EOF
  $shar_touch -am 0506230599 'env.h' &&
  chmod 0444 'env.h' ||
  $echo 'restore of' 'env.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo './env.h:' 'MD5 check failed'
885b4e51a1a423a71b6f19089bbd90f9  ./env.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'env.h'`"
    test 3389 -eq "$shar_count" ||
    $echo 'env.h:' 'original size' '3389,' 'current size' "$shar_count!"
  fi
fi
# ============= envars.h ==============
if test -f 'envars.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'envars.h' '(file already exists)'
else
  $echo 'x -' extracting 'envars.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'envars.h' &&
#ifndef _ENVARS_H_
#define _ENVARS_H_
/*
**  SCCSID = @(#)envars.h	1.1   -=-EVOLVE  IV=-   07/30/98
*/
#define defXRange 20
#define defYRange 20
#define EVtemp 0
#define EVpH 1
#define EVsalinity 2
#define EVlight 3
#define EVdecomp 4
#define ENVSIZE 5
/*
**  An assignment must be added to the
**  default constructor for each default
**  value added here.
*/
#define defTemp 20.0
#define defPH 7.0
#define defSalinity .001
#define defLight 1.0
#define defDecomp 1.0
#endif
SHAR_EOF
  $shar_touch -am 0506230599 'envars.h' &&
  chmod 0444 'envars.h' ||
  $echo 'restore of' 'envars.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo './envars.h:' 'MD5 check failed'
a628e328e16214252dd81ac6725ec038  ./envars.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'envars.h'`"
    test 475 -eq "$shar_count" ||
    $echo 'envars.h:' 'original size' '475,' 'current size' "$shar_count!"
  fi
fi
# ============= organism.h ==============
if test -f 'organism.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'organism.h' '(file already exists)'
else
  $echo 'x -' extracting 'organism.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'organism.h' &&
/*
X *  SCCSID = @(#)organism.h	3.3   -=EVOLVE IV=-   05/05/99
X */
#ifndef ORGANISM_H
#define ORGANISM_H
#include "defs.h"
#include <iostream.h>
#include "material.h"
#include "chromosome.h"
#include "protein.h"
#include "position.h"
#include "env.h"
#include "date.h"
#include "macro.h"
#include "vector.h"
#include "myset.h"
#include <fstream.h>
extern ofstream& ofile;
X
X
class Organism : 
public Position, 
//public PeptideBag, 
public Date,
public EnVar
{
X  friend ostream& operator<<(ostream&, Organism&);
X  friend class ORecord;
X  friend class OrganismInfo;
X  static int CoD[3];
X  static int reproFault[6];
X  static int secretions[3];    //Maps A,B and C to compounds
X  static float totalSoma;
X  static float pq;
X  static float totalE;
X  Material_t aminoAverage;
X  enum Direction {east, south, west, north} lastMove;
X  float roll;
X  Material cytoplasm;
X  Material auxm;
X  Chromosome* myChromosome;
X  PeptideString* aux;
X  int np;  // Number of proteins I have
X  Vector<Function_t>* functionality;  
X  Set<Protein*>* protein;
X  Vector<Material_t>* proteinQuantity;
X  int ttl;
X  int datalog;
X  int nextMetabolite;
X  int nextPeptide;
X  void express();
X  void assemble();
X  void inhibit();
X  void reproduce();
X  void acceptFrag(PeptideString*);
X  void conjugate(Organism&);
X  static Material globalCapacity;
X public:
X  static void setGC(Material_t v) {
X    globalCapacity = Material(v);
X  }
X  static int popCheck;
X  void setAvg(const Material&);
X  Organism() {
X    functionality = new Vector<Function_t>(NFunction);
X    myChromosome = 0;
X    aux = 0;
X    np = 0;
X    lastMove = east;
X    roll = 0;
X    cytoplasm = Material(0);
X    auxm = Material(0);
X    for(int i=0; i<NFunction; i++)
X      (*(functionality))[i] = 0;
//    ttl = (int) chaos(Lifespan, 20);
X    ttl=0;
X    protein = new Set<Protein*>(0);
X    proteinQuantity = new Vector<int>(0);
X    datalog = 0;
X    nextMetabolite = 0;
X    nextPeptide = 0;
X    aminoAverage = 0;
X  }
X  Organism(Chromosome&, Material&, int, int);
X  Organism(Position&, Chromosome*, Material&);
X  ~Organism();
X  void setDatalog(int i) {datalog=i;}
X  int getDatalog(){return datalog;}
X  void geneFunction(Vector<Function_t>& fv) {
X    fv = (*(functionality));
X  }
/*
** return biomass = cytoplasm + proteins + aux + chromosome
*/  
X  void biomass(Material& mr)  {
X    mr += cytoplasm;
X    mr += auxm;
X    mr += *(myChromosome);
X    for(int i=0; i<np; i++) {
X      mr += (Material&) *(*(protein))[i] * (*(proteinQuantity))[i];
X    }
X  }
/*
** return biomass = cytoplasm + proteins + aux + chromosome
*/  
X  void copyBiomass(Material_t mv[])  {
X    Material mr;
X    biomass(mr);
X    for(int i=0; i<NMat+1; i++)
X      mv[i] = mr[i];
X  }
X  EnVar_t ambientLight() {return Location::theWorld[this->index()].Eget(EVlight);}
X  int totalProtein() {
X    int t = 0;
X    for(int i=0; i<np; i++)
X      t += (*(proteinQuantity))[i];
X    return t;
X  }
X
X  static void resetReproFault(int v = 0) {
X    for(int i=0; i<6; i++) reproFault[i] = v;}
X  static void showReproFault() {
X    for(int i=0; i<6; i++)
X      ofile << reproFault[i] << " | ";
X  }
X
X  static void resetCoD(int v = 0) {
X    for(int i=0; i<3; i++) CoD[i] = v;}
X  static void showCoD() {
X    for(int i=0; i<3; i++)
X      ofile << CoD[i] << " | ";
X    ofile << endl;
X  }
X  static void resetTotalSoma(float a=0.0) { totalSoma = a;}
X  static float getTotalSoma() {return totalSoma;}
X  static void resetpq(float a=0.0) { pq = a;}
X  static float getpq() {return pq;}
X  static void resette(float a=0.0) { totalE = a;}
X  static float gette() {return totalE;}
X  void uptake(Material&);
X  int chargeFor(Material_t c) {
X    return int ((cytoplasm[ENERGY]>c)?(cytoplasm[ENERGY]-=c):cytoplasm[ENERGY]=0);
X  }
X  int ECheck(Material_t c) {return cytoplasm[ENERGY] < c;}
X  static void setCapacity(int i, Material_t v) {globalCapacity.set(i, v);}
X  static void getCapacity(Material& mr) {mr = globalCapacity;}
X  static Material_t get1Capacity(int i) {return globalCapacity.get(i);}
X  void copyFunctionality(Function_t*);
X  void copyHealth(Health_t*);
X  int makeCompound(int, Material&);
X  void moveTo(int, Position&);
X  void move();
X  void die();
X  void live();
X  void secrete();
X  void excrete();
X  void metabolism();
X  void sense();
X  int degrade();
};
#endif
SHAR_EOF
  $shar_touch -am 0506230599 'organism.h' &&
  chmod 0444 'organism.h' ||
  $echo 'restore of' 'organism.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo './organism.h:' 'MD5 check failed'
0e9566df9e1d395711f60af67935540b  ./organism.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'organism.h'`"
    test 4225 -eq "$shar_count" ||
    $echo 'organism.h:' 'original size' '4225,' 'current size' "$shar_count!"
  fi
fi
# ============= protein.h ==============
if test -f 'protein.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'protein.h' '(file already exists)'
else
  $echo 'x -' extracting 'protein.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'protein.h' &&
#ifndef PROTEIN_H
#define PROTEIN_H
X
/*
X *  SCCSID = @(#)protein.h	1.3   -=EVOLVE IV=-   05/05/99
X */
X
#include <assert.h>
#include "material.h"
#include "mylist.h"
#include "fptr.h"
X
/*
**  Proteins are macro molecules that (potentially) have
**  a functional description as well as a chemical composition.
**
**  The Material base class describes the cost to build
**  the protein and the list of function pointers identify
**  the function(s) that it serves.
**  1/14/98 -- modify Protein to ensure that the primary
**  function is always the first in the List<> functions;
*/
X
class Protein : public Material {
X  friend ostream& operator<<(ostream&, Protein&);
X  int setpt;             // Desired protein concentration
X  float inhibition;      // Contents of EPI section of gene
X  List<FunctionPtr*> functions;  // Function description of protein.
X public:
X  Protein() : Material() {}
X  Protein(Peptide*);
X  Protein(Protein& pr) : Material((Material&)pr), functions(pr.functions) {
X    setpt = pr.setpt;
X    inhibition = pr.inhibition;
X  }
X  ~Protein();
X  int NFunctions() { return functions.length();}
X  int getIndex();
X  Pix getFirst() {return functions.getFirst();}
X  Pix getNext(Pix p) {return functions.getNext(p);}
X  FunctionPtr* getFP(Pix p) {
X    if(p) 
X      return functions(p);
X    else
X      return 0;
X  }
//  float build(Material&);
X  int getSetpt() {return setpt;}
X  void setInhibition(float v) {inhibition = v;}
X  float getInhibition() {return inhibition;}
X  int primaryFunction() {
X    if(getFirst())
X      return functions(getFirst())->getIndex();
X    else
X      return -1;
X  }
//  int synthesize(Material&, float[]);
};
X
#endif
SHAR_EOF
  $shar_touch -am 0506230599 'protein.h' &&
  chmod 0444 'protein.h' ||
  $echo 'restore of' 'protein.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo './protein.h:' 'MD5 check failed'
69681a6d36ec7f817139335b2c8a0e6b  ./protein.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'protein.h'`"
    test 1650 -eq "$shar_count" ||
    $echo 'protein.h:' 'original size' '1650,' 'current size' "$shar_count!"
  fi
fi
# ============= record.h ==============
if test -f 'record.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'record.h' '(file already exists)'
else
  $echo 'x -' extracting 'record.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'record.h' &&
#ifndef _RECORD_H_
#define _RECORD_H_
/*
**  SCCSID = @(#)record.h	1.1   -=EVOLVE IV=-    05/05/99
*/
#include "defs.h"
#include "position.h"
#include "date.h"
#include "env.h"
X
/*
** Definitions for the records used in the history facility.
** The classes are never constructed as such.  The allocate() member
** is used to instantiate them in the memory mapped file.  
** (See allocator.h)
*/
/*
**  The "top level" record
*/
class HistoryRec{
X  friend class FrameRec;
X  friend class Extractor;
X  int nFrames;
X  int frameAddr[MaxHistory];
X  Date sampleInterval;
X public:
X  HistoryRec(){}
X  static void allocate();
X  void initRec();
X  void closeRec();
X  void advanceClock(Date& dr) {dr.incrementDate(sampleInterval);}
X  void collapse();
};
X  
class FrameRec {
X  friend class EnvRec;
X  friend class Extractor;
X  Date currentTime;
X  int nEnv;
X  int envAddr[1];  /* additional space allocated at run time. */
X public:
X  FrameRec(){}
X  static void allocate();
X  void initRec();
X  void closeRec();
};
class EnvRec {
X  friend class OrgRec;
X  friend class Extractor;
X  Position location;
X  Material_t resources[NMat+1];
X  int nOrg;
X  int orgAddr[1];  /* additional space allocated at run time. */
X public:
X  EnvRec() {}
X  static void allocate(Location&);
X  void initRec(Location&);
X  void closeRec();
X  int EnvX() { return location.x; }
X  int EnvY() { return location.y; }
};
/*
** health vector:
**  chromosome length
**  
*/
class OrgRec {
X  friend class Extractor;
X  Function_t functionality[NFunction];
X  Material_t biomass[NMat+1];
X  Health_t health[NHealth];
X public:
X  OrgRec(){}
X  static void allocate();
X  void initRec(Organism&);
X  void closeRec();
};
#endif 
X
SHAR_EOF
  $shar_touch -am 0506230599 'record.h' &&
  chmod 0444 'record.h' ||
  $echo 'restore of' 'record.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo './record.h:' 'MD5 check failed'
5c43ce55cd9445d1ca4cc4cce2de6738  ./record.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'record.h'`"
    test 1665 -eq "$shar_count" ||
    $echo 'record.h:' 'original size' '1665,' 'current size' "$shar_count!"
  fi
fi
# ============= serial.h ==============
if test -f 'serial.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'serial.h' '(file already exists)'
else
  $echo 'x -' extracting 'serial.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'serial.h' &&
/*
X *  SCCSID = @(#)serial.h	1.2   -=Evolve IV=-   08/16/98
X */
#include "date.h"
// Serial no. is julian date plus serialNo.
class Serial : Date {
X  static long nextSerialNo;
X  long serialNo;
X public:
X  Serial(){
X    serialNo = nextSerialNo++;
X  }
X  static void dailyReset() {
X    nextSerialNo = 0;
X  }
};
SHAR_EOF
  $shar_touch -am 0506230599 'serial.h' &&
  chmod 0444 'serial.h' ||
  $echo 'restore of' 'serial.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo './serial.h:' 'MD5 check failed'
fad227413668152716b4576bc7dd1fff  ./serial.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'serial.h'`"
    test 307 -eq "$shar_count" ||
    $echo 'serial.h:' 'original size' '307,' 'current size' "$shar_count!"
  fi
fi
# ============= stringgen.h ==============
if test -f 'stringgen.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'stringgen.h' '(file already exists)'
else
  $echo 'x -' extracting 'stringgen.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'stringgen.h' &&
#ifndef _STRINGGEN_H_
#define _STRINGGEN_H_
#include <iostream.h>
X
/*
**  random strings
*/
class Rstring {
X  friend ostream& operator <<(ostream&, Rstring&);
X  char* str;
X  static char* defAlpha;
X public:
X  Rstring(int);
X  Rstring(Rstring&);
X  Rstring(Rstring&, char*, int);
X  Rstring(Rstring&, Rstring&);
X  Rstring(char* = defAlpha, int = 0);
X  ~Rstring(){delete[] str;}
X  Rstring& insertChar(int, char);
X  int countChar(char);
X  int len() {return strlen(str);}
X  void replaceChar(int i, char c){str[i] = c;}
X  void upCase(int, int);
};
X
char rChar(char*);
X
#endif
X
SHAR_EOF
  $shar_touch -am 0506230599 'stringgen.h' &&
  chmod 0444 'stringgen.h' ||
  $echo 'restore of' 'stringgen.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo './stringgen.h:' 'MD5 check failed'
4db5547e63f588dd79f5861b840f2f07  ./stringgen.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'stringgen.h'`"
    test 568 -eq "$shar_count" ||
    $echo 'stringgen.h:' 'original size' '568,' 'current size' "$shar_count!"
  fi
fi
# ============= vector.h ==============
if test -f 'vector.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'vector.h' '(file already exists)'
else
  $echo 'x -' extracting 'vector.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'vector.h' &&
#ifndef _VECTOR_H_
#define _VECTOR_H_
#include <assert.h>
#include <iostream.h>
/*  SCCSID = @(#)vector.h	3.1   EVOLVE IV   05/05/99 
**
**  This is the simple case.  The index is 0-based.
**  No provision is made for expansion.
*/
X
template<class T>
class Vector {
X  friend istream& operator<<(istream&, Vector<T>);
X  int size;
X  T* data;
X  int rangecheck(int x) const {return (x >= 0) && (x < size);}
X public:
X  Vector() {
X    size = 0;
X    data = 0;
X  }
X  Vector(int sz, T val=0) {
X    size = sz;
X    if(size) {
X      data = new T[size](val);
X    }
X    else
X      data = 0;
X  }
//This ASSUMES that vec is at least as long as sz!
X  Vector(int sz, T* vec) {
X    size = sz;
X    if(size)
X      data = new T[size];
X    for(int i=0; i<size; i++) 
X      data[i] = vec[i];
X  }
X  Vector(const Vector<T>& vr) {
X    size = vr.size;
X    if(size) {
X      data = new T[size];
X      for(int i=0; i<size; i++) 
X	data[i] = vr.data[i];
X    }
X  }
X  ~Vector() { 
X    if(size)
X      delete[] data; 
X  }
X  Vector<T>& subVec(int start, int length) {
X    assert(size >= length+start);
X    Vector<T>* rv = new Vector<T>(length);
X    for(int i=0; i<length; i++)
X      rv->data[i] = data[i+start];
X    return *rv;
X  }
/*
** This is for the memory mapped instances that never get
** constructed.
*/
X  int getSize() const {return size;}
X  T& operator[](int i) { 
X    assert(rangecheck(i));
X    return data[i];
X  }
X  T operator[](int i) const { 
X    assert(rangecheck(i));
X    return data[i];
X  }
X  T readOnly(int i) const {
X    assert(rangecheck(i));
X    return data[i];
X  }
/*
**  Binary operations on vectors of inequal size 
**  proceed by operating only over the range
**  of the smaller vector.  The return value
**  is always a vector of the larger size.
*/
X  Vector<T> operator+(const Vector<T>& vr) const {
X    int smaller = (vr.size > size)?size:vr.size;
X    int larger = (vr.size > size)?vr.size:size;
X    int i;
X    Vector<T> retval(larger);
X    for(i=0; i<smaller; i++)
X      retval.data[i] = data[i] + vr.data[i];
X    if(larger != smaller)
X      if(size == larger)
X	for(;i<larger;i++)
X	  retval.data[i]=data[i];
X      else
X	for(;i<larger;i++)
X	  retval.data[i]= vr.data[i];
X    return retval;
X  }
X      
X  Vector<T> operator-(const Vector<T>& vr) const {
X    assert(size == vr.size);
X    Vector<T> retval(size);
X    for(int i=0; i<size; i++) {
X      retval.data[i] = data[i] - vr.data[i];
X      cout << retval.data[i] << " " ;
X    }
X    cout << endl;
X    return (retval);
X  }
/*      
X  Vector<T> operator-(const Vector<T>& vr) const {
X    int smaller = (vr.size > size)?size:vr.size;
X    int larger = (vr.size > size)?vr.size:size;
X    int i;
X    Vector<T> retval(larger);
X    for(i=0; i<smaller; i++)
X      retval.data[i] = data[i] - vr.data[i];
X    if(larger != smaller)
X      if(size == larger)
X	for(;i<larger;i++)
X	  retval.data[i]=data[i];
X      else
X	for(;i<larger;i++)
X	  retval.data[i]= -vr.data[i];
X    return retval;
X  }
*/      
X  Vector<T> operator*(const T factor) const {
X    Vector<T> retval (size);
X    for(int i=0; i< size; i++)
X      retval.data[i] = data[i] * factor;
X    return retval;
X  }
X      
X  Vector<T> operator/(const T divisor) const {
X    assert(divisor != 0);
X    Vector<T> retval (size);
X    for(int i=0; i< size; i++)
X      retval.data[i] = data[i] / divisor;
X    return retval;
X  }
X  Vector<T>& operator+=(const Vector<T>& vr) {
X    int smaller = (vr.size > size)?size:vr.size;
X    for(int i=0; i<smaller; i++)
X      data[i] += vr.data[i];
X    return *this;
X  }
X  Vector<T>& operator-=(const Vector<T>& vr) {
X    int smaller = (vr.size > size)?size:vr.size;
X    for(int i=0; i<smaller; i++)
X      data[i] -= vr.data[i];
X    return *this;
X  }
X  Vector<T>& operator*=(const T mult) {
X    for(int i=0; i< size; i++)
X      data[i] = (T)(data[i] * mult);
X    return *this;
X  }
X  Vector<T>& operator/=(const T divisor) {
X    for(int i=0; i< size; i++)
X      data[i] = (T)(data[i] / divisor);
X    return *this;
X  }
X  int operator==(const Vector<T>& vr) const {
X    int smaller = (vr.size > size)?size:vr.size;
X    for(int i=0; i<smaller; i++)
X      if(data[i] != vr.data[i])
X	return 0;
X    return 1;
X  }
X  int operator<(const Vector<T>& vr) const {
X    int smaller = (vr.size > size)?size:vr.size;
X    for(int i=0; i<smaller; i++)
X      if(data[i] >= vr.data[i])
X	return 0;
X    return 1;
X  }
X  int operator>(const Vector<T>& vr) const {
X    int smaller = (vr.size > size)?size:vr.size;
X    for(int i=0; i<smaller; i++)
X      if(data[i] <= vr.data[i])
X	return 0;
X    return 1;
X  }
X  int operator<=(const Vector<T>& vr) const {
X    int smaller = (vr.size > size)?size:vr.size;
X    for(int i=0; i<smaller; i++)
X      if(data[i] > vr.data[i])
X	return 0;
X    return 1;
X  }
X  int operator>=(const Vector<T>& vr) const {
X    int smaller = (vr.size > size)?size:vr.size;
X    for(int i=0; i<smaller; i++)
X      if(data[i] < vr.data[i])
X	return 0;
X    return 1;
X  }
X  int operator!=(const Vector<T>& vr) const {
X    int smaller = (vr.size > size)?size:vr.size;
X    for(int i=0; i<smaller; i++)
X      if(data[i] != vr.data[i])
X	return 1;
X    return 0;
X  }
/*
**  Assignment does a deep copy.
**  The former contents of the lval
**  are lost.
*/
X  Vector<T>& operator=(const Vector<T>& vr) {
X    if(size != vr.size) {
X      if(size)
X	delete[] data;
X      size = vr.size;
X      if(size)
X	data = new T[size];
X    }
X    for(int i=0; i<size; i++)
X      data[i] = vr.data[i];
X    return *this;
X  }
};
#endif
SHAR_EOF
  $shar_touch -am 0506230599 'vector.h' &&
  chmod 0444 'vector.h' ||
  $echo 'restore of' 'vector.h' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo './vector.h:' 'MD5 check failed'
13ec55cd3bf2c227d72c6ee5641eef25  ./vector.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'vector.h'`"
    test 5405 -eq "$shar_count" ||
    $echo 'vector.h:' 'original size' '5405,' 'current size' "$shar_count!"
  fi
fi
rm -fr _sh12579
exit 0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]