#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2.1).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 2004-07-28 14:21 PDT by <conrad@cicero.cgl.ucsf.edu>.
# Source directory was `/home/conrad'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode       name
# ------ ---------- ------------------------------------------
#   8002 -rw-rw-r-- libpdb++/pdb++.3
#    833 -rw-rw-r-- libpdb++/Makefile
#  10614 -rw-rw-r-- libpdb++/pdb++.h
#   1873 -rw-rw-r-- libpdb++/pdbrun5_read.i
#   1843 -rw-rw-r-- libpdb++/pdbrun5_write.i
#   1804 -rw-rw-r-- libpdb++/pdbrun6_read.i
#   1787 -rw-rw-r-- libpdb++/pdbrun6_write.i
#   3131 -rw-rw-r-- libpdb++/read_format.i
#   2897 -rw-rw-r-- libpdb++/write_format.i
#   1306 -rw-rw-r-- libpdb++/pdb++.cc
#  14454 -rw-rw-r-- libpdb++/pdb_chars.cc
#  16032 -rw-rw-r-- libpdb++/pdb_read.cc
#   8760 -rw-rw-r-- libpdb++/pdb_sprntf.cc
#   4650 -rw-rw-r-- libpdb++/pdb_sscanf.cc
#  12195 -rw-rw-r-- libpdb++/pdb_type.cc
#   1062 -rw-rw-r-- libpdb++/pdbinput.cc
#
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
if touch -am -t 200112312359.59 $$.touch >/dev/null 2>&1 && test ! -f 200112312359.59 -a -f $$.touch; then
  shar_touch='touch -am -t $1$2$3$4$5$6.$7 "$8"'
elif touch -am 123123592001.59 $$.touch >/dev/null 2>&1 && test ! -f 123123592001.59 -a ! -f 123123592001.5 -a -f $$.touch; then
  shar_touch='touch -am $3$4$5$6$1$2.$7 "$8"'
elif touch -am 1231235901 $$.touch >/dev/null 2>&1 && test ! -f 1231235901 -a -f $$.touch; then
  shar_touch='touch -am $3$4$5$6$2 "$8"'
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 200112312359.59 123123592001.59 123123592001.5 1231235901 $$.touch
#
if mkdir _sh13093; then
  $echo 'x -' 'creating lock directory'
else
  $echo 'failed to create lock directory'
  exit 1
fi
# ============= libpdb++/pdb++.3 ==============
if test ! -d 'libpdb++'; then
  $echo 'x -' 'creating directory' 'libpdb++'
  mkdir 'libpdb++'
fi
if test -f 'libpdb++/pdb++.3' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'libpdb++/pdb++.3' '(file already exists)'
else
  $echo 'x -' extracting 'libpdb++/pdb++.3' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'libpdb++/pdb++.3' &&
