CCL Home Page
Up Directory CCL libpdb++
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	pdb++.3
#	Makefile
#	pdb++.h
#	pdbrun5_read.i
#	pdbrun5_write.i
#	pdbrun6_read.i
#	pdbrun6_write.i
#	read_format.i
#	write_format.i
#	pdb++.cc
#	pdb_chars.cc
#	pdb_read.cc
#	pdb_sprntf.cc
#	pdb_sscanf.cc
#	pdb_type.cc
#	pdbinput.cc
# This archive created: Mon May 22 13:08:52 1995
export PATH; PATH=/bin:/usr/bin:$PATH
echo shar: "extracting 'pdb++.3'" '(8002 characters)'
if test -f 'pdb++.3'
then
	echo shar: "will not over-write existing file 'pdb++.3'"
else
sed 's/^	X//' << \SHAR_EOF > '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
	Xpdb++ \- A C++ class for manipulating Brookhaven Protein DataBank records
	X.SH SYNOPSIS
	X.nf
	X#include 
	X
	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\&....
	X.fi
	X.SH DESCRIPTION
	XThe routines listed above are available in the pdb++ library,
	X.IR "-L/usr/local/lib/midas -lpdb++" .
	X.PP
	XThe
	X.B PDB
	Xclass provides methods for parsing Brookhaven Protein DataBank (PDB) records
	X(lines from a PDB file) into structures
	Xand expanding those structures back into PDB records.
	XRather than provide access functions for each possible field,
	Xthe structure containing the parsed record is publicly available.
	XThe field names are listed in the header file.
	X.PP
	XThe
	X.B PDB 
	Xclass has two enhancements to the Brookhaven Protein DataBank specification:
	Xfour character residue names, and the PDBRUN set of scene annotation records.
	XFor character residue names work because
	Xeverywhere in the specification a three character residue name appears,
	Xthere is a blank afterwards.
	X.SH "MEMBER CONSTANTS"
	X.TP
	X.B BufLen
	XThe maximum length of a generated PDB record string (including the null byte).
	X.TP
	X.B PDBRUNVersion
	XThe default version of the PDBRUN scene annotation records.
	X.PP
	XThere are also constants for each known PDB record type
	X.RI ( e.g. ,
	X.BR ATOM ,
	X.BR HETATM ,
	X.IR etc. ),
	Xand the constant 
	X.B UNKNOWN
	Xfor an unknown PDB record.
	X.PP
	XThe 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 ,
	Xand
	X.BR USER_GFX_LABEL .
	X.PP
	XThe following constants are for the various graphics primitives supported
	Xin 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 ,
	Xand 
	X.BR GFX_POLYGON .
	X.SH "MEMBER TYPES"
	X.TP
	Xtypedef char \fBDate\fP[10]
	XA text field containing a date, typically \fIday\fP\-\fImonth\fP\-\fIyear\fP,
	Xwhere
	X.I day
	Xis numeric,
	X.I month
	Xis a three-letter abbreviation,
	Xand
	X.I year
	Xis the last two digits of the year.
	X.TP
	Xtypedef char \fBAName\fP[5]
	XA PDB atom name, \fIe.g.\fP, NO2*.
	X.TP
	Xtypedef char \fBRName\fP[5]
	XResidue name, \fIe.g.\fP, ALA.
	X.TP
	Xtypedef char \fBPName\fP[5]
	XPDB name, \fIe.g.\fP, 9lyz.
	X.TP
	Xtypedef char \fBId\fP[4]
	XGeneric short id field.
	X.TP
	Xtypedef double \fBReal\fP
	XSize of floating point numbers read and written.
	X.TP
	Xstruct \fBResidue\fP
	XA \fBResidue\fP consists of a residue name (\fBname\fP),
	Xa chain identifier (\fBchainId\fP), a sequence number (\fBseqNum\fP),
	Xand 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
	XConstructors.
	XThe first two above construct a zeroed instance of the given record type
	X(default
	X.BR UNKNOWN ).
	XThe last constructor above fills in all of the fields of the instance
	Xfrom the given PDB record text.
	X.RE
	X.TP
	XRecordType \fBtype\fP() const
	XReturn the type of PDB instance.
	X.TP
	Xvoid \fBtype\fP(RecordType t)
	XChange the PDB record type of the instance
	Xand reinitialize all the fields to default values
	X(zero in all cases except for an
	X.BR ATOM 's
	Xoccupancy which defaults to 1.0).
	X.TP
	Xconst char *\fBchars\fP() const;
	XReturn a string containing the PDB record in textual form.
	X.TP
	Xstatic int \fBPdbrunInputVersion\fP()
	XReturn the current PDBRUN scene annotation version used to parse text records.
	X.TP
	Xstatic int \fBPdbrunOutputVersion\fP()
	XReturn the current PDBRUN scene annotation version used to create text records.
	X.TP
	Xstatic void \fBPdbrunInputVersion\fP(int v)
	XSet the current PDBRUN scene annotation version used to parse text records.
	X.TP
	Xstatic void \fBPdbrunOutputVersion\fP(int v)
	XSet the current PDBRUN scene annotation version used to create text records.
	X.TP
	Xstatic recordType \fBgetType\fP(const char *buf)
	XReturn the PDB record type for the given line of text.
	X.TP
	Xstatic GfxType \fBgetGfxType\fP(const char *buf)
	X.TP
	Xstatic const char *\fBgfxChars\fP(GfxType gt)
	X.TP
	Xstatic int \fBsscanf\fP(const char *, const char *, ...)
	XA version of
	X.BR sscanf (3)
	Xwhose format's behave like \s-2FORTRAN\s0 formats where field widths
	Xare sacrosanct.
	XIf the input line is short,
	Xthen the rest of the fields are initialized to default values.
	XAny literal characters in the format must match the input.
	XThe format characters are:
	Xspace, ignore input character;
	X.BR c ,
	Xcharacter (array), default to a space;
	X.BR d ,
	Xinteger, default zero;
	X.BR f ,
	Xdouble, default zero;
	X.BR s ,
	Xget a C string, trailing spaces are stripped and it is null terminated,
	Xdefault an empty string.
	X.B sscanf
	Xreturns the number of input fields converted
	X(may be less than expected if the input line is short)
	Xor \(mi1 if an error is found.
	X.TP
	Xstatic int \fBsprintf\fP(char *, const char *, ...)
	XA version of
	X.BR sprintf (3)
	Xwhose format's behave like \s-2FORTRAN\s0 formats where field widths
	Xare sacrosanct.
	XLiteral characters are copied as is.
	XIf the text or number to be printed is larger than the given field width,
	Xthen the field is filled in with asterisks.
	XThe format characters are:
	X.BR d ,
	Xinteger;
	X.BR D ,
	Xinteger where zero is written as spaces;
	X.BR s ,
	Xright-justified string (a negative field width left-justifies);
	X.BR c ,
	Xcharacter (array), zero characters are converted to spaces;
	X.BR f ,
	Xfloating point, normal
	X.B printf
	Xprecisions are used.
	X.SH "I/O FUNCTIONS"
	X.TP
	Xostream &\fBoperator<<\fP(ostream &s, const PDB &p)
	XOutput the current PDB record on the given output stream.
	X.TP
	Xistream &\fBoperator>>\fP(istream &s, PDB &p)
	XRead a line from the given input stream and convert to a PDB record.
	X.SH "SEE ALSO"
	X``Protein Data Bank Atomic Coordinate and Bibliographic Entry Format Description,'' Febuary 1992,
	XBrookhaven National Laboratory,
	Xthe January 1993 Protein Data Bank Quarterly Newsletter,
	X``Annotating PDB Files with Scene Information,''
	XGregory S. Couch, \fIet. al.\fP, (submitted for publication).
	X.SH NOTES
	XThe subtype field of USERxx structure tells what the
	X.I xx
	Xpart was.
	XThe rest of the line, up to the card sequence portion, is the text field.
	X.PP
	XDue to the way Brookhaven encodes their files,
	Xatom names often have leading blanks and sometimes have embedded blanks.
	XResidue names occasionally have leading blanks too.
	XTo be entirely consistent with the PDB format,
	Xthe programmer should put those blanks in before using the
	X.B chars
	Xmember function.
	X.SH BUGS
	XRoutines are needed to convert to and from PDB typesetting conventions in
	X.BR COMPND ,
	X.BR SOURCE ,
	X.BR AUTHOR ,
	Xand
	X.B JRNL
	Xrecords.
	X.SH COPYRIGHT
	XCopyright \(co 1994 The Regents of the University of California.
	XAll rights reserved.
	X.PP
	XRedistribution and use in source and binary forms are permitted
	Xprovided that the above copyright notice and this paragraph are
	Xduplicated in all such forms and that any documentation,
	Xadvertising materials, and other materials related to such
	Xdistribution and use acknowledge that the software was developed
	Xby the University of California, San Francisco.  The name of the
	XUniversity may not be used to endorse or promote products derived
	Xfrom this software without specific prior written permission.
	XTHIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
	XIMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
	XWARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
SHAR_EOF
if test 8002 -ne "`wc -c < 'pdb++.3'`"
then
	echo shar: "error transmitting 'pdb++.3'" '(should have been 8002 characters)'
fi
fi
echo shar: "extracting 'Makefile'" '(821 characters)'
if test -f 'Makefile'
then
	echo shar: "will not over-write existing file 'Makefile'"
else
sed 's/^	X//' << \SHAR_EOF > 'Makefile'
	X#
	X#	On BSD machines, RANLIB should be 'ranlib'
	X#
	X#	On System V machines, RANLIB should be ':'
	X#
	XSHELL		= /bin/sh
	XRANLIB		= :
	X
	XCXX		= gcc -felide-constructors
	X#CXX		= CC
	X
	X.SUFFIXES:	.cc
	X
	X.cc.o:
	X	$(CXX) -c $< -o $@
	X
	XOPT		= -O
	XDEBUG		=
	XCFLAGS		= $(OPT) $(DEBUG)
	XLIBRARY		= pdb++
	X
	XLIBARCH		= lib$(LIBRARY).a
	XOBJS		= pdb_read.o pdb_sprntf.o pdb_sscanf.o pdb_chars.o \
	X		pdb_type.o pdb++.o pdbinput.o
	XSRCS		= pdb_read.cc pdb_sprntf.cc pdb_sscanf.cc pdb_chars.cc \
	X		pdb_type.cc pdb++.cc pdbinput.cc
	X
	Xall:		$(LIBARCH)
	X
	Xinstall:	$(LIBARCH)
	X		install -F /usr/local/lib $(LIBARCH)
	X
	X$(LIBARCH):     $(OBJS)
	X		@echo "Loading $(LIBARCH) ... "
	X		@ar cru $(LIBARCH) $(OBJS)
	X		@$(RANLIB) $(LIBARCH)
	X		@echo "done"
	X
	Xclean:;		@rm -f $(OBJS)
	X
	Xspotless:;	@rm -f $(OBJS) $(LIBARCH)
	X
	Xtags:           $(HDRS) $(SRCS); @ctags -w $(HDRS) $(SRCS)
SHAR_EOF
if test 821 -ne "`wc -c < 'Makefile'`"
then
	echo shar: "error transmitting 'Makefile'" '(should have been 821 characters)'
fi
fi
echo shar: "extracting 'pdb++.h'" '(10596 characters)'
if test -f 'pdb++.h'
then
	echo shar: "will not over-write existing file 'pdb++.h'"
else
sed 's/^	X//' << \SHAR_EOF > 'pdb++.h'
	X//
	X//	Copyright (c) 1992 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: pdb++.h,v 1.14 95/02/28 14:09:49 gregc Exp $
	X//
	X//	Based on Brookhaven National Laboratory Protein Data Bank, Feb 1992
	X//
	X//	C structure declarations
	X//
	X
	X#ifndef PDB_H
	X#define	PDB_H
	X
	X#include 
	X
	Xclass PDB {
	Xpublic:
	X#ifdef PDB_WORKAROUND
	X	enum { BufLen = 73, PDBRUNVersion = 6 };
	X#else
	X	static const int BufLen = 73;		// PDB record length (72 + '\0')
	X	static const int PDBRUNVersion = 6;	// Best version generated
	X#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	};
	X#ifdef PDB_WORKAROUND
	X	enum { NUM_TYPES = AGGRGT + 1,
	X		NUM_USER = USER_GFX_POINT - USER_PDBRUN + 1 };
	X#else
	X	static const int	NUM_TYPES = AGGRGT + 1;
	X	static const int	NUM_USER = USER_GFX_POINT - USER_PDBRUN + 1;
	X#endif
	Xprivate:
	X	RecordType	rType;
	X	static int	pdbrunInputVersion, pdbrunOutputVersion;
	X	static int	byteCmp(const PDB &l, const PDB &r);
	Xpublic:
	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 istream	&operator>>(istream &s, PDB &p);
	X};
	X
	Xinline ostream &
	Xoperator<<(ostream &s, const PDB &p)
	X{
	X	s << p.chars();
	X	return s;
	X}
	X
	X# endif // PDB_H
SHAR_EOF
if test 10596 -ne "`wc -c < 'pdb++.h'`"
then
	echo shar: "error transmitting 'pdb++.h'" '(should have been 10596 characters)'
fi
fi
echo shar: "extracting 'pdbrun5_read.i'" '(1873 characters)'
if test -f 'pdbrun5_read.i'
then
	echo shar: "will not over-write existing file 'pdbrun5_read.i'"
else
sed 's/^	X//' << \SHAR_EOF > 'pdbrun5_read.i'
	X/*
	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 */
	X/* PDBRUN */	"%12  %2d",
	X/* EYEPOS */	"%12  %9f %9f %9f",
	X/* ATPOS */	"%11   %9f %9f %9f",
	X/* WINDOW */	"%12  %9f %9f %9f %9f %9f %9f",
	X/* FOCUS */	"%11  %9f",
	X/* VIEWPORT */	"%14  %9f %9f %9f %9f",
	X/* BGCOLOR */	"USER  BGCOLOR %lf %lf %lf",
	X/* ANGLE */	"%11  %2d %6d %6d %6d %6d %8f",
	X/* DISTANCE */	"%14  %2d %6d %6d %8f",
	X/* FILE */	"%10  %61s",
	X/* MARKNAME */	NULL,
	X/* MARK */	NULL,
	X/* CNAME */	"USER  CNAME %s %lf %lf %lf",
	X/* COLOR */	"USER  COLOR %s %lf %lf %lf",
	X/* RADIUS */	"%12  %7f",
	X/* OBJECT */	"%12  %3d",
	X/* ENDOBJ */	"%12  %3d",
	X/* CHAIN */	"USER  CHAIN %d %d",
	X/* GFX BEGIN */	NULL,
	X/* GFX END */	NULL,
	X/* GFX COLOR */	"USER  GFX COLOR %s %lf %lf %lf",
	X/* GFX NORMAL */	NULL,
	X/* GFX VERTEX */	NULL,
	X/* GFX FONT */	"USER  GFX FONT %s %d",
	X/* GFX TEXTPOS */	NULL,
	X/* GFX LABEL */	"USER  GFX LABEL %lf %lf %lf %26[^\n]",
	X/* GFX MOVE */	"%14  %9f %9f %9f",
	X/* GFX DRAW */	"%14  %9f %9f %9f",
	X/* GFX MARKER */	"%16  %9f %9f %9f",
	X/* GFX POINT */	"%15  %9f %9f %9f",
SHAR_EOF
if test 1873 -ne "`wc -c < 'pdbrun5_read.i'`"
then
	echo shar: "error transmitting 'pdbrun5_read.i'" '(should have been 1873 characters)'
fi
fi
echo shar: "extracting 'pdbrun5_write.i'" '(1843 characters)'
if test -f 'pdbrun5_write.i'
then
	echo shar: "will not over-write existing file 'pdbrun5_write.i'"
else
sed 's/^	X//' << \SHAR_EOF > 'pdbrun5_write.i'
	X/*
	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 */
	X"USER  PDBRUN %2d",
	X"USER  EYEPOS %9.3f %9.3f %9.3f",
	X"USER  ATPOS  %9.3f %9.3f %9.3f",
	X"USER  WINDOW %9.3f %9.3f %9.3f %9.3f %9.3f %9.3f",
	X"USER  FOCUS %9.3f",
	X"USER  VIEWPORT %9.3f %9.3f %9.3f %9.3f",
	X"USER  BGCOLOR %.3f %.3f %.3f",
	X"USER  ANGLE %2d %6d %6d %6d %6d %8.3f",
	X"USER  DISTANCE %2d %6d %6d %8.3f",
	X"USER  FILE %-61s",
	XNULL,	/* USER  MARKNAME */
	XNULL,	/* USER  MARK */
	X"USER  CNAME %-.38s %.3f %.3f %.3f",
	X"USER  COLOR %-.38s %5.3f %5.3f %5.3f",
	X"USER  RADIUS %7.3f",
	X"USER  OBJECT %3d",
	X"USER  ENDOBJ %3d",
	X"USER  CHAIN %d %d",
	XNULL,	/* USER  GFX BEGIN */
	XNULL,	/* USER  GFX END */
	X"USER  GFX COLOR %-.38s %.3f %.3f %.3f",
	XNULL,	/* USER  GFX NORMAL */
	XNULL,	/* USER  GFX VERTEX */
	X"USER  GFX FONT %-.53s %d",
	XNULL,	/* USER  GFX TEXTPOS */
	X"USER  GFX LABEL %9.3f %9.3f %9.3f \"%-.24s\"",
	X"USER  GFX MOVE %9.3f %9.3f %9.3f",
	X"USER  GFX DRAW %9.3f %9.3f %9.3f",
	X"USER  GFX MARKER %9.3f %9.3f %9.3f",
	X"USER  GFX POINT %9.3f %9.3f %9.3f",
SHAR_EOF
if test 1843 -ne "`wc -c < 'pdbrun5_write.i'`"
then
	echo shar: "error transmitting 'pdbrun5_write.i'" '(should have been 1843 characters)'
fi
fi
echo shar: "extracting 'pdbrun6_read.i'" '(1804 characters)'
if test -f 'pdbrun6_read.i'
then
	echo shar: "will not over-write existing file 'pdbrun6_read.i'"
else
sed 's/^	X//' << \SHAR_EOF > 'pdbrun6_read.i'
	X/*
	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 */
	X/* PDBRUN */	"%12  %2d",
	X/* EYEPOS */	"%12  %9f %9f %9f",
	X/* ATPOS */	"%11   %9f %9f %9f",
	X/* WINDOW */	"%12  %9f %9f %9f %9f %9f %9f",
	X/* FOCUS */	"%11   %9f",
	X/* VIEWPORT */	"%14  %9f %9f %9f %9f",
	X/* BGCOLOR */	"%13  %5f %5f %5f",
	X/* ANGLE */	"%11  %6d %6d %6d %6d %9f",
	X/* DISTANCE */	"%14  %6d %6d %9f",
	X/* FILE */	"%10  %4d %56s",
	X/* MARKNAME */	"%14  %57s",
	X/* MARK */	"%10  %57s",
	X/* CNAME */	"%11  %5f %5f %5f %38s",
	X/* COLOR */	"%11  %5f %5f %5f %38s",
	X/* RADIUS */	"%12  %7f",
	X/* OBJECT */	"%12 ",
	X/* ENDOBJ */	"%12 ",
	X/* CHAIN */	"%11  %6d %6d",
	X/* GFX BEGIN */	"%15  %32s",
	X/* GFX END */	"%13 ",
	X/* GFX COLOR */	"%15  %5f %5f %5f %38s",
	X/* GFX NORMAL */	"%16  %9f %9f %9f",
	X/* GFX VERTEX */	"%16  %9f %9f %9f",
	X/* GFX FONT */	"%14  %3d %53s",
	X/* GFX TEXTPOS */	"%17  %9f %9f %9f",
	X/* GFX LABEL */	"%15  %56s",
	X/* GFX MOVE */	NULL,
	X/* GFX DRAW */	NULL,
	X/* GFX MARKER */	NULL,
	X/* GFX POINT */	NULL,
SHAR_EOF
if test 1804 -ne "`wc -c < 'pdbrun6_read.i'`"
then
	echo shar: "error transmitting 'pdbrun6_read.i'" '(should have been 1804 characters)'
fi
fi
echo shar: "extracting 'pdbrun6_write.i'" '(1787 characters)'
if test -f 'pdbrun6_write.i'
then
	echo shar: "will not over-write existing file 'pdbrun6_write.i'"
else
sed 's/^	X//' << \SHAR_EOF > 'pdbrun6_write.i'
	X/*
	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 */
	X"USER  PDBRUN %2d",
	X"USER  EYEPOS %9.3f %9.3f %9.3f",
	X"USER  ATPOS  %9.3f %9.3f %9.3f",
	X"USER  WINDOW %9.3f %9.3f %9.3f %9.3f %9.3f %9.3f",
	X"USER  FOCUS  %9.3f",
	X"USER  VIEWPORT %9.3f %9.3f %9.3f %9.3f",
	X"USER  BGCOLOR %5.3f %5.3f %5.3f",
	X"USER  ANGLE %6d %6d %6d %6d %9.3f",
	X"USER  DISTANCE %6d %6d %9.3f",
	X"USER  FILE %4d %-56s",
	X"USER  MARKNAME %-57s",
	X"USER  MARK %-57s",
	X"USER  CNAME %5.3f %5.3f %5.3f %-42s",
	X"USER  COLOR %5.3f %5.3f %5.3f %-42s",
	X"USER  RADIUS %7.3f",
	X"USER  OBJECT",
	X"USER  ENDOBJ",
	X"USER  CHAIN %6d %6d",
	X"USER  GFX BEGIN %-32s",
	X"USER  GFX END",
	X"USER  GFX COLOR %5.3f %5.3f %5.3f %s",
	X"USER  GFX NORMAL %9.3f %9.3f %9.3f",
	X"USER  GFX VERTEX %9.3f %9.3f %9.3f",
	X"USER  GFX FONT %3d %-53s",
	X"USER  GFX TEXTPOS %9.3f %9.3f %9.3f",
	X"USER  GFX LABEL %-56s",
	XNULL,	/* USER  GFX MOVE */
	XNULL,	/* USER  GFX DRAW */
	XNULL,	/* USER  GFX MARKER */
	XNULL,	/* USER  GFX POINT */
SHAR_EOF
if test 1787 -ne "`wc -c < 'pdbrun6_write.i'`"
then
	echo shar: "error transmitting 'pdbrun6_write.i'" '(should have been 1787 characters)'
fi
fi
echo shar: "extracting 'read_format.i'" '(3131 characters)'
if test -f 'read_format.i'
then
	echo shar: "will not over-write existing file 'read_format.i'"
else
sed 's/^	X//' << \SHAR_EOF > 'read_format.i'
	X/*
	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 */
	X/* UNKNOWN */	NULL,
	X/* ANISOU */	"%6 %5d %4s%c%4s%c%4d%c %7d%7d%7d%7d%7d%7d",	/* SIGUIJ */
	X/* ATOM */	"%6 %5d %4s%c%4s%c%4d%c   %8f%8f%8f%6f%6f %3d",	/* HETATM, SIGATM */
	X/* AUTHOR */	"%9 %c%60s",		/* COMPND, EXPDTA, JRNL, SOURCE */
	X/* COMPND */	"%9 %c%60s",			/* AUTHOR */
	X/* CONECT */	"%6 %5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d",
	X/* CRYST1 */	"%6 %9f%9f%9f%7f%7f%7f %11s%4d",
	X/* END */	NULL,
	X/* FORMUL */	"%8 %2d  %4s%2d%c%51s",
	X/* FTNOTE */	"%7 %3d %59s",	/*  REMARK, SYMDES, MTXDES, CMPDES, AGRDES */
	X/* HEADER */	"%10 %40s%9s  %c%4s",
	X/* HELIX */	"%7 %3d %3s %4s%c %4d%c %4s%c %4d%c%2d%30s",
	X/* HET */	"%7 %4s %c%4d%c  %5d%5 %40s",
	X/* HETATM */	"%6 %5d %4s%c%4s%c%4d%c   %8f%8f%8f%6f%6f %3d",	/* ATOM */
	X/* JRNL */	"%9 %c%60s",			/* AUTHOR */
	X/* MASTER */	"%10 %5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d",
	X/* MTRIX */	"%5 %d %3d%10f%10f%10f%5 %10f   %2d",
	X/* OBSLTE */	"%8 %2d %9s %4s%6 %4s %4s %4s %4s %4s %4s %4s %4s",
	X/* ORIGX */	"%5 %d%4 %10f%10f%10f%5 %10f",	/* SCALE */
	X/* REMARK */	"%7 %3d %59s",			/* FTNOTE */
	X/* REVDAT */	"%7 %3d%2d %9s %7s %c%7 %31s",
	X/* SCALE */	"%5 %d%4 %10f%10f%10f%5 %10f",
	X/* SEQRES */	"%6 %4d %c %4d  %4s%4s%4s%4s%4s%4s%4s%4s%4s%4s%4s%4s%4s",
	X/* SHEET */	"%6 %4d %3s%2d %4s%c%4d%c %4s%c%4d%c%2d %4s%4s%c%4d%c %4s%4s%c%4d%c",
	X/* SIGATM */	"%6 %5d %4s%c%4s%c%4d%c   %8f%8f%8f%6f%6f %3d",	/* ATOM */
	X/* SIGUIJ */	"%6 %5d %4s%c%4s%c%4d%c %7d%7d%7d%7d%7d%7d",	/* ANISOU */
	X/* SITE */	"%7 %3d %3s %2d %4s%c%4d%c %4s%c%4d%c %4s%c%4d%c %4s%c%4d%c",
	X/* SOURCE */	"%9 %c%60s",			/* AUTHOR */
	X/* SPRSDE */	"%8 %2d %9s %4s%6 %4s %4s %4s %4s %4s %4s %4s %4s",
	X/* SSBOND */	"%7 %3d %4s%c %4d%c   %4s%c %4d%c%4 %30s",
	X/* TER */	"%6 %5d%6 %4s%c%4d%c",
	X/* TURN */	"%7 %3d %3s %4s%c%4d%c %4s%c%4d%c%4 %30s",
	X/* TVECT */	"%7 %3d%10f%10f%10f%30s",
	X/* USER */	"%4 %2s%66s",
	X/* MODEL */	"%9 %5d",
	X/* ENDMDL */	NULL,
	X/* EXPDTA */	"%9 %c%60s",			/* AUTHOR */
	X/* SYMDES */	"%7 %3d %59s",			/* FTNOTE */
	X/* SYMOP */	"%5 %d %3d%10f%10f%10f%5 %10f",
	X/* MTXDES */	"%7 %3d %59s",			/* FTNOTE */
	X/* CMPDES */	"%7 %3d %59s",			/* FTNOTE */
	X/* CMPONT */	"%7 %3d %4s%c %4d%c %4s%c %4d%c",
	X/* TRNSFM */	"%7 %3d %3d %3d",
	X/* AGRDES */	"%7 %3d %59s",			/* FTNOTE */
	X/* AGGRGT */	"%7 %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d",
SHAR_EOF
if test 3131 -ne "`wc -c < 'read_format.i'`"
then
	echo shar: "error transmitting 'read_format.i'" '(should have been 3131 characters)'
fi
fi
echo shar: "extracting 'write_format.i'" '(2897 characters)'
if test -f 'write_format.i'
then
	echo shar: "will not over-write existing file 'write_format.i'"
else
sed 's/^	X//' << \SHAR_EOF > 'write_format.i'
	X/*
	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 */
	X"UNKNOWN:  ??%-6.6s??",
	X"ANISOU%5d %-4s%c%-4s%c%4d%c %7d%7d%7d%7d%7d%7d",	/* SIGUIJ */
	X"ATOM  %5d %-4s%c%-4s%c%4d%c   %8.3f%8.3f%8.3f%6.2f%6.2f %3D", /* HETATM, SIGATM */
	X"AUTHOR   %c%-60s",			/* COMPND, EXPDTA, JRNL, SOURCE */
	X"COMPND   %c%-60s",					/* AUTHOR */
	X"CONECT%5d%5D%5D%5D%5D%5D%5D%5D%5D%5D%5D",
	X"CRYST1%9.3f%9.3f%9.3f%7.2f%7.2f%7.2f %-11s%4d",
	X"END",
	X"FORMUL  %2D  %-4s%2D%c%-51s",
	X"FTNOTE %3D %-59s",					/* REMARK */
	X"HEADER    %-40s%-11s%c%-4s",
	X"HELIX  %3D %3s %-4s%c %4d%c %-4s%c %4d%c%2D%-30s",
	X"HET    %-4s %c%4d%c  %5d     %-40s",
	X"HETATM%5d %-4s%c%-4s%c%4d%c   %8.3f%8.3f%8.3f%6.2f%6.2f %3D",
	X"JRNL     %c%-60s",					/* AUTHOR */
	X"MASTER    %5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d",
	X"MTRIX%1d %3d%10.6f%10.6f%10.6f     %10.5f   %2D",
	X"OBSLTE  %2D %-9s %-10s%-5s%-5s%-5s%-5s%-5s%-5s%-5s%-4s",
	X"ORIGX%1d    %10.6f%10.6f%10.6f     %10.5f",		/* SCALE */
	X"REMARK %3D %-59s",
	X"REVDAT %3D%2D %-9s %-7s %c       %-31s",
	X"SCALE%1d    %10.6f%10.6f%10.6f     %10.5f",		/* ORIGX */
	X"SEQRES%4d %c %4d  %-4s%-4s%-4s%-4s%-4s%-4s%-4s%-4s%-4s%-4s%-4s%-4s%-4s",
	X"SHEET %4D %3s%2d %-4s%c%4d%c %-4s%c%4d%c%2d %-4s%-4s%c%4D%c %-4s%-4s%c%4D%c",
	X"SIGATM%5d %-4s%c%-4s%c%4d%c   %8.3f%8.3f%8.3f%6.2f%6.2f %3D",
	X"SIGUIJ%5d %-4s%c%-4s%c%4d%c %7D%7D%7D%7D%7D%7D",	/* ANISOU */
	X"SITE   %3d %3s %2d %-4s%c%4D%c %-4s%c%4D%c %-4s%c%4D%c %-4s%c%4D%c",
	X"SOURCE   %c%-60s",					/* AUTHOR */
	X"SPRSDE  %2D %-9s %-10s%-5s%-5s%-5s%-5s%-5s%-5s%-5s%-4s",
	X"SSBOND %3D %-4s%c %4d%c   %-4s%c %4D%c    %-30s",
	X"TER   %5d      %-4s%c%4d%c",
	X"TURN   %3D %3s %-4s%c%4d%c %-4s%c%4d%c    %-30s",
	X"TVECT  %3D%10.5f%10.5f%10.5f%-30s",
	X"USER%-2s%-66s",
	X"MODEL    %5d",
	X"ENDMDL",
	X"EXPDTA   %c%-60s",					/* AUTHOR */
	X"SYMDES %3d %59s",					/* FTNOTE */
	X"SYMOP%1d %3d%10.6f%10.6f%10.6f     %10.5f",
	X"MTXDES %3d %59s",					/* FTNOTE */
	X"CMPDES %3d %59s",					/* FTNOTE */
	X"CMPONT %3d %4s%c %4d%c %4s%c %4d%c",
	X"TRNSFM %3d %3d %3d",
	X"AGRDES %3d %59s",					/* FTNOTE */
	X"AGGRGT %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d",
SHAR_EOF
if test 2897 -ne "`wc -c < 'write_format.i'`"
then
	echo shar: "error transmitting 'write_format.i'" '(should have been 2897 characters)'
fi
fi
echo shar: "extracting 'pdb++.cc'" '(1306 characters)'
if test -f 'pdb++.cc'
then
	echo shar: "will not over-write existing file 'pdb++.cc'"
else
sed 's/^	X//' << \SHAR_EOF > 'pdb++.cc'
	X//
	X//	Copyright (c) 1992 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: pdb++.cc,v 1.6 1994/12/13 22:41:17 gregc Exp $
	X//
	X
	X#include "pdb++.h"
	X
	Xextern "C" {
	X#include 
	X}
	X
	Xvoid
	XPDB::type(RecordType t)
	X{
	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}
	X
	Xint
	XPDB::byteCmp(const PDB &l, const PDB &r)
	X{
	X	return memcmp(&l, &r, sizeof (PDB));
	X}
SHAR_EOF
if test 1306 -ne "`wc -c < 'pdb++.cc'`"
then
	echo shar: "error transmitting 'pdb++.cc'" '(should have been 1306 characters)'
fi
fi
echo shar: "extracting 'pdb_chars.cc'" '(14454 characters)'
if test -f 'pdb_chars.cc'
then
	echo shar: "will not over-write existing file 'pdb_chars.cc'"
else
sed 's/^	X//' << \SHAR_EOF > 'pdb_chars.cc'
	X//
	X//	Copyright (c) 1989,1992 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: pdb_chars.cc,v 1.8 95/02/28 14:09:52 gregc Exp $
	X//
	X//	subroutine for writing PDB format files
	X//
	X
	X# include	"pdb++.h"
	Xextern "C" {
	X# include	
	X}
	Xextern "C" int	sprintf(char *, const char *, ...);
	X
	Xstatic char const * const pdbRecordFormat[PDB::NUM_TYPES] = {
	X#include "write_format.i"
	X};
	X
	Xstatic char const * const pdbrun5[PDB::NUM_USER] = {
	X#include "pdbrun5_write.i"
	X};
	X
	Xstatic char const * const pdbrun6[PDB::NUM_USER] = {
	X#include "pdbrun6_write.i"
	X};
	X
	Xconst char *
	XPDB::chars(void) const
	X{
	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;
	X}
SHAR_EOF
if test 14454 -ne "`wc -c < 'pdb_chars.cc'`"
then
	echo shar: "error transmitting 'pdb_chars.cc'" '(should have been 14454 characters)'
fi
fi
echo shar: "extracting 'pdb_read.cc'" '(16032 characters)'
if test -f 'pdb_read.cc'
then
	echo shar: "will not over-write existing file 'pdb_read.cc'"
else
sed 's/^	X//' << \SHAR_EOF > 'pdb_read.cc'
	X//
	X//	Copyright (c) 1989, 1992 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: pdb_read.cc,v 1.8 95/02/28 14:09:28 gregc Exp $
	X//
	X//	subroutine for reading PDB format files
	X//
	X
	X# include	"pdb++.h"
	X# include	
	X
	X# ifndef NULL
	X# define	NULL		0
	X# endif
	X
	Xextern "C" int	sscanf(const char *, const char *, ...);
	X
	X//
	X//	for each pdb record type there is a format reading in the
	X//	record values and for printing them out.
	X//
	X//	The actual format of a line written, is the print format
	X//	followed by blank padding to 72 characters, followed by
	X//	8 characters of file and line information.
	X//
	X
	Xstatic char const * const pdbRecordFormat[PDB::NUM_TYPES] = {
	X#include "read_format.i"
	X};
	X
	Xstatic char const * const pdbrun5[PDB::NUM_USER] = {
	X#include "pdbrun5_read.i"
	X};
	X
	Xstatic char const * const pdbrun6[PDB::NUM_USER] = {
	X#include "pdbrun6_read.i"
	X};
	X
	XPDB::PDB(const char *buf)
	X{
	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:
	Xunknown:
	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
	Xuser:
	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	}
	X}
SHAR_EOF
if test 16032 -ne "`wc -c < 'pdb_read.cc'`"
then
	echo shar: "error transmitting 'pdb_read.cc'" '(should have been 16032 characters)'
fi
fi
echo shar: "extracting 'pdb_sprntf.cc'" '(8760 characters)'
if test -f 'pdb_sprntf.cc'
then
	echo shar: "will not over-write existing file 'pdb_sprntf.cc'"
else
sed 's/^	X//' << \SHAR_EOF > 'pdb_sprntf.cc'
	X//
	X//	Copyright (c) 1989,1992 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: pdb_sprntf.cc,v 1.4 94/09/06 15:03:07 gregc Exp $
	X//
	X
	X#include "pdb++.h"
	X#include 
	X#include 
	X#include 
	X
	X	// scratch must be big enough to hold the largest number
	Xstatic char	scratch[256];
	X
	X#define	OVERFLOW_CHAR	'*'
	X
	Xstatic char	*outint(int, int, int, char, char, int, char *, char);
	Xstatic char	*outunsigned(unsigned int, int, char, int, char *);
	Xstatic char	*outstr(char *, int, int, char, int, char *);
	Xstatic char	*outfloat(double, int, int, char, int, char *);
	Xstatic char	*outexp(double, int, int, char, int, char *);
	Xstatic char	*e_out(int, char *);
	X
	Xint
	XPDB::sprintf(char *outbuf, const char *fmt, ...)
	X{
	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}
	X
	Xstatic char *
	Xe_out(int width, char *where)
	X{
	X	while (width-- > 0)
	X		*where++ = OVERFLOW_CHAR;
	X	return where;
	X}
	X
	Xstatic char *
	Xoutint(int value, int width, int radix, char fill_char, char hex,
	X					int left_justify, char *p, char zero)
	X{
	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}
	X
	Xstatic char *
	Xoutunsigned(unsigned int value, int width, char fill_char, int left_justify,
	X									char *p)
	X{
	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}
	X
	Xstatic char *
	Xoutstr(char *s, int width, int maxstr, char fill_char, int left_justify, char *p)
	X{
	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}
	X
	Xstatic char *
	Xoutfloat(double value, int width, int nplace, char fill_char, int left_justify,
	X									char *p)
	X{
	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}
	X
	Xstatic char *
	Xoutexp(double value, int width, int nplace, char fill_char, int left_justify,
	X									char *p)
	X{
	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;
	X}
SHAR_EOF
if test 8760 -ne "`wc -c < 'pdb_sprntf.cc'`"
then
	echo shar: "error transmitting 'pdb_sprntf.cc'" '(should have been 8760 characters)'
fi
fi
echo shar: "extracting 'pdb_sscanf.cc'" '(4650 characters)'
if test -f 'pdb_sscanf.cc'
then
	echo shar: "will not over-write existing file 'pdb_sscanf.cc'"
else
sed 's/^	X//' << \SHAR_EOF > 'pdb_sscanf.cc'
	X//
	X//	Copyright (c) 1989,1992 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: pdb_sscanf.cc,v 1.8 94/09/06 15:03:23 gregc Exp $
	X//
	X
	X#include "pdb++.h"
	X#include 
	X#include 
	X#include 
	X
	X//
	X//	pdb_sscanf performs similarly to sscanf, execept that fields are of
	X//	fixed length and a complete line is always consumed.  The field
	X//	width defaults to one.  If the line is shorter than expected then
	X//	the default is returned.
	X//
	X//		d	get an integer.  Default:  0.
	X//		f	get a floating point number (C double).  Default:  0.0.
	X//		(space) ignore characters within field
	X//		s	get a C string, leading and trailing spaces are
	X//			stripped; the field width is used as a limit on
	X//			the string length, the null character is appended
	X//			to the end of the string.  Default:  empty string.
	X//		c	get a character(s); no stripping of spaces, nor is
	X//			a null character appended.  Default:  space(s).
	X//
	X
	X#define	MAXFIELDSIZE	64
	X
	Xint
	XPDB::sscanf(const char *buffer, const char *fmt, ...)
	X{
	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;
	X}
SHAR_EOF
if test 4650 -ne "`wc -c < 'pdb_sscanf.cc'`"
then
	echo shar: "error transmitting 'pdb_sscanf.cc'" '(should have been 4650 characters)'
fi
fi
echo shar: "extracting 'pdb_type.cc'" '(12195 characters)'
if test -f 'pdb_type.cc'
then
	echo shar: "will not over-write existing file 'pdb_type.cc'"
else
sed 's/^	X//' << \SHAR_EOF > 'pdb_type.cc'
	X//
	X//	Copyright (c) 1992 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: pdb_type.cc,v 1.14 1995/05/22 19:53:09 gregc Exp $
	X//
	X//	subroutine for reading PDB format files
	X//
	X
	X# include	"pdb++.h"
	Xextern "C" {
	X# include	
	X# include	
	X}
	X#if 0
	Xextern "C" int strcasecmp (const char *s1, const char *s2);
	Xextern "C" int strncasecmp (const char *s1, const char *s2, size_t n);
	X#endif
	X
	X# ifndef _toupper
	X# define	_toupper	toupper
	X# endif
	X
	Xint PDB::pdbrunInputVersion = PDB::PDBRUNVersion;	// just in case
	Xint PDB::pdbrunOutputVersion = PDB::PDBRUNVersion;	// just in case
	X
	XPDB::GfxType
	XPDB::getGfxType(const char *buf)
	X{
	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}
	X
	Xconst char *
	XPDB::gfxChars(GfxType gt)
	X{
	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}
	X
	Xstatic PDB::RecordType
	Xpdbrun5Type(const char *buf)
	X{
	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}
	X
	Xstatic PDB::RecordType
	Xpdbrun6Type(const char *buf)
	X{
	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}
	X
	XPDB::RecordType
	XPDB::getType(const char *buf)
	X{
	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;
	X}
SHAR_EOF
if test 12195 -ne "`wc -c < 'pdb_type.cc'`"
then
	echo shar: "error transmitting 'pdb_type.cc'" '(should have been 12195 characters)'
fi
fi
echo shar: "extracting 'pdbinput.cc'" '(1052 characters)'
if test -f 'pdbinput.cc'
then
	echo shar: "will not over-write existing file 'pdbinput.cc'"
else
sed 's/^	X//' << \SHAR_EOF > 'pdbinput.cc'
	X//
	X//	Copyright (c) 1992 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: pdbinput.cc,v 1.1 94/02/22 17:09:27 gregc Exp $
	X//
	X
	X#include "pdb++.h"
	X
	Xistream &
	Xoperator>>(istream &s, PDB &p)
	X{
	X	char	buf[4 * PDB::BufLen];
	X
	X	s.getline(buf, 4 * PDB::BufLen);
	X	if (s)
	X		p = PDB(buf);
	X	return s;
	X}
SHAR_EOF
if test 1052 -ne "`wc -c < 'pdbinput.cc'`"
then
	echo shar: "error transmitting 'pdbinput.cc'" '(should have been 1052 characters)'
fi
fi
exit 0
#	End of shell archive
Modified: Thu Jan 1 00:00:00 1970 GMT
Page accessed 2014 times since Sat Apr 17 21:33:48 1999 GMT