X.\" Copyright 1994, U.C.S.F. Computer Graphics Laboratory
X.\" $Id: pdb++.3,v 1.9 94/12/13 15:22:03 gregc Exp $
X.TH PDB++ 3
X.SH NAME
pdb++ \- A C++ class for manipulating Brookhaven Protein DataBank records
X.SH SYNOPSIS
X.nf
#include <pdb++.h>
X
\&....
X	PDB	record;
X
X	while (cin >> record) {
X		switch (record.type()) {
X		case PDB::ATOM:
X			cout << record.atom.xyz[0] << ' ' << record.atom.xyz[0]
X				<< ' ' << record.atom.xyz[0] << endl;
X			....
X			break;
X		}
X	}
\&....
X.fi
X.SH DESCRIPTION
The routines listed above are available in the pdb++ library,
X.IR "-L/usr/local/lib/midas -lpdb++" .
X.PP
The
X.B PDB
class provides methods for parsing Brookhaven Protein DataBank (PDB) records
(lines from a PDB file) into structures
and expanding those structures back into PDB records.
Rather than provide access functions for each possible field,
the structure containing the parsed record is publicly available.
The field names are listed in the header file.
X.PP
The
X.B PDB 
class has two enhancements to the Brookhaven Protein DataBank specification:
four character residue names, and the PDBRUN set of scene annotation records.
For character residue names work because
everywhere in the specification a three character residue name appears,
there is a blank afterwards.
X.SH "MEMBER CONSTANTS"
X.TP
X.B BufLen
The maximum length of a generated PDB record string (including the null byte).
X.TP
X.B PDBRUNVersion
The default version of the PDBRUN scene annotation records.
X.PP
There are also constants for each known PDB record type
X.RI ( e.g. ,
X.BR ATOM ,
X.BR HETATM ,
X.IR etc. ),
and the constant 
X.B UNKNOWN
for an unknown PDB record.
X.PP
The following constants are for each PDBRUN scene annotation record type:
X.BR USER_PDBRUN ,
X.BR USER_EYEPOS ,
X.BR USER_ATPOS ,
X.BR USER_WINDOW ,
X.BR USER_FOCUS ,
X.BR USER_VIEWPORT ,
X.BR USER_BGCOLOR ,
X.BR USER_ANGLE ,
X.BR USER_DISTANCE ,
X.BR USER_FILE ,
X.BR USER_MARKNAME ,
X.BR USER_MARK ,
X.BR USER_CNAME ,
X.BR USER_COLOR ,
X.BR USER_RADIUS ,
X.BR USER_OBJECT ,
X.BR USER_ENDOBJ ,
X.BR USER_CHAIN ,
X.BR USER_GFX_BEGIN ,
X.BR USER_GFX_END ,
X.BR USER_GFX_COLOR ,
X.BR USER_GFX_NORMAL ,
X.BR USER_GFX_VERTEX ,
X.BR USER_GFX_FONT ,
X.BR USER_GFX_TEXTPOS ,
and
X.BR USER_GFX_LABEL .
X.PP
The following constants are for the various graphics primitives supported
in scenes:
X.BR GFX_UNKNOWN ,
X.BR GFX_POINTS ,
X.BR GFX_MARKERS ,
X.BR GFX_LINES ,
X.BR GFX_LINE_STRIP ,
X.BR GFX_LINE_LOOP ,
X.BR GFX_TRIANGLES ,
X.BR GFX_TRIANGLE_STRIP ,
X.BR GFX_TRIANGLE_FAN ,
X.BR GFX_QUADS ,
X.BR GFX_QUAD_STRIP ,
and 
X.BR GFX_POLYGON .
X.SH "MEMBER TYPES"
X.TP
typedef char \fBDate\fP[10]
A text field containing a date, typically \fIday\fP\-\fImonth\fP\-\fIyear\fP,
where
X.I day
is numeric,
X.I month
is a three-letter abbreviation,
and
X.I year
is the last two digits of the year.
X.TP
typedef char \fBAName\fP[5]
A PDB atom name, \fIe.g.\fP, NO2*.
X.TP
typedef char \fBRName\fP[5]
Residue name, \fIe.g.\fP, ALA.
X.TP
typedef char \fBPName\fP[5]
PDB name, \fIe.g.\fP, 9lyz.
X.TP
typedef char \fBId\fP[4]
Generic short id field.
X.TP
typedef double \fBReal\fP
Size of floating point numbers read and written.
X.TP
struct \fBResidue\fP
A \fBResidue\fP consists of a residue name (\fBname\fP),
a chain identifier (\fBchainId\fP), a sequence number (\fBseqNum\fP),
and an insertion code (\fBinsertCode\fP).
X.SH "MEMBER FUNCTIONS"
X.LP
X.BR pdb ()
X.br
X.BR pdb "(RecordType t)"
X.br
X.BR pdb "(const char *buf)"
X.RS
Constructors.
The first two above construct a zeroed instance of the given record type
(default
X.BR UNKNOWN ).
The last constructor above fills in all of the fields of the instance
from the given PDB record text.
X.RE
X.TP
RecordType \fBtype\fP() const
Return the type of PDB instance.
X.TP
void \fBtype\fP(RecordType t)
Change the PDB record type of the instance
and reinitialize all the fields to default values
(zero in all cases except for an
X.BR ATOM 's
occupancy which defaults to 1.0).
X.TP
const char *\fBchars\fP() const;
Return a string containing the PDB record in textual form.
X.TP
static int \fBPdbrunInputVersion\fP()
Return the current PDBRUN scene annotation version used to parse text records.
X.TP
static int \fBPdbrunOutputVersion\fP()
Return the current PDBRUN scene annotation version used to create text records.
X.TP
static void \fBPdbrunInputVersion\fP(int v)
Set the current PDBRUN scene annotation version used to parse text records.
X.TP
static void \fBPdbrunOutputVersion\fP(int v)
Set the current PDBRUN scene annotation version used to create text records.
X.TP
static recordType \fBgetType\fP(const char *buf)
Return the PDB record type for the given line of text.
X.TP
static GfxType \fBgetGfxType\fP(const char *buf)
X.TP
static const char *\fBgfxChars\fP(GfxType gt)
X.TP
static int \fBsscanf\fP(const char *, const char *, ...)
A version of
X.BR sscanf (3)
whose format's behave like \s-2FORTRAN\s0 formats where field widths
are sacrosanct.
If the input line is short,
then the rest of the fields are initialized to default values.
Any literal characters in the format must match the input.
The format characters are:
space, ignore input character;
X.BR c ,
character (array), default to a space;
X.BR d ,
integer, default zero;
X.BR f ,
double, default zero;
X.BR s ,
get a C string, trailing spaces are stripped and it is null terminated,
default an empty string.
X.B sscanf
returns the number of input fields converted
(may be less than expected if the input line is short)
or \(mi1 if an error is found.
X.TP
static int \fBsprintf\fP(char *, const char *, ...)
A version of
X.BR sprintf (3)
whose format's behave like \s-2FORTRAN\s0 formats where field widths
are sacrosanct.
Literal characters are copied as is.
If the text or number to be printed is larger than the given field width,
then the field is filled in with asterisks.
The format characters are:
X.BR d ,
integer;
X.BR D ,
integer where zero is written as spaces;
X.BR s ,
right-justified string (a negative field width left-justifies);
X.BR c ,
character (array), zero characters are converted to spaces;
X.BR f ,
floating point, normal
X.B printf
precisions are used.
X.SH "I/O FUNCTIONS"
X.TP
ostream &\fBoperator<<\fP(ostream &s, const PDB &p)
Output the current PDB record on the given output stream.
X.TP
istream &\fBoperator>>\fP(istream &s, PDB &p)
Read a line from the given input stream and convert to a PDB record.
X.SH "SEE ALSO"
``Protein Data Bank Atomic Coordinate and Bibliographic Entry Format Description,'' Febuary 1992,
Brookhaven National Laboratory,
the January 1993 Protein Data Bank Quarterly Newsletter,
``Annotating PDB Files with Scene Information,''
Gregory S. Couch, \fIet. al.\fP, (submitted for publication).
X.SH NOTES
The subtype field of USERxx structure tells what the
X.I xx
part was.
The rest of the line, up to the card sequence portion, is the text field.
X.PP
Due to the way Brookhaven encodes their files,
atom names often have leading blanks and sometimes have embedded blanks.
Residue names occasionally have leading blanks too.
To be entirely consistent with the PDB format,
the programmer should put those blanks in before using the
X.B chars
member function.
X.SH BUGS
Routines are needed to convert to and from PDB typesetting conventions in
X.BR COMPND ,
X.BR SOURCE ,
X.BR AUTHOR ,
and
X.B JRNL
records.
X.SH COPYRIGHT
Copyright \(co 1994 The Regents of the University of California.
All rights reserved.
X.PP
Redistribution and use in source and binary forms are permitted
provided that the above copyright notice and this paragraph are
duplicated in all such forms and that any documentation,
advertising materials, and other materials related to such
distribution and use acknowledge that the software was developed
by the University of California, San Francisco.  The name of the
University may not be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
SHAR_EOF
  (set 20 04 07 28 14 02 31 'libpdb++/pdb++.3'; eval "$shar_touch") &&
  chmod 0664 'libpdb++/pdb++.3' ||
  $echo 'restore of' 'libpdb++/pdb++.3' '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 'libpdb++/pdb++.3:' 'MD5 check failed'
52c709d713c0785c5d8ecc77ecb47aa6  libpdb++/pdb++.3
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'libpdb++/pdb++.3'`"
    test 8002 -eq "$shar_count" ||
    $echo 'libpdb++/pdb++.3:' 'original size' '8002,' 'current size' "$shar_count!"
  fi
fi
# ============= libpdb++/Makefile ==============
if test -f 'libpdb++/Makefile' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'libpdb++/Makefile' '(file already exists)'
else
  $echo 'x -' extracting 'libpdb++/Makefile' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'libpdb++/Makefile' &&
#
#	On BSD machines, RANLIB should be 'ranlib'
#
#	On System V machines, RANLIB should be ':'
#
SHELL		= /bin/sh
RANLIB		= :
X
CXX		= gcc -felide-constructors
#CXX		= CC
X
X.SUFFIXES:	.cc
X
X.cc.o:
X	$(CXX) $(CCFLAGS) -c $< -o $@
X
OPT		= -O
DEBUG		=
CCFLAGS		= $(OPT) $(DEBUG)
LIBRARY		= pdb++
X
LIBARCH		= lib$(LIBRARY).a
OBJS		= pdb_read.o pdb_sprntf.o pdb_sscanf.o pdb_chars.o \
X		pdb_type.o pdb++.o pdbinput.o
SRCS		= pdb_read.cc pdb_sprntf.cc pdb_sscanf.cc pdb_chars.cc \
X		pdb_type.cc pdb++.cc pdbinput.cc
X
all:		$(LIBARCH)
X
install:	$(LIBARCH)
X		install -F /usr/local/lib $(LIBARCH)
X
$(LIBARCH):     $(OBJS)
X		@echo "Loading $(LIBARCH) ... "
X		@ar cru $(LIBARCH) $(OBJS)
X		@$(RANLIB) $(LIBARCH)
X		@echo "done"
X
clean:;		@rm -f $(OBJS)
X
spotless:;	@rm -f $(OBJS) $(LIBARCH)
X
tags:           $(HDRS) $(SRCS); @ctags -w $(HDRS) $(SRCS)
SHAR_EOF
  (set 20 04 07 28 14 04 53 'libpdb++/Makefile'; eval "$shar_touch") &&
  chmod 0664 'libpdb++/Makefile' ||
  $echo 'restore of' 'libpdb++/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 'libpdb++/Makefile:' 'MD5 check failed'
29fcbf453ba578894a97eae5a818702b  libpdb++/Makefile
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'libpdb++/Makefile'`"
    test 833 -eq "$shar_count" ||
    $echo 'libpdb++/Makefile:' 'original size' '833,' 'current size' "$shar_count!"
  fi
fi
# ============= libpdb++/pdb++.h ==============
if test -f 'libpdb++/pdb++.h' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'libpdb++/pdb++.h' '(file already exists)'
else
  $echo 'x -' extracting 'libpdb++/pdb++.h' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'libpdb++/pdb++.h' &&
//
//	Copyright (c) 1992 The Regents of the University of California.
//	All rights reserved.
//
//	Redistribution and use in source and binary forms are permitted
//	provided that the above copyright notice and this paragraph are
//	duplicated in all such forms and that any documentation,
//	advertising materials, and other materials related to such
//	distribution and use acknowledge that the software was developed
//	by the University of California, San Francisco.  The name of the
//	University may not be used to endorse or promote products derived
//	from this software without specific prior written permission.
//	THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
//	IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
//	WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
//	$Id: pdb++.h,v 1.14 95/02/28 14:09:49 gregc Exp $
//
//	Based on Brookhaven National Laboratory Protein Data Bank, Feb 1992
//
//	C structure declarations
//
X
#ifndef PDB_H
#define	PDB_H
X
#include <iostream>
X
class PDB {
public:
#ifdef PDB_WORKAROUND
X	enum { BufLen = 73, PDBRUNVersion = 6 };
#else
X	static const int BufLen = 73;		// PDB record length (72 + '\0')
X	static const int PDBRUNVersion = 6;	// Best version generated
#endif
X	typedef char	Date[10];
X	typedef char	AName[5];		// atom name - NO2*
X	typedef char	RName[5];		// residue name - ALA
X	typedef char	PName[5];		// pdb name - 9lyz
X	typedef char	Id[4];			// generic short id field
X	typedef double	Real;			// size of floating point
X
X	struct Residue {			// residue info
X		RName	name;
X		char	chainId;
X		int	seqNum;
X		char	insertCode;
X	};
X
X	// graphics primitive types
X	enum GfxType {
X		GFX_UNKNOWN, GFX_POINTS, GFX_MARKERS, GFX_LINES,
X		GFX_LINE_STRIP, GFX_LINE_LOOP, GFX_TRIANGLES,
X		GFX_TRIANGLE_STRIP, GFX_TRIANGLE_FAN, GFX_QUADS,
X		GFX_QUAD_STRIP, GFX_POLYGON
X	};
X
X	//
X	//	structures declarations for each record type
X	//
X
X	struct Unknown {
X		char	junk[BufLen];
X	};
X	struct Aggrgt {
X		int	serialNum;
X		int	numComponents;
X		int	cmpontSerialNums[14];
X	};
X	struct Agrdes {
X		int	num;
X		char	text[60];
X	};
X	struct Anisou {
X		int	serialNum;
X		AName	name;
X		char	altLoc;
X		Residue	residue;
X		int	u[6];
X	};
X	struct Atom {
X		int	serialNum;
X		AName	name;
X		char	altLoc;
X		Residue	residue;
X		Real	xyz[3];
X		Real	occupancy, tempFactor;
X		int	ftnoteNum;
X	};
X	struct Author {
X		char	data[61];
X		char	continuation;
X	};
X	typedef Agrdes	Cmpdes;
X	struct Cmpont {
X		int	seqNum;
X		Residue	residues[2];
X	};
X	typedef Author	Compnd;
X	struct Conect {
X		int	serialNum;
X		int	covalent[4];
X		struct {
X			int	hydrogen[2];
X			int	salt;
X		}	bonds[2];
X	};
X	struct Cryst1 {
X		Real	a, b, c;
X		Real	alpha, beta, gamma;
X		char	spaceGrp[12];
X		int	z;
X	};
X	// no structure for END
X	// no structure for ENDMDL
X	typedef Author	Expdta;
X	struct Formul {
X		int	component;
X		RName	hetId;
X		int	continuation;
X		char	exclude;	// * to exclude
X		char	formula[52];
X	};
X	typedef Agrdes	Ftnote;
X	struct Header {
X		char	classification[41];
X		Date	timestamp;
X		PName	id;
X		char	type;
X	};
X	struct Helix {
X		int	serialNum;
X		Id	id;
X		Residue	residues[2];
X		int	type;
X		char	comment[31];
X	};
X	struct Het {
X		Residue	hetGrp;
X		int	numAtoms;
X		char	text[41];
X	};
X	typedef Atom	Hetatm;
X	typedef Author	Jrnl;
X	struct Master {
X		int	numRemark;
X		int	numFtnote;
X		int	numHet;
X		int	numHelix;
X		int	numSheet;
X		int	numTurn;
X		int	numSite;
X		int	numTransform;
X		int	numCoordinate;
X		int	numTer;
X		int	numConect;
X		int	numSeqres;
X	};
X	struct Model {
X		int	num;
X	};
X	struct Mtrix {
X		int	rowNum;
X		int	serialNum;
X		Real	m1, m2, m3, v;
X		int	given;
X	};
X	typedef Agrdes	Mtxdes;
X	struct Obslte {
X		int	continuation;
X		Date	timestamp;
X		PName	oldId;
X		PName	idMap[8];
X	};
X	struct Origx {
X		int	rowNum;
X		Real	o1, o2, o3, t;
X	};
X	typedef Ftnote	Remark;
X	struct Revdat {
X		int	modification;
X		int	continuation;
X		Date	timestamp;
X		char	id[8];
X		char	modType;
X		char	corrections[31];
X	};
X	struct Scale {
X		int	rowNum;
X		Real	s1, s2, s3, u;
X	};
X	struct Seqres {
X		int	serialNum;
X		char	chainId;
X		int	count;
X		RName	names[13];
X	};
X	struct Sheet {
X		int	strandNum;
X		Id	id;
X		int	count;
X		Residue	residues[2];
X		int	sense;
X		struct {
X			AName	name;
X			Residue	residue;
X		}		atoms[2];
X	};
X	typedef Atom	Sigatm;
X	typedef Anisou	Siguij;
X	struct Site {
X		int	seqNum;
X		Id	id;
X		int	count;
X		Residue	residues[4];
X	};
X	typedef Author	Source;
X	struct Sprsde {
X		int	continuation;
X		Date	timestamp;
X		PName	id;
X		PName	supersede[8];
X	};
X	struct Ssbond {
X		int	seqNum;
X		Residue	residues[2];
X		char	comment[31];
X	};
X	typedef Agrdes	Symdes;
X	struct Symop {
X		int	rowNum;
X		int	serialNum;
X		Real	s1, s2, s3, t;
X	};
X	struct Ter {
X		int	serialNum;
X		Residue	residue;
X	};
X	struct Trnsfm {
X		int	resultSerialNum;
X		int	applySerialNum;
X		int	sourceSerialNum;
X	};
X	struct Turn {
X		int	seqNum;
X		Id	id;
X		Residue	residues[2];
X		char	comment[31];
X	};
X	struct Tvect {
X		int	serialNum;
X		Real	t1, t2, t3;
X		char	comment[31];
X	};
X	struct User {
X		char	subtype[3];
X		char	text[67];
X	};
X	struct UserPdbrun {
X		int	version;
X	};
X	struct UserEyePos {
X		Real	xyz[3];
X	};
X	typedef UserEyePos UserAtPos;
X	struct UserWindow {
X		Real	left, right, bottom, top, hither, yon;
X	};
X	struct UserFocus {
X		Real	focus;
X	};
X	struct UserViewport {
X		Real	xmin, xmax, ymin, ymax;
X	};
X	struct UserBgColor {
X		Real	rgb[3];
X	};
X	struct UserAngle {
X		int	atom0, atom1, atom2, atom3;
X		Real	angle;
X		int	which;			// version 5 -- obsolete
X	};
X	struct UserDistance {
X		int	atom0, atom1;
X		Real	distance;
X		int	which;			// version 5 -- obsolete
X	};
X	struct UserFile {
X		char	filename[62];
X		int	model;			// not in version 5
X	};
X	struct UserMarkname {			// not in version 5
X		char	markname[58];
X	};
X	typedef UserMarkname UserMark;		// not in version 5
X	struct UserCName {
X		Real	rgb[3];
X		char	name[39];
X	};
X	struct UserColor {
X		Real	rgb[3];
X		char	spec[39];
X	};
X	struct UserRadius {
X		Real	radius;
X	};
X	struct UserObject {
X		int	model;			// version 5 -- obsolete
X	};
X	struct UserEndObj {
X		int	model;			// version 5 -- obsolete
X	};
X	struct UserChain {
X		int	atom0, atom1;
X	};
X	struct UserGfxBegin {			// not in version 5
X		GfxType	primitive;
X		char	unknown[33];
X	};
X	// no structure for USER  GFX END
X	typedef UserColor UserGfxColor;
X	struct UserGfxNormal {			// not in version 5
X		Real	xyz[3];
X	};
X	typedef UserGfxNormal UserGfxVertex;
X	struct UserGfxFont {
X		int	size;
X		char	name[54];
X	};
X	struct UserGfxTextPos {			// not in version 5
X		Real	xyz[3];
X	};
X	struct UserGfxLabel {
X		Real	xyz[3];			// version 5 -- obsolete
X		char	text[57];		// 27 in version 5
X	};
X	struct UserGfxMove {			// version 5 -- obsolete
X		Real	xyz[3];
X	};
X	typedef UserGfxMove UserGfxDraw;	// version 5 -- obsolete
X	typedef UserGfxMove UserGfxMarker;	// version 5 -- obsolete
X	typedef UserGfxMove UserGfxPoint;	// version 5 -- obsolete
X
X	enum RecordType { UNKNOWN, ANISOU, ATOM, AUTHOR, COMPND, CONECT, CRYST1,
X		END, FORMUL, FTNOTE, HEADER, HELIX, HET, HETATM, JRNL, MASTER,
X		MTRIX, OBSLTE, ORIGX, REMARK, REVDAT, SCALE, SEQRES, SHEET,
X		SIGATM, SIGUIJ, SITE, SOURCE, SPRSDE, SSBOND, TER, TURN, TVECT,
X		USER, MODEL, ENDMDL, EXPDTA, SYMDES, SYMOP, MTXDES, CMPDES,
X		CMPONT, TRNSFM, AGRDES, AGGRGT,
X		USER_PDBRUN, USER_EYEPOS, USER_ATPOS, USER_WINDOW, USER_FOCUS,
X		USER_VIEWPORT, USER_BGCOLOR, USER_ANGLE, USER_DISTANCE,
X		USER_FILE, USER_MARKNAME, USER_MARK, USER_CNAME, USER_COLOR,
X		USER_RADIUS, USER_OBJECT, USER_ENDOBJ, USER_CHAIN,
X		USER_GFX_BEGIN, USER_GFX_END, USER_GFX_COLOR, USER_GFX_NORMAL,
X		USER_GFX_VERTEX, USER_GFX_FONT, USER_GFX_TEXTPOS,
X		USER_GFX_LABEL,
X		USER_GFX_MOVE, USER_GFX_DRAW, USER_GFX_MARKER, USER_GFX_POINT
X	};
#ifdef PDB_WORKAROUND
X	enum { NUM_TYPES = AGGRGT + 1,
X		NUM_USER = USER_GFX_POINT - USER_PDBRUN + 1 };
#else
X	static const int	NUM_TYPES = AGGRGT + 1;
X	static const int	NUM_USER = USER_GFX_POINT - USER_PDBRUN + 1;
#endif
private:
X	RecordType	rType;
X	static int	pdbrunInputVersion, pdbrunOutputVersion;
X	static int	byteCmp(const PDB &l, const PDB &r);
public:
X	union {
X		Unknown	unknown;
X		Aggrgt	aggrgt;
X		Agrdes	agrdes;
X		Anisou	anisou;
X		Atom	atom;
X		Author	author;
X		Cmpdes	cmpdes;
X		Cmpont	cmpont;
X		Compnd	compnd;
X		Conect	conect;
X		Cryst1	cryst1;
X		// no End structure
X		// no Endmdl structure
X		Expdta	expdta;
X		Formul	formul;
X		Ftnote	ftnote;
X		Header	header;
X		Helix	helix;
X		Het	het;
X		Hetatm	hetatm;
X		Jrnl	jrnl;
X		Master	master;
X		Model	model;
X		Mtrix	mtrix;
X		Mtxdes	mtxdes;
X		Obslte	obslte;
X		Origx	origx;
X		Remark	remark;
X		Revdat	revdat;
X		Scale	scale;
X		Seqres	seqres;
X		Sheet	sheet;
X		Sigatm	sigatm;
X		Siguij	siguij;
X		Site	site;
X		Source	source;
X		Sprsde	sprsde;
X		Ssbond	ssbond;
X		Symdes	symdes;
X		Symop	symop;
X		Ter	ter;
X		Trnsfm	trnsfm;
X		Turn	turn;
X		Tvect	tvect;
X		User	user;
X		UserPdbrun	userPdbrun;
X		UserEyePos	userEyePos;
X		UserAtPos	userAtPos;
X		UserWindow	userWindow;
X		UserFocus	userFocus;
X		UserViewport	userViewport;
X		UserBgColor	userBgColor;
X		UserAngle	userAngle;
X		UserDistance	userDistance;
X		UserFile	userFile;
X		UserMarkname	userMarkname;
X		UserMark	userMark;
X		UserCName	userCName;
X		UserColor	userColor;
X		UserRadius	userRadius;
X		UserObject	userObject;
X		UserEndObj	userEndObj;
X		UserChain	userChain;
X		UserGfxBegin	userGfxBegin;
X		// no UserGfxEnd structure
X		UserGfxColor	userGfxColor;
X		UserGfxNormal	userGfxNormal;
X		UserGfxVertex	userGfxVertex;
X		UserGfxFont	userGfxFont;
X		UserGfxTextPos	userGfxTextPos;
X		UserGfxLabel	userGfxLabel;
X		UserGfxMove	userGfxMove;
X		UserGfxDraw	userGfxDraw;
X		UserGfxMarker	userGfxMarker;
X		UserGfxPoint	userGfxPoint;
X	};
X
X			PDB() { type(UNKNOWN); }
X			PDB(RecordType t) { type(t); }
X			PDB(const char *buf);
X	RecordType	type() const { return rType; }
X	void		type(RecordType t);
X	const char	*chars() const;
X	static int	PdbrunInputVersion() { return pdbrunInputVersion; }
X	static int	PdbrunOutputVersion() { return pdbrunOutputVersion; }
X	static void	PdbrunInputVersion(int v) { pdbrunInputVersion = v; }
X	static void	PdbrunOutputVersion(int v) { pdbrunOutputVersion = v; }
X	static RecordType
X			getType(const char *buf);
X	static GfxType	getGfxType(const char *buf);
X	static const char
X			*gfxChars(GfxType gt);
X	static int	sscanf(const char *, const char *, ...);
X	static int	sprintf(char *, const char *, ...);
X
X	inline bool operator==(const PDB &r) const {
X				if (rType != r.rType)
X					return 0;
X				return byteCmp(*this, r) == 0;
X			}
X	inline bool operator!=(const PDB &r) const {
X				if (rType != r.rType)
X					return 1;
X				return byteCmp(*this, r) != 0;
X			}
X
X	friend std::istream	&operator>>(std::istream &s, PDB &p);
};
X
inline std::ostream &
operator<<(std::ostream &s, const PDB &p)
{
X	s << p.chars();
X	return s;
}
X
# endif // PDB_H
SHAR_EOF
  (set 20 04 07 28 14 03 46 'libpdb++/pdb++.h'; eval "$shar_touch") &&
  chmod 0664 'libpdb++/pdb++.h' ||
  $echo 'restore of' 'libpdb++/pdb++.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 'libpdb++/pdb++.h:' 'MD5 check failed'
7a9df75bdfd3b7d7aa879fa49429118a  libpdb++/pdb++.h
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'libpdb++/pdb++.h'`"
    test 10614 -eq "$shar_count" ||
    $echo 'libpdb++/pdb++.h:' 'original size' '10614,' 'current size' "$shar_count!"
  fi
fi
# ============= libpdb++/pdbrun5_read.i ==============
if test -f 'libpdb++/pdbrun5_read.i' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'libpdb++/pdbrun5_read.i' '(file already exists)'
else
  $echo 'x -' extracting 'libpdb++/pdbrun5_read.i' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'libpdb++/pdbrun5_read.i' &&
/*
X *	Copyright (c) 1994 The Regents of the University of California.
X *	All rights reserved.
X *
X *	Redistribution and use in source and binary forms are permitted
X *	provided that the above copyright notice and this paragraph are
X *	duplicated in all such forms and that any documentation,
X *	advertising materials, and other materials related to such
X *	distribution and use acknowledge that the software was developed
X *	by the University of California, San Francisco.  The name of the
X *	University may not be used to endorse or promote products derived
X *	from this software without specific prior written permission.
X *	THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X *	IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X *	WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X *
X *	$Id: pdbrun5_read.i,v 1.4 1994/11/16 22:09:29 gregc Exp $
X */
/* PDBRUN */	"%12  %2d",
/* EYEPOS */	"%12  %9f %9f %9f",
/* ATPOS */	"%11   %9f %9f %9f",
/* WINDOW */	"%12  %9f %9f %9f %9f %9f %9f",
/* FOCUS */	"%11  %9f",
/* VIEWPORT */	"%14  %9f %9f %9f %9f",
/* BGCOLOR */	"USER  BGCOLOR %lf %lf %lf",
/* ANGLE */	"%11  %2d %6d %6d %6d %6d %8f",
/* DISTANCE */	"%14  %2d %6d %6d %8f",
/* FILE */	"%10  %61s",
/* MARKNAME */	NULL,
/* MARK */	NULL,
/* CNAME */	"USER  CNAME %s %lf %lf %lf",
/* COLOR */	"USER  COLOR %s %lf %lf %lf",
/* RADIUS */	"%12  %7f",
/* OBJECT */	"%12  %3d",
/* ENDOBJ */	"%12  %3d",
/* CHAIN */	"USER  CHAIN %d %d",
/* GFX BEGIN */	NULL,
/* GFX END */	NULL,
/* GFX COLOR */	"USER  GFX COLOR %s %lf %lf %lf",
/* GFX NORMAL */	NULL,
/* GFX VERTEX */	NULL,
/* GFX FONT */	"USER  GFX FONT %s %d",
/* GFX TEXTPOS */	NULL,
/* GFX LABEL */	"USER  GFX LABEL %lf %lf %lf %26[^\n]",
/* GFX MOVE */	"%14  %9f %9f %9f",
/* GFX DRAW */	"%14  %9f %9f %9f",
/* GFX MARKER */	"%16  %9f %9f %9f",
/* GFX POINT */	"%15  %9f %9f %9f",
SHAR_EOF
  (set 20 04 07 28 14 02 31 'libpdb++/pdbrun5_read.i'; eval "$shar_touch") &&
  chmod 0664 'libpdb++/pdbrun5_read.i' ||
  $echo 'restore of' 'libpdb++/pdbrun5_read.i' '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 'libpdb++/pdbrun5_read.i:' 'MD5 check failed'
bb6d73bffd2f78d1a436a3ca157de1fd  libpdb++/pdbrun5_read.i
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'libpdb++/pdbrun5_read.i'`"
    test 1873 -eq "$shar_count" ||
    $echo 'libpdb++/pdbrun5_read.i:' 'original size' '1873,' 'current size' "$shar_count!"
  fi
fi
# ============= libpdb++/pdbrun5_write.i ==============
if test -f 'libpdb++/pdbrun5_write.i' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'libpdb++/pdbrun5_write.i' '(file already exists)'
else
  $echo 'x -' extracting 'libpdb++/pdbrun5_write.i' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'libpdb++/pdbrun5_write.i' &&
/*
X *	Copyright (c) 1994 The Regents of the University of California.
X *	All rights reserved.
X *
X *	Redistribution and use in source and binary forms are permitted
X *	provided that the above copyright notice and this paragraph are
X *	duplicated in all such forms and that any documentation,
X *	advertising materials, and other materials related to such
X *	distribution and use acknowledge that the software was developed
X *	by the University of California, San Francisco.  The name of the
X *	University may not be used to endorse or promote products derived
X *	from this software without specific prior written permission.
X *	THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X *	IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X *	WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X *
X *	$Id: pdbrun5_write.i,v 1.2 1994/11/16 22:09:29 gregc Exp $
X */
"USER  PDBRUN %2d",
"USER  EYEPOS %9.3f %9.3f %9.3f",
"USER  ATPOS  %9.3f %9.3f %9.3f",
"USER  WINDOW %9.3f %9.3f %9.3f %9.3f %9.3f %9.3f",
"USER  FOCUS %9.3f",
"USER  VIEWPORT %9.3f %9.3f %9.3f %9.3f",
"USER  BGCOLOR %.3f %.3f %.3f",
"USER  ANGLE %2d %6d %6d %6d %6d %8.3f",
"USER  DISTANCE %2d %6d %6d %8.3f",
"USER  FILE %-61s",
NULL,	/* USER  MARKNAME */
NULL,	/* USER  MARK */
"USER  CNAME %-.38s %.3f %.3f %.3f",
"USER  COLOR %-.38s %5.3f %5.3f %5.3f",
"USER  RADIUS %7.3f",
"USER  OBJECT %3d",
"USER  ENDOBJ %3d",
"USER  CHAIN %d %d",
NULL,	/* USER  GFX BEGIN */
NULL,	/* USER  GFX END */
"USER  GFX COLOR %-.38s %.3f %.3f %.3f",
NULL,	/* USER  GFX NORMAL */
NULL,	/* USER  GFX VERTEX */
"USER  GFX FONT %-.53s %d",
NULL,	/* USER  GFX TEXTPOS */
"USER  GFX LABEL %9.3f %9.3f %9.3f \"%-.24s\"",
"USER  GFX MOVE %9.3f %9.3f %9.3f",
"USER  GFX DRAW %9.3f %9.3f %9.3f",
"USER  GFX MARKER %9.3f %9.3f %9.3f",
"USER  GFX POINT %9.3f %9.3f %9.3f",
SHAR_EOF
  (set 20 04 07 28 14 02 31 'libpdb++/pdbrun5_write.i'; eval "$shar_touch") &&
  chmod 0664 'libpdb++/pdbrun5_write.i' ||
  $echo 'restore of' 'libpdb++/pdbrun5_write.i' '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 'libpdb++/pdbrun5_write.i:' 'MD5 check failed'
2eb90d6351de2175e9857e75c5ae0997  libpdb++/pdbrun5_write.i
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'libpdb++/pdbrun5_write.i'`"
    test 1843 -eq "$shar_count" ||
    $echo 'libpdb++/pdbrun5_write.i:' 'original size' '1843,' 'current size' "$shar_count!"
  fi
fi
# ============= libpdb++/pdbrun6_read.i ==============
if test -f 'libpdb++/pdbrun6_read.i' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'libpdb++/pdbrun6_read.i' '(file already exists)'
else
  $echo 'x -' extracting 'libpdb++/pdbrun6_read.i' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'libpdb++/pdbrun6_read.i' &&
/*
X *	Copyright (c) 1994 The Regents of the University of California.
X *	All rights reserved.
X *
X *	Redistribution and use in source and binary forms are permitted
X *	provided that the above copyright notice and this paragraph are
X *	duplicated in all such forms and that any documentation,
X *	advertising materials, and other materials related to such
X *	distribution and use acknowledge that the software was developed
X *	by the University of California, San Francisco.  The name of the
X *	University may not be used to endorse or promote products derived
X *	from this software without specific prior written permission.
X *	THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X *	IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X *	WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X *
X *	$Id: pdbrun6_read.i,v 1.3 1995/01/20 01:20:36 gregc Exp $
X */
/* PDBRUN */	"%12  %2d",
/* EYEPOS */	"%12  %9f %9f %9f",
/* ATPOS */	"%11   %9f %9f %9f",
/* WINDOW */	"%12  %9f %9f %9f %9f %9f %9f",
/* FOCUS */	"%11   %9f",
/* VIEWPORT */	"%14  %9f %9f %9f %9f",
/* BGCOLOR */	"%13  %5f %5f %5f",
/* ANGLE */	"%11  %6d %6d %6d %6d %9f",
/* DISTANCE */	"%14  %6d %6d %9f",
/* FILE */	"%10  %4d %56s",
/* MARKNAME */	"%14  %57s",
/* MARK */	"%10  %57s",
/* CNAME */	"%11  %5f %5f %5f %38s",
/* COLOR */	"%11  %5f %5f %5f %38s",
/* RADIUS */	"%12  %7f",
/* OBJECT */	"%12 ",
/* ENDOBJ */	"%12 ",
/* CHAIN */	"%11  %6d %6d",
/* GFX BEGIN */	"%15  %32s",
/* GFX END */	"%13 ",
/* GFX COLOR */	"%15  %5f %5f %5f %38s",
/* GFX NORMAL */	"%16  %9f %9f %9f",
/* GFX VERTEX */	"%16  %9f %9f %9f",
/* GFX FONT */	"%14  %3d %53s",
/* GFX TEXTPOS */	"%17  %9f %9f %9f",
/* GFX LABEL */	"%15  %56s",
/* GFX MOVE */	NULL,
/* GFX DRAW */	NULL,
/* GFX MARKER */	NULL,
/* GFX POINT */	NULL,
SHAR_EOF
  (set 20 04 07 28 14 02 31 'libpdb++/pdbrun6_read.i'; eval "$shar_touch") &&
  chmod 0664 'libpdb++/pdbrun6_read.i' ||
  $echo 'restore of' 'libpdb++/pdbrun6_read.i' '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 'libpdb++/pdbrun6_read.i:' 'MD5 check failed'
8d72fdf7d689c2c1298c25a7e855262e  libpdb++/pdbrun6_read.i
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'libpdb++/pdbrun6_read.i'`"
    test 1804 -eq "$shar_count" ||
    $echo 'libpdb++/pdbrun6_read.i:' 'original size' '1804,' 'current size' "$shar_count!"
  fi
fi
# ============= libpdb++/pdbrun6_write.i ==============
if test -f 'libpdb++/pdbrun6_write.i' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'libpdb++/pdbrun6_write.i' '(file already exists)'
else
  $echo 'x -' extracting 'libpdb++/pdbrun6_write.i' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'libpdb++/pdbrun6_write.i' &&
/*
X *	Copyright (c) 1994 The Regents of the University of California.
X *	All rights reserved.
X *
X *	Redistribution and use in source and binary forms are permitted
X *	provided that the above copyright notice and this paragraph are
X *	duplicated in all such forms and that any documentation,
X *	advertising materials, and other materials related to such
X *	distribution and use acknowledge that the software was developed
X *	by the University of California, San Francisco.  The name of the
X *	University may not be used to endorse or promote products derived
X *	from this software without specific prior written permission.
X *	THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X *	IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X *	WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X *
X *	$Id: pdbrun6_write.i,v 1.3 1995/01/20 01:20:36 gregc Exp $
X */
"USER  PDBRUN %2d",
"USER  EYEPOS %9.3f %9.3f %9.3f",
"USER  ATPOS  %9.3f %9.3f %9.3f",
"USER  WINDOW %9.3f %9.3f %9.3f %9.3f %9.3f %9.3f",
"USER  FOCUS  %9.3f",
"USER  VIEWPORT %9.3f %9.3f %9.3f %9.3f",
"USER  BGCOLOR %5.3f %5.3f %5.3f",
"USER  ANGLE %6d %6d %6d %6d %9.3f",
"USER  DISTANCE %6d %6d %9.3f",
"USER  FILE %4d %-56s",
"USER  MARKNAME %-57s",
"USER  MARK %-57s",
"USER  CNAME %5.3f %5.3f %5.3f %-42s",
"USER  COLOR %5.3f %5.3f %5.3f %-42s",
"USER  RADIUS %7.3f",
"USER  OBJECT",
"USER  ENDOBJ",
"USER  CHAIN %6d %6d",
"USER  GFX BEGIN %-32s",
"USER  GFX END",
"USER  GFX COLOR %5.3f %5.3f %5.3f %s",
"USER  GFX NORMAL %9.3f %9.3f %9.3f",
"USER  GFX VERTEX %9.3f %9.3f %9.3f",
"USER  GFX FONT %3d %-53s",
"USER  GFX TEXTPOS %9.3f %9.3f %9.3f",
"USER  GFX LABEL %-56s",
NULL,	/* USER  GFX MOVE */
NULL,	/* USER  GFX DRAW */
NULL,	/* USER  GFX MARKER */
NULL,	/* USER  GFX POINT */
SHAR_EOF
  (set 20 04 07 28 14 02 31 'libpdb++/pdbrun6_write.i'; eval "$shar_touch") &&
  chmod 0664 'libpdb++/pdbrun6_write.i' ||
  $echo 'restore of' 'libpdb++/pdbrun6_write.i' '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 'libpdb++/pdbrun6_write.i:' 'MD5 check failed'
6e7825b5b613f7a15dd86413296f9187  libpdb++/pdbrun6_write.i
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'libpdb++/pdbrun6_write.i'`"
    test 1787 -eq "$shar_count" ||
    $echo 'libpdb++/pdbrun6_write.i:' 'original size' '1787,' 'current size' "$shar_count!"
  fi
fi
# ============= libpdb++/read_format.i ==============
if test -f 'libpdb++/read_format.i' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'libpdb++/read_format.i' '(file already exists)'
else
  $echo 'x -' extracting 'libpdb++/read_format.i' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'libpdb++/read_format.i' &&
/*
X *	Copyright (c) 1993 The Regents of the University of California.
X *	All rights reserved.
X *
X *	Redistribution and use in source and binary forms are permitted
X *	provided that the above copyright notice and this paragraph are
X *	duplicated in all such forms and that any documentation,
X *	advertising materials, and other materials related to such
X *	distribution and use acknowledge that the software was developed
X *	by the University of California, San Francisco.  The name of the
X *	University may not be used to endorse or promote products derived
X *	from this software without specific prior written permission.
X *	THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X *	IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X *	WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X *
X *	$Id: read_format.i,v 1.2 93/04/21 19:55:49 gregc Exp $
X */
/* UNKNOWN */	NULL,
/* ANISOU */	"%6 %5d %4s%c%4s%c%4d%c %7d%7d%7d%7d%7d%7d",	/* SIGUIJ */
/* ATOM */	"%6 %5d %4s%c%4s%c%4d%c   %8f%8f%8f%6f%6f %3d",	/* HETATM, SIGATM */
/* AUTHOR */	"%9 %c%60s",		/* COMPND, EXPDTA, JRNL, SOURCE */
/* COMPND */	"%9 %c%60s",			/* AUTHOR */
/* CONECT */	"%6 %5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d",
/* CRYST1 */	"%6 %9f%9f%9f%7f%7f%7f %11s%4d",
/* END */	NULL,
/* FORMUL */	"%8 %2d  %4s%2d%c%51s",
/* FTNOTE */	"%7 %3d %59s",	/*  REMARK, SYMDES, MTXDES, CMPDES, AGRDES */
/* HEADER */	"%10 %40s%9s  %c%4s",
/* HELIX */	"%7 %3d %3s %4s%c %4d%c %4s%c %4d%c%2d%30s",
/* HET */	"%7 %4s %c%4d%c  %5d%5 %40s",
/* HETATM */	"%6 %5d %4s%c%4s%c%4d%c   %8f%8f%8f%6f%6f %3d",	/* ATOM */
/* JRNL */	"%9 %c%60s",			/* AUTHOR */
/* MASTER */	"%10 %5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d",
/* MTRIX */	"%5 %d %3d%10f%10f%10f%5 %10f   %2d",
/* OBSLTE */	"%8 %2d %9s %4s%6 %4s %4s %4s %4s %4s %4s %4s %4s",
/* ORIGX */	"%5 %d%4 %10f%10f%10f%5 %10f",	/* SCALE */
/* REMARK */	"%7 %3d %59s",			/* FTNOTE */
/* REVDAT */	"%7 %3d%2d %9s %7s %c%7 %31s",
/* SCALE */	"%5 %d%4 %10f%10f%10f%5 %10f",
/* SEQRES */	"%6 %4d %c %4d  %4s%4s%4s%4s%4s%4s%4s%4s%4s%4s%4s%4s%4s",
/* SHEET */	"%6 %4d %3s%2d %4s%c%4d%c %4s%c%4d%c%2d %4s%4s%c%4d%c %4s%4s%c%4d%c",
/* SIGATM */	"%6 %5d %4s%c%4s%c%4d%c   %8f%8f%8f%6f%6f %3d",	/* ATOM */
/* SIGUIJ */	"%6 %5d %4s%c%4s%c%4d%c %7d%7d%7d%7d%7d%7d",	/* ANISOU */
/* SITE */	"%7 %3d %3s %2d %4s%c%4d%c %4s%c%4d%c %4s%c%4d%c %4s%c%4d%c",
/* SOURCE */	"%9 %c%60s",			/* AUTHOR */
/* SPRSDE */	"%8 %2d %9s %4s%6 %4s %4s %4s %4s %4s %4s %4s %4s",
/* SSBOND */	"%7 %3d %4s%c %4d%c   %4s%c %4d%c%4 %30s",
/* TER */	"%6 %5d%6 %4s%c%4d%c",
/* TURN */	"%7 %3d %3s %4s%c%4d%c %4s%c%4d%c%4 %30s",
/* TVECT */	"%7 %3d%10f%10f%10f%30s",
/* USER */	"%4 %2s%66s",
/* MODEL */	"%9 %5d",
/* ENDMDL */	NULL,
/* EXPDTA */	"%9 %c%60s",			/* AUTHOR */
/* SYMDES */	"%7 %3d %59s",			/* FTNOTE */
/* SYMOP */	"%5 %d %3d%10f%10f%10f%5 %10f",
/* MTXDES */	"%7 %3d %59s",			/* FTNOTE */
/* CMPDES */	"%7 %3d %59s",			/* FTNOTE */
/* CMPONT */	"%7 %3d %4s%c %4d%c %4s%c %4d%c",
/* TRNSFM */	"%7 %3d %3d %3d",
/* AGRDES */	"%7 %3d %59s",			/* FTNOTE */
/* AGGRGT */	"%7 %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d",
SHAR_EOF
  (set 20 04 07 28 14 02 31 'libpdb++/read_format.i'; eval "$shar_touch") &&
  chmod 0664 'libpdb++/read_format.i' ||
  $echo 'restore of' 'libpdb++/read_format.i' '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 'libpdb++/read_format.i:' 'MD5 check failed'
671992088e70c64c967b1d24cc5edcfb  libpdb++/read_format.i
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'libpdb++/read_format.i'`"
    test 3131 -eq "$shar_count" ||
    $echo 'libpdb++/read_format.i:' 'original size' '3131,' 'current size' "$shar_count!"
  fi
fi
# ============= libpdb++/write_format.i ==============
if test -f 'libpdb++/write_format.i' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'libpdb++/write_format.i' '(file already exists)'
else
  $echo 'x -' extracting 'libpdb++/write_format.i' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'libpdb++/write_format.i' &&
/*
X *	Copyright (c) 1993 The Regents of the University of California.
X *	All rights reserved.
X *
X *	Redistribution and use in source and binary forms are permitted
X *	provided that the above copyright notice and this paragraph are
X *	duplicated in all such forms and that any documentation,
X *	advertising materials, and other materials related to such
X *	distribution and use acknowledge that the software was developed
X *	by the University of California, San Francisco.  The name of the
X *	University may not be used to endorse or promote products derived
X *	from this software without specific prior written permission.
X *	THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X *	IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X *	WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X *
X *	$Id: write_format.i,v 1.3 93/06/24 11:53:47 gregc Exp $
X */
"UNKNOWN:  ??%-6.6s??",
"ANISOU%5d %-4s%c%-4s%c%4d%c %7d%7d%7d%7d%7d%7d",	/* SIGUIJ */
"ATOM  %5d %-4s%c%-4s%c%4d%c   %8.3f%8.3f%8.3f%6.2f%6.2f %3D", /* HETATM, SIGATM */
"AUTHOR   %c%-60s",			/* COMPND, EXPDTA, JRNL, SOURCE */
"COMPND   %c%-60s",					/* AUTHOR */
"CONECT%5d%5D%5D%5D%5D%5D%5D%5D%5D%5D%5D",
"CRYST1%9.3f%9.3f%9.3f%7.2f%7.2f%7.2f %-11s%4d",
"END",
"FORMUL  %2D  %-4s%2D%c%-51s",
"FTNOTE %3D %-59s",					/* REMARK */
"HEADER    %-40s%-11s%c%-4s",
"HELIX  %3D %3s %-4s%c %4d%c %-4s%c %4d%c%2D%-30s",
"HET    %-4s %c%4d%c  %5d     %-40s",
"HETATM%5d %-4s%c%-4s%c%4d%c   %8.3f%8.3f%8.3f%6.2f%6.2f %3D",
"JRNL     %c%-60s",					/* AUTHOR */
"MASTER    %5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d",
"MTRIX%1d %3d%10.6f%10.6f%10.6f     %10.5f   %2D",
"OBSLTE  %2D %-9s %-10s%-5s%-5s%-5s%-5s%-5s%-5s%-5s%-4s",
"ORIGX%1d    %10.6f%10.6f%10.6f     %10.5f",		/* SCALE */
"REMARK %3D %-59s",
"REVDAT %3D%2D %-9s %-7s %c       %-31s",
"SCALE%1d    %10.6f%10.6f%10.6f     %10.5f",		/* ORIGX */
"SEQRES%4d %c %4d  %-4s%-4s%-4s%-4s%-4s%-4s%-4s%-4s%-4s%-4s%-4s%-4s%-4s",
"SHEET %4D %3s%2d %-4s%c%4d%c %-4s%c%4d%c%2d %-4s%-4s%c%4D%c %-4s%-4s%c%4D%c",
"SIGATM%5d %-4s%c%-4s%c%4d%c   %8.3f%8.3f%8.3f%6.2f%6.2f %3D",
"SIGUIJ%5d %-4s%c%-4s%c%4d%c %7D%7D%7D%7D%7D%7D",	/* ANISOU */
"SITE   %3d %3s %2d %-4s%c%4D%c %-4s%c%4D%c %-4s%c%4D%c %-4s%c%4D%c",
"SOURCE   %c%-60s",					/* AUTHOR */
"SPRSDE  %2D %-9s %-10s%-5s%-5s%-5s%-5s%-5s%-5s%-5s%-4s",
"SSBOND %3D %-4s%c %4d%c   %-4s%c %4D%c    %-30s",
"TER   %5d      %-4s%c%4d%c",
"TURN   %3D %3s %-4s%c%4d%c %-4s%c%4d%c    %-30s",
"TVECT  %3D%10.5f%10.5f%10.5f%-30s",
"USER%-2s%-66s",
"MODEL    %5d",
"ENDMDL",
"EXPDTA   %c%-60s",					/* AUTHOR */
"SYMDES %3d %59s",					/* FTNOTE */
"SYMOP%1d %3d%10.6f%10.6f%10.6f     %10.5f",
"MTXDES %3d %59s",					/* FTNOTE */
"CMPDES %3d %59s",					/* FTNOTE */
"CMPONT %3d %4s%c %4d%c %4s%c %4d%c",
"TRNSFM %3d %3d %3d",
"AGRDES %3d %59s",					/* FTNOTE */
"AGGRGT %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d",
SHAR_EOF
  (set 20 04 07 28 14 02 31 'libpdb++/write_format.i'; eval "$shar_touch") &&
  chmod 0664 'libpdb++/write_format.i' ||
  $echo 'restore of' 'libpdb++/write_format.i' '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 'libpdb++/write_format.i:' 'MD5 check failed'
58ff97a7c0e597246c42aa4f2243ad50  libpdb++/write_format.i
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'libpdb++/write_format.i'`"
    test 2897 -eq "$shar_count" ||
    $echo 'libpdb++/write_format.i:' 'original size' '2897,' 'current size' "$shar_count!"
  fi
fi
# ============= libpdb++/pdb++.cc ==============
if test -f 'libpdb++/pdb++.cc' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'libpdb++/pdb++.cc' '(file already exists)'
else
  $echo 'x -' extracting 'libpdb++/pdb++.cc' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'libpdb++/pdb++.cc' &&
//
//	Copyright (c) 1992 The Regents of the University of California.
//	All rights reserved.
//
//	Redistribution and use in source and binary forms are permitted
//	provided that the above copyright notice and this paragraph are
//	duplicated in all such forms and that any documentation,
//	advertising materials, and other materials related to such
//	distribution and use acknowledge that the software was developed
//	by the University of California, San Francisco.  The name of the
//	University may not be used to endorse or promote products derived
//	from this software without specific prior written permission.
//	THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
//	IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
//	WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
//	$Id: pdb++.cc,v 1.6 1994/12/13 22:41:17 gregc Exp $
//
X
#include "pdb++.h"
X
extern "C" {
#include <string.h>
}
X
void
PDB::type(RecordType t)
{
X	if (t == UNKNOWN) {
X		// optimize default case (skip memset())
X		rType = t;
X		unknown.junk[0] = '\0';
X		return;
X	}
X	memset(this, 0, sizeof *this);
X	rType = t;
X	switch (t) {
X	default:
X		break;
X	case ATOM:
X		atom.occupancy = 1.0;
X		break;
X	}
}
X
int
PDB::byteCmp(const PDB &l, const PDB &r)
{
X	return memcmp(&l, &r, sizeof (PDB));
}
SHAR_EOF
  (set 20 04 07 28 14 02 31 'libpdb++/pdb++.cc'; eval "$shar_touch") &&
  chmod 0664 'libpdb++/pdb++.cc' ||
  $echo 'restore of' 'libpdb++/pdb++.cc' '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 'libpdb++/pdb++.cc:' 'MD5 check failed'
27609c5f4ff6fa084ba4a320ef3178bb  libpdb++/pdb++.cc
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'libpdb++/pdb++.cc'`"
    test 1306 -eq "$shar_count" ||
    $echo 'libpdb++/pdb++.cc:' 'original size' '1306,' 'current size' "$shar_count!"
  fi
fi
# ============= libpdb++/pdb_chars.cc ==============
if test -f 'libpdb++/pdb_chars.cc' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'libpdb++/pdb_chars.cc' '(file already exists)'
else
  $echo 'x -' extracting 'libpdb++/pdb_chars.cc' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'libpdb++/pdb_chars.cc' &&
//
//	Copyright (c) 1989,1992 The Regents of the University of California.
//	All rights reserved.
//
//	Redistribution and use in source and binary forms are permitted
//	provided that the above copyright notice and this paragraph are
//	duplicated in all such forms and that any documentation,
//	advertising materials, and other materials related to such
//	distribution and use acknowledge that the software was developed
//	by the University of California, San Francisco.  The name of the
//	University may not be used to endorse or promote products derived
//	from this software without specific prior written permission.
//	THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
//	IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
//	WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
//	$Id: pdb_chars.cc,v 1.8 95/02/28 14:09:52 gregc Exp $
//
//	subroutine for writing PDB format files
//
X
# include	"pdb++.h"
extern "C" {
# include	<ctype.h>
}
extern "C" int	sprintf(char *, const char *, ...);
X
static char const * const pdbRecordFormat[PDB::NUM_TYPES] = {
#include "write_format.i"
};
X
static char const * const pdbrun5[PDB::NUM_USER] = {
#include "pdbrun5_write.i"
};
X
static char const * const pdbrun6[PDB::NUM_USER] = {
#include "pdbrun6_write.i"
};
X
const char *
PDB::chars(void) const
{
X	static char	buf[BufLen];
X	const char	*fmt;
X	const Sheet	*sh;
X	const Residue	*shr0, *shr1, *sha0, *sha1;
X	int		count;
X
X	// convert C structure to pdb record
X
X	if (rType < USER_PDBRUN)
X		fmt = pdbRecordFormat[rType];
X	else if (pdbrunOutputVersion < 6)
X		fmt = pdbrun5[rType - USER_PDBRUN];
X	else
X		fmt = pdbrun6[rType - USER_PDBRUN];
X	switch (rType) {
X
X	case UNKNOWN:
X		count = sprintf(buf, fmt, unknown.junk);
X		break;
X
X	case AGGRGT:
X		count = sprintf(buf, fmt, aggrgt.serialNum,
X			aggrgt.numComponents, aggrgt.cmpontSerialNums[0],
X			aggrgt.cmpontSerialNums[1],
X			aggrgt.cmpontSerialNums[2],
X			aggrgt.cmpontSerialNums[3],
X			aggrgt.cmpontSerialNums[4],
X			aggrgt.cmpontSerialNums[5],
X			aggrgt.cmpontSerialNums[6],
X			aggrgt.cmpontSerialNums[7],
X			aggrgt.cmpontSerialNums[8],
X			aggrgt.cmpontSerialNums[9],
X			aggrgt.cmpontSerialNums[10],
X			aggrgt.cmpontSerialNums[11],
X			aggrgt.cmpontSerialNums[12],
X			aggrgt.cmpontSerialNums[13]);
X		break;
X
X	case AGRDES:
X	case CMPDES:
X	case FTNOTE:
X	case MTXDES:
X	case REMARK:
X	case SYMDES:
X		count = sprintf(buf, fmt, agrdes.num, agrdes.text);
X		break;
X
X	case ANISOU:
X	case SIGUIJ:
X		count = sprintf(buf, fmt, anisou.serialNum, anisou.name,
X			anisou.altLoc, anisou.residue.name,
X			anisou.residue.chainId, anisou.residue.seqNum,
X			anisou.residue.insertCode, anisou.u[0], anisou.u[1],
X			anisou.u[2], anisou.u[3], anisou.u[4], anisou.u[5]);
X		break;
X
X	case ATOM:
X	case HETATM:
X	case SIGATM:
X		count = sprintf(buf, fmt, atom.serialNum, atom.name,
X			atom.altLoc, atom.residue.name, atom.residue.chainId,
X			atom.residue.seqNum, atom.residue.insertCode,
X			atom.xyz[0], atom.xyz[1], atom.xyz[2], atom.occupancy,
X			atom.tempFactor, atom.ftnoteNum);
X		break;
X
X	case AUTHOR:
X	case COMPND:
X	case JRNL:
X	case SOURCE:
X	case EXPDTA:
X		count = sprintf(buf, fmt, author.continuation, author.data);
X		break;
X
X	case CONECT:
X		count = sprintf(buf, fmt, conect.serialNum,
X			conect.covalent[0], conect.covalent[1],
X			conect.covalent[2], conect.covalent[3],
X			conect.bonds[0].hydrogen[0],
X			conect.bonds[0].hydrogen[1], conect.bonds[0].salt,
X			conect.bonds[1].hydrogen[0],
X			conect.bonds[1].hydrogen[1], conect.bonds[1].salt);
X		break;
X
X	case CMPONT:
X		count = sprintf(buf, fmt, cmpont.seqNum,
X			cmpont.residues[0].name, cmpont.residues[0].chainId,
X			cmpont.residues[0].seqNum,
X			cmpont.residues[0].insertCode,
X			cmpont.residues[1].name, cmpont.residues[1].chainId,
X			cmpont.residues[1].seqNum,
X			cmpont.residues[1].insertCode);
X		break;
X
X	case CRYST1:
X		count = sprintf(buf, fmt, cryst1.a, cryst1.b, cryst1.c,
X			cryst1.alpha, cryst1.beta, cryst1.gamma,
X			cryst1.spaceGrp, cryst1.z);
X		break;
X
X	case END:
X	case ENDMDL:
X		count = sprintf(buf, fmt);
X		break;
X
X	case FORMUL:
X		count = sprintf(buf, fmt, formul.component, formul.hetId,
X			formul.continuation, formul.exclude, formul.formula);
X		break;
X
X	case HEADER:
X		count = sprintf(buf, fmt, header.classification,
X			header.timestamp, header.type, header.id);
X		break;
X
X	case HELIX:
X		count = sprintf(buf, fmt, helix.serialNum, helix.id,
X			helix.residues[0].name, helix.residues[0].chainId,
X			helix.residues[0].seqNum,
X			helix.residues[0].insertCode, helix.residues[1].name,
X			helix.residues[1].chainId, helix.residues[1].seqNum,
X			helix.residues[1].insertCode, helix.type,
X			helix.comment);
X		break;
X
X	case HET:
X		count = sprintf(buf, fmt, het.hetGrp.name,
X			het.hetGrp.chainId, het.hetGrp.seqNum,
X			het.hetGrp.insertCode, het.numAtoms, het.text);
X		break;
X
X	case MASTER:
X		count = sprintf(buf, fmt, master.numRemark, master.numFtnote,
X			master.numHet, master.numHelix, master.numSheet,
X			master.numTurn, master.numSite, master.numTransform,
X			master.numCoordinate, master.numTer,
X			master.numConect, master.numSeqres);
X		break;
X
X	case MODEL:
X		count = sprintf(buf, fmt, model.num);
X		break;
X
X	case MTRIX:
X		count = sprintf(buf, fmt, mtrix.rowNum, mtrix.serialNum,
X			mtrix.m1, mtrix.m2, mtrix.m3, mtrix.v, mtrix.given);
X		break;
X
X	case OBSLTE:
X		count = sprintf(buf, fmt, obslte.continuation, obslte.timestamp,
X			obslte.oldId, obslte.idMap[0], obslte.idMap[1],
X			obslte.idMap[2], obslte.idMap[3], obslte.idMap[4],
X			obslte.idMap[2], obslte.idMap[6], obslte.idMap[7]);
X		break;
X
X	case ORIGX:
X		count = sprintf(buf, fmt, origx.rowNum, origx.o1, origx.o2,
X			origx.o3, origx.t);
X		break;
X
X	case REVDAT:
X		count = sprintf(buf, fmt, revdat.modification,
X			revdat.continuation, revdat.timestamp, revdat.id,
X			revdat.modType, revdat.corrections);
X		break;
X
X	case SCALE:
X		count = sprintf(buf, fmt, scale.rowNum, scale.s1, scale.s2,
X			scale.s3, scale.u);
X		break;
X
X	case SEQRES:
X		count = sprintf(buf, fmt, seqres.serialNum, seqres.chainId,
X			seqres.count, seqres.names[0], seqres.names[1],
X			seqres.names[2], seqres.names[3], seqres.names[4],
X			seqres.names[5], seqres.names[6], seqres.names[7],
X			seqres.names[8], seqres.names[9], seqres.names[10],
X			seqres.names[11], seqres.names[12]);
X		break;
X
X	case SHEET:
X		sh = &sheet;
X		shr0 = &sh->residues[0];
X		shr1 = &sh->residues[1];
X		sha0 = &sh->atoms[0].residue;
X		sha1 = &sh->atoms[1].residue;
X		count = sprintf(buf, fmt, sh->strandNum, sh->id, sh->count,
X			shr0->name, shr0->chainId, shr0->seqNum,
X			shr0->insertCode, shr1->name, shr1->chainId,
X			shr1->seqNum, shr1->insertCode, sh->sense,
X			sh->atoms[0].name, sha0->name, sha0->chainId,
X			sha0->seqNum, sha0->insertCode, sh->atoms[1].name,
X			sha1->name, sha1->chainId, sha1->seqNum,
X			sha1->insertCode);
X		break;
X
X	case SITE:
X		shr0 = &site.residues[0];
X		shr1 = &site.residues[1];
X		sha0 = &site.residues[2];
X		sha1 = &site.residues[3];
X		count = sprintf(buf, fmt, site.seqNum, site.id, site.count,
X			shr0->name, shr0->chainId, shr0->seqNum,
X			shr0->insertCode,
X			shr1->name, shr1->chainId, shr1->seqNum,
X			shr1->insertCode,
X			sha0->name, sha0->chainId, sha0->seqNum,
X			sha0->insertCode,
X			sha1->name, sha1->chainId, sha1->seqNum,
X			sha1->insertCode);
X		break;
X
X	case SPRSDE:
X		count = sprintf(buf, fmt, sprsde.continuation, sprsde.timestamp,
X			sprsde.id, sprsde.supersede[0], sprsde.supersede[1],
X			sprsde.supersede[2], sprsde.supersede[3],
X			sprsde.supersede[4], sprsde.supersede[5],
X			sprsde.supersede[6], sprsde.supersede[7]);
X		break;
X
X	case SSBOND:
X		count = sprintf(buf, fmt, ssbond.seqNum,
X			ssbond.residues[0].name, ssbond.residues[0].chainId,
X			ssbond.residues[0].seqNum,
X			ssbond.residues[0].insertCode,
X			ssbond.residues[1].name, ssbond.residues[1].chainId,
X			ssbond.residues[1].seqNum,
X			ssbond.residues[1].insertCode, ssbond.comment);
X		break;
X
X	case SYMOP:
X		count = sprintf(buf, fmt, symop.rowNum, symop.serialNum,
X			symop.s1, symop.s2, symop.s3, symop.t);
X		break;
X
X	case TER:
X		count = sprintf(buf, fmt, ter.serialNum, ter.residue.name,
X			ter.residue.chainId, ter.residue.seqNum,
X			ter.residue.insertCode);
X		break;
X
X	case TRNSFM:
X		count = sprintf(buf, fmt, trnsfm.resultSerialNum,
X			trnsfm.applySerialNum, trnsfm.sourceSerialNum);
X		break;
X
X	case TURN:
X		count = sprintf(buf, fmt, turn.seqNum, turn.id,
X			turn.residues[0].name, turn.residues[0].chainId,
X			turn.residues[0].seqNum, turn.residues[0].insertCode,
X			turn.residues[1].name, turn.residues[1].chainId,
X			turn.residues[1].seqNum, turn.residues[1].insertCode,
X			turn.comment);
X		break;
X
X	case TVECT:
X		count = sprintf(buf, fmt, tvect.serialNum, tvect.t1, tvect.t2,
X			tvect.t3, tvect.comment);
X		break;
X
X	case USER:
X		count = sprintf(buf, fmt, user.subtype, user.text);
X		break;
X
X	case USER_PDBRUN:
X		count = sprintf(buf, fmt, userPdbrun.version);
X		pdbrunOutputVersion = userPdbrun.version;
X		break;
X
X	case USER_EYEPOS:
X		count = sprintf(buf, fmt, userEyePos.xyz[0], userEyePos.xyz[1],
X			userEyePos.xyz[2]);
X		break;
X
X	case USER_ATPOS:
X		count = sprintf(buf, fmt, userAtPos.xyz[0], userAtPos.xyz[1],
X			userAtPos.xyz[2]);
X		break;
X
X	case USER_WINDOW:
X		count = sprintf(buf, fmt, userWindow.left, userWindow.right,
X			userWindow.bottom, userWindow.top, userWindow.hither,
X			userWindow.yon);
X		break;
X
X	case USER_FOCUS:
X		count = sprintf(buf, fmt, userFocus.focus);
X		break;
X
X	case USER_VIEWPORT:
X		count = sprintf(buf, fmt, userViewport.xmin, userViewport.xmax,
X			userViewport.ymin, userViewport.ymax);
X		break;
X
X	case USER_BGCOLOR:
X		if (pdbrunOutputVersion < 6)
X			count = ::sprintf(buf, fmt, userBgColor.rgb[0],
X				userBgColor.rgb[1], userBgColor.rgb[2]);
X		else
X			count = sprintf(buf, fmt, userBgColor.rgb[0],
X				userBgColor.rgb[1], userBgColor.rgb[2]);
X		break;
X
X	case USER_ANGLE:
X		if (pdbrunOutputVersion < 6)
X			count = sprintf(buf, fmt, userAngle.which,
X				userAngle.atom0, userAngle.atom1,
X				userAngle.atom2, userAngle.atom3,
X				userAngle.angle);
X		else
X			count = sprintf(buf, fmt, userAngle.atom0,
X				userAngle.atom1, userAngle.atom2,
X				userAngle.atom3, userAngle.angle);
X		break;
X
X	case USER_DISTANCE:
X		if (pdbrunOutputVersion < 6)
X			count = sprintf(buf, fmt, userDistance.which,
X				userDistance.atom0, userDistance.atom1,
X				userDistance.distance);
X		else
X			count = sprintf(buf, fmt, userDistance.atom0,
X				userDistance.atom1, userDistance.distance);
X		break;
X
X	case USER_FILE:
X		if (pdbrunOutputVersion < 6)
X			count = sprintf(buf, fmt, userFile.filename);
X		else
X			count = sprintf(buf, fmt, userFile.model,
X							userFile.filename);
X		break;
X
X	case USER_MARKNAME:
X		if (pdbrunOutputVersion < 6)
X			count = 0;
X		else
X			count = sprintf(buf, fmt, userMarkname.markname);
X		break;
X
X	case USER_MARK:
X		if (pdbrunOutputVersion < 6)
X			count = 0;
X		else
X			count = sprintf(buf, fmt, userMark.markname);
X		break;
X
X	case USER_CNAME:
X		if (pdbrunOutputVersion < 6)
X			count = ::sprintf(buf, fmt, userCName.name,
X				userCName.rgb[0], userCName.rgb[1],
X				userCName.rgb[2]);
X		else
X			count = sprintf(buf, fmt, userCName.rgb[0],
X				userCName.rgb[1], userCName.rgb[2],
X				userCName.name);
X		break;
X
X	case USER_COLOR:
X		if (pdbrunOutputVersion < 6)
X			count = ::sprintf(buf, fmt, userColor.spec,
X				userColor.rgb[0], userColor.rgb[1],
X				userColor.rgb[2]);
X		else
X			count = sprintf(buf, fmt, userColor.rgb[0],
X				userColor.rgb[1], userColor.rgb[2],
X				userColor.spec);
X		break;
X
X	case USER_RADIUS:
X		count = sprintf(buf, fmt, userRadius.radius);
X		break;
X
X	case USER_OBJECT:
X		count = sprintf(buf, fmt, userObject.model);
X		break;
X
X	case USER_ENDOBJ:
X		count = sprintf(buf, fmt, userEndObj.model);
X		break;
X
X	case USER_CHAIN:
X		if (pdbrunOutputVersion < 6)
X			count = ::sprintf(buf, fmt, userChain.atom0,
X				userChain.atom1);
X		else
X			count = sprintf(buf, fmt, userChain.atom0,
X				userChain.atom1);
X		break;
X
X	case USER_GFX_BEGIN:
X		if (pdbrunOutputVersion < 6)
X			count = 0;
X		else if (userGfxBegin.primitive == GFX_UNKNOWN)
X			count = sprintf(buf, fmt, userGfxBegin.unknown);
X		else
X			count = sprintf(buf, fmt,
X					gfxChars(userGfxBegin.primitive));
X		break;
X
X	case USER_GFX_END:
X		if (pdbrunOutputVersion < 6)
X			count = 0;
X		else
X			count = sprintf(buf, fmt);
X		break;
X
X	case USER_GFX_COLOR:
X		if (pdbrunOutputVersion < 6)
X			count = ::sprintf(buf, fmt, userGfxColor.spec,
X				userGfxColor.rgb[0], userGfxColor.rgb[1],
X				userGfxColor.rgb[2]);
X		else
X			count = sprintf(buf, fmt, userGfxColor.rgb[0],
X				userGfxColor.rgb[1], userGfxColor.rgb[2],
X				userGfxColor.spec);
X		break;
X
X	case USER_GFX_NORMAL:
X		if (pdbrunOutputVersion < 6)
X			count = 0;
X		else
X			count = sprintf(buf, fmt, userGfxNormal.xyz[0],
X				userGfxNormal.xyz[1], userGfxNormal.xyz[2]);
X		break;
X
X	case USER_GFX_VERTEX:
X		if (pdbrunOutputVersion < 6)
X			count = 0;
X		else
X			count = sprintf(buf, fmt, userGfxVertex.xyz[0],
X				userGfxVertex.xyz[1], userGfxVertex.xyz[2]);
X		break;
X
X	case USER_GFX_FONT:
X		if (pdbrunOutputVersion < 6)
X			count = ::sprintf(buf, fmt, userGfxFont.name,
X				userGfxFont.size);
X		else
X			count = sprintf(buf, fmt, userGfxFont.size,
X				userGfxFont.name);
X		break;
X
X	case USER_GFX_TEXTPOS:
X		if (pdbrunOutputVersion < 6)
X			count = 0;
X		else
X			count = sprintf(buf, fmt, userGfxTextPos.xyz[0],
X				userGfxTextPos.xyz[1], userGfxTextPos.xyz[2]);
X		break;
X
X	case USER_GFX_LABEL:
X		if (pdbrunOutputVersion < 6)
X			count = ::sprintf(buf, fmt, userGfxLabel.xyz[0],
X				userGfxLabel.xyz[1], userGfxLabel.xyz[2],
X				userGfxLabel.text);
X		else
X			count = sprintf(buf, fmt, userGfxLabel.text);
X		break;
X
X	case USER_GFX_MOVE:
X		if (pdbrunOutputVersion >= 6)
X			count = 0;
X		else
X			count = sprintf(buf, fmt, userGfxMove.xyz[0],
X				userGfxMove.xyz[1], userGfxMove.xyz[2]);
X		break;
X
X	case USER_GFX_DRAW:
X		if (pdbrunOutputVersion >= 6)
X			count = 0;
X		else
X			count = sprintf(buf, fmt, userGfxDraw.xyz[0],
X				userGfxDraw.xyz[1], userGfxDraw.xyz[2]);
X		break;
X
X	case USER_GFX_MARKER:
X		if (pdbrunOutputVersion >= 6)
X			count = 0;
X		else
X			count = sprintf(buf, fmt, userGfxMarker.xyz[0],
X				userGfxMarker.xyz[1], userGfxMarker.xyz[2]);
X		break;
X
X	case USER_GFX_POINT:
X		if (pdbrunOutputVersion >= 6)
X			count = 0;
X		else
X			count = sprintf(buf, fmt, userGfxPoint.xyz[0],
X				userGfxPoint.xyz[1], userGfxPoint.xyz[2]);
X		break;
X
X	default:
X		count = sprintf(buf, "unknown pdb record #%d", rType);
X		break;
X	}
X
X	// find last non-blank in buf, and shorten it
X	while (count > 1 && isspace(buf[count - 1]))
X		count -= 1;
X	buf[count] = '\0';
X	return buf;
}
SHAR_EOF
  (set 20 04 07 28 14 02 31 'libpdb++/pdb_chars.cc'; eval "$shar_touch") &&
  chmod 0664 'libpdb++/pdb_chars.cc' ||
  $echo 'restore of' 'libpdb++/pdb_chars.cc' '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 'libpdb++/pdb_chars.cc:' 'MD5 check failed'
9550de880fe6cb3e11729fb1a5252884  libpdb++/pdb_chars.cc
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'libpdb++/pdb_chars.cc'`"
    test 14454 -eq "$shar_count" ||
    $echo 'libpdb++/pdb_chars.cc:' 'original size' '14454,' 'current size' "$shar_count!"
  fi
fi
# ============= libpdb++/pdb_read.cc ==============
if test -f 'libpdb++/pdb_read.cc' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'libpdb++/pdb_read.cc' '(file already exists)'
else
  $echo 'x -' extracting 'libpdb++/pdb_read.cc' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'libpdb++/pdb_read.cc' &&
//
//	Copyright (c) 1989, 1992 The Regents of the University of California.
//	All rights reserved.
//
//	Redistribution and use in source and binary forms are permitted
//	provided that the above copyright notice and this paragraph are
//	duplicated in all such forms and that any documentation,
//	advertising materials, and other materials related to such
//	distribution and use acknowledge that the software was developed
//	by the University of California, San Francisco.  The name of the
//	University may not be used to endorse or promote products derived
//	from this software without specific prior written permission.
//	THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
//	IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
//	WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
//	$Id: pdb_read.cc,v 1.8 95/02/28 14:09:28 gregc Exp $
//
//	subroutine for reading PDB format files
//
X
# include	"pdb++.h"
# include	<string.h>
X
# ifndef NULL
# define	NULL		0
# endif
X
extern "C" int	sscanf(const char *, const char *, ...);
X
//
//	for each pdb record type there is a format reading in the
//	record values and for printing them out.
//
//	The actual format of a line written, is the print format
//	followed by blank padding to 72 characters, followed by
//	8 characters of file and line information.
//
X
static char const * const pdbRecordFormat[PDB::NUM_TYPES] = {
#include "read_format.i"
};
X
static char const * const pdbrun5[PDB::NUM_USER] = {
#include "pdbrun5_read.i"
};
X
static char const * const pdbrun6[PDB::NUM_USER] = {
#include "pdbrun6_read.i"
};
X
PDB::PDB(const char *buf)
{
X	const char	*fmt;
X	Sheet		*sh;
X	Residue		*sha0, *sha1;
X
X	// convert pdb record to C structure
X
X	memset(this, 0, sizeof *this);
X	rType = getType(buf);
X	if (rType < USER_PDBRUN)
X		fmt = pdbRecordFormat[rType];
X	else if (pdbrunInputVersion < 6)
X		fmt = pdbrun5[rType - USER_PDBRUN];
X	else
X		fmt = pdbrun6[rType - USER_PDBRUN];
X	switch (rType) {
X
X	default:
X	case UNKNOWN:
unknown:
X		rType = UNKNOWN;		// in case of goto
X		(void) sprintf(unknown.junk, "%72s", buf);
X		break;
X
X	case AGGRGT:
X		if (0 > sscanf(buf, fmt, &aggrgt.serialNum,
X				&aggrgt.numComponents,
X				&aggrgt.cmpontSerialNums[0],
X				&aggrgt.cmpontSerialNums[1],
X				&aggrgt.cmpontSerialNums[2],
X				&aggrgt.cmpontSerialNums[3],
X				&aggrgt.cmpontSerialNums[4],
X				&aggrgt.cmpontSerialNums[5],
X				&aggrgt.cmpontSerialNums[6],
X				&aggrgt.cmpontSerialNums[7],
X				&aggrgt.cmpontSerialNums[8],
X				&aggrgt.cmpontSerialNums[9],
X				&aggrgt.cmpontSerialNums[10],
X				&aggrgt.cmpontSerialNums[11],
X				&aggrgt.cmpontSerialNums[12],
X				&aggrgt.cmpontSerialNums[13]))
X			goto unknown;
X		break;
X
X	case AGRDES:
X	case CMPDES:
X	case FTNOTE:
X	case MTXDES:
X	case REMARK:
X	case SYMDES:
X		if (0 > sscanf(buf, fmt, &agrdes.num, agrdes.text))
X			goto unknown;
X		break;
X
X	case ANISOU:
X	case SIGUIJ:
X		if (0 > sscanf(buf, fmt, &anisou.serialNum, anisou.name,
X				&anisou.altLoc, anisou.residue.name,
X				&anisou.residue.chainId,
X				&anisou.residue.seqNum,
X				&anisou.residue.insertCode,
X				&anisou.u[0], &anisou.u[1], &anisou.u[2],
X				&anisou.u[3], &anisou.u[4], &anisou.u[5]))
X			goto unknown;
X		break;
X
X	case ATOM:
X	case HETATM:
X	case SIGATM:
X		if (0 > sscanf(buf, fmt, &atom.serialNum, atom.name,
X				&atom.altLoc, atom.residue.name,
X				&atom.residue.chainId, &atom.residue.seqNum,
X				&atom.residue.insertCode, &atom.xyz[0],
X				&atom.xyz[1], &atom.xyz[2], &atom.occupancy,
X				&atom.tempFactor, &atom.ftnoteNum))
X			goto unknown;
X		break;
X
X	case AUTHOR:
X	case COMPND:
X	case EXPDTA:
X	case JRNL:
X	case SOURCE:
X		if (0 > sscanf(buf, fmt, &author.continuation, author.data))
X			goto unknown;
X		break;
X
X	case CONECT:
X		if (0 > sscanf(buf, fmt, &conect.serialNum,
X				&conect.covalent[0], &conect.covalent[1],
X				&conect.covalent[2], &conect.covalent[3],
X				&conect.bonds[0].hydrogen[0],
X				&conect.bonds[0].hydrogen[1],
X				&conect.bonds[0].salt,
X				&conect.bonds[1].hydrogen[0],
X				&conect.bonds[1].hydrogen[1],
X				&conect.bonds[1].salt))
X			goto unknown;
X		break;
X
X	case CMPONT:
X		if (0 > sscanf(buf, fmt, &cmpont.seqNum,
X				cmpont.residues[0].name,
X				&cmpont.residues[0].chainId,
X				&cmpont.residues[0].seqNum,
X				&cmpont.residues[0].insertCode,
X				cmpont.residues[1].name,
X				&cmpont.residues[1].chainId,
X				&cmpont.residues[1].seqNum,
X				&cmpont.residues[1].insertCode))
X			goto unknown;
X		break;
X
X	case CRYST1:
X		if (0 > sscanf(buf, fmt, &cryst1.a, &cryst1.b, &cryst1.c,
X				&cryst1.alpha, &cryst1.beta, &cryst1.gamma,
X				cryst1.spaceGrp, &cryst1.z))
X			goto unknown;
X		break;
X
X	case END:
X	case ENDMDL:
X		break;
X
X	case FORMUL:
X		if (0 > sscanf(buf, fmt, &formul.component, formul.hetId,
X				&formul.continuation, &formul.exclude,
X				formul.formula))
X			goto unknown;
X		break;
X
X	case HEADER:
X		if (0 > sscanf(buf, fmt, header.classification,
X				header.timestamp, &header.type, header.id))
X			goto unknown;
X		break;
X
X	case HELIX:
X		if (0 > sscanf(buf, fmt, &helix.serialNum, helix.id,
X				helix.residues[0].name,
X				&helix.residues[0].chainId,
X				&helix.residues[0].seqNum,
X				&helix.residues[0].insertCode,
X				helix.residues[1].name,
X				&helix.residues[1].chainId,
X				&helix.residues[1].seqNum,
X				&helix.residues[1].insertCode,
X				&helix.type, helix.comment))
X			goto unknown;
X		break;
X
X	case HET:
X		if (0 > sscanf(buf, fmt, het.hetGrp.name,
X				&het.hetGrp.chainId, &het.hetGrp.seqNum,
X				&het.hetGrp.insertCode, &het.numAtoms,
X				het.text))
X			goto unknown;
X		break;
X
X	case MASTER:
X		if (0 > sscanf(buf, fmt, &master.numRemark, &master.numFtnote,
X				&master.numHet, &master.numHelix,
X				&master.numSheet, &master.numTurn,
X				&master.numSite, &master.numTransform,
X				&master.numCoordinate, &master.numTer,
X				&master.numConect, &master.numSeqres))
X			goto unknown;
X		break;
X
X	case MODEL:
X		if (0 > sscanf(buf, fmt, &model.num))
X			goto unknown;
X		break;
X
X	case MTRIX:
X		if (0 > sscanf(buf, fmt, &mtrix.rowNum, &mtrix.serialNum,
X				&mtrix.m1, &mtrix.m2, &mtrix.m3, &mtrix.v,
X				&mtrix.given))
X			goto unknown;
X		break;
X
X	case OBSLTE:
X		if (0 > sscanf(buf, fmt, &obslte.continuation, obslte.timestamp,
X				obslte.oldId, obslte.idMap[0],
X				obslte.idMap[1], obslte.idMap[2],
X				obslte.idMap[3], obslte.idMap[4],
X				obslte.idMap[2], obslte.idMap[6],
X				obslte.idMap[7]))
X			goto unknown;
X		break;
X
X	case ORIGX:
X		if (0 > sscanf(buf, fmt, &origx.rowNum, &origx.o1, &origx.o2,
X				&origx.o3, &origx.t))
X			goto unknown;
X		break;
X
X	case REVDAT:
X		if (0 > sscanf(buf, fmt, &revdat.modification,
X				&revdat.continuation, revdat.timestamp,
X				revdat.id, &revdat.modType,
X				revdat.corrections))
X			goto unknown;
X		break;
X
X	case SCALE:
X		if (0 > sscanf(buf, fmt, &scale.rowNum, &scale.s1, &scale.s2,
X				&scale.s3, &scale.u))
X			goto unknown;
X		break;
X
X	case SEQRES:
X		if (0 > sscanf(buf, fmt, &seqres.serialNum, &seqres.chainId,
X				&seqres.count, seqres.names[0], seqres.names[1],
X				seqres.names[2], seqres.names[3],
X				seqres.names[4], seqres.names[5],
X				seqres.names[6], seqres.names[7],
X				seqres.names[8], seqres.names[9],
X				seqres.names[10], seqres.names[11],
X				seqres.names[12]))
X			goto unknown;
X		break;
X
X	case SHEET:
X		sh = &sheet;
X		sha0 = &sh->atoms[0].residue;
X		sha1 = &sh->atoms[1].residue;
X		if (0 > sscanf(buf, fmt, &sh->strandNum, sh->id, &sh->count,
X				sh->residues[0].name, &sh->residues[0].chainId,
X				&sh->residues[0].seqNum,
X				&sh->residues[0].insertCode,
X				sh->residues[1].name, &sh->residues[1].chainId,
X				&sh->residues[1].seqNum,
X				&sh->residues[1].insertCode, &sh->sense,
X				sh->atoms[0].name, sha0->name, &sha0->chainId,
X				&sha0->seqNum, &sha0->insertCode,
X				sh->atoms[1].name, sha1->name, &sha1->chainId,
X				&sha1->seqNum, &sha1->insertCode))
X			goto unknown;
X		break;
X
X	case SITE:
X		if (0 > sscanf(buf, fmt, &site.seqNum, site.id, &site.count,
X				site.residues[0].name,
X				&site.residues[0].chainId,
X				&site.residues[0].seqNum,
X				&site.residues[0].insertCode,
X				site.residues[1].name,
X				&site.residues[1].chainId,
X				&site.residues[1].seqNum,
X				&site.residues[1].insertCode,
X				site.residues[2].name,
X				&site.residues[2].chainId,
X				&site.residues[2].seqNum,
X				&site.residues[2].insertCode,
X				site.residues[3].name,
X				&site.residues[3].chainId,
X				&site.residues[3].seqNum,
X				&site.residues[3].insertCode))
X			goto unknown;
X		break;
X
X	case SPRSDE:
X		if (0 > sscanf(buf, fmt, &sprsde.continuation,
X				sprsde.timestamp, sprsde.id,
X				sprsde.supersede[0], sprsde.supersede[1],
X				sprsde.supersede[2], sprsde.supersede[3],
X				sprsde.supersede[4], sprsde.supersede[5],
X				sprsde.supersede[6], sprsde.supersede[7]))
X			goto unknown;
X		break;
X
X	case SSBOND:
X		if (0 > sscanf(buf, fmt, &ssbond.seqNum,
X				ssbond.residues[0].name,
X				&ssbond.residues[0].chainId,
X				&ssbond.residues[0].seqNum,
X				&ssbond.residues[0].insertCode,
X				ssbond.residues[1].name,
X				&ssbond.residues[1].chainId,
X				&ssbond.residues[1].seqNum,
X				&ssbond.residues[1].insertCode,
X				ssbond.comment))
X			goto unknown;
X		break;
X
X	case SYMOP:
X		if (0 > sscanf(buf, fmt, &symop.rowNum, &symop.serialNum,
X				&symop.s1, &symop.s2, &symop.s3, &symop.t))
X			goto unknown;
X		break;
X
X	case TER:
X		if (0 > sscanf(buf, fmt, &ter.serialNum, ter.residue.name,
X				&ter.residue.chainId, &ter.residue.seqNum,
X				&ter.residue.insertCode))
X			goto unknown;
X		break;
X
X	case TRNSFM:
X		if (0 > sscanf(buf, fmt, &trnsfm.resultSerialNum,
X				&trnsfm.applySerialNum,
X				&trnsfm.sourceSerialNum))
X			goto unknown;
X		break;
X
X	case TURN:
X		if (0 > sscanf(buf, fmt, &turn.seqNum, turn.id,
X				turn.residues[0].name,
X				&turn.residues[0].chainId,
X				&turn.residues[0].seqNum,
X				&turn.residues[0].insertCode,
X				turn.residues[1].name,
X				&turn.residues[1].chainId,
X				&turn.residues[1].seqNum,
X				&turn.residues[1].insertCode, turn.comment))
X			goto unknown;
X		break;
X
X	case TVECT:
X		if (0 > sscanf(buf, fmt, &tvect.serialNum, &tvect.t1,
X				&tvect.t2, &tvect.t3, tvect.comment))
X			goto unknown;
X		break;
X
user:
X		rType = USER;
X		fmt = pdbRecordFormat[rType];
X	case USER:
X		if (0 > sscanf(buf, fmt, user.subtype, user.text))
X			goto unknown;
X		break;
X
X	case USER_PDBRUN:
X		if (0 > sscanf(buf, fmt, &userPdbrun.version))
X			goto user;
X		pdbrunInputVersion = userPdbrun.version;
X		break;
X
X	case USER_EYEPOS:
X		if (0 > sscanf(buf, fmt, &userEyePos.xyz[0],
X				&userEyePos.xyz[1], &userEyePos.xyz[2]))
X			goto user;
X		break;
X
X	case USER_ATPOS:
X		if (0 > sscanf(buf, fmt, &userAtPos.xyz[0],
X				&userAtPos.xyz[1], &userAtPos.xyz[2]))
X			goto user;
X		break;
X
X	case USER_WINDOW:
X		if (0 > sscanf(buf, fmt, &userWindow.left, &userWindow.right,
X				&userWindow.bottom, &userWindow.top,
X				&userWindow.hither, &userWindow.yon))
X			goto user;
X		break;
X
X	case USER_FOCUS:
X		if (0 > sscanf(buf, fmt, &userFocus.focus))
X			goto user;
X		break;
X
X	case USER_VIEWPORT:
X		if (0 > sscanf(buf, fmt, &userViewport.xmin, &userViewport.xmax,
X				&userViewport.ymin, &userViewport.ymax))
X			goto user;
X		break;
X
X	case USER_BGCOLOR:
X		if (pdbrunInputVersion < 6) {
X			if (0 > ::sscanf(buf, fmt, &userBgColor.rgb[0],
X					&userBgColor.rgb[1],
X					&userBgColor.rgb[2]))
X				goto user;
X		} else if (0 > sscanf(buf, fmt, &userBgColor.rgb[0],
X				&userBgColor.rgb[1], &userBgColor.rgb[2]))
X			goto user;
X		break;
X
X	case USER_ANGLE:
X		if (pdbrunInputVersion < 6) {
X			if (0 > sscanf(buf, fmt, &userAngle.which,
X					&userAngle.atom0, &userAngle.atom1,
X					&userAngle.atom2, &userAngle.atom3,
X					&userAngle.angle))
X				goto user;
X		} else if (0 > sscanf(buf, fmt, &userAngle.atom0,
X				&userAngle.atom1, &userAngle.atom2,
X				&userAngle.atom3, &userAngle.angle))
X			goto user;
X		break;
X
X	case USER_DISTANCE:
X		if (pdbrunInputVersion < 6) {
X			if (0 > sscanf(buf, fmt, &userDistance.which,
X					&userDistance.atom0,
X					&userDistance.atom1,
X					&userDistance.distance))
X				goto user;
X		} else if (0 > sscanf(buf, fmt, &userDistance.atom0,
X				&userDistance.atom1, &userDistance.distance))
X			goto user;
X		break;
X
X	case USER_FILE:
X		if (pdbrunInputVersion < 6) {
X			if (0 > sscanf(buf, fmt, userFile.filename))
X				goto user;
X		} else if (0 > sscanf(buf, fmt, &userFile.model,
X							userFile.filename))
X			goto user;
X		break;
X
X	case USER_MARKNAME:
X		if (pdbrunInputVersion < 6
X		|| 0 > sscanf(buf, fmt, userMarkname.markname))
X			goto user;
X		break;
X
X	case USER_MARK:
X		if (pdbrunInputVersion < 6
X		|| 0 > sscanf(buf, fmt, userMark.markname))
X			goto user;
X		break;
X
X	case USER_CNAME:
X		if (pdbrunInputVersion < 6) {
X			if (0 > ::sscanf(buf, fmt, userCName.name,
X					&userCName.rgb[0], &userCName.rgb[1],
X					&userCName.rgb[2]))
X				goto user;
X		} else if (0 > sscanf(buf, fmt, &userCName.rgb[0],
X				&userCName.rgb[1], &userCName.rgb[2],
X				userCName.name))
X			goto user;
X		break;
X
X	case USER_COLOR:
X		if (pdbrunInputVersion < 6) {
X			if (0 > ::sscanf(buf, fmt, userColor.spec,
X					&userColor.rgb[0], &userColor.rgb[1],
X					&userColor.rgb[2]))
X				goto user;
X		} else if (0 > sscanf(buf, fmt, &userColor.rgb[0],
X				&userColor.rgb[1], &userColor.rgb[2],
X				userColor.spec))
X			goto user;
X		break;
X
X	case USER_RADIUS:
X		if (0 > sscanf(buf, fmt, &userRadius.radius))
X			goto user;
X		break;
X
X	case USER_OBJECT:
X		if (pdbrunInputVersion < 6) {
X			if (0 > sscanf(buf, fmt, &userObject.model))
X				goto user;
X		}
X		break;
X
X	case USER_ENDOBJ:
X		if (pdbrunInputVersion < 6) {
X			if (0 > sscanf(buf, fmt, &userEndObj.model))
X				goto user;
X		}
X		break;
X
X	case USER_CHAIN:
X		if (pdbrunInputVersion < 6) {
X			if (0 > ::sscanf(buf, fmt, &userChain.atom0,
X					&userChain.atom1))
X				goto user;
X		} else if (0 > sscanf(buf, fmt, &userChain.atom0,
X				&userChain.atom1))
X			goto user;
X		break;
X
X	case USER_GFX_BEGIN:
X		if (pdbrunInputVersion < 6
X		|| 0 > sscanf(buf, fmt, userGfxBegin.unknown))
X			goto user;
X		userGfxBegin.primitive = getGfxType(userGfxBegin.unknown);
X		break;
X
X	case USER_GFX_END:
X		if (pdbrunInputVersion < 6)
X			goto user;
X		break;
X
X	case USER_GFX_COLOR:
X		if (pdbrunInputVersion < 6) {
X			if (0 > ::sscanf(buf, fmt, userGfxColor.spec,
X					&userGfxColor.rgb[0],
X					&userGfxColor.rgb[1],
X					&userGfxColor.rgb[2]))
X				goto user;
X		} else if (0 > sscanf(buf, fmt, &userGfxColor.rgb[0],
X				&userGfxColor.rgb[1], &userGfxColor.rgb[2],
X				userGfxColor.spec))
X			goto user;
X		break;
X
X	case USER_GFX_NORMAL:
X		if (pdbrunInputVersion < 6
X		|| 0 > sscanf(buf, fmt, &userGfxNormal.xyz[0],
X				&userGfxNormal.xyz[1],
X				&userGfxNormal.xyz[2]))
X			goto user;
X		break;
X
X	case USER_GFX_VERTEX:
X		if (pdbrunInputVersion < 6
X		|| 0 > sscanf(buf, fmt, &userGfxVertex.xyz[0],
X				&userGfxVertex.xyz[1],
X				&userGfxVertex.xyz[2]))
X			goto user;
X		break;
X
X	case USER_GFX_FONT:
X		if (pdbrunInputVersion < 6) {
X			if (0 > ::sscanf(buf, fmt, userGfxFont.name,
X					&userGfxFont.size))
X				goto user;
X		} else if (0 > sscanf(buf, fmt, &userGfxFont.size,
X				userGfxFont.name))
X			goto user;
X		break;
X
X	case USER_GFX_TEXTPOS:
X		if (pdbrunInputVersion < 6
X		|| 0 > sscanf(buf, fmt, &userGfxTextPos.xyz[0],
X				&userGfxTextPos.xyz[1], &userGfxTextPos.xyz[2]))
X			goto user;
X		break;
X
X	case USER_GFX_LABEL:
X		if (pdbrunInputVersion < 6) {
X			if (0 > ::sscanf(buf, fmt, &userGfxLabel.xyz[0],
X					&userGfxLabel.xyz[1],
X					&userGfxLabel.xyz[2],
X					userGfxLabel.text))
X				goto user;
X		} else if (0 > sscanf(buf, fmt, userGfxLabel.text))
X			goto user;
X		// TODO: process text?
X		break;
X
X	case USER_GFX_MOVE:
X		if (pdbrunInputVersion >= 6
X		|| 0 > sscanf(buf, fmt, &userGfxMove.xyz[0],
X				&userGfxMove.xyz[1], &userGfxMove.xyz[2]))
X			goto user;
X		break;
X
X	case USER_GFX_DRAW:
X		if (pdbrunInputVersion >= 6
X		|| 0 > sscanf(buf, fmt, &userGfxDraw.xyz[0],
X				&userGfxDraw.xyz[1], &userGfxDraw.xyz[2]))
X			goto user;
X		break;
X
X	case USER_GFX_MARKER:
X		if (pdbrunInputVersion >= 6
X		|| 0 > sscanf(buf, fmt, &userGfxMarker.xyz[0],
X				&userGfxMarker.xyz[1],
X				&userGfxMarker.xyz[2]))
X			goto user;
X		break;
X
X	case USER_GFX_POINT:
X		if (pdbrunInputVersion >= 6
X		|| 0 > sscanf(buf, fmt, &userGfxPoint.xyz[0],
X				&userGfxPoint.xyz[1], &userGfxPoint.xyz[2]))
X			goto user;
X		break;
X	}
}
SHAR_EOF
  (set 20 04 07 28 14 02 31 'libpdb++/pdb_read.cc'; eval "$shar_touch") &&
  chmod 0664 'libpdb++/pdb_read.cc' ||
  $echo 'restore of' 'libpdb++/pdb_read.cc' '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 'libpdb++/pdb_read.cc:' 'MD5 check failed'
5b3116242ba184e0296775a43527dd2c  libpdb++/pdb_read.cc
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'libpdb++/pdb_read.cc'`"
    test 16032 -eq "$shar_count" ||
    $echo 'libpdb++/pdb_read.cc:' 'original size' '16032,' 'current size' "$shar_count!"
  fi
fi
# ============= libpdb++/pdb_sprntf.cc ==============
if test -f 'libpdb++/pdb_sprntf.cc' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'libpdb++/pdb_sprntf.cc' '(file already exists)'
else
  $echo 'x -' extracting 'libpdb++/pdb_sprntf.cc' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'libpdb++/pdb_sprntf.cc' &&
//
//	Copyright (c) 1989,1992 The Regents of the University of California.
//	All rights reserved.
//
//	Redistribution and use in source and binary forms are permitted
//	provided that the above copyright notice and this paragraph are
//	duplicated in all such forms and that any documentation,
//	advertising materials, and other materials related to such
//	distribution and use acknowledge that the software was developed
//	by the University of California, San Francisco.  The name of the
//	University may not be used to endorse or promote products derived
//	from this software without specific prior written permission.
//	THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
//	IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
//	WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
//	$Id: pdb_sprntf.cc,v 1.4 94/09/06 15:03:07 gregc Exp $
//
X
#include "pdb++.h"
#include <ctype.h>
#include <string.h>
#include <stdarg.h>
X
X	// scratch must be big enough to hold the largest number
static char	scratch[256];
X
#define	OVERFLOW_CHAR	'*'
X
static char	*outint(int, int, int, char, char, int, char *, char);
static char	*outunsigned(unsigned int, int, char, int, char *);
static char	*outstr(char *, int, int, char, int, char *);
static char	*outfloat(double, int, int, char, int, char *);
static char	*outexp(double, int, int, char, int, char *);
static char	*e_out(int, char *);
X
int
PDB::sprintf(char *outbuf, const char *fmt, ...)
{
X	va_list		argv;
X	char		*p;
X	const char	*f;
X	int		field1, field2;
X	char		c, fill_char;
X	int		inum;
X	unsigned 	unum;
X	double		fnum;
X	int		left_justify;
X
X	va_start(argv, fmt);
X	f = fmt;
X	p = outbuf;
X	while (*f) {
X		if (*f == '%') {
X			f++;
X			if (*f == '-')
X				left_justify = 1, f++;
X			else
X				left_justify = 0;
X
X			if (*f == '0')
X				fill_char = '0', f++;
X			else
X				fill_char = ' ';
X
X			if (isdigit(*f)) {
X				field1 = *f++ - '0';
X				while (isdigit(*f))
X					field1 = field1 * 10 + *f++ - '0';
X			}
X			else
X				field1 = -1;
X
X			if (*f == '.') {
X				f++;
X				field2 = 0;
X				while (isdigit(*f))
X					field2 = field2 * 10 + *f++ - '0';
X			}
X			else
X				field2 = -1;
X
X			if (*f == 'l' || *f == 'h')
X				f++;
X
X			while (isspace(*f))
X				f++;
X			switch (*f) {
X			  case 'c':
X				c = (char) va_arg(argv, int);
X				if (c == '\0')
X					c = ' ';
X				if (left_justify)
X					*p++ = c;
X				while (--field1 > 0)
X					*p++ = fill_char;
X				if (!left_justify)
X					*p++ = c;
X				break;
X			  case 'd':
X			  case 'D':
X				inum = va_arg(argv, int);
X				p = outint(inum, field1, 10, fill_char, 'a',
X					left_justify, p, (*f == 'D') ? ' ':'0');
X				break;
X			  case 'e':
X				fnum = va_arg(argv, double);
X				if (field2 < 0)
X					field2 = 6;
X				p = outexp(fnum, field1, field2, fill_char,
X					left_justify, p);
X				break;
X			  case 'f':
X				fnum = va_arg(argv, double);
X				if (field2 < 0)
X					field2 = 6;
X				p = outfloat(fnum, field1, field2, fill_char,
X					left_justify, p);
X				break;
X			  case 'o':
X				inum = va_arg(argv, int);
X				p = outint(inum, field1, 8, fill_char, 'a',
X					left_justify, p, '0');
X				break;
X			  case 's':
X				p = outstr(va_arg(argv, char *), field1, field2,
X					fill_char, left_justify, p);
X				break;
X			  case 'u':
X				unum = va_arg(argv, unsigned);
X				p = outunsigned(unum, field1, fill_char,
X					left_justify, p);
X				break;
X			  case 'x':
X				inum = va_arg(argv, int);
X				p = outint(inum, field1, 16, fill_char, 'a',
X					left_justify, p, '0');
X				break;
X			  case 'X':
X				inum = va_arg(argv, int);
X				p = outint(inum, field1, 16, fill_char, 'A',
X					left_justify, p, '0');
X				break;
X			  default:
X				if (left_justify)
X					*p++ = *f;
X				while (--field1 > 0)
X					*p++ = fill_char;
X				if (!left_justify)
X					*p++ = *f;
X				break;
X			}
X			f++;
X		}
X		else if (*f == '\\') {		/* Special character */
X			switch (*++f) {
X			  case 'n':
X				*p++ = '\n';
X				break;
X			  case 'r':
X				*p++ = '\r';
X				break;
X			  case 'b':
X				*p++ = '\b';
X				break;
X			  case 't':
X				*p++ = '\t';
X				break;
X			  case 'f':
X				*p++ = '\f';
X				break;
X			  case '0': case '1': case '2': case '3':
X			  case '4': case '5': case '6': case '7':
X				inum = *f++ - '0';
X				if (*f >= '0' && *f <= '7') {
X					inum = inum * 8 + *f++ - '0';
X					if (*f >= '0' && *f <= '7')
X						inum = inum * 8 + *f++ - '0';
X				}
X				f--;
X				*p++ = (char) inum;
X				break;
X			  default:
X				*p++ = *f;
X			}
X			f++;
X		}
X		else				/* Normal character */
X			*p++ = *f++;
X	}
X	*p = '\0';
X	va_end(argv);
X	return p - outbuf;
}
X
static char *
e_out(int width, char *where)
{
X	while (width-- > 0)
X		*where++ = OVERFLOW_CHAR;
X	return where;
}
X
static char *
outint(int value, int width, int radix, char fill_char, char hex,
X					int left_justify, char *p, char zero)
{
X	char	*s;
X	int	n;
X	int	negative;
X
X	if (value < 0)
X		negative = 1, value = -value, width--;
X	else
X		negative = 0;
X	s = scratch;
X	if (value)
X		do {
X			n = value % radix;
X			*s++ = n < 10 ? '0' + n : hex + n - 10;
X			value /= radix;
X		} while (value);
X	else
X		*s++ = zero;
X	n = s - scratch;
X	if (width != -1 && n > width)
X		return e_out(width + negative, p);
X
X	if (negative && fill_char == '0')
X		*p++ = '-';
X	if (!left_justify)
X		while (width-- > n)
X			*p++ = fill_char;
X	if (negative && fill_char == ' ')
X		*p++ = '-';
X	while (--s >= scratch)
X		*p++ = *s;
X	if (left_justify)
X		while (width-- > n)
X			*p++ = fill_char;
X	return p;
}
X
static char *
outunsigned(unsigned int value, int width, char fill_char, int left_justify,
X									char *p)
{
X	char	*s;
X	int	n;
X
X	s = scratch;
X	while (value) {
X		*s++ = value % 10 + '0';
X		value /= 10;
X	}
X	n = s - scratch;
X	if (n == 0)
X		*s++ = '0', n = 1;
X	if (width != -1 && n > width)
X		return e_out(width, p);
X
X	if (!left_justify)
X		while (width-- > n)
X			*p++ = fill_char;
X	while (--s >= scratch)
X		*p++ = *s;
X	if (left_justify)
X		while (width-- > n)
X			*p++ = fill_char;
X	return p;
}
X
static char *
outstr(char *s, int width, int maxstr, char fill_char, int left_justify, char *p)
{
X	int	len;
X
X	len = strlen(s);
X	if (maxstr >= 0 && len > maxstr)
X		len = maxstr;
X	if (width != -1 && len > width)
X		return e_out(width, p);
X
X	if (!left_justify)
X		while (width-- > len)
X			*p++ = fill_char;
X	else
X		width -= len;
X	while (len--)
X		*p++ = *s++;
X	if (left_justify)
X		while (width-- > 0)
X			*p++ = fill_char;
X	return p;
}
X
static char *
outfloat(double value, int width, int nplace, char fill_char, int left_justify,
X									char *p)
{
X	int	i, intval;
X	char	*place, *to, *from;
X	int	negative;
X
X	negative = value < 0.0 ? 1 : 0;
X		
X	if (negative)
X		value = -value;
X
X	for (i = 0; i < nplace; i++)
X		value *= 10.0;
X
X	intval = (int) (value + 0.5);
X
X	if (width == -1)
X		width = nplace + 4;		/* TODO: fix */
X	else if (nplace + (nplace == 0 ? 1 : 2) > width)
X		return e_out(width, p);
X
X	for (place = p + width - 1; place >= p + width - nplace; place--) {
X		*place = '0' + intval % 10;
X		intval /= 10;
X	}
X
X	if (nplace > 0)
X		*place-- = '.';
X
X	if (intval == 0)
X		*place-- = '0';
X
X	for (; place >= p; place--) {
X		if (intval == 0)
X			break;
X		else {
X			*place = '0' + intval % 10;
X			intval /= 10;
X		}
X	}
X
X	if (intval != 0)
X		return e_out(width, p);
X
X	if (place < p && negative)
X		return e_out(width, p);
X
X	if (left_justify) {
X		for (from = place + 1, to = (negative ? p + 1 : p);
X						from < p + width; from++, to++)
X			*to = *from;
X		for (; to < p + width; to++)
X			*to = fill_char;
X		if (negative)
X			*p = '-';
X	} else {
X		for (to = place; to >= p; to--)
X			*to = fill_char;
X		if (negative)
X			if (fill_char == ' ')
X				*place = '-';
X			else
X				*p = '-';
X	}
X
X	return p + width;
}
X
static char *
outexp(double value, int width, int nplace, char fill_char, int left_justify,
X									char *p)
{
X	int	n;
X	char	*s;
X	int	negative;
X	double	fraction;
X
X	if (value < 0)
X		negative = 1, value = -value, width--;
X	else
X		negative = 0;
X
X	n = 0;
X	while (value > 10)
X		n++, value /= 10;
X	if (value)
X		while (value < 1)
X			n--, value *= 10;
X
X	s = scratch;
X	if (n < 0) {
X		n = -n;
X		*s++ = n % 10 + '0';
X		*s++ = n / 10 + '0';
X		*s++ = '-';
X	}
X	else {
X		*s++ = n % 10 + '0';
X		*s++ = n / 10 + '0';
X		*s++ = '+';
X	}
X	*s = 'e';
X
X	s = scratch + nplace + 4;	/* 4 == strlen("e+00") */
X	fraction = value - (int) value;
X	for (n = 0; n < nplace; n++) {
X		fraction *= 10.0;
X		*--s = '0' + (int) fraction;
X		fraction -= (int) fraction;
X	}
X
X	s = scratch + nplace + 4;
X	if (nplace)
X		*s++ = '.';
X	n = (int) value;
X	if (n)
X		*s++ = n % 10 + '0';
X	else
X		*s++ = '0';
X	n = s - scratch;
X	if (width != -1 && n > width)
X		return e_out(width + negative, p);
X
X	if (negative && fill_char == '0')
X		*p++ = '-';
X	if (!left_justify)
X		while (width-- > n)
X			*p++ = fill_char;
X	if (negative && fill_char == ' ')
X		*p++ = '-';
X	while (--s >= scratch)
X		*p++ = *s;
X	if (left_justify)
X		while (width-- > n)
X			*p++ = fill_char;
X	return p;
}
SHAR_EOF
  (set 20 04 07 28 14 02 31 'libpdb++/pdb_sprntf.cc'; eval "$shar_touch") &&
  chmod 0664 'libpdb++/pdb_sprntf.cc' ||
  $echo 'restore of' 'libpdb++/pdb_sprntf.cc' '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 'libpdb++/pdb_sprntf.cc:' 'MD5 check failed'
342095bdf0d405e1d0894d2e811f2e10  libpdb++/pdb_sprntf.cc
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'libpdb++/pdb_sprntf.cc'`"
    test 8760 -eq "$shar_count" ||
    $echo 'libpdb++/pdb_sprntf.cc:' 'original size' '8760,' 'current size' "$shar_count!"
  fi
fi
# ============= libpdb++/pdb_sscanf.cc ==============
if test -f 'libpdb++/pdb_sscanf.cc' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'libpdb++/pdb_sscanf.cc' '(file already exists)'
else
  $echo 'x -' extracting 'libpdb++/pdb_sscanf.cc' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'libpdb++/pdb_sscanf.cc' &&
//
//	Copyright (c) 1989,1992 The Regents of the University of California.
//	All rights reserved.
//
//	Redistribution and use in source and binary forms are permitted
//	provided that the above copyright notice and this paragraph are
//	duplicated in all such forms and that any documentation,
//	advertising materials, and other materials related to such
//	distribution and use acknowledge that the software was developed
//	by the University of California, San Francisco.  The name of the
//	University may not be used to endorse or promote products derived
//	from this software without specific prior written permission.
//	THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
//	IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
//	WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
//	$Id: pdb_sscanf.cc,v 1.8 94/09/06 15:03:23 gregc Exp $
//
X
#include "pdb++.h"
#include <ctype.h>
#include <stdarg.h>
#include <stdlib.h>
X
//
//	pdb_sscanf performs similarly to sscanf, execept that fields are of
//	fixed length and a complete line is always consumed.  The field
//	width defaults to one.  If the line is shorter than expected then
//	the default is returned.
//
//		d	get an integer.  Default:  0.
//		f	get a floating point number (C double).  Default:  0.0.
//		(space) ignore characters within field
//		s	get a C string, leading and trailing spaces are
//			stripped; the field width is used as a limit on
//			the string length, the null character is appended
//			to the end of the string.  Default:  empty string.
//		c	get a character(s); no stripping of spaces, nor is
//			a null character appended.  Default:  space(s).
//
X
#define	MAXFIELDSIZE	64
X
int
PDB::sscanf(const char *buffer, const char *fmt, ...)
{
X	va_list	ap;
X	int	i, field_width;
X	int	nmatch;
X	char	*s, *t;
X	char	tmp[MAXFIELDSIZE];
X
X	va_start(ap, fmt);
X	nmatch = 0;
X	for (; *fmt != '\0'; fmt++) {
X		if (*fmt != '%') {
X			if (*buffer == *fmt)
X				buffer++;
X			else if (*buffer != '\0' && *buffer != '\n')
X				return -1;
X			continue;
X		}
X
X		// calculate field_width
X		field_width = 0;
X		for (++fmt; isdigit(*fmt); fmt++)
X			field_width = field_width * 10 + *fmt - '0';
X		if (field_width == 0)
X			field_width = 1;	// default
X		if (*buffer != '\0' && *buffer != '\n')
X			nmatch++;
X
X		switch (*fmt) {
X
X		case 'd':			// integer
X			// if we've already seen the end of the buffer, don't
X			// try to get anymore characters
X			if (*buffer == '\0' || *buffer == '\n') {
X				*(va_arg(ap, int *)) = 0;
X				break;
X			}
X
X			s = tmp;
X			for (i = 0; i < field_width; i++) {
X				if (*buffer == '\0' || *buffer == '\n')
X					break;
X				*s++ = *buffer++;
X			}
X			*s = '\0';
X			// remove trailing spaces
X			while (s > tmp && isspace(*(s - 1)))
X				*--s = '\0';
X			*(va_arg(ap, int *)) = (int) strtol(tmp, &t, 10);
X			if (t != s)
X				return -1;
X			break;
X
X		case 'f':			// floating point
X			// if we've already seen the end of the buffer, don't
X			// try to get anymore characters
X			if (*buffer == '\0' || *buffer == '\n') {
X				*(va_arg(ap, double *)) = 0.0;
X				break;
X			}
X
X			s = tmp;
X			for (i = 0; i < field_width; i++) {
X				if (*buffer == '\0' || *buffer == '\n')
X					break;
X				*s++ = *buffer++;
X			}
X			*s = '\0';
X			// remove trailing spaces
X			while (s > tmp && isspace(*(s - 1)))
X				*--s = '\0';
X			*(va_arg(ap, double *)) = strtod(tmp, &t);
X			if (t != s)
X				return -1;
X			break;
X
X		case 's':			// string
X			// if we've already seen the end of the buffer, don't
X			// try to get anymore characters
X			if (*buffer == '\0' || *buffer == '\n') {
X				*(va_arg(ap, char *)) = '\0';
X				break;
X			}
X
X			s = t = va_arg(ap, char *);
X			for (i = 0; i < field_width; i++) {
X				if (*buffer == '\0' || *buffer == '\n')
X					break;
X				*s++ = *buffer++;
X			}
X			*s = '\0';
X			// remove trailing spaces
X			while (s > t && isspace(*--s))
X				*s = '\0';
X			break;
X
X		case 'c':			// character(s)
X			s = va_arg(ap, char *);
X			for (i = 0; i < field_width; i++)
X				s[i] = ' ';	// default
X
X			// if we've already seen the end of the buffer, don't
X			// try to get anymore characters
X			if (*buffer == '\0' || *buffer == '\n')
X				break;
X
X			for (i = 0; i < field_width; i++) {
X				if (*buffer == '\0' || *buffer == '\n')
X					break;
X				*s++ = *buffer++;
X			}
X			break;
X
X		case ' ':			// space (ignore)
X			// if we've already seen the end of the buffer, don't
X			// try to get anymore characters
X			if (*buffer == '\0' || *buffer == '\n')
X				break;
X
X			for (i = 0; i < field_width; i++, buffer++)
X				if (*buffer == '\0' || *buffer == '\n')
X					break;
X			break;
X
X		default:
X			va_end(ap);
X			return -1;
X		}
X	}
X	va_end(ap);
X	return nmatch;
}
SHAR_EOF
  (set 20 04 07 28 14 02 31 'libpdb++/pdb_sscanf.cc'; eval "$shar_touch") &&
  chmod 0664 'libpdb++/pdb_sscanf.cc' ||
  $echo 'restore of' 'libpdb++/pdb_sscanf.cc' '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 'libpdb++/pdb_sscanf.cc:' 'MD5 check failed'
9590c272aad35193953441ecd3e0b47b  libpdb++/pdb_sscanf.cc
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'libpdb++/pdb_sscanf.cc'`"
    test 4650 -eq "$shar_count" ||
    $echo 'libpdb++/pdb_sscanf.cc:' 'original size' '4650,' 'current size' "$shar_count!"
  fi
fi
# ============= libpdb++/pdb_type.cc ==============
if test -f 'libpdb++/pdb_type.cc' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'libpdb++/pdb_type.cc' '(file already exists)'
else
  $echo 'x -' extracting 'libpdb++/pdb_type.cc' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'libpdb++/pdb_type.cc' &&
//
//	Copyright (c) 1992 The Regents of the University of California.
//	All rights reserved.
//
//	Redistribution and use in source and binary forms are permitted
//	provided that the above copyright notice and this paragraph are
//	duplicated in all such forms and that any documentation,
//	advertising materials, and other materials related to such
//	distribution and use acknowledge that the software was developed
//	by the University of California, San Francisco.  The name of the
//	University may not be used to endorse or promote products derived
//	from this software without specific prior written permission.
//	THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
//	IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
//	WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
//	$Id: pdb_type.cc,v 1.14 1995/05/22 19:53:09 gregc Exp $
//
//	subroutine for reading PDB format files
//
X
# include	"pdb++.h"
extern "C" {
# include	<ctype.h>
# include	<string.h>
}
#if 0
extern "C" int strcasecmp (const char *s1, const char *s2);
extern "C" int strncasecmp (const char *s1, const char *s2, size_t n);
#endif
X
# ifndef _toupper
# define	_toupper	toupper
# endif
X
int PDB::pdbrunInputVersion = PDB::PDBRUNVersion;	// just in case
int PDB::pdbrunOutputVersion = PDB::PDBRUNVersion;	// just in case
X
PDB::GfxType
PDB::getGfxType(const char *buf)
{
X	switch (buf[0]) {
X	case 'L': case 'l':
X		if (strcasecmp(buf + 1, "INE-LOOP") == 0)
X			return GFX_LINE_LOOP;
X		if (strcasecmp(buf + 1, "INE-STRIP") == 0)
X			return GFX_LINE_STRIP;
X		if (strcasecmp(buf + 1, "INES") == 0)
X			return GFX_LINES;
X		break;
X	case 'M': case 'm':
X		if (strcasecmp(buf + 1, "ARKERS") == 0)
X			return GFX_MARKERS;
X		break;
X	case 'P': case 'p':
X		if (strcasecmp(buf + 1, "OINTS") == 0)
X			return GFX_POINTS;
X		if (strcasecmp(buf + 1, "OLYGON") == 0)
X			return GFX_POLYGON;
X		break;
X	case 'Q': case 'q':
X		if (strcasecmp(buf + 1, "UAD-STRIP") == 0)
X			return GFX_QUAD_STRIP;
X		if (strcasecmp(buf + 1, "UADS") == 0)
X			return GFX_QUADS;
X		break;
X	case 'T': case 't':
X		if (strcasecmp(buf + 1, "RIANGLE-FAN") == 0)
X			return GFX_TRIANGLE_FAN;
X		if (strcasecmp(buf + 1, "RIANGLE-STRIP") == 0)
X			return GFX_TRIANGLE_STRIP;
X		if (strcasecmp(buf + 1, "RIANGLES") == 0)
X			return GFX_TRIANGLES;
X		break;
X	}
X	return GFX_UNKNOWN;
}
X
const char *
PDB::gfxChars(GfxType gt)
{
X	switch (gt) {
X	default:		return "UNKNOWN";
X	case GFX_POINTS:	return "POINTS";
X	case GFX_MARKERS:	return "MARKERS";
X	case GFX_LINES:		return "LINES";
X	case GFX_LINE_STRIP:	return "LINE-STRIP";
X	case GFX_LINE_LOOP:	return "LINE-LOOP";
X	case GFX_TRIANGLES:	return "TRIANGLES";
X	case GFX_TRIANGLE_STRIP:	return "TRIANGLE-STRIP";
X	case GFX_TRIANGLE_FAN:	return "TRIANGLE-FAN";
X	case GFX_QUADS:		return "QUADS";
X	case GFX_QUAD_STRIP:	return "QUAD-STRIP";
X	case GFX_POLYGON:	return "POLYGON";
X	}
}
X
static PDB::RecordType
pdbrun5Type(const char *buf)
{
X	switch (buf[0]) {
X	case 'A': case 'a':
X		if (strncasecmp(buf + 1, "NGLE ", 5) == 0)
X			return PDB::USER_ANGLE;
X		if (strncasecmp(buf + 1, "TPOS ", 5) == 0)
X			return PDB::USER_ATPOS;
X		break;
X	case 'B': case 'b':
X		if (strncasecmp(buf + 1, "GCOLOR ", 7) == 0)
X			return PDB::USER_BGCOLOR;
X		break;
X	case 'C': case 'c':
X		if (strncasecmp(buf + 1, "HAIN ", 5) == 0)
X			return PDB::USER_CHAIN;
X		if (strncasecmp(buf + 1, "NAME ", 5) == 0)
X			return PDB::USER_CNAME;
X		if (strncasecmp(buf + 1, "OLOR ", 5) == 0)
X			return PDB::USER_COLOR;
X		break;
X	case 'D': case 'd':
X		if (strncasecmp(buf + 1, "ISTANCE ", 8) == 0)
X			return PDB::USER_DISTANCE;
X		break;
X	case 'E': case 'e':
X		if (strncasecmp(buf + 1, "NDOBJ ", 6) == 0)
X			return PDB::USER_ENDOBJ;
X		if (strncasecmp(buf + 1, "YEPOS ", 6) == 0)
X			return PDB::USER_EYEPOS;
X		break;
X	case 'F': case 'f':
X		if (strncasecmp(buf + 1, "ILE ", 4) == 0)
X			return PDB::USER_FILE;
X		if (strncasecmp(buf + 1, "OCUS ", 5) == 0)
X			return PDB::USER_FOCUS;
X		break;
X	case 'G': case 'g':
X		if (strncasecmp(buf + 1, "FX ", 3) != 0)
X			break;
X		if (strncasecmp(buf + 4, "COLOR ", 6) == 0)
X			return PDB::USER_GFX_COLOR;
X		if (strncasecmp(buf + 4, "DRAW ", 5) == 0)
X			return PDB::USER_GFX_DRAW;
X		if (strncasecmp(buf + 4, "FONT ", 5) == 0)
X			return PDB::USER_GFX_FONT;
X		if (strncasecmp(buf + 4, "LABEL ", 6) == 0)
X			return PDB::USER_GFX_LABEL;
X		if (strncasecmp(buf + 4, "MARKER ", 7) == 0)
X			return PDB::USER_GFX_MARKER;
X		if (strncasecmp(buf + 4, "MOVE ", 5) == 0)
X			return PDB::USER_GFX_MOVE;
X		if (strncasecmp(buf + 4, "POINT ", 6) == 0)
X			return PDB::USER_GFX_POINT;
X		break;
X	case 'O': case 'o':
X		if (strncasecmp(buf + 1, "BJECT ", 6) == 0)
X			return PDB::USER_OBJECT;
X		break;
X	case 'P': case 'p':
X		if (strncasecmp(buf + 1, "DBRUN ", 6) == 0)
X			return PDB::USER_PDBRUN;
X		break;
X	case 'R': case 'r':
X		if (strncasecmp(buf + 1, "ADIUS ", 6) == 0)
X			return PDB::USER_RADIUS;
X		break;
X	case 'V': case 'v':
X		if (strncasecmp(buf + 1, "IEWPORT ", 8) == 0)
X			return PDB::USER_VIEWPORT;
X		break;
X	case 'W': case 'w':
X		if (strncasecmp(buf + 1, "INDOW ", 6) == 0)
X			return PDB::USER_WINDOW;
X		break;
X	}
X	return PDB::USER;
}
X
static PDB::RecordType
pdbrun6Type(const char *buf)
{
X	switch (buf[0]) {
X	case 'A': case 'a':
X		if (strncasecmp(buf + 1, "NGLE ", 5) == 0)
X			return PDB::USER_ANGLE;
X		if (strncasecmp(buf + 1, "TPOS ", 5) == 0)
X			return PDB::USER_ATPOS;
X		break;
X	case 'B': case 'b':
X		if (strncasecmp(buf + 1, "GCOLOR ", 7) == 0)
X			return PDB::USER_BGCOLOR;
X		break;
X	case 'C': case 'c':
X		if (strncasecmp(buf + 1, "HAIN ", 5) == 0)
X			return PDB::USER_CHAIN;
X		if (strncasecmp(buf + 1, "NAME ", 5) == 0)
X			return PDB::USER_CNAME;
X		if (strncasecmp(buf + 1, "OLOR ", 5) == 0)
X			return PDB::USER_COLOR;
X		break;
X	case 'D': case 'd':
X		if (strncasecmp(buf + 1, "ISTANCE ", 8) == 0)
X			return PDB::USER_DISTANCE;
X		break;
X	case 'E': case 'e':
X		if (strncasecmp(buf + 1, "NDOBJ", 5) == 0
X		&& (buf[6] == '\0' || buf[6] == '\n' || buf[6] == ' '))
X			return PDB::USER_ENDOBJ;
X		if (strncasecmp(buf + 1, "YEPOS ", 6) == 0)
X			return PDB::USER_EYEPOS;
X		break;
X	case 'F': case 'f':
X		if (strncasecmp(buf + 1, "ILE ", 4) == 0)
X			return PDB::USER_FILE;
X		if (strncasecmp(buf + 1, "OCUS ", 5) == 0)
X			return PDB::USER_FOCUS;
X		break;
X	case 'G': case 'g':
X		if (buf[1] != 'F' || buf[2] != 'X' || buf[3] != ' ')
X			break;
X		switch (buf[4]) {
X		case 'B': case 'b':
X			if (strncasecmp(buf + 5, "EGIN ", 5) == 0)
X				return PDB::USER_GFX_BEGIN;
X			break;
X		case 'C': case 'c':
X			if (strncasecmp(buf + 5, "OLOR ", 5) == 0)
X				return PDB::USER_GFX_COLOR;
X			break;
X		case 'E': case 'e':
X			if (buf[5] == 'N' && buf[6] == 'D'
X			&& (buf[7] == '\0' || buf[7] == '\n' || buf[7] == ' '))
X				return PDB::USER_GFX_END;
X			break;
X		case 'F': case 'f':
X			if (strncasecmp(buf + 5, "ONT ", 4) == 0)
X				return PDB::USER_GFX_FONT;
X			break;
X		case 'L': case 'l':
X			if (strncasecmp(buf + 5, "ABEL ", 5) == 0)
X				return PDB::USER_GFX_LABEL;
X			break;
X		case 'N': case 'n':
X			if (strncasecmp(buf + 5, "ORMAL ", 6) == 0)
X				return PDB::USER_GFX_NORMAL;
X			break;
X		case 'T': case 't':
X			if (strncasecmp(buf + 5, "EXTPOS ", 7) == 0)
X				return PDB::USER_GFX_TEXTPOS;
X			break;
X		case 'V': case 'v':
X			if (strncasecmp(buf + 5, "ERTEX ", 6) == 0)
X				return PDB::USER_GFX_VERTEX;
X			break;
X		}
X		break;
X	case 'M': case 'm':
X		if (strncasecmp(buf + 1, "ARK ", 4) == 0)
X			return PDB::USER_MARK;
X		if (strncasecmp(buf + 1, "ARKNAME ", 6) == 0)
X			return PDB::USER_MARKNAME;
X		break;
X	case 'O': case 'o':
X		if (strncasecmp(buf + 1, "BJECT", 5) == 0
X		&& (buf[6] == '\0' || buf[6] == '\n' || buf[6] == ' '))
X			return PDB::USER_OBJECT;
X		break;
X	case 'P': case 'p':
X		if (strncasecmp(buf + 1, "DBRUN ", 6) == 0)
X			return PDB::USER_PDBRUN;
X		break;
X	case 'R': case 'r':
X		if (strncasecmp(buf + 1, "ADIUS ", 6) == 0)
X			return PDB::USER_RADIUS;
X		break;
X	case 'V': case 'v':
X		if (strncasecmp(buf + 1, "IEWPORT ", 6) == 0)
X			return PDB::USER_VIEWPORT;
X		break;
X	case 'W': case 'w':
X		if (strncasecmp(buf + 1, "INDOW ", 6) == 0)
X			return PDB::USER_WINDOW;
X		break;
X	}
X	return PDB::USER;
}
X
PDB::RecordType
PDB::getType(const char *buf)
{
X	char	rt[4];		// PDB record type
X	int	i;
X
X	for (i = 0; buf[i] != '\0' && buf[i] != '\n' && i < 4; i += 1) {
X		if (islower(buf[i]))
X			rt[i] = _toupper(buf[i]);
X		else
X			rt[i] = buf[i];
X	}
X	if (i < 4)
X		for (; i < 4; i += 1)
X			rt[i] = ' ';
X
X	switch (rt[0]) {
X
X	case 'A':
X		switch (rt[1]) {
X		case 'G':
X			if (rt[2] == 'R' && rt[3] == 'D')
X				return AGRDES;
X			if (rt[2] == 'G' && rt[3] == 'R')
X				return AGGRGT;
X			break;
X		case 'N':
X			if (rt[2] == 'I' && rt[3] == 'S')
X				return ANISOU;
X			break;
X		case 'T':
X			if (rt[2] == 'O' && rt[3] == 'M')
X				return ATOM;
X			break;
X		case 'U':
X			if (rt[2] == 'T' && rt[3] == 'H')
X				return AUTHOR;
X			break;
X		}
X		break;
X
X	case 'C':
X		switch (rt[1]) {
X		case 'M':
X			if (rt[2] == 'P' && rt[3] == 'D')
X				return CMPDES;
X			if (rt[2] == 'P' && rt[3] == 'O')
X				return CMPONT;
X			break;
X		case 'O':
X			if (rt[2] == 'M' && rt[3] == 'P')
X				return COMPND;
X			if (rt[2] == 'N' && rt[3] == 'E')
X				return CONECT;
X			break;
X		case 'R':
X			if (rt[2] == 'Y' && rt[3] == 'S')
X				return CRYST1;
X			break;
X		}
X		break;
X
X	case 'E':
X		switch (rt[1]) {
X		case 'N':
X			if (rt[2] == 'D' && rt[3] == ' ')
X				return END;
X			if (rt[2] == 'D' && rt[3] == 'M')
X				return ENDMDL;
X			break;
X		case 'X':
X			if (rt[2] == 'P' && rt[3] == 'D')
X				return EXPDTA;
X			break;
X		}
X		break;
X
X	case 'F':
X		switch (rt[1]) {
X		case 'T':
X			if (rt[2] == 'N' && rt[3] == 'O')
X				return FTNOTE;
X			break;
X		case 'O':
X			if (rt[2] == 'R' && rt[3] == 'M')
X				return FORMUL;
X			break;
X		}
X		break;
X
X	case 'H':
X		if (rt[1] != 'E')
X			break;
X		if (rt[2] == 'T' && rt[3] == 'A')
X			return HETATM;
X		if (rt[2] == 'A' && rt[3] == 'D')
X			return HEADER;
X		if (rt[2] == 'T' && rt[3] == ' ')
X			return HET;
X		if (rt[2] == 'L' && rt[3] == 'I')
X			return HELIX;
X		break;
X
X	case 'J':
X		if (rt[1] == 'R' && rt[2] == 'N' && rt[3] == 'L')
X			return JRNL;
X		break;
X
X	case 'M':
X		switch (rt[1]) {
X		case 'A':
X			if (rt[2] == 'S' && rt[3] == 'T')
X				return MASTER;
X			break;
X		case 'O':
X			if (rt[2] == 'D' && rt[3] == 'E')
X				return MODEL;
X			break;
X		case 'T':
X			if (rt[2] == 'R' && rt[3] == 'I')
X				return MTRIX;
X			if (rt[2] == 'X' && rt[3] == 'D')
X				return MTXDES;
X			break;
X		}
X		break;
X
X	case 'O':
X		switch (rt[1]) {
X		case 'B':
X			if (rt[2] == 'S' && rt[3] == 'L')
X				return OBSLTE;
X			break;
X		case 'R':
X			if (rt[2] == 'I' && rt[3] == 'G')
X				return ORIGX;
X			break;
X		}
X		break;
X
X	case 'R':
X		if (rt[1] != 'E')
X			break;
X		if (rt[2] == 'M' && rt[3] == 'A')
X			return REMARK;
X		if (rt[2] == 'V' && rt[3] == 'D')
X			return REVDAT;
X		break;
X
X	case 'S':
X		switch (rt[1]) {
X
X		case 'C':
X			if (rt[2] == 'A' && rt[3] == 'L')
X				return SCALE;
X			break;
X
X		case 'E':
X			if (rt[2] == 'Q' && rt[3] == 'R')
X				return SEQRES;
X			break;
X
X		case 'H':
X			if (rt[2] == 'E' && rt[3] == 'E')
X				return SHEET;
X			break;
X
X		case 'I':
X			if (rt[2] == 'T' && rt[3] == 'E')
X				return SITE;
X			if (rt[2] == 'G' && rt[3] == 'A')
X				return SIGATM;
X			if (rt[2] == 'G' && rt[3] == 'U')
X				return SIGUIJ;
X			break;
X
X		case 'O':
X			if (rt[2] == 'U' && rt[3] == 'R')
X				return SOURCE;
X			break;
X
X		case 'P':
X			if (rt[2] == 'R' && rt[3] == 'S')
X				return SPRSDE;
X			break;
X
X		case 'S':
X			if (rt[2] == 'B' && rt[3] == 'O')
X				return SSBOND;
X			break;
X
X		case 'Y':
X			if (rt[2] == 'M' && rt[3] == 'D')
X				return SYMDES;
X			if (rt[2] == 'M' && rt[3] == 'O')
X				return SYMOP;
X			break;
X		}
X		break;
X
X	case 'T':
X		switch (rt[1]) {
X		case 'E':
X			if (rt[2] == 'R' && rt[3] == ' ')
X				return TER;
X			break;
X		case 'R':
X			if (rt[2] == 'N' && rt[3] == 'S')
X				return TRNSFM;
X			break;
X		case 'U':
X			if (rt[2] == 'R' && rt[3] == 'N')
X				return TURN;
X			break;
X		case 'V':
X			if (rt[2] == 'E' && rt[3] == 'C')
X				return TVECT;
X			break;
X		}
X		break;
X
X	case 'U':
X		if (rt[1] == 'S' && rt[2] == 'E' && rt[3] == 'R')
X			switch (pdbrunInputVersion) {
X			case 1: case 2: case 3: case 4: case 5:
X				return pdbrun5Type(buf + 6);
X			case 6:
X				return pdbrun6Type(buf + 6);
X			default:
X				if (strncasecmp(buf + 6, "PDBRUN ", 7) == 0)
X					return USER_PDBRUN;
X				return USER;
X			}
X		break;
X	}
X	return UNKNOWN;
}
SHAR_EOF
  (set 20 04 07 28 14 02 31 'libpdb++/pdb_type.cc'; eval "$shar_touch") &&
  chmod 0664 'libpdb++/pdb_type.cc' ||
  $echo 'restore of' 'libpdb++/pdb_type.cc' '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 'libpdb++/pdb_type.cc:' 'MD5 check failed'
0800761be52dbb760a8acfcc34e8a30d  libpdb++/pdb_type.cc
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'libpdb++/pdb_type.cc'`"
    test 12195 -eq "$shar_count" ||
    $echo 'libpdb++/pdb_type.cc:' 'original size' '12195,' 'current size' "$shar_count!"
  fi
fi
# ============= libpdb++/pdbinput.cc ==============
if test -f 'libpdb++/pdbinput.cc' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'libpdb++/pdbinput.cc' '(file already exists)'
else
  $echo 'x -' extracting 'libpdb++/pdbinput.cc' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'libpdb++/pdbinput.cc' &&
//
//	Copyright (c) 1992 The Regents of the University of California.
//	All rights reserved.
//
//	Redistribution and use in source and binary forms are permitted
//	provided that the above copyright notice and this paragraph are
//	duplicated in all such forms and that any documentation,
//	advertising materials, and other materials related to such
//	distribution and use acknowledge that the software was developed
//	by the University of California, San Francisco.  The name of the
//	University may not be used to endorse or promote products derived
//	from this software without specific prior written permission.
//	THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
//	IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
//	WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
//	$Id: pdbinput.cc,v 1.1 94/02/22 17:09:27 gregc Exp $
//
X
#include "pdb++.h"
X
std::istream &
operator>>(std::istream &s, PDB &p)
{
X	char	buf[4 * PDB::BufLen];
X
X	s.getline(buf, 4 * PDB::BufLen);
X	if (s)
X		p = PDB(buf);
X	return s;
}
SHAR_EOF
  (set 20 04 07 28 14 04 11 'libpdb++/pdbinput.cc'; eval "$shar_touch") &&
  chmod 0664 'libpdb++/pdbinput.cc' ||
  $echo 'restore of' 'libpdb++/pdbinput.cc' '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 'libpdb++/pdbinput.cc:' 'MD5 check failed'
cb9d578f4e4752655ff2f40acd8c65e0  libpdb++/pdbinput.cc
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'libpdb++/pdbinput.cc'`"
    test 1062 -eq "$shar_count" ||
    $echo 'libpdb++/pdbinput.cc:' 'original size' '1062,' 'current size' "$shar_count!"
  fi
fi
rm -fr _sh13093
exit 0
