CCL Home Page
Up Directory CCL libpdb.shar
#! /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:
#	ms.3
#	pdb.3
#	Makefile
#	ms.h
#	pdb.h
#	pdb_int.h
#	pdbrun5_read.i
#	pdbrun5_write.i
#	pdbrun6_read.i
#	pdbrun6_write.i
#	read_format.i
#	write_format.i
#	ms.c
#	pdb_read.c
#	pdb_sprntf.c
#	pdb_sscanf.c
#	pdb_write.c
#	pdbrun.c
# This archive created: Wed Nov  1 20:29:01 1995
export PATH; PATH=/bin:/usr/bin:$PATH
echo shar: "extracting 'ms.3'" '(2081 characters)'
if test -f 'ms.3'
then
	echo shar: "will not over-write existing file 'ms.3'"
else
sed 's/^	X//' << \SHAR_EOF > 'ms.3'
	X.\" Copyright (c) 1984,1989 by the Regents of the University of California.
	X.\" All Rights Reserved.
	X.\" $Id: ms.3,v 1.1 94/11/02 13:10:21 gregc Exp $
	X.TH MS 3 "14 Sept 1989"
	X.SH NAME
	Xms_read_record, ms_parse, ms_write_record \- read and write Molecular Surface (ms) records
	X.SH SYNOPSIS
	X.nf
	X.B #include 
	X.PP
	X.B ms_record ms_read_record(f)
	X.B FILE *f;
	X.PP
	X.B ms_record ms_parse(line_buffer)
	X.B char *line_buffer;
	X.PP
	X.B void ms_write_record(f, m)
	X.B FILE *f;
	X.B ms_record *m;
	X.fi
	X.SH DESCRIPTION
	XThe routines listed above
	Xare subroutines for Molecular Surface record I/O
	Xand are available in the pdb library, typically
	X.IR "-L/usr/local/lib/midas -lpdb" .
	X.PP
	XAlthough the header file is too long to reproduce here, it should be
	Xperused before using any of the above routines.
	XIt is typically found in
	X.IR /usr/local/midas/include .
	X.PP
	X\fBms_read_record\fP reads the next line of input from the file \fBf\fP,
	Xand returns the contents parsed into a C structure.
	X\fBms_parse\fP parses the contents of the line buffer
	Xand returns a C structure.
	X\fBms_write_record\fP writes the contents of the MS record (\fB*m\fP) to 
	Xthe file \fBf\fP.
	X.SH "SEE ALSO"
	Xdms(1)
	X.SH DIAGNOSTICS
	XUpon reaching the end of the file, \fBms_read_record\fP will return
	Xa record with MS_END as its type.
	X.SH COPYRIGHT
	XCopyright \(co 1992 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 2081 -ne "`wc -c < 'ms.3'`"
then
	echo shar: "error transmitting 'ms.3'" '(should have been 2081 characters)'
fi
fi
echo shar: "extracting 'pdb.3'" '(3650 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 (c) 1984,1989 by the Regents of the University of California.
	X.\" All Rights Reserved.
	X.\" $Id: pdb.3,v 1.16 94/11/06 19:55:29 gregc Exp $
	X.TH PDB 3 "14 Sept 1989"
	X.SH NAME
	Xpdb_read_record, pdb_parse, pdb_write_record \- read and write Brookhaven Protein DataBank records
	X.SH SYNOPSIS
	X.nf
	X.B #include 
	X.PP
	X.B pdb_record pdb_read_record(f)
	X.B FILE *f;
	X.PP
	X.B pdb_record pdb_parse(line_buffer)
	X.B char *line_buffer;
	X.PP
	X.B "void pdb_write_record(f, r, name, line_num)"
	X.B FILE *f;
	X.B pdb_record *r;
	X.B char *name;
	X.B int line_num;
	X.fi
	X.SH DESCRIPTION
	XThe routines listed above
	Xare subroutines for Brookhaven Protein Data Bank record I/O
	Xand are available in the pdb library, typically
	X.IR "-L/usr/local/lib/midas -lpdb" .
	X.PP
	XAlthough the header file is too long to reproduce here, it should be
	Xperused before using any of the above routines.
	XIt is typically found in
	X.IR /usr/local/midas/include .
	X\fBpdb_read_record\fP reads the next line of input from the file \fBf\fP,
	Xand returns the contents parsed into a C structure.
	X\fBpdb_parse\fP parses the contents of the line buffer
	Xand returns a C structure.
	X\fBpdb_write_record\fP writes the contents of the PDB record (\fB*r\fP) to 
	Xthe file \fBf\fP.  If the \fBname\fP is non-null, then it and the line
	Xnumber given (\fBline_num\fP) are placed in columns 72 through 80 on the
	Xline in standard PDB format.
	X.PP
	X\fBpdb_read_record\fP and \fBpdb_write_record\fP automatically
	Xhandle versions 5 and 6 of the UCSFCGL's PDB scene annotation records.
	XThe version number is automatically changed when a USER  PDBRUN record is read
	Xor written.
	XAny other version number turns off the parsing of scene annotation records.
	X.SH "SEE ALSO"
	X``Protein Data Bank Atomic Coordinate and Bibliographic Entry Format Description,'' Febuary 1992,
	XBrookhaven National Laboratory
	X(URL: ftp://ftp.pdb.bnl.gov/pub/format_desc.ps),
	Xthe January 1993 Protein Data Bank Quarterly Newsletter,
	Xand Couch, \fIet. al\fP, ``Annotating PDB Files with Scene Information'',
	X(in press)
	X(URL: http://cgl.ucsf.edu/????).
	X.SH DIAGNOSTICS
	XUpon reaching the end of the file, \fBpdb_read_record\fP will return
	Xa record with PDB_END as its type.
	X.SH NOTES
	XThe subtype field of USERxx structure tells what the \fIxx\fP part 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 usually have leading blanks and sometimes have embedded blanks.
	XResidue names occasionally have leading blanks too.
	XTo be entirely consistent with the PDB format, the programmer should put those
	Xblanks in before using \fBpdb_write_record\fP.
	X.SH BUGS
	XDoesn't allow exact duplication of the PDB card image sorting field
	X(columns 73 through 80).
	X.PP
	XRoutines are needed to convert to and from PDB typesetting conventions
	Xin COMPND, SOURCE, AUTHOR, and JRNL records.
	X.SH COPYRIGHT
	XCopyright \(co 1989 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 3650 -ne "`wc -c < 'pdb.3'`"
then
	echo shar: "error transmitting 'pdb.3'" '(should have been 3650 characters)'
fi
fi
echo shar: "extracting 'Makefile'" '(1069 characters)'
if test -f 'Makefile'
then
	echo shar: "will not over-write existing file 'Makefile'"
else
sed 's/^	X//' << \SHAR_EOF > 'Makefile'
	X#
	X#	For machines that don't have lint, remove $(LINTLIB) from the
	X#	"all" target.
	X#
	X#	On BSD machines, LINTOPT should be '-C', RANLIB should be 'ranlib'
	X#
	X#	On System V machines, LINTOPT should be '-o $(NOTHING)',
	X#	RANLIB should be ':'
	X#
	XSHELL		= /bin/sh
	XRANLIB		= :
	XNOTHING		=
	XLINTOPT		= -o $(NOTHING)
	X
	XOPT		= -O -g
	XDEBUG		=
	XCFLAGS		= $(OPT) $(DEBUG)
	XLIBRARY		= pdb
	X
	XLIBARCH		= lib$(LIBRARY).a
	XLINTLIB		= llib-l$(LIBRARY).ln
	XOBJS		= pdb_read.o pdb_sprntf.o pdb_sscanf.o pdb_write.o pdbrun.o ms.o
	XSRCS		= pdb_read.c pdb_sprntf.c pdb_sscanf.c pdb_write.c pdbrun.c ms.c
	X
	Xall:		$(LIBARCH) $(LINTLIB)
	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
	X$(LINTLIB):	$(SRCS) $(HDRS)
	X		@echo "Creating $(LINTLIB) ... "
	X		@lint $(LINTOPT)$(LIBRARY) $(SRCS)
	X		@echo "done"
	X
	Xclean:;		@rm -f $(OBJS)
	X
	Xspotless:;	@rm -f $(OBJS) $(LIBARCH) $(LINTLIB)
	X
	Xlint:		$(SRCS)
	X		lint -u $(SRCS)
	X
	Xtags:           $(HDRS) $(SRCS); @ctags -w $(HDRS) $(SRCS)
SHAR_EOF
if test 1069 -ne "`wc -c < 'Makefile'`"
then
	echo shar: "error transmitting 'Makefile'" '(should have been 1069 characters)'
fi
fi
echo shar: "extracting 'ms.h'" '(2307 characters)'
if test -f 'ms.h'
then
	echo shar: "will not over-write existing file 'ms.h'"
else
sed 's/^	X//' << \SHAR_EOF > 'ms.h'
	X/*
	X *	Copyright (c) 1989 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: ms.h,v 2.2 94/01/27 12:41:26 gregc Exp $
	X */
	X
	X#ifndef MS_H
	X#define	MS_H
	X
	X#include 
	X
	X#ifdef __cplusplus
	Xextern "C" {
	X#endif
	X
	X#define	MS_RECLEN	128
	X#define	MS_BUFSIZ	(MS_RECLEN + 2)
	X
	X#define	MS_MAX_RESTYPE	8
	X#define	MS_MAX_RESSEQ	8
	X#define	MS_MAX_ATNAME	8
	X
	X#define	MS_UNKNOWN	0
	X#define	MS_END		1
	X#define	MS_ATOM		2
	X#define	MS_SURFACE	3
	X#define	MS_USER		4
	X
	X#define	MS_NUM_R	5
	X
	Xtypedef struct ms_atom	{
	X	char	residue_type[MS_MAX_RESTYPE];
	X	char	residue_sequence[MS_MAX_RESSEQ];
	X	char	atom_name[MS_MAX_ATNAME];
	X	float	coord[3];
	X}	ms_atom;
	X
	Xtypedef struct ms_surf	{
	X	char	residue_type[MS_MAX_RESTYPE];
	X	char	residue_sequence[MS_MAX_RESSEQ];
	X	char	atom_name[MS_MAX_ATNAME];
	X	float	coord[3];
	X	float	normal[3];
	X	float	area;
	X	float	extra;
	X	char	has_normal;
	X	char	type;
	X	char	level;
	X}	ms_surface;
	X
	Xtypedef struct ms_user	{
	X	char	string[MS_BUFSIZ];
	X}	ms_user;
	X
	X#define	ms_unknown	ms_user
	X
	Xtypedef struct ms_record	{
	X	int	record_type;
	X	union	{
	X		ms_unknown	unknown;
	X		ms_atom		atom;
	X		ms_surface	surface;
	X		ms_user		user;
	X	}	ms;
	X}	ms_record;
	X
	X#if defined(__STDC__) || defined(__cplusplus)
	Xextern ms_record	ms_read_record(FILE *);
	Xextern ms_record	ms_read_string(const char *);
	Xextern void		ms_write_record(FILE *, const ms_record *);
	Xextern void		ms_write_string(char *, const ms_record *);
	X#else
	Xextern ms_record	ms_read_record();
	Xextern ms_record	ms_read_string();
	Xextern void		ms_write_record();
	Xextern void		ms_write_string();
	X#endif
	X
	X#ifdef __cplusplus
	X}
	X#endif
	X#endif
SHAR_EOF
if test 2307 -ne "`wc -c < 'ms.h'`"
then
	echo shar: "error transmitting 'ms.h'" '(should have been 2307 characters)'
fi
fi
echo shar: "extracting 'pdb.h'" '(12494 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) 1989 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 2.11 1995/01/20 01:20:36 gregc Exp $
	X *
	X *	Based on Brookhaven National Laboratory Protein Data Bank, March 1989
	X *
	X *	C structure declarations
	X */
	X
	X#ifndef PDB_H
	X# define	PDB_H
	X
	X# include	
	X
	X# ifdef __cplusplus
	Xextern "C" {
	X# endif
	X
	X# define	PDB_RECLEN	80		/* PDB record length */
	X# define	PDB_BUFSIZ	PDB_RECLEN + 2	/* + '\n' + '\0' */		
	X
	X# define	PDB_PDBRUN_VERSION	6
	X
	X# define	PDB_UNKNOWN	0
	X
	X/* records originally in alphabetical order */
	X
	X# define	PDB_ANISOU	1
	X# define	PDB_ATOM	2
	X# define	PDB_AUTHOR	3
	X# define	PDB_COMPND	4
	X# define	PDB_CONECT	5
	X# define	PDB_CRYST1	6
	X# define	PDB_END		7
	X# define	PDB_FORMUL	8
	X# define	PDB_FTNOTE	9
	X# define	PDB_HEADER	10
	X# define	PDB_HELIX	11
	X# define	PDB_HET		12
	X# define	PDB_HETATM	13
	X# define	PDB_JRNL	14
	X# define	PDB_MASTER	15
	X# define	PDB_MTRIX	16
	X# define	PDB_OBSLTE	17
	X# define	PDB_ORIGX	18
	X# define	PDB_REMARK	19
	X# define	PDB_REVDAT	20
	X# define	PDB_SCALE	21
	X# define	PDB_SEQRES	22
	X# define	PDB_SHEET	23
	X# define	PDB_SIGATM	24
	X# define	PDB_SIGUIJ	25
	X# define	PDB_SITE	26
	X# define	PDB_SOURCE	27
	X# define	PDB_SPRSDE	28
	X# define	PDB_SSBOND	29
	X# define	PDB_TER		30
	X# define	PDB_TURN	31
	X# define	PDB_TVECT	32
	X# define	PDB_USER	33
	X# define	PDB_MODEL	34
	X# define	PDB_ENDMDL	35
	X# define	PDB_EXPDTA	36
	X# define	PDB_SYMDES	37
	X# define	PDB_SYMOP	38
	X# define	PDB_MTXDES	39
	X# define	PDB_CMPDES	40
	X# define	PDB_CMPONT	41
	X# define	PDB_TRNSFM	42
	X# define	PDB_AGRDES	43
	X# define	PDB_AGGRGT	44
	X
	X# define	PDB_NUM_R	45
	X
	X# define	PDB_USER_PDBRUN		0x100
	X# define	PDB_USER_EYEPOS		0x101
	X# define	PDB_USER_ATPOS		0x102
	X# define	PDB_USER_WINDOW		0x103
	X# define	PDB_USER_FOCUS		0x104
	X# define	PDB_USER_VIEWPORT	0x105
	X# define	PDB_USER_BGCOLOR	0x106
	X# define	PDB_USER_ANGLE		0x107
	X# define	PDB_USER_DISTANCE	0x108
	X# define	PDB_USER_FILE		0x109
	X# define	PDB_USER_MARKNAME	0x10a
	X# define	PDB_USER_MARK		0x10b
	X# define	PDB_USER_CNAME		0x10c
	X# define	PDB_USER_COLOR		0x10d
	X# define	PDB_USER_RADIUS		0x10e
	X# define	PDB_USER_OBJECT		0x10f
	X# define	PDB_USER_ENDOBJ		0x110
	X# define	PDB_USER_CHAIN		0x111
	X# define	PDB_USER_GFX_BEGIN	0x112
	X# define	PDB_USER_GFX_END	0x113
	X# define	PDB_USER_GFX_COLOR	0x114
	X# define	PDB_USER_GFX_NORMAL	0x115
	X# define	PDB_USER_GFX_VERTEX	0x116
	X# define	PDB_USER_GFX_FONT	0x117
	X# define	PDB_USER_GFX_TEXTPOS	0x118
	X# define	PDB_USER_GFX_LABEL	0x119
	X# define	PDB_USER_GFX_MOVE	0x11a	/* obsolete */
	X# define	PDB_USER_GFX_DRAW	0x11b	/* obsolete */
	X# define	PDB_USER_GFX_MARKER	0x11c	/* obsolete */
	X# define	PDB_USER_GFX_POINT	0x11d	/* obsolete */
	X
	X# define	PDB_NUM_USER_R		(PDB_USER_GFX_POINT-PDB_USER_PDBRUN+1)
	X
	X# define	PDB_GFX_UNKNOWN		0x0
	X# define	PDB_GFX_POINTS		0x1
	X# define	PDB_GFX_MARKERS		0x2
	X# define	PDB_GFX_LINES		0x3
	X# define	PDB_GFX_LINE_STRIP	0x4
	X# define	PDB_GFX_LINE_LOOP	0x5
	X# define	PDB_GFX_TRIANGLES	0x6
	X# define	PDB_GFX_TRIANGLE_STRIP	0x7
	X# define	PDB_GFX_TRIANGLE_FAN	0x8
	X# define	PDB_GFX_QUADS		0x9
	X# define	PDB_GFX_QUAD_STRIP	0xa
	X# define	PDB_GFX_POLYGON		0xb
	X
	Xtypedef char	pdb_date[10];
	Xtypedef char	pdb_aname[5];		/* atom name - NO2* */
	Xtypedef char	pdb_rname[5];		/* residue name - ALA */
	Xtypedef char	pdb_pname[5];		/* pdb name - 9lyz */
	Xtypedef char	pdb_id[4];		/* generic short id field */
	Xtypedef double	pdb_float;		/* size of floating point */
	X
	Xtypedef struct {			/* residue info */
	X	pdb_rname	name;
	X	char		chain_id;
	X	int		seq_num;
	X	char		insert_code;
	X} pdb_residue;
	X
	X/*
	X *	structures declarations for each record type
	X */
	X
	Xstruct pdb_unknown {
	X	char	junk[81];
	X};
	Xstruct pdb_aggrgt {
	X	int	serial_num;
	X	int	num_components;
	X	int	cmpont_serial_nums[14];
	X};
	X# define	pdb_agrdes	pdb_ftnote
	Xstruct pdb_anisou {
	X	int		serial_num;
	X	pdb_aname	name;
	X	char		alt_loc;
	X	pdb_residue	residue;
	X	int		u[6];
	X};
	Xstruct pdb_atom {
	X	int		serial_num;
	X	pdb_aname	name;
	X	char		alt_loc;
	X	pdb_residue	residue;
	X	pdb_float	x, y, z;
	X	pdb_float	occupancy, temp_factor;
	X	int		ftnote_num;
	X};
	Xstruct pdb_author {
	X	char	data[61];
	X	char	continuation;
	X};
	X# define	pdb_cmpdes	pdb_ftnote
	Xstruct pdb_cmpont {
	X	int		seq_num;
	X	pdb_residue	residues[2];
	X};
	X# define	pdb_compnd	pdb_author
	Xstruct pdb_conect {
	X	int	serial_num;
	X	int	covalent[4];
	X	struct {
	X		int	hydrogen[2];
	X		int	salt;
	X	} bonds[2];
	X};
	Xstruct pdb_cryst1 {
	X	pdb_float	a, b, c;
	X	pdb_float	alpha, beta, gamma;
	X	char		space_grp[12];
	X	int		z;
	X};
	X/* no structure for PDB_END */
	X/* no structure for PDB_ENDMDL */
	X# define	pdb_expdta	pdb_author
	Xstruct pdb_formul {
	X	int		component;
	X	pdb_rname	het_id;
	X	int		continuation;
	X	char		exclude;	/* * to exclude */
	X	char		formula[52];
	X};
	Xstruct pdb_ftnote {
	X	int	num;
	X	char	text[60];
	X};
	Xstruct pdb_header {
	X	char		class[41];
	X	pdb_date	date;
	X	pdb_pname	id;
	X	char		type;
	X};
	Xstruct pdb_helix {
	X	int		serial_num;
	X	pdb_id		id;
	X	pdb_residue	residues[2];
	X	int		class;
	X	char		comment[31];
	X};
	Xstruct pdb_het {
	X	pdb_residue	het_grp;
	X	int		num_atoms;
	X	char		text[41];
	X};
	X# define	pdb_hetatm	pdb_atom
	X# define	pdb_jrnl	pdb_author
	Xstruct pdb_master {
	X	int	num_remark;
	X	int	num_ftnote;
	X	int	num_het;
	X	int	num_helix;
	X	int	num_sheet;
	X	int	num_turn;
	X	int	num_site;
	X	int	num_transform;
	X	int	num_coordinate;
	X	int	num_ter;
	X	int	num_conect;
	X	int	num_seqres;
	X};
	Xstruct pdb_model {
	X	int	num;
	X};
	Xstruct pdb_mtrix {
	X	int		row_num;
	X	int		serial_num;
	X	pdb_float	m1, m2, m3, v;
	X	int		given;
	X};
	X# define	pdb_mtxdes	pdb_ftnote
	Xstruct pdb_obslte {
	X	int		continuation;
	X	pdb_date	date;
	X	pdb_pname	old_id;
	X	pdb_pname	id_map[8];
	X};
	Xstruct pdb_origx {
	X	int		row_num;
	X	pdb_float	o1, o2, o3, t;
	X};
	X# define	pdb_remark	pdb_ftnote
	Xstruct pdb_revdat {
	X	int		modification;
	X	int		continuation;
	X	pdb_date	date;
	X	char		id[8];
	X	char		mod_type;
	X	char		corrections[31];
	X};
	Xstruct pdb_scale {
	X	int		row_num;
	X	pdb_float	s1, s2, s3, u;
	X};
	Xstruct pdb_seqres {
	X	int		serial_num;
	X	char		chain_id;
	X	int		count;
	X	pdb_rname	names[13];
	X};
	Xstruct pdb_sheet {
	X	int		strand_num;
	X	pdb_id		id;
	X	int		count;
	X	pdb_residue	residues[2];
	X	int		sense;
	X	struct {
	X		pdb_aname	name;
	X		pdb_residue	residue;
	X	} atoms[2];
	X};
	X# define	pdb_sigatm	pdb_atom
	X# define	pdb_siguij	pdb_anisou
	Xstruct pdb_site {
	X	int		seq_num;
	X	pdb_id		id;
	X	int		count;
	X	pdb_residue	residues[4];
	X};
	X# define	pdb_source	pdb_author
	Xstruct pdb_sprsde {
	X	int		continuation;
	X	pdb_date	date;
	X	pdb_pname	id;
	X	pdb_pname	supersede[8];
	X};
	Xstruct pdb_ssbond {
	X	int		seq_num;
	X	pdb_residue	residues[2];
	X	char		comment[31];
	X};
	X# define	pdb_symdes	pdb_ftnote
	Xstruct pdb_symop {
	X	int		row_num;
	X	int		serial_num;
	X	pdb_float	s1, s2, s3, t;
	X};
	Xstruct pdb_ter {
	X	int		serial_num;
	X	pdb_residue	residue;
	X};
	Xstruct pdb_trnsfm {
	X	int		result_serial_num;
	X	int		apply_serial_num;
	X	int		source_serial_num;
	X};
	Xstruct pdb_turn {
	X	int		seq_num;
	X	pdb_id		id;
	X	pdb_residue	residues[2];
	X	char		comment[31];
	X};
	Xstruct pdb_tvect {
	X	int		serial_num;
	X	pdb_float	t1, t2, t3;
	X	char		comment[31];
	X};
	Xstruct pdb_user {
	X	char	subtype[3];
	X	char	text[67];
	X};
	Xstruct pdb_user_pdbrun {
	X	int	version;
	X};
	Xstruct pdb_user_eyepos {
	X	pdb_float	xyz[3];
	X};
	X# define	pdb_user_atpos	pdb_user_eyepos
	Xstruct pdb_user_window {
	X	pdb_float	left, right, bottom, top, hither, yon;
	X};
	Xstruct pdb_user_focus {
	X	pdb_float	focus;
	X};
	Xstruct pdb_user_viewport {
	X	pdb_float	xmin, xmax, ymin, ymax;
	X};
	Xstruct pdb_user_bgcolor {
	X	pdb_float	rgb[3];
	X};
	Xstruct pdb_user_angle {
	X	int		atom0, atom1, atom2, atom3;
	X	pdb_float	angle;
	X	int		which;			/* version 5 -- obsolete */
	X};
	Xstruct pdb_user_distance {
	X	int		atom0, atom1;
	X	pdb_float	distance;
	X	int		which;			/* version 5 -- obsolete */
	X};
	Xstruct pdb_user_file {
	X	char		filename[62];		/* 57 in version 6 */
	X	int		model;			/* not in version 5 */
	X};
	Xstruct pdb_user_markname {
	X	char		markname[58];
	X};
	X# define	pdb_user_mark	pdb_user_markname
	Xstruct pdb_user_cname {
	X	pdb_float	rgb[3];
	X	char		name[39];
	X};
	Xstruct pdb_user_color {
	X	pdb_float	rgb[3];
	X	char		spec[39];
	X};
	Xstruct pdb_user_radius {
	X	pdb_float	radius;
	X};
	Xstruct pdb_user_object {
	X	int		model;			/* version 5 -- obsolete */
	X};
	Xstruct pdb_user_endobj {
	X	int		model;			/* version 5 -- obsolete */
	X};
	Xstruct pdb_user_chain {
	X	int		atom0, atom1;
	X};
	Xstruct pdb_user_gfx_begin {			/* not in version 5 */
	X	int		primitive;
	X	char		unknown[33];
	X};
	X/* no structure for USER  GFX END */
	X# define	pdb_user_gfx_color	pdb_user_color
	Xstruct pdb_user_gfx_normal {
	X	pdb_float	xyz[3];
	X};
	X# define	pdb_user_gfx_vertex	pdb_user_gfx_normal
	Xstruct pdb_user_gfx_font {
	X	int	size;
	X	char	name[54];
	X};
	Xstruct pdb_user_gfx_textpos {			/* not in version 5 */
	X	pdb_float	xyz[3];
	X};
	Xstruct pdb_user_gfx_label {
	X	pdb_float	xyz[3];			/* version 5 -- obsolete */
	X	char		text[57];		/* 27 in version 5 */
	X};
	Xstruct pdb_user_gfx_move {			/* version 5 -- obsolete */
	X	pdb_float	xyz[3];
	X};
	X# define	pdb_user_gfx_draw	pdb_user_gfx_move	/* version 5 -- obsolete */
	X# define	pdb_user_gfx_marker	pdb_user_gfx_move	/* "" */
	X# define	pdb_user_gfx_point	pdb_user_gfx_move	/* "" */
	X
	Xtypedef struct pdb_record {
	X	int	record_type;
	X	union	{
	X		struct pdb_unknown	unknown;
	X		struct pdb_agrdes	agrdes;
	X		struct pdb_aggrgt	aggrgt;
	X		struct pdb_anisou	anisou;
	X		struct pdb_atom		atom;
	X		struct pdb_author	author;
	X		struct pdb_cmpdes	cmpdes;
	X		struct pdb_cmpont	cmpont;
	X		struct pdb_compnd	compnd;
	X		struct pdb_conect	conect;
	X		struct pdb_cryst1	cryst1;
	X		/* no pdb_end structure */
	X		/* no pdb_endmdl structure */
	X		struct pdb_expdta	expdta;
	X		struct pdb_formul	formul;
	X		struct pdb_ftnote	ftnote;
	X		struct pdb_header	header;
	X		struct pdb_helix	helix;
	X		struct pdb_het		het;
	X		struct pdb_hetatm	hetatm;
	X		struct pdb_jrnl		jrnl;
	X		struct pdb_master	master;
	X		struct pdb_model	model;
	X		struct pdb_mtrix	mtrix;
	X		struct pdb_mtxdes	mtxdes;
	X		struct pdb_obslte	obslte;
	X		struct pdb_origx	origx;
	X		struct pdb_remark	remark;
	X		struct pdb_revdat	revdat;
	X		struct pdb_scale	scale;
	X		struct pdb_seqres	seqres;
	X		struct pdb_sheet	sheet;
	X		struct pdb_sigatm	sigatm;
	X		struct pdb_siguij	siguij;
	X		struct pdb_site		site;
	X		struct pdb_source	source;
	X		struct pdb_sprsde	sprsde;
	X		struct pdb_ssbond	ssbond;
	X		struct pdb_symdes	symdes;
	X		struct pdb_symop	symop;
	X		struct pdb_ter		ter;
	X		struct pdb_trnsfm	trnsfm;
	X		struct pdb_turn		turn;
	X		struct pdb_tvect	tvect;
	X		struct pdb_user		user;
	X		struct pdb_user_pdbrun	user_pdbrun;
	X		struct pdb_user_eyepos	user_eyepos;
	X		struct pdb_user_atpos	user_atpos;
	X		struct pdb_user_window	user_window;
	X		struct pdb_user_focus	user_focus;
	X		struct pdb_user_viewport	user_viewport;
	X		struct pdb_user_bgcolor	user_bgcolor;
	X		struct pdb_user_angle	user_angle;
	X		struct pdb_user_distance	user_distance;
	X		struct pdb_user_file	user_file;
	X		struct pdb_user_markname	user_markname;
	X		struct pdb_user_mark	user_mark;
	X		struct pdb_user_cname	user_cname;
	X		struct pdb_user_color	user_color;
	X		struct pdb_user_radius	user_radius;
	X		struct pdb_user_object	user_object;
	X		struct pdb_user_endobj	user_endobj;
	X		struct pdb_user_chain	user_chain;
	X		struct pdb_user_gfx_begin	user_gfx_begin;
	X		struct pdb_user_gfx_color	user_gfx_color;
	X		struct pdb_user_gfx_normal	user_gfx_normal;
	X		struct pdb_user_gfx_vertex	user_gfx_vertex;
	X		struct pdb_user_gfx_font	user_gfx_font;
	X		struct pdb_user_gfx_textpos	user_gfx_textpos;
	X		struct pdb_user_gfx_label	user_gfx_label;
	X		struct pdb_user_gfx_move	user_gfx_move;
	X		struct pdb_user_gfx_draw	user_gfx_draw;
	X		struct pdb_user_gfx_marker	user_gfx_marker;
	X		struct pdb_user_gfx_point	user_gfx_point;
	X	} pdb;
	X} pdb_record;
	X
	X# if defined(__STDC__) || defined(__cplusplus)
	Xextern pdb_record	pdb_read_record(FILE *);
	Xextern pdb_record	pdb_read_string(const char *);
	Xextern void		pdb_write_record(FILE *, const pdb_record *, const char *, int);
	Xextern void		pdb_write_string(char *, const pdb_record *);
	X# else
	Xextern pdb_record	pdb_read_record();
	Xextern pdb_record	pdb_read_string();
	Xextern void		pdb_write_record();
	Xextern void		pdb_write_string();
	X# endif
	X
	X# ifdef __cplusplus
	X}
	X# endif
	X#endif /* PDB_H */
SHAR_EOF
if test 12494 -ne "`wc -c < 'pdb.h'`"
then
	echo shar: "error transmitting 'pdb.h'" '(should have been 12494 characters)'
fi
fi
echo shar: "extracting 'pdb_int.h'" '(1312 characters)'
if test -f 'pdb_int.h'
then
	echo shar: "will not over-write existing file 'pdb_int.h'"
else
sed 's/^	X//' << \SHAR_EOF > 'pdb_int.h'
	X/*
	X *	Copyright (c) 1989 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_int.h,v 2.4 1994/11/17 00:58:58 gregc Exp $
	X */
	X
	X#include	"pdb.h"
	X
	X#ifndef __STDC__
	X# define	const
	X#endif
	X
	Xextern int	pdb_pdbrun_version;
	X
	X#ifdef __STDC__
	Xextern int	pdb_sscanf(const char *, const char *, ...);
	Xextern void	pdb_sprintf(char *, const char *, ...);
	Xextern const char	*pdb_gfx_string(int i);
	Xextern int	pdb_gfx_type(const char *type);
	X#else
	Xextern int	pdb_sscanf();
	Xextern void	pdb_sprintf();
	Xextern char	*pdb_gfx_string();
	Xextern int	pdb_gfx_type();
	X#endif
SHAR_EOF
if test 1312 -ne "`wc -c < 'pdb_int.h'`"
then
	echo shar: "error transmitting 'pdb_int.h'" '(should have been 1312 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 'ms.c'" '(6563 characters)'
if test -f 'ms.c'
then
	echo shar: "will not over-write existing file 'ms.c'"
else
sed 's/^	X//' << \SHAR_EOF > 'ms.c'
	X/*
	X *	Copyright (c) 1989 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: ms.c,v 2.4 94/05/19 16:01:16 conrad Exp $
	X */
	X
	X#include 
	X#include 
	X#include 
	X#include 
	X#include "pdb_int.h"
	X#include "ms.h"
	X
	X#ifndef TRUE
	X#define	TRUE	1
	X#define	FALSE	0
	X#endif
	X
	X/*
	X * ms_read_record:
	X *	Read an ms record from a file and return the corresponding
	X *	data structure
	X */
	Xms_record
	X#ifdef __STDC__
	Xms_read_record(FILE *fp)
	X#else
	Xms_read_record(fp)
	X	FILE	*fp;
	X#endif
	X{
	X	char		buf[MS_BUFSIZ];
	X	char		*cp;
	X	int		c;
	X	ms_record	record;
	X
	X	/*
	X	 * If at end of file, just set the record type and return
	X	 */
	X	if (fgets(buf, sizeof buf, fp) == NULL) {
	X		record.record_type = MS_END;
	X		return record;
	X	}
	X
	X	cp = strchr(buf, '\n');
	X	if (cp != NULL)
	X		*cp = '\0';
	X	else
	X		/* discard extra characters since line too long */
	X		while ((c = getc(fp)) != '\n' && c != EOF)
	X			continue;
	X
	X	return ms_read_string(buf);
	X}
	X
	X#ifdef __STDC__
	X	static void	crunch(char *);
	X#else
	X	static void	crunch();
	X#endif
	X
	X/*
	X * ms_read_string
	X *	Construct the data structure corresponding to the given line
	X */
	Xms_record
	X#ifdef __STDC__
	Xms_read_string(const char *buf)
	X#else
	Xms_read_string(buf)
	X	char	*buf;
	X#endif
	X{
	X	int		i;
	X	const char	*cp;
	X	char		*sp;
	X	int		nfield;
	X	double		area, extra;
	X	double		coord[3], normal[3];
	X	ms_record	record;
	X	ms_atom		*map;
	X	ms_surface	*msp;
	X	char		type;
	X	const char	*atom_fmt, *surf_fmt;
	X
	X	/*
	X	 * If the head of the string is "user" (case-independently),
	X	 * we copy the buffer into the string and return
	X	 */
	X	if (strncasecmp(buf, "user", 4) == 0) {
	X		record.record_type = MS_USER;
	X		for (cp = buf + 4; isspace(*cp); cp++)
	X			continue;
	X		sp = record.ms.user.string;
	X		while (*cp != '\0' && *cp != '\n')
	X			*sp++ = *cp++;
	X		*sp = '\0';
	X		return record;
	X	}
	X
	X	/*
	X	 * This is either an atom line, surface line, or an error
	X	 */
	X	if (strlen(buf) < 41) {
	X		record.record_type = MS_UNKNOWN;
	X		(void) strcpy(record.ms.unknown.string, buf);
	X		return record;
	X	}
	X	type = buf[40];
	X	atom_fmt = "%3s %4s %4s%8f %8f %8f A";
	X	surf_fmt = "%3s %4s %4s%8f %8f %8f S%c%c %6f %6f %6f %6f %6f";
	X	if (isspace(type)) {
	X		type = buf[41];
	X		atom_fmt = "%3s %5s %4s%8f %8f %8f A";
	X		surf_fmt = "%3s %5s %4s%8f %8f %8f S%c%c %6f %6f %6f %6f %6f";
	X	}
	X	switch (type) {
	X	  case 'A':
	X		record.record_type = MS_ATOM;
	X		map = &record.ms.atom;
	X		nfield = pdb_sscanf(buf, atom_fmt,
	X			map->residue_type, map->residue_sequence,
	X			map->atom_name, &coord[0], &coord[1], &coord[2]);
	X		if (nfield == 6) {
	X			for (i = 0; i < 3; i++)
	X				map->coord[i] = coord[i];
	X			crunch(map->residue_type);
	X			crunch(map->residue_sequence);
	X			crunch(map->atom_name);
	X			return record;
	X		}
	X		break;
	X	  case 'S':
	X		record.record_type = MS_SURFACE;
	X		msp = &record.ms.surface;
	X		nfield = pdb_sscanf(buf, surf_fmt,
	X			msp->residue_type, msp->residue_sequence,
	X			msp->atom_name, &coord[0], &coord[1], &coord[2],
	X			&msp->type, &msp->level, &area,
	X			&normal[0], &normal[1], &normal[2], &extra);
	X		switch (nfield) {
	X		  case 9:
	X			normal[0] = 0;
	X			/* FALLTHROUGH */
	X		  case 10:
	X			msp->has_normal = FALSE;
	X			for (i = 0; i < 3; i++)
	X				msp->coord[i] = coord[i];
	X			msp->area = area;
	X			msp->extra = normal[0];
	X			crunch(msp->residue_type);
	X			crunch(msp->residue_sequence);
	X			crunch(msp->atom_name);
	X			return record;
	X		  case 12:
	X			extra = 0;
	X			/* FALLTHROUGH */
	X		  case 13:
	X			msp->has_normal = TRUE;
	X			for (i = 0; i < 3; i++) {
	X				msp->coord[i] = coord[i];
	X				msp->normal[i] = normal[i];
	X			}
	X			msp->area = area;
	X			msp->extra = extra;
	X			crunch(msp->residue_type);
	X			crunch(msp->residue_sequence);
	X			crunch(msp->atom_name);
	X			return record;
	X		}
	X		break;
	X	}
	X
	X	/*
	X	 * Okay.  We must not have recognized the record.  Set the
	X	 * record type, copy the string into the string and return
	X	 */
	X	record.record_type = MS_UNKNOWN;
	X	(void) strcpy(record.ms.unknown.string, buf);
	X	return record;
	X}
	X
	X/*
	X * crunch:
	X *	Remove blanks from a string
	X */
	Xstatic
	Xvoid
	X#ifdef __STDC__
	Xcrunch(char *s)
	X#else
	Xcrunch(s)
	X	char	*s;
	X#endif
	X{
	X	char	*last;
	X
	X	for (last = s; *s != '\0'; s++)
	X		if (!isspace(*s))
	X			*last++ = *s;
	X	*last = '\0';
	X}
	X
	X/*
	X * ms_write_record:
	X *	Write an ms record to a file from the corresponding
	X *	data structure
	X */
	Xvoid
	X#ifdef __STDC__
	Xms_write_record(FILE *fp, const ms_record *mp)
	X#else
	Xms_write_record(fp, mp)
	X	FILE		*fp;
	X	ms_record	*mp;
	X#endif
	X{
	X	char	buffer[MS_RECLEN];
	X
	X	ms_write_string(buffer, mp);
	X	fprintf(fp, "%s\n", buffer);
	X}
	X
	X/*
	X * ms_write_string:
	X *	Write an ms record to a string from the corresponding
	X *	data structure
	X */
	Xvoid
	X#ifdef __STDC__
	Xms_write_string(char *buffer, const ms_record *mp)
	X#else
	Xms_write_string(buffer, mp)
	X	char		*buffer;
	X	ms_record	*mp;
	X#endif
	X{
	X	const ms_atom		*map;
	X	const ms_surface	*msp;
	X	char			*cp;
	X
	X	switch (mp->record_type) {
	X	  case MS_ATOM:
	X		map = &mp->ms.atom;
	X		(void) sprintf(buffer, "%-3s %4s %4s %7.3f  %7.3f  %7.3f A",
	X			map->residue_type, map->residue_sequence,
	X			map->atom_name, map->coord[0], map->coord[1],
	X			map->coord[2]);
	X		break;
	X	  case MS_SURFACE:
	X		msp = &mp->ms.surface;
	X		(void) sprintf(buffer,
	X			"%-3s %4s %4s %7.3f  %7.3f  %7.3f S%c%c %6.3f",
	X			msp->residue_type, msp->residue_sequence,
	X			msp->atom_name, msp->coord[0], msp->coord[1],
	X			msp->coord[2], msp->type, msp->level, msp->area);
	X		cp = strchr(buffer, '\0');
	X		if (msp->has_normal) {
	X			(void) sprintf(cp, " %6.3f %6.3f %6.3f",
	X				msp->normal[0], msp->normal[1], msp->normal[2]);
	X			cp = strchr(cp, '\0');
	X		}
	X		if (msp->extra != 0) {
	X			if (msp->extra >= 1000 || msp->extra <= -100)
	X				(void) sprintf(cp, " %6.1f", msp->extra);
	X			else if (msp->extra >= 100 || msp->extra <= -10)
	X				(void) sprintf(cp, " %6.2f", msp->extra);
	X			else
	X				(void) sprintf(cp, " %6.3f", msp->extra);
	X		}
	X		break;
	X	  case MS_USER:
	X		(void) sprintf(buffer, "USER %s\n", mp->ms.user.string);
	X		break;
	X	}
	X}
SHAR_EOF
if test 6563 -ne "`wc -c < 'ms.c'`"
then
	echo shar: "error transmitting 'ms.c'" '(should have been 6563 characters)'
fi
fi
echo shar: "extracting 'pdb_read.c'" '(30391 characters)'
if test -f 'pdb_read.c'
then
	echo shar: "will not over-write existing file 'pdb_read.c'"
else
sed 's/^	X//' << \SHAR_EOF > 'pdb_read.c'
	X/*
	X *	Copyright (c) 1989 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.c,v 2.20 1995/07/22 02:03:18 gregc Exp $
	X *
	X *	subroutine for reading PDB format files
	X *
	X */
	X
	X/* LINTLIBRARY */
	X
	X# include	
	X# include	
	X# include	
	X# include	"pdb_int.h"
	X
	X# ifndef _tolower
	X# define	_tolower	tolower
	X# endif
	X
	X# define	STREQN(a,b,n)	(strncmp(a, b, n) == 0)
	X
	Xstatic const char * const pdb_record_format[PDB_NUM_R] = {
	X#include "read_format.i"
	X};
	X
	Xstatic char const * const pdbrun5[] = {
	X#include "pdbrun5_read.i"
	X};
	X
	Xstatic char const * const pdbrun6[] = {
	X#include "pdbrun6_read.i"
	X};
	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
	Xpdb_record
	X# ifdef __STDC__
	Xpdb_read_record(FILE *f)
	X# else
	Xpdb_read_record(f)
	X	FILE		*f;
	X# endif
	X{
	X
	X	char			buffer[PDB_BUFSIZ];
	X	char			*cp;
	X	int			c;
	X	static pdb_record	r_end = { PDB_END };
	X
	X	if (fgets(buffer, PDB_BUFSIZ, f) == NULL) {
	X		/* at eof or error - default to eof */
	X		return r_end;
	X	}
	X
	X	cp = strchr(buffer, '\n');
	X	if (cp != NULL)
	X		*cp = '\0';
	X	else
	X		/* discard extra characters since line too long */
	X		while ((c = getc(f)) != '\n' && c != EOF)
	X			continue;
	X
	X	return pdb_read_string(buffer);
	X}
	X
	Xstatic int
	X#ifdef __STDC__
	Xpdbrun5_type(const char *buf)
	X#else
	Xpdbrun5_type(buf)
	X	char	*buf;
	X#endif
	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 int
	X#ifdef __STDC__
	Xpdbrun6_type(const char *buf)
	X#else
	Xpdbrun6_type(buf)
	X	char	*buf;
	X#endif
	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_record
	X# ifdef __STDC__
	Xpdb_read_string(const char *buffer)
	X# else
	Xpdb_read_string(buffer)
	X	char	*buffer;
	X# endif
	X{
	X
	X	pdb_record		r;
	X	const char		*fmt;
	X	struct pdb_sheet	*sh;
	X	pdb_residue		*sha0, *sha1;
	X	char			record_type[4];
	X	int			i;
	X	char			new_buffer[PDB_BUFSIZ];
	X
	X# if defined(__STDC__) || defined(vms)
	X	(void) memset(&r, 0, sizeof r);
	X# else
	X	bzero((char *) &r, sizeof r);
	X# endif
	X
	X# ifdef DEBUG
	X	printf("%s", buffer);
	X# endif /* DEBUG */
	X
	X	/* convert pdb record to C structure */
	X
	X	for (i = 0; buffer[i] != '\0' && buffer[i] != '\n' && i < 4; i += 1) {
	X		if (isupper(buffer[i]))
	X			record_type[i] = _tolower(buffer[i]);
	X		else
	X			record_type[i] = buffer[i];
	X	}
	X	if (i < 4)
	X		for (; i < 4; i += 1)
	X			record_type[i] = ' ';
	X
	X	r.record_type = PDB_UNKNOWN;
	X	switch (record_type[0]) {
	X
	X	case 'a':
	X		if (STREQN(record_type + 1, "tom", 3))
	X			r.record_type = PDB_ATOM;
	X		else if (STREQN(record_type + 1, "uth", 3))
	X			r.record_type = PDB_AUTHOR;
	X		else if (STREQN(record_type + 1, "nis", 3))
	X			r.record_type = PDB_ANISOU;
	X		else if (STREQN(record_type + 1, "grd", 3))
	X			r.record_type = PDB_AGRDES;
	X		else if (STREQN(record_type + 1, "ggr", 3))
	X			r.record_type = PDB_AGGRGT;
	X		break;
	X
	X	case 'c':
	X		if (STREQN(record_type + 1, "omp", 3))
	X			r.record_type = PDB_COMPND;
	X		else if (STREQN(record_type + 1, "rys", 3))
	X			r.record_type = PDB_CRYST1;
	X		else if (STREQN(record_type + 1, "one", 3))
	X			r.record_type = PDB_CONECT;
	X		else if (STREQN(record_type + 1, "mpd", 3))
	X			r.record_type = PDB_CMPDES;
	X		else if (STREQN(record_type + 1, "mpo", 3))
	X			r.record_type = PDB_CMPONT;
	X		break;
	X
	X	case 'e':
	X		if (STREQN(record_type + 1, "nd ", 3))
	X			r.record_type = PDB_END;
	X		else if (STREQN(record_type + 1, "ndm", 3))
	X			r.record_type = PDB_ENDMDL;
	X		else if (STREQN(record_type + 1, "xpd", 3))
	X			r.record_type = PDB_EXPDTA;
	X		break;
	X
	X	case 'f':
	X		if (STREQN(record_type + 1, "tno", 3))
	X			r.record_type = PDB_FTNOTE;
	X		else if (STREQN(record_type + 1, "orm", 3))
	X			r.record_type = PDB_FORMUL;
	X		break;
	X
	X	case 'h':
	X		if (STREQN(record_type + 1, "eta", 3))
	X			r.record_type = PDB_HETATM;
	X		else if (STREQN(record_type + 1, "ead", 3))
	X			r.record_type = PDB_HEADER;
	X		else if (STREQN(record_type + 1, "et ", 3))
	X			r.record_type = PDB_HET;
	X		else if (STREQN(record_type + 1, "eli", 3))
	X			r.record_type = PDB_HELIX;
	X		break;
	X
	X	case 'j':
	X		if (STREQN(record_type + 1, "rnl", 3))
	X			r.record_type = PDB_JRNL;
	X		break;
	X
	X	case 'm':
	X		if (STREQN(record_type + 1, "tri", 3))
	X			r.record_type = PDB_MTRIX;
	X		else if (STREQN(record_type + 1, "ast", 3))
	X			r.record_type = PDB_MASTER;
	X		else if (STREQN(record_type + 1, "ode", 3))
	X			r.record_type = PDB_MODEL;
	X		else if (STREQN(record_type + 1, "txd", 3))
	X			r.record_type = PDB_MTXDES;
	X		break;
	X
	X	case 'o':
	X		if (STREQN(record_type + 1, "bsl", 3))
	X			r.record_type = PDB_OBSLTE;
	X		else if (STREQN(record_type + 1, "rig", 3))
	X			r.record_type = PDB_ORIGX;
	X		break;
	X
	X	case 'r':
	X		if (STREQN(record_type + 1, "ema", 3))
	X			r.record_type = PDB_REMARK;
	X		else if (STREQN(record_type + 1, "evd", 3))
	X			r.record_type = PDB_REVDAT;
	X		break;
	X
	X	case 's':
	X		switch (record_type[1]) {
	X
	X		case 'c':
	X			if (STREQN(record_type + 2, "al", 2))
	X				r.record_type = PDB_SCALE;
	X			break;
	X
	X		case 'e':
	X			if (STREQN(record_type + 2, "qr", 2))
	X				r.record_type = PDB_SEQRES;
	X			break;
	X
	X		case 'h':
	X			if (STREQN(record_type + 2, "ee", 2))
	X				r.record_type = PDB_SHEET;
	X			break;
	X
	X		case 'i':
	X			if (STREQN(record_type + 2, "te", 2))
	X				r.record_type = PDB_SITE;
	X			else if (STREQN(record_type + 2, "ga", 2))
	X				r.record_type = PDB_SIGATM;
	X			else if (STREQN(record_type + 2, "gu", 2))
	X				r.record_type = PDB_SIGUIJ;
	X			break;
	X
	X		case 'o':
	X			if (STREQN(record_type + 2, "ur", 2))
	X				r.record_type = PDB_SOURCE;
	X			break;
	X
	X		case 'p':
	X			if (STREQN(record_type + 2, "rs", 2))
	X				r.record_type = PDB_SPRSDE;
	X			break;
	X
	X		case 's':
	X			if (STREQN(record_type + 2, "bo", 2))
	X				r.record_type = PDB_SSBOND;
	X			break;
	X
	X		case 'y':
	X			if (STREQN(record_type + 2, "md", 2))
	X				r.record_type = PDB_SYMDES;
	X			else if (STREQN(record_type + 2, "mo", 2))
	X				r.record_type = PDB_SYMOP;
	X			break;
	X		}
	X		break;
	X
	X	case 't':
	X		if (STREQN(record_type + 1, "urn", 3))
	X			r.record_type = PDB_TURN;
	X		else if (STREQN(record_type + 1, "vec", 3))
	X			r.record_type = PDB_TVECT;
	X		else if (STREQN(record_type + 1, "er ", 3))
	X			r.record_type = PDB_TER;
	X		else if (STREQN(record_type + 1, "rns", 3))
	X			r.record_type = PDB_TRNSFM;
	X		break;
	X
	X	case 'u':
	X		if (STREQN(record_type + 1, "ser", 3)) {
	X			r.record_type = PDB_USER;
	X			switch (pdb_pdbrun_version) {
	X			case 1: case 2: case 3: case 4: case 5:
	X				r.record_type = pdbrun5_type(buffer + 6);
	X				break;
	X			case 6:
	X				r.record_type = pdbrun6_type(buffer + 6);
	X				break;
	X			default:
	X				if (strncasecmp(buffer + 6, "PDBRUN ", 7) == 0)
	X					r.record_type = PDB_USER_PDBRUN;
	X				break;
	X			}
	X		}
	X		break;
	X	}
	X
	X	if (r.record_type < PDB_USER_PDBRUN)
	X		fmt = pdb_record_format[r.record_type];
	X	else if (pdb_pdbrun_version < 6)
	X		fmt = pdbrun5[r.record_type - PDB_USER_PDBRUN];
	X	else
	X		fmt = pdbrun6[r.record_type - PDB_USER_PDBRUN];
	X	switch (r.record_type) {
	X
	X	default:
	X	case PDB_UNKNOWN:
	Xunknown:
	X		r.record_type = PDB_UNKNOWN;		/* in case of goto */
	X		(void) pdb_sscanf(buffer, "%72s", r.pdb.unknown.junk);
	X		break;
	X
	X	case PDB_AGGRGT:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.aggrgt.serial_num,
	X				&r.pdb.aggrgt.num_components,
	X				&r.pdb.aggrgt.cmpont_serial_nums[0],
	X				&r.pdb.aggrgt.cmpont_serial_nums[1],
	X				&r.pdb.aggrgt.cmpont_serial_nums[2],
	X				&r.pdb.aggrgt.cmpont_serial_nums[3],
	X				&r.pdb.aggrgt.cmpont_serial_nums[4],
	X				&r.pdb.aggrgt.cmpont_serial_nums[5],
	X				&r.pdb.aggrgt.cmpont_serial_nums[6],
	X				&r.pdb.aggrgt.cmpont_serial_nums[7],
	X				&r.pdb.aggrgt.cmpont_serial_nums[8],
	X				&r.pdb.aggrgt.cmpont_serial_nums[9],
	X				&r.pdb.aggrgt.cmpont_serial_nums[10],
	X				&r.pdb.aggrgt.cmpont_serial_nums[11],
	X				&r.pdb.aggrgt.cmpont_serial_nums[12],
	X				&r.pdb.aggrgt.cmpont_serial_nums[13]))
	X			goto unknown;
	X		break;
	X	case PDB_ANISOU:
	X	case PDB_SIGUIJ:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.anisou.serial_num,
	X				r.pdb.anisou.name, &r.pdb.anisou.alt_loc,
	X				r.pdb.anisou.residue.name,
	X				&r.pdb.anisou.residue.chain_id,
	X				&r.pdb.anisou.residue.seq_num,
	X				&r.pdb.anisou.residue.insert_code,
	X				&r.pdb.anisou.u[0], &r.pdb.anisou.u[1],
	X				&r.pdb.anisou.u[2], &r.pdb.anisou.u[3],
	X				&r.pdb.anisou.u[4], &r.pdb.anisou.u[5]))
	X			goto unknown;
	X		break;
	X
	X	case PDB_ATOM:
	X	case PDB_HETATM:
	X	case PDB_SIGATM:
	X		if (0 <= pdb_sscanf(buffer, fmt, &r.pdb.atom.serial_num,
	X				r.pdb.atom.name, &r.pdb.atom.alt_loc,
	X				r.pdb.atom.residue.name,
	X				&r.pdb.atom.residue.chain_id,
	X				&r.pdb.atom.residue.seq_num,
	X				&r.pdb.atom.residue.insert_code,
	X				&r.pdb.atom.x, &r.pdb.atom.y, &r.pdb.atom.z,
	X				&r.pdb.atom.occupancy, &r.pdb.atom.temp_factor,
	X				&r.pdb.atom.ftnote_num))
	X			break;
	X		/* handle atom serial number overflows */
	X		if (strncmp(&buffer[6], "*****", 5) != 0)
	X			goto unknown;
	X		strncpy(new_buffer, buffer, PDB_BUFSIZ);
	X		strncpy(&new_buffer[6], "00000", 5);
	X		if (0 <= pdb_sscanf(new_buffer, fmt, &r.pdb.atom.serial_num,
	X				r.pdb.atom.name, &r.pdb.atom.alt_loc,
	X				r.pdb.atom.residue.name,
	X				&r.pdb.atom.residue.chain_id,
	X				&r.pdb.atom.residue.seq_num,
	X				&r.pdb.atom.residue.insert_code,
	X				&r.pdb.atom.x, &r.pdb.atom.y, &r.pdb.atom.z,
	X				&r.pdb.atom.occupancy, &r.pdb.atom.temp_factor,
	X				&r.pdb.atom.ftnote_num)) {
	X			static int atom_serial_number = 10000;
	X			r.pdb.atom.serial_num = atom_serial_number++;
	X			break;
	X		}
	X		goto unknown;
	X
	X	case PDB_AUTHOR:
	X	case PDB_COMPND:
	X	case PDB_JRNL:
	X	case PDB_SOURCE:
	X	case PDB_EXPDTA:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.author.continuation,
	X				r.pdb.author.data))
	X			goto unknown;
	X		break;
	X
	X	case PDB_CMPONT:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.cmpont.seq_num,
	X				r.pdb.cmpont.residues[0].name,
	X				&r.pdb.cmpont.residues[0].chain_id,
	X				&r.pdb.cmpont.residues[0].seq_num,
	X				&r.pdb.cmpont.residues[0].insert_code,
	X				r.pdb.cmpont.residues[1].name,
	X				&r.pdb.cmpont.residues[1].chain_id,
	X				&r.pdb.cmpont.residues[1].seq_num,
	X				&r.pdb.cmpont.residues[1].insert_code))
	X			goto unknown;
	X		break;
	X
	X	case PDB_CONECT:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.conect.serial_num,
	X				&r.pdb.conect.covalent[0],
	X				&r.pdb.conect.covalent[1],
	X				&r.pdb.conect.covalent[2],
	X				&r.pdb.conect.covalent[3],
	X				&r.pdb.conect.bonds[0].hydrogen[0],
	X				&r.pdb.conect.bonds[0].hydrogen[1],
	X				&r.pdb.conect.bonds[0].salt,
	X				&r.pdb.conect.bonds[1].hydrogen[0],
	X				&r.pdb.conect.bonds[1].hydrogen[1],
	X				&r.pdb.conect.bonds[1].salt))
	X			goto unknown;
	X		break;
	X
	X	case PDB_CRYST1:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.cryst1.a,
	X				&r.pdb.cryst1.b, &r.pdb.cryst1.c,
	X				&r.pdb.cryst1.alpha, &r.pdb.cryst1.beta,
	X				&r.pdb.cryst1.gamma, r.pdb.cryst1.space_grp,
	X				&r.pdb.cryst1.z))
	X			goto unknown;
	X		break;
	X
	X	case PDB_END:
	X	case PDB_ENDMDL:
	X		break;
	X
	X	case PDB_FORMUL:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.formul.component,
	X				r.pdb.formul.het_id, &r.pdb.formul.continuation,
	X				&r.pdb.formul.exclude, r.pdb.formul.formula))
	X			goto unknown;
	X		break;
	X
	X	case PDB_FTNOTE:
	X	case PDB_REMARK:
	X	case PDB_SYMDES:
	X	case PDB_MTXDES:
	X	case PDB_CMPDES:
	X	case PDB_AGRDES:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.ftnote.num,
	X				r.pdb.ftnote.text))
	X			goto unknown;
	X		break;
	X
	X	case PDB_HEADER:
	X		if (0 > pdb_sscanf(buffer, fmt, r.pdb.header.class,
	X				r.pdb.header.date, &r.pdb.header.type,
	X				r.pdb.header.id))
	X			goto unknown;
	X		break;
	X
	X	case PDB_HELIX:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.helix.serial_num,
	X				r.pdb.helix.id,
	X				r.pdb.helix.residues[0].name,
	X				&r.pdb.helix.residues[0].chain_id,
	X				&r.pdb.helix.residues[0].seq_num,
	X				&r.pdb.helix.residues[0].insert_code,
	X				r.pdb.helix.residues[1].name,
	X				&r.pdb.helix.residues[1].chain_id,
	X				&r.pdb.helix.residues[1].seq_num,
	X				&r.pdb.helix.residues[1].insert_code,
	X				&r.pdb.helix.class, r.pdb.helix.comment))
	X			goto unknown;
	X		break;
	X
	X	case PDB_HET:
	X		if (0 > pdb_sscanf(buffer, fmt, r.pdb.het.het_grp.name,
	X				&r.pdb.het.het_grp.chain_id,
	X				&r.pdb.het.het_grp.seq_num,
	X				&r.pdb.het.het_grp.insert_code,
	X				&r.pdb.het.num_atoms, r.pdb.het.text))
	X			goto unknown;
	X		break;
	X
	X	case PDB_MASTER:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.master.num_remark,
	X				&r.pdb.master.num_ftnote,
	X				&r.pdb.master.num_het, &r.pdb.master.num_helix,
	X				&r.pdb.master.num_sheet, &r.pdb.master.num_turn,
	X				&r.pdb.master.num_site,
	X				&r.pdb.master.num_transform,
	X				&r.pdb.master.num_coordinate,
	X				&r.pdb.master.num_ter, &r.pdb.master.num_conect,
	X				&r.pdb.master.num_seqres))
	X			goto unknown;
	X		break;
	X
	X	case PDB_MODEL:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.model.num))
	X			goto unknown;
	X		break;
	X
	X	case PDB_MTRIX:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.mtrix.row_num,
	X				&r.pdb.mtrix.serial_num, &r.pdb.mtrix.m1,
	X				&r.pdb.mtrix.m2, &r.pdb.mtrix.m3,
	X				&r.pdb.mtrix.v, &r.pdb.mtrix.given))
	X			goto unknown;
	X		break;
	X
	X	case PDB_OBSLTE:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.obslte.continuation,
	X				r.pdb.obslte.date, r.pdb.obslte.old_id,
	X				r.pdb.obslte.id_map[0], r.pdb.obslte.id_map[1],
	X				r.pdb.obslte.id_map[2], r.pdb.obslte.id_map[3],
	X				r.pdb.obslte.id_map[4], r.pdb.obslte.id_map[2],
	X				r.pdb.obslte.id_map[6], r.pdb.obslte.id_map[7]))
	X			goto unknown;
	X		break;
	X
	X	case PDB_ORIGX:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.origx.row_num,
	X				&r.pdb.origx.o1, &r.pdb.origx.o2,
	X				&r.pdb.origx.o3, &r.pdb.origx.t))
	X			goto unknown;
	X		break;
	X
	X	case PDB_REVDAT:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.revdat.modification,
	X				&r.pdb.revdat.continuation, r.pdb.revdat.date,
	X				r.pdb.revdat.id, &r.pdb.revdat.mod_type,
	X				r.pdb.revdat.corrections))
	X			goto unknown;
	X		break;
	X
	X	case PDB_SCALE:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.scale.row_num,
	X				&r.pdb.scale.s1, &r.pdb.scale.s2,
	X				&r.pdb.scale.s3, &r.pdb.scale.u))
	X			goto unknown;
	X		break;
	X
	X	case PDB_SEQRES:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.seqres.serial_num,
	X				&r.pdb.seqres.chain_id, &r.pdb.seqres.count,
	X				r.pdb.seqres.names[0], r.pdb.seqres.names[1],
	X				r.pdb.seqres.names[2], r.pdb.seqres.names[3],
	X				r.pdb.seqres.names[4], r.pdb.seqres.names[5],
	X				r.pdb.seqres.names[6], r.pdb.seqres.names[7],
	X				r.pdb.seqres.names[8], r.pdb.seqres.names[9],
	X				r.pdb.seqres.names[10], r.pdb.seqres.names[11],
	X				r.pdb.seqres.names[12]))
	X			goto unknown;
	X		break;
	X
	X	case PDB_SHEET:
	X		sh = &r.pdb.sheet;
	X		sha0 = &sh->atoms[0].residue;
	X		sha1 = &sh->atoms[1].residue;
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.sheet.strand_num,
	X				sh->id, &r.pdb.sheet.count,
	X				sh->residues[0].name, &sh->residues[0].chain_id,
	X				&sh->residues[0].seq_num,
	X				&sh->residues[0].insert_code,
	X				sh->residues[1].name, &sh->residues[1].chain_id,
	X				&sh->residues[1].seq_num,
	X				&sh->residues[1].insert_code, &sh->sense,
	X				sh->atoms[0].name, sha0->name, &sha0->chain_id,
	X				&sha0->seq_num, &sha0->insert_code,
	X				sh->atoms[1].name, sha1->name,
	X				&sha1->chain_id, &sha1->seq_num,
	X				&sha1->insert_code))
	X			goto unknown;
	X		break;
	X
	X	case PDB_SITE:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.site.seq_num,
	X				r.pdb.site.id, &r.pdb.site.count,
	X				r.pdb.site.residues[0].name,
	X				&r.pdb.site.residues[0].chain_id,
	X				&r.pdb.site.residues[0].seq_num,
	X				&r.pdb.site.residues[0].insert_code,
	X				r.pdb.site.residues[1].name,
	X				&r.pdb.site.residues[1].chain_id,
	X				&r.pdb.site.residues[1].seq_num,
	X				&r.pdb.site.residues[1].insert_code,
	X				r.pdb.site.residues[2].name,
	X				&r.pdb.site.residues[2].chain_id,
	X				&r.pdb.site.residues[2].seq_num,
	X				&r.pdb.site.residues[2].insert_code,
	X				r.pdb.site.residues[3].name,
	X				&r.pdb.site.residues[3].chain_id,
	X				&r.pdb.site.residues[3].seq_num,
	X				&r.pdb.site.residues[3].insert_code))
	X			goto unknown;
	X		break;
	X
	X	case PDB_SPRSDE:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.sprsde.continuation,
	X				r.pdb.sprsde.date, r.pdb.sprsde.id,
	X				r.pdb.sprsde.supersede[0],
	X				r.pdb.sprsde.supersede[1],
	X				r.pdb.sprsde.supersede[2],
	X				r.pdb.sprsde.supersede[3],
	X				r.pdb.sprsde.supersede[4],
	X				r.pdb.sprsde.supersede[5],
	X				r.pdb.sprsde.supersede[6],
	X				r.pdb.sprsde.supersede[7]))
	X			goto unknown;
	X		break;
	X
	X	case PDB_SSBOND:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.ssbond.seq_num,
	X				r.pdb.ssbond.residues[0].name,
	X				&r.pdb.ssbond.residues[0].chain_id,
	X				&r.pdb.ssbond.residues[0].seq_num,
	X				&r.pdb.ssbond.residues[0].insert_code,
	X				r.pdb.ssbond.residues[1].name,
	X				&r.pdb.ssbond.residues[1].chain_id,
	X				&r.pdb.ssbond.residues[1].seq_num,
	X				&r.pdb.ssbond.residues[1].insert_code,
	X				r.pdb.ssbond.comment))
	X			goto unknown;
	X		break;
	X
	X	case PDB_SYMOP:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.symop.row_num,
	X				&r.pdb.symop.serial_num, &r.pdb.symop.s1,
	X				&r.pdb.symop.s2, &r.pdb.symop.s3,
	X				&r.pdb.symop.t))
	X			goto unknown;
	X		break;
	X
	X	case PDB_TER:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.ter.serial_num,
	X				r.pdb.ter.residue.name,
	X				&r.pdb.ter.residue.chain_id,
	X				&r.pdb.ter.residue.seq_num,
	X				&r.pdb.ter.residue.insert_code))
	X			goto unknown;
	X		break;
	X
	X	case PDB_TRNSFM:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.trnsfm.result_serial_num,
	X				&r.pdb.trnsfm.apply_serial_num,
	X				&r.pdb.trnsfm.source_serial_num))
	X			goto unknown;
	X		break;
	X
	X	case PDB_TURN:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.turn.seq_num,
	X				r.pdb.turn.id, r.pdb.turn.residues[0].name,
	X				&r.pdb.turn.residues[0].chain_id,
	X				&r.pdb.turn.residues[0].seq_num,
	X				&r.pdb.turn.residues[0].insert_code,
	X				r.pdb.turn.residues[1].name,
	X				&r.pdb.turn.residues[1].chain_id,
	X				&r.pdb.turn.residues[1].seq_num,
	X				&r.pdb.turn.residues[1].insert_code,
	X				r.pdb.turn.comment))
	X			goto unknown;
	X		break;
	X
	X	case PDB_TVECT:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.tvect.serial_num,
	X				&r.pdb.tvect.t1, &r.pdb.tvect.t2,
	X				&r.pdb.tvect.t3, r.pdb.tvect.comment))
	X			goto unknown;
	X		break;
	X
	Xuser:
	X		r.record_type = PDB_USER;
	X		fmt = pdb_record_format[r.record_type];
	X	case PDB_USER:
	X		if (0 > pdb_sscanf(buffer, fmt, r.pdb.user.subtype,
	X				r.pdb.user.text))
	X			goto unknown;
	X		break;
	X
	X	case PDB_USER_PDBRUN:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.user_pdbrun.version))
	X			goto user;
	X		pdb_pdbrun_version = r.pdb.user_pdbrun.version;
	X		break;
	X
	X	case PDB_USER_EYEPOS:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.user_eyepos.xyz[0],
	X				&r.pdb.user_eyepos.xyz[1],
	X				&r.pdb.user_eyepos.xyz[2]))
	X			goto user;
	X		break;
	X
	X	case PDB_USER_ATPOS:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.user_atpos.xyz[0],
	X				&r.pdb.user_atpos.xyz[1],
	X				&r.pdb.user_atpos.xyz[2]))
	X			goto user;
	X		break;
	X
	X	case PDB_USER_WINDOW:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.user_window.left,
	X				&r.pdb.user_window.right,
	X				&r.pdb.user_window.bottom,
	X				&r.pdb.user_window.top,
	X				&r.pdb.user_window.hither,
	X				&r.pdb.user_window.yon))
	X			goto user;
	X		break;
	X
	X	case PDB_USER_FOCUS:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.user_focus.focus))
	X			goto user;
	X		break;
	X
	X	case PDB_USER_VIEWPORT:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.user_viewport.xmin,
	X				&r.pdb.user_viewport.xmax,
	X				&r.pdb.user_viewport.ymin,
	X				&r.pdb.user_viewport.ymax))
	X			goto user;
	X		break;
	X
	X	case PDB_USER_BGCOLOR:
	X		if (pdb_pdbrun_version < 6) {
	X			if (0 > sscanf(buffer, fmt, &r.pdb.user_bgcolor.rgb[0],
	X					&r.pdb.user_bgcolor.rgb[1],
	X					&r.pdb.user_bgcolor.rgb[2]))
	X				goto user;
	X		} else if (0 > pdb_sscanf(buffer, fmt,
	X				&r.pdb.user_bgcolor.rgb[0],
	X				&r.pdb.user_bgcolor.rgb[1],
	X				&r.pdb.user_bgcolor.rgb[2]))
	X			goto user;
	X		break;
	X
	X	case PDB_USER_ANGLE:
	X		if (pdb_pdbrun_version < 6) {
	X			if (0 > pdb_sscanf(buffer, fmt, &r.pdb.user_angle.which,
	X					&r.pdb.user_angle.atom0,
	X					&r.pdb.user_angle.atom1,
	X					&r.pdb.user_angle.atom2,
	X					&r.pdb.user_angle.atom3,
	X					&r.pdb.user_angle.angle))
	X				goto user;
	X		} else if (0 > pdb_sscanf(buffer, fmt, &r.pdb.user_angle.atom0,
	X				&r.pdb.user_angle.atom1,
	X				&r.pdb.user_angle.atom2,
	X				&r.pdb.user_angle.atom3,
	X				&r.pdb.user_angle.angle))
	X			goto user;
	X		break;
	X
	X	case PDB_USER_DISTANCE:
	X		if (pdb_pdbrun_version < 6) {
	X			if (0 > pdb_sscanf(buffer, fmt,
	X					&r.pdb.user_distance.which,
	X					&r.pdb.user_distance.atom0,
	X					&r.pdb.user_distance.atom1,
	X					&r.pdb.user_distance.distance))
	X				goto user;
	X		} else if (0 > pdb_sscanf(buffer, fmt,
	X				&r.pdb.user_distance.atom0,
	X				&r.pdb.user_distance.atom1,
	X				&r.pdb.user_distance.distance))
	X			goto user;
	X		break;
	X
	X	case PDB_USER_FILE:
	X		if (pdb_pdbrun_version < 6) {
	X			if (0 > pdb_sscanf(buffer, fmt,
	X						r.pdb.user_file.filename))
	X				goto user;
	X		} else if (0 > pdb_sscanf(buffer, fmt, &r.pdb.user_file.model,
	X						r.pdb.user_file.filename))
	X			goto user;
	X		break;
	X
	X	case PDB_USER_MARKNAME:
	X		if (0 > pdb_sscanf(buffer, fmt, r.pdb.user_markname.markname))
	X			goto user;
	X		break;
	X
	X	case PDB_USER_MARK:
	X		if (0 > pdb_sscanf(buffer, fmt, r.pdb.user_mark.markname))
	X			goto user;
	X		break;
	X
	X	case PDB_USER_CNAME:
	X		if (pdb_pdbrun_version < 6) {
	X			if (0 > sscanf(buffer, fmt, r.pdb.user_cname.name,
	X					&r.pdb.user_cname.rgb[0],
	X					&r.pdb.user_cname.rgb[1],
	X					&r.pdb.user_cname.rgb[2]))
	X				goto user;
	X		} else if (0 > pdb_sscanf(buffer, fmt, &r.pdb.user_cname.rgb[0],
	X				&r.pdb.user_cname.rgb[1],
	X				&r.pdb.user_cname.rgb[2],
	X				r.pdb.user_cname.name))
	X			goto user;
	X		break;
	X
	X	case PDB_USER_COLOR:
	X		if (pdb_pdbrun_version < 6) {
	X			if (0 > sscanf(buffer, fmt, r.pdb.user_color.spec,
	X					&r.pdb.user_color.rgb[0],
	X					&r.pdb.user_color.rgb[1],
	X					&r.pdb.user_color.rgb[2]))
	X				goto user;
	X		} else if (0 > pdb_sscanf(buffer, fmt, &r.pdb.user_color.rgb[0],
	X				&r.pdb.user_color.rgb[1],
	X				&r.pdb.user_color.rgb[2],
	X				r.pdb.user_color.spec))
	X			goto user;
	X		break;
	X
	X	case PDB_USER_RADIUS:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.user_radius.radius))
	X			goto user;
	X		break;
	X
	X	case PDB_USER_OBJECT:
	X		if (pdb_pdbrun_version < 6) {
	X			if (0 > pdb_sscanf(buffer, fmt,
	X					&r.pdb.user_object.model))
	X				goto user;
	X		}
	X		break;
	X
	X	case PDB_USER_ENDOBJ:
	X		if (pdb_pdbrun_version < 6) {
	X			if (0 > pdb_sscanf(buffer, fmt,
	X					&r.pdb.user_endobj.model))
	X				goto user;
	X		}
	X		break;
	X
	X	case PDB_USER_CHAIN:
	X		if (pdb_pdbrun_version < 6) {
	X			if (0 > sscanf(buffer, fmt, &r.pdb.user_chain.atom0,
	X					&r.pdb.user_chain.atom1))
	X				goto user;
	X		} else if (0 > pdb_sscanf(buffer, fmt, &r.pdb.user_chain.atom0,
	X				&r.pdb.user_chain.atom1))
	X			goto user;
	X		break;
	X
	X	case PDB_USER_GFX_BEGIN:
	X		if (0 > pdb_sscanf(buffer, fmt, r.pdb.user_gfx_begin.unknown))
	X			goto user;
	X		r.pdb.user_gfx_begin.primitive
	X			= pdb_gfx_type(r.pdb.user_gfx_begin.unknown);
	X		break;
	X
	X	case PDB_USER_GFX_END:
	X		break;
	X
	X	case PDB_USER_GFX_COLOR:
	X		if (pdb_pdbrun_version < 6) {
	X			if (0 > sscanf(buffer, fmt, r.pdb.user_gfx_color.spec,
	X					&r.pdb.user_gfx_color.rgb[0],
	X					&r.pdb.user_gfx_color.rgb[1],
	X					&r.pdb.user_gfx_color.rgb[2]))
	X				goto user;
	X		} else if (0 > pdb_sscanf(buffer, fmt,
	X				&r.pdb.user_gfx_color.rgb[0],
	X				&r.pdb.user_gfx_color.rgb[1],
	X				&r.pdb.user_gfx_color.rgb[2],
	X				r.pdb.user_gfx_color.spec))
	X			goto user;
	X		break;
	X
	X	case PDB_USER_GFX_NORMAL:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.user_gfx_normal.xyz[0],
	X				&r.pdb.user_gfx_normal.xyz[1],
	X				&r.pdb.user_gfx_normal.xyz[2]))
	X			goto user;
	X		break;
	X
	X	case PDB_USER_GFX_VERTEX:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.user_gfx_vertex.xyz[0],
	X				&r.pdb.user_gfx_vertex.xyz[1],
	X				&r.pdb.user_gfx_vertex.xyz[2]))
	X			goto user;
	X		break;
	X
	X	case PDB_USER_GFX_FONT:
	X		if (pdb_pdbrun_version < 6) {
	X			if (0 > sscanf(buffer, fmt, r.pdb.user_gfx_font.name,
	X					&r.pdb.user_gfx_font.size))
	X				goto user;
	X		} else if (0 > pdb_sscanf(buffer, fmt,
	X				&r.pdb.user_gfx_font.size,
	X				r.pdb.user_gfx_font.name))
	X			goto user;
	X		break;
	X
	X	case PDB_USER_GFX_TEXTPOS:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.user_gfx_textpos.xyz[0],
	X				&r.pdb.user_gfx_textpos.xyz[1],
	X				&r.pdb.user_gfx_textpos.xyz[2]))
	X			goto user;
	X		break;
	X
	X	case PDB_USER_GFX_LABEL:
	X		if (pdb_pdbrun_version < 6) {
	X			if (0 > sscanf(buffer, fmt,
	X					&r.pdb.user_gfx_label.xyz[0],
	X					&r.pdb.user_gfx_label.xyz[1],
	X					&r.pdb.user_gfx_label.xyz[2],
	X					r.pdb.user_gfx_label.text))
	X				goto user;
	X		} else if (0 > pdb_sscanf(buffer, fmt,
	X				r.pdb.user_gfx_label.text))
	X			goto user;
	X		/* TODO: process text? */
	X		break;
	X
	X	case PDB_USER_GFX_MOVE:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.user_gfx_move.xyz[0],
	X				&r.pdb.user_gfx_move.xyz[1],
	X				&r.pdb.user_gfx_move.xyz[2]))
	X			goto user;
	X		break;
	X
	X	case PDB_USER_GFX_DRAW:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.user_gfx_draw.xyz[0],
	X				&r.pdb.user_gfx_draw.xyz[1],
	X				&r.pdb.user_gfx_draw.xyz[2]))
	X			goto user;
	X		break;
	X
	X	case PDB_USER_GFX_MARKER:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.user_gfx_marker.xyz[0],
	X				&r.pdb.user_gfx_marker.xyz[1],
	X				&r.pdb.user_gfx_marker.xyz[2]))
	X			goto user;
	X		break;
	X
	X	case PDB_USER_GFX_POINT:
	X		if (0 > pdb_sscanf(buffer, fmt, &r.pdb.user_gfx_point.xyz[0],
	X				&r.pdb.user_gfx_point.xyz[1],
	X				&r.pdb.user_gfx_point.xyz[2]))
	X			goto user;
	X		break;
	X	}
	X	
	X	return r;
	X}
	X
	X# ifdef vms
	Xpdb_read_dummy()
	X{
	X	pdb_fmt_dummy();
	X}
	X# endif
SHAR_EOF
if test 30391 -ne "`wc -c < 'pdb_read.c'`"
then
	echo shar: "error transmitting 'pdb_read.c'" '(should have been 30391 characters)'
fi
fi
echo shar: "extracting 'pdb_sprntf.c'" '(10000 characters)'
if test -f 'pdb_sprntf.c'
then
	echo shar: "will not over-write existing file 'pdb_sprntf.c'"
else
sed 's/^	X//' << \SHAR_EOF > 'pdb_sprntf.c'
	X/*
	X *	Copyright (c) 1989 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.c,v 2.4 1994/04/15 22:34:24 gregc Exp $
	X */
	X
	X/* LINTLIBRARY */
	X
	X# include	
	X# include	
	X# include	
	X# ifdef __STDC__
	X# include	
	X# else
	X# include	
	X# endif
	X
	Xstatic char	scratch[BUFSIZ];
	X
	X# define	OVERFLOW_CHAR	'*'
	X
	X# ifdef __STDC__
	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# else
	Xstatic char	*outint(), *outunsigned(), *outstr(), *outfloat(), *outexp();
	Xstatic char	*e_out();
	X# endif
	X
	X# ifdef __STDC__
	Xvoid
	Xpdb_sprintf(char *outbuf, const char *fmt, ...)
	X# else
	X/*VARARGS2*/
	Xvoid
	Xpdb_sprintf(outbuf, fmt, va_alist)
	Xchar	*outbuf;
	Xchar	*fmt;
	Xva_dcl
	X# endif
	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# ifdef __STDC__
	X	va_start(argv, fmt);
	X# else
	X	va_start(argv);
	X# endif
	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}
	X
	Xstatic char *
	X# ifdef __STDC__
	Xe_out(int width, char *where)
	X# else
	Xe_out(width, where)
	X	int	width;
	X	char	*where;
	X# endif
	X{
	X	while (width-- > 0)
	X		*where++ = OVERFLOW_CHAR;
	X	return where;
	X}
	X
	Xstatic char *
	X# ifdef __STDC__
	Xoutint(int value, int width, int radix, char fill_char, char hex,
	X					int left_justify, char *p, char zero)
	X# else
	Xoutint(value, width, radix, fill_char, hex, left_justify, p, zero)
	X	int	value, width;
	X	int	radix;
	X	char	fill_char;
	X	char	hex;
	X	int	left_justify;
	X	char	*p;
	X	char	zero;
	X# endif
	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 *
	X# ifdef __STDC__
	Xoutunsigned(unsigned int value, int width, char fill_char, int left_justify,
	X									char *p)
	X# else
	Xoutunsigned(value, width, fill_char, left_justify, p)
	X	unsigned int	value;
	X	int		width;
	X	char		fill_char;
	X	int		left_justify;
	X	char		*p;
	X# endif
	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 *
	X# ifdef __STDC__
	Xoutstr(char *s, int width, int maxstr, char fill_char, int left_justify, char *p)
	X# else
	Xoutstr(s, width, maxstr, fill_char, left_justify, p)
	X	char	*s;
	X	int	width;
	X	int	maxstr;
	X	char	fill_char;
	X	int	left_justify;
	X	char	*p;
	X# endif
	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 *
	X# ifdef __STDC__
	Xoutfloat(double value, int width, int nplace, char fill_char, int left_justify,
	X									char *p)
	X# else
	Xoutfloat(value, width, nplace, fill_char, left_justify, p)
	X	double	value;
	X	int	width, nplace;
	X	char	fill_char;
	X	int	left_justify;
	X	char	*p;
	X# endif
	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 = 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 *
	X# ifdef __STDC__
	Xoutexp(double value, int width, int nplace, char fill_char, int left_justify,
	X									char *p)
	X# else
	Xoutexp(value, width, nplace, fill_char, left_justify, p)
	X	double	value;
	X	int	width, nplace;
	X	char	*p;
	X	char	fill_char;
	X	int	left_justify;
	X# endif
	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 10000 -ne "`wc -c < 'pdb_sprntf.c'`"
then
	echo shar: "error transmitting 'pdb_sprntf.c'" '(should have been 10000 characters)'
fi
fi
echo shar: "extracting 'pdb_sscanf.c'" '(5183 characters)'
if test -f 'pdb_sscanf.c'
then
	echo shar: "will not over-write existing file 'pdb_sscanf.c'"
else
sed 's/^	X//' << \SHAR_EOF > 'pdb_sscanf.c'
	X/*
	X *	Copyright (c) 1989 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.c,v 2.8 1994/04/15 22:34:24 gregc Exp $
	X */
	X
	X/* LINTLIBRARY */
	X
	X# include	
	X# include	
	X# ifdef __STDC__
	X# include	
	X# include	
	X# else
	X# include	
	X
	Xextern int	atoi();
	Xextern double	atof();
	X# endif
	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
	X# ifdef __STDC__
	Xpdb_sscanf(const char *buffer, const char *fmt, ...)
	X# else
	X/*VARARGS2*/
	Xpdb_sscanf(buffer, fmt, va_alist)
	X	char	*buffer;
	X	char	*fmt;
	X	va_dcl
	X# endif
	X{
	X	va_list	ap;
	X	int	i, field_width;
	X	int	nmatch;
	X	char	*s, *t;
	X	char	tmp[MAXFIELDSIZE];
	X
	X# ifdef __STDC__
	X	va_start(ap, fmt);
	X# else
	X	va_start(ap);
	X# endif
	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#ifndef __STDC__
	X			*(va_arg(ap, int *)) = atoi(tmp);
	X#else
	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#endif
	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#ifndef __STDC__
	X			*(va_arg(ap, double *)) = atof(tmp);
	X#else
	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#endif
	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			fprintf(stderr, "bad format '%c' in pdb_sscanf\n",
	X									*fmt);
	X			va_end(ap);
	X			return -1;
	X		}
	X	}
	X	va_end(ap);
	X	return nmatch;
	X}
SHAR_EOF
if test 5183 -ne "`wc -c < 'pdb_sscanf.c'`"
then
	echo shar: "error transmitting 'pdb_sscanf.c'" '(should have been 5183 characters)'
fi
fi
echo shar: "extracting 'pdb_write.c'" '(18051 characters)'
if test -f 'pdb_write.c'
then
	echo shar: "will not over-write existing file 'pdb_write.c'"
else
sed 's/^	X//' << \SHAR_EOF > 'pdb_write.c'
	X/*
	X *	Copyright (c) 1989 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_write.c,v 2.11 1995/01/20 01:20:36 gregc Exp $
	X *
	X *	subroutine for writing PDB format files
	X *
	X */
	X
	X/* LINTLIBRARY */
	X
	X# include	
	X# include	
	X# include	"pdb_int.h"
	X
	Xstatic const char * const pdb_record_format[PDB_NUM_R] = {
	X#include "write_format.i"
	X};
	X
	Xstatic char const * const pdbrun5[] = {
	X#include "pdbrun5_write.i"
	X};
	X
	Xstatic char const * const pdbrun6[] = {
	X#include "pdbrun6_write.i"
	X};
	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
	Xvoid
	X# ifdef __STDC__
	Xpdb_write_record(FILE *f, const pdb_record *r, const char *name, int line_num)
	X# else
	Xpdb_write_record(f, r, name, line_num)
	X	FILE		*f;
	X	pdb_record	*r;
	X	char		*name;		/* if NULL, don't print */
	X	int		line_num;	/* if name == NULL, don't print */
	X# endif
	X{
	X	char	buffer[PDB_BUFSIZ];
	X
	X	pdb_write_string(buffer, r);
	X	if (name == NULL)
	X		(void) fprintf(f, "%s\n", buffer);
	X	else if (line_num >= 10000)
	X		(void) fprintf(f, "%-72.72s%-4.4s%04d\n", buffer, name,
	X							line_num % 10000);
	X	else
	X		(void) fprintf(f, "%-72.72s%-4.4s%4d\n", buffer, name,
	X								line_num);
	X}
	X
	Xvoid
	X# ifdef __STDC__
	Xpdb_write_string(char *buffer, const pdb_record *r)
	X# else
	Xpdb_write_string(buffer, r)
	X	char		*buffer;
	X	pdb_record	*r;
	X# endif
	X{
	X	const char		*fmt;
	X	const struct pdb_sheet	*sh;
	X	const pdb_residue	*shr0, *shr1, *sha0, *sha1;
	X	char			*s, *t;
	X
	X	/* convert C structure to pdb record */
	X
	X
	X	if (r->record_type < PDB_USER_PDBRUN)
	X		fmt = pdb_record_format[r->record_type];
	X	else if (pdb_pdbrun_version < 6)
	X		fmt = pdbrun5[r->record_type - PDB_USER_PDBRUN];
	X	else
	X		fmt = pdbrun6[r->record_type - PDB_USER_PDBRUN];
	X	switch (r->record_type) {
	X
	X	case PDB_UNKNOWN:
	X		pdb_sprintf(buffer, fmt, r->pdb.unknown.junk);
	X		break;
	X
	X	case PDB_AGGRGT:
	X		pdb_sprintf(buffer, fmt, r->pdb.aggrgt.serial_num,
	X			r->pdb.aggrgt.num_components,
	X			r->pdb.aggrgt.cmpont_serial_nums[0],
	X			r->pdb.aggrgt.cmpont_serial_nums[1],
	X			r->pdb.aggrgt.cmpont_serial_nums[2],
	X			r->pdb.aggrgt.cmpont_serial_nums[3],
	X			r->pdb.aggrgt.cmpont_serial_nums[4],
	X			r->pdb.aggrgt.cmpont_serial_nums[5],
	X			r->pdb.aggrgt.cmpont_serial_nums[6],
	X			r->pdb.aggrgt.cmpont_serial_nums[7],
	X			r->pdb.aggrgt.cmpont_serial_nums[8],
	X			r->pdb.aggrgt.cmpont_serial_nums[9],
	X			r->pdb.aggrgt.cmpont_serial_nums[10],
	X			r->pdb.aggrgt.cmpont_serial_nums[11],
	X			r->pdb.aggrgt.cmpont_serial_nums[12],
	X			r->pdb.aggrgt.cmpont_serial_nums[13]);
	X		break;
	X
	X	case PDB_ANISOU:
	X	case PDB_SIGUIJ:
	X		pdb_sprintf(buffer, fmt, r->pdb.anisou.serial_num,
	X			r->pdb.anisou.name, r->pdb.anisou.alt_loc,
	X			r->pdb.anisou.residue.name,
	X			r->pdb.anisou.residue.chain_id,
	X			r->pdb.anisou.residue.seq_num,
	X			r->pdb.anisou.residue.insert_code,
	X			r->pdb.anisou.u[0], r->pdb.anisou.u[1],
	X			r->pdb.anisou.u[2], r->pdb.anisou.u[3],
	X			r->pdb.anisou.u[4], r->pdb.anisou.u[5]);
	X		break;
	X
	X	case PDB_ATOM:
	X	case PDB_HETATM:
	X	case PDB_SIGATM:
	X		pdb_sprintf(buffer, fmt, r->pdb.atom.serial_num,
	X			r->pdb.atom.name, r->pdb.atom.alt_loc,
	X			r->pdb.atom.residue.name,
	X			r->pdb.atom.residue.chain_id,
	X			r->pdb.atom.residue.seq_num,
	X			r->pdb.atom.residue.insert_code,
	X			r->pdb.atom.x, r->pdb.atom.y, r->pdb.atom.z,
	X			r->pdb.atom.occupancy, r->pdb.atom.temp_factor,
	X			r->pdb.atom.ftnote_num);
	X		break;
	X
	X	case PDB_AUTHOR:
	X	case PDB_COMPND:
	X	case PDB_JRNL:
	X	case PDB_SOURCE:
	X	case PDB_EXPDTA:
	X		pdb_sprintf(buffer, fmt, r->pdb.author.continuation,
	X			r->pdb.author.data);
	X		break;
	X
	X	case PDB_CONECT:
	X		pdb_sprintf(buffer, fmt, r->pdb.conect.serial_num,
	X			r->pdb.conect.covalent[0], r->pdb.conect.covalent[1],
	X			r->pdb.conect.covalent[2], r->pdb.conect.covalent[3],
	X			r->pdb.conect.bonds[0].hydrogen[0],
	X			r->pdb.conect.bonds[0].hydrogen[1],
	X			r->pdb.conect.bonds[0].salt,
	X			r->pdb.conect.bonds[1].hydrogen[0],
	X			r->pdb.conect.bonds[1].hydrogen[1],
	X			r->pdb.conect.bonds[1].salt);
	X		break;
	X
	X	case PDB_CMPONT:
	X		pdb_sprintf(buffer, fmt, r->pdb.cmpont.seq_num,
	X			r->pdb.cmpont.residues[0].name,
	X			r->pdb.cmpont.residues[0].chain_id,
	X			r->pdb.cmpont.residues[0].seq_num,
	X			r->pdb.cmpont.residues[0].insert_code,
	X			r->pdb.cmpont.residues[1].name,
	X			r->pdb.cmpont.residues[1].chain_id,
	X			r->pdb.cmpont.residues[1].seq_num,
	X			r->pdb.cmpont.residues[1].insert_code);
	X		break;
	X
	X	case PDB_CRYST1:
	X		pdb_sprintf(buffer, fmt, r->pdb.cryst1.a, r->pdb.cryst1.b,
	X			r->pdb.cryst1.c, r->pdb.cryst1.alpha,
	X			r->pdb.cryst1.beta, r->pdb.cryst1.gamma,
	X			r->pdb.cryst1.space_grp, r->pdb.cryst1.z);
	X		break;
	X
	X	case PDB_END:
	X	case PDB_ENDMDL:
	X		pdb_sprintf(buffer, fmt);
	X		break;
	X
	X	case PDB_FORMUL:
	X		pdb_sprintf(buffer, fmt, r->pdb.formul.component,
	X			r->pdb.formul.het_id, r->pdb.formul.continuation,
	X			r->pdb.formul.exclude, r->pdb.formul.formula);
	X		break;
	X
	X	case PDB_FTNOTE:
	X	case PDB_REMARK:
	X	case PDB_SYMDES:
	X	case PDB_MTXDES:
	X	case PDB_CMPDES:
	X	case PDB_AGRDES:
	X		pdb_sprintf(buffer, fmt, r->pdb.ftnote.num, r->pdb.ftnote.text);
	X		break;
	X
	X	case PDB_HEADER:
	X		pdb_sprintf(buffer, fmt, r->pdb.header.class,
	X			r->pdb.header.date, r->pdb.header.type,
	X			r->pdb.header.id);
	X		break;
	X
	X	case PDB_HELIX:
	X		pdb_sprintf(buffer, fmt, r->pdb.helix.serial_num,
	X			r->pdb.helix.id,
	X			r->pdb.helix.residues[0].name,
	X			r->pdb.helix.residues[0].chain_id,
	X			r->pdb.helix.residues[0].seq_num,
	X			r->pdb.helix.residues[0].insert_code,
	X			r->pdb.helix.residues[1].name,
	X			r->pdb.helix.residues[1].chain_id,
	X			r->pdb.helix.residues[1].seq_num,
	X			r->pdb.helix.residues[1].insert_code,
	X			r->pdb.helix.class, r->pdb.helix.comment);
	X		break;
	X
	X	case PDB_HET:
	X		pdb_sprintf(buffer, fmt, r->pdb.het.het_grp.name,
	X			r->pdb.het.het_grp.chain_id, r->pdb.het.het_grp.seq_num,
	X			r->pdb.het.het_grp.insert_code, r->pdb.het.num_atoms,
	X			r->pdb.het.text);
	X		break;
	X
	X	case PDB_MASTER:
	X		pdb_sprintf(buffer, fmt, r->pdb.master.num_remark,
	X			r->pdb.master.num_ftnote, r->pdb.master.num_het,
	X			r->pdb.master.num_helix, r->pdb.master.num_sheet,
	X			r->pdb.master.num_turn, r->pdb.master.num_site,
	X			r->pdb.master.num_transform,
	X			r->pdb.master.num_coordinate, r->pdb.master.num_ter,
	X			r->pdb.master.num_conect, r->pdb.master.num_seqres);
	X		break;
	X
	X	case PDB_MODEL:
	X		pdb_sprintf(buffer, fmt, r->pdb.model.num);
	X		break;
	X
	X	case PDB_MTRIX:
	X		pdb_sprintf(buffer, fmt, r->pdb.mtrix.row_num,
	X			r->pdb.mtrix.serial_num, r->pdb.mtrix.m1,
	X			r->pdb.mtrix.m2, r->pdb.mtrix.m3, r->pdb.mtrix.v,
	X			r->pdb.mtrix.given);
	X		break;
	X
	X	case PDB_OBSLTE:
	X		pdb_sprintf(buffer, fmt, r->pdb.obslte.continuation,
	X			r->pdb.obslte.date, r->pdb.obslte.old_id,
	X			r->pdb.obslte.id_map[0], r->pdb.obslte.id_map[1],
	X			r->pdb.obslte.id_map[2], r->pdb.obslte.id_map[3],
	X			r->pdb.obslte.id_map[4], r->pdb.obslte.id_map[2],
	X			r->pdb.obslte.id_map[6], r->pdb.obslte.id_map[7]);
	X		break;
	X
	X	case PDB_ORIGX:
	X		pdb_sprintf(buffer, fmt, r->pdb.origx.row_num, r->pdb.origx.o1,
	X			r->pdb.origx.o2, r->pdb.origx.o3, r->pdb.origx.t);
	X		break;
	X
	X	case PDB_REVDAT:
	X		pdb_sprintf(buffer, fmt, r->pdb.revdat.modification,
	X			r->pdb.revdat.continuation, r->pdb.revdat.date,
	X			r->pdb.revdat.id, r->pdb.revdat.mod_type,
	X			r->pdb.revdat.corrections);
	X		break;
	X
	X	case PDB_SCALE:
	X		pdb_sprintf(buffer, fmt, r->pdb.scale.row_num, r->pdb.scale.s1,
	X			r->pdb.scale.s2, r->pdb.scale.s3, r->pdb.scale.u);
	X		break;
	X
	X	case PDB_SEQRES:
	X		pdb_sprintf(buffer, fmt, r->pdb.seqres.serial_num,
	X			r->pdb.seqres.chain_id, r->pdb.seqres.count,
	X			r->pdb.seqres.names[0], r->pdb.seqres.names[1],
	X			r->pdb.seqres.names[2], r->pdb.seqres.names[3],
	X			r->pdb.seqres.names[4], r->pdb.seqres.names[5],
	X			r->pdb.seqres.names[6], r->pdb.seqres.names[7],
	X			r->pdb.seqres.names[8], r->pdb.seqres.names[9],
	X			r->pdb.seqres.names[10], r->pdb.seqres.names[11],
	X			r->pdb.seqres.names[12]);
	X		break;
	X
	X	case PDB_SHEET:
	X		sh = &r->pdb.sheet;
	X		shr0 = &sh->residues[0];
	X		shr1 = &sh->residues[1];
	X		sha0 = &sh->atoms[0].residue;
	X		sha1 = &sh->atoms[1].residue;
	X		pdb_sprintf(buffer, fmt, sh->strand_num,
	X			sh->id, sh->count,
	X			shr0->name, shr0->chain_id, shr0->seq_num,
	X			shr0->insert_code,
	X			shr1->name, shr1->chain_id, shr1->seq_num,
	X			shr1->insert_code,
	X			sh->sense,
	X			sh->atoms[0].name,
	X			sha0->name, sha0->chain_id, sha0->seq_num,
	X			sha0->insert_code,
	X			sh->atoms[1].name,
	X			sha1->name, sha1->chain_id, sha1->seq_num,
	X			sha1->insert_code);
	X		break;
	X
	X	case PDB_SITE:
	X		shr0 = &r->pdb.site.residues[0];
	X		shr1 = &r->pdb.site.residues[1];
	X		sha0 = &r->pdb.site.residues[2];
	X		sha1 = &r->pdb.site.residues[3];
	X		pdb_sprintf(buffer, fmt, r->pdb.site.seq_num,
	X			r->pdb.site.id, r->pdb.site.count,
	X			shr0->name, shr0->chain_id, shr0->seq_num,
	X			shr0->insert_code,
	X			shr1->name, shr1->chain_id, shr1->seq_num,
	X			shr1->insert_code,
	X			sha0->name, sha0->chain_id, sha0->seq_num,
	X			sha0->insert_code,
	X			sha1->name, sha1->chain_id, sha1->seq_num,
	X			sha1->insert_code);
	X		break;
	X
	X	case PDB_SPRSDE:
	X		pdb_sprintf(buffer, fmt, r->pdb.sprsde.continuation,
	X			r->pdb.sprsde.date, r->pdb.sprsde.id,
	X			r->pdb.sprsde.supersede[0], r->pdb.sprsde.supersede[1],
	X			r->pdb.sprsde.supersede[2], r->pdb.sprsde.supersede[3],
	X			r->pdb.sprsde.supersede[4], r->pdb.sprsde.supersede[5],
	X			r->pdb.sprsde.supersede[6], r->pdb.sprsde.supersede[7]);
	X		break;
	X
	X	case PDB_SSBOND:
	X		pdb_sprintf(buffer, fmt, r->pdb.ssbond.seq_num,
	X			r->pdb.ssbond.residues[0].name,
	X			r->pdb.ssbond.residues[0].chain_id,
	X			r->pdb.ssbond.residues[0].seq_num,
	X			r->pdb.ssbond.residues[0].insert_code,
	X			r->pdb.ssbond.residues[1].name,
	X			r->pdb.ssbond.residues[1].chain_id,
	X			r->pdb.ssbond.residues[1].seq_num,
	X			r->pdb.ssbond.residues[1].insert_code,
	X			r->pdb.ssbond.comment);
	X		break;
	X
	X	case PDB_SYMOP:
	X		pdb_sprintf(buffer, fmt, r->pdb.symop.row_num,
	X			r->pdb.symop.serial_num, r->pdb.symop.s1,
	X			r->pdb.symop.s2, r->pdb.symop.s3, r->pdb.symop.t);
	X		break;
	X
	X	case PDB_TER:
	X		pdb_sprintf(buffer, fmt, r->pdb.ter.serial_num,
	X			r->pdb.ter.residue.name, r->pdb.ter.residue.chain_id,
	X			r->pdb.ter.residue.seq_num,
	X			r->pdb.ter.residue.insert_code);
	X		break;
	X
	X	case PDB_TRNSFM:
	X		pdb_sprintf(buffer, fmt, r->pdb.trnsfm.result_serial_num,
	X			r->pdb.trnsfm.apply_serial_num,
	X			r->pdb.trnsfm.source_serial_num);
	X		break;
	X
	X	case PDB_TURN:
	X		pdb_sprintf(buffer, fmt, r->pdb.turn.seq_num,
	X			r->pdb.turn.id,
	X			r->pdb.turn.residues[0].name,
	X			r->pdb.turn.residues[0].chain_id,
	X			r->pdb.turn.residues[0].seq_num,
	X			r->pdb.turn.residues[0].insert_code,
	X			r->pdb.turn.residues[1].name,
	X			r->pdb.turn.residues[1].chain_id,
	X			r->pdb.turn.residues[1].seq_num,
	X			r->pdb.turn.residues[1].insert_code,
	X			r->pdb.turn.comment);
	X		break;
	X
	X	case PDB_TVECT:
	X		pdb_sprintf(buffer, fmt, r->pdb.tvect.serial_num,
	X			r->pdb.tvect.t1, r->pdb.tvect.t2, r->pdb.tvect.t3,
	X			r->pdb.tvect.comment);
	X		break;
	X
	X	case PDB_USER:
	X		pdb_sprintf(buffer, fmt, r->pdb.user.subtype, r->pdb.user.text);
	X		break;
	X
	X	case PDB_USER_PDBRUN:
	X		pdb_sprintf(buffer, fmt, r->pdb.user_pdbrun.version);
	X		pdb_pdbrun_version = r->pdb.user_pdbrun.version;
	X		break;
	X
	X	case PDB_USER_EYEPOS:
	X		pdb_sprintf(buffer, fmt, r->pdb.user_eyepos.xyz[0],
	X			r->pdb.user_eyepos.xyz[1], r->pdb.user_eyepos.xyz[2]);
	X		break;
	X
	X	case PDB_USER_ATPOS:
	X		pdb_sprintf(buffer, fmt, r->pdb.user_atpos.xyz[0],
	X			r->pdb.user_atpos.xyz[1], r->pdb.user_atpos.xyz[2]);
	X		break;
	X
	X	case PDB_USER_WINDOW:
	X		pdb_sprintf(buffer, fmt, r->pdb.user_window.left,
	X			r->pdb.user_window.right, r->pdb.user_window.bottom,
	X			r->pdb.user_window.top, r->pdb.user_window.hither,
	X			r->pdb.user_window.yon);
	X		break;
	X
	X	case PDB_USER_FOCUS:
	X		pdb_sprintf(buffer, fmt, r->pdb.user_focus.focus);
	X		break;
	X
	X	case PDB_USER_VIEWPORT:
	X		pdb_sprintf(buffer, fmt, r->pdb.user_viewport.xmin,
	X			r->pdb.user_viewport.xmax, r->pdb.user_viewport.ymin,
	X			r->pdb.user_viewport.ymax);
	X		break;
	X
	X	case PDB_USER_BGCOLOR:
	X		if (pdb_pdbrun_version < 6)
	X			sprintf(buffer, fmt, r->pdb.user_bgcolor.rgb[0],
	X				r->pdb.user_bgcolor.rgb[1],
	X				r->pdb.user_bgcolor.rgb[2]);
	X		else
	X			pdb_sprintf(buffer, fmt, r->pdb.user_bgcolor.rgb[0],
	X				r->pdb.user_bgcolor.rgb[1],
	X				r->pdb.user_bgcolor.rgb[2]);
	X		break;
	X
	X	case PDB_USER_ANGLE:
	X		if (pdb_pdbrun_version < 6)
	X			pdb_sprintf(buffer, fmt, r->pdb.user_angle.which,
	X				r->pdb.user_angle.atom0,
	X				r->pdb.user_angle.atom1,
	X				r->pdb.user_angle.atom2,
	X				r->pdb.user_angle.atom3,
	X				r->pdb.user_angle.angle);
	X		else
	X			pdb_sprintf(buffer, fmt, r->pdb.user_angle.atom0,
	X				r->pdb.user_angle.atom1,
	X				r->pdb.user_angle.atom2,
	X				r->pdb.user_angle.atom3,
	X				r->pdb.user_angle.angle);
	X		break;
	X
	X	case PDB_USER_DISTANCE:
	X		if (pdb_pdbrun_version < 6)
	X			pdb_sprintf(buffer, fmt, r->pdb.user_distance.which,
	X				r->pdb.user_distance.atom0,
	X				r->pdb.user_distance.atom1,
	X				r->pdb.user_distance.distance);
	X		else
	X			pdb_sprintf(buffer, fmt, r->pdb.user_distance.atom0,
	X				r->pdb.user_distance.atom1,
	X				r->pdb.user_distance.distance);
	X		break;
	X
	X	case PDB_USER_FILE:
	X		if (pdb_pdbrun_version < 6)
	X			pdb_sprintf(buffer, fmt, r->pdb.user_file.filename);
	X		else
	X			pdb_sprintf(buffer, fmt, r->pdb.user_file.model,
	X						r->pdb.user_file.filename);
	X		break;
	X
	X	case PDB_USER_MARKNAME:
	X		pdb_sprintf(buffer, fmt, r->pdb.user_markname.markname);
	X		break;
	X
	X	case PDB_USER_MARK:
	X		pdb_sprintf(buffer, fmt, r->pdb.user_mark.markname);
	X		break;
	X
	X	case PDB_USER_CNAME:
	X		if (pdb_pdbrun_version < 6)
	X			sprintf(buffer, fmt, r->pdb.user_cname.name,
	X				r->pdb.user_cname.rgb[0],
	X				r->pdb.user_cname.rgb[1],
	X				r->pdb.user_cname.rgb[2]);
	X		else
	X			pdb_sprintf(buffer, fmt, r->pdb.user_cname.rgb[0],
	X				r->pdb.user_cname.rgb[1],
	X				r->pdb.user_cname.rgb[2],
	X				r->pdb.user_cname.name);
	X		break;
	X
	X	case PDB_USER_COLOR:
	X		if (pdb_pdbrun_version < 6)
	X			sprintf(buffer, fmt, r->pdb.user_color.spec,
	X				r->pdb.user_color.rgb[0],
	X				r->pdb.user_color.rgb[1],
	X				r->pdb.user_color.rgb[2]);
	X		else
	X			pdb_sprintf(buffer, fmt, r->pdb.user_color.rgb[0],
	X				r->pdb.user_color.rgb[1],
	X				r->pdb.user_color.rgb[2],
	X				r->pdb.user_color.spec);
	X		break;
	X
	X	case PDB_USER_RADIUS:
	X		pdb_sprintf(buffer, fmt, r->pdb.user_radius.radius);
	X		break;
	X
	X	case PDB_USER_OBJECT:
	X		pdb_sprintf(buffer, fmt, r->pdb.user_object.model);
	X		break;
	X
	X	case PDB_USER_ENDOBJ:
	X		pdb_sprintf(buffer, fmt, r->pdb.user_endobj.model);
	X		break;
	X
	X	case PDB_USER_CHAIN:
	X		if (pdb_pdbrun_version < 6)
	X			sprintf(buffer, fmt, r->pdb.user_chain.atom0,
	X				r->pdb.user_chain.atom1);
	X		else
	X			pdb_sprintf(buffer, fmt, r->pdb.user_chain.atom0,
	X				r->pdb.user_chain.atom1);
	X		break;
	X
	X	case PDB_USER_GFX_BEGIN:
	X		if (r->pdb.user_gfx_begin.primitive == PDB_GFX_UNKNOWN)
	X			pdb_sprintf(buffer, fmt, r->pdb.user_gfx_begin.unknown);
	X		else
	X			pdb_sprintf(buffer, fmt, pdb_gfx_string(
	X					r->pdb.user_gfx_begin.primitive));
	X		break;
	X
	X	case PDB_USER_GFX_END:
	X		pdb_sprintf(buffer, fmt);
	X		break;
	X
	X	case PDB_USER_GFX_COLOR:
	X		if (pdb_pdbrun_version < 6)
	X			sprintf(buffer, fmt, r->pdb.user_gfx_color.spec,
	X				r->pdb.user_gfx_color.rgb[0],
	X				r->pdb.user_gfx_color.rgb[1],
	X				r->pdb.user_gfx_color.rgb[2]);
	X		else
	X			pdb_sprintf(buffer, fmt, r->pdb.user_gfx_color.rgb[0],
	X				r->pdb.user_gfx_color.rgb[1],
	X				r->pdb.user_gfx_color.rgb[2],
	X				r->pdb.user_gfx_color.spec);
	X		break;
	X
	X	case PDB_USER_GFX_NORMAL:
	X		pdb_sprintf(buffer, fmt, r->pdb.user_gfx_normal.xyz[0],
	X			r->pdb.user_gfx_normal.xyz[1],
	X			r->pdb.user_gfx_normal.xyz[2]);
	X		break;
	X
	X	case PDB_USER_GFX_VERTEX:
	X		pdb_sprintf(buffer, fmt, r->pdb.user_gfx_vertex.xyz[0],
	X			r->pdb.user_gfx_vertex.xyz[1],
	X			r->pdb.user_gfx_vertex.xyz[2]);
	X		break;
	X
	X	case PDB_USER_GFX_FONT:
	X		if (pdb_pdbrun_version < 6)
	X			sprintf(buffer, fmt, r->pdb.user_gfx_font.name,
	X				r->pdb.user_gfx_font.size);
	X		else
	X			pdb_sprintf(buffer, fmt, r->pdb.user_gfx_font.size,
	X				r->pdb.user_gfx_font.name);
	X		break;
	X
	X	case PDB_USER_GFX_TEXTPOS:
	X		pdb_sprintf(buffer, fmt, r->pdb.user_gfx_textpos.xyz[0],
	X			r->pdb.user_gfx_textpos.xyz[1],
	X			r->pdb.user_gfx_textpos.xyz[2]);
	X		break;
	X
	X	case PDB_USER_GFX_LABEL:
	X		if (pdb_pdbrun_version < 6)
	X			sprintf(buffer, fmt, r->pdb.user_gfx_label.xyz[0],
	X				r->pdb.user_gfx_label.xyz[1],
	X				r->pdb.user_gfx_label.xyz[2],
	X				r->pdb.user_gfx_label.text);
	X		else
	X			pdb_sprintf(buffer, fmt, r->pdb.user_gfx_label.text);
	X		break;
	X
	X	case PDB_USER_GFX_MOVE:
	X		pdb_sprintf(buffer, fmt, r->pdb.user_gfx_move.xyz[0],
	X			r->pdb.user_gfx_move.xyz[1],
	X			r->pdb.user_gfx_move.xyz[2]);
	X		break;
	X
	X	case PDB_USER_GFX_DRAW:
	X		pdb_sprintf(buffer, fmt, r->pdb.user_gfx_draw.xyz[0],
	X			r->pdb.user_gfx_draw.xyz[1],
	X			r->pdb.user_gfx_draw.xyz[2]);
	X		break;
	X
	X	case PDB_USER_GFX_MARKER:
	X		pdb_sprintf(buffer, fmt, r->pdb.user_gfx_marker.xyz[0],
	X			r->pdb.user_gfx_marker.xyz[1],
	X			r->pdb.user_gfx_marker.xyz[2]);
	X		break;
	X
	X	case PDB_USER_GFX_POINT:
	X		pdb_sprintf(buffer, fmt, r->pdb.user_gfx_point.xyz[0],
	X			r->pdb.user_gfx_point.xyz[1],
	X			r->pdb.user_gfx_point.xyz[2]);
	X		break;
	X
	X	default:
	X		(void) sprintf(buffer, "unknown pdb record #%d",
	X								r->record_type);
	X		break;
	X	}
	X
	X	/* find last non-blank in buffer, and shorten it */
	X	t = NULL;
	X	for (s = buffer; *s != '\0'; s++)
	X		if (!isspace(*s))
	X			t = s + 1;
	X	if (t == NULL)		/* this should never happen, but ... */
	X		t = buffer;
	X	*t = '\0';
	X}
	X
	X# ifdef vms
	Xpdb_write_dummy()
	X{
	X	pdb_fmt_dummy();
	X}
	X# endif
SHAR_EOF
if test 18051 -ne "`wc -c < 'pdb_write.c'`"
then
	echo shar: "error transmitting 'pdb_write.c'" '(should have been 18051 characters)'
fi
fi
echo shar: "extracting 'pdbrun.c'" '(2700 characters)'
if test -f 'pdbrun.c'
then
	echo shar: "will not over-write existing file 'pdbrun.c'"
else
sed 's/^	X//' << \SHAR_EOF > 'pdbrun.c'
	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: pdbrun.c,v 1.4 1994/11/18 01:00:57 gregc Exp $
	X *
	X *	subroutine for reading PDB format files
	X *
	X */
	X
	X/* LINTLIBRARY */
	X
	X# include	"pdb_int.h"
	X# include	
	X
	Xint	pdb_pdbrun_version = PDB_PDBRUN_VERSION;
	X
	X#ifdef __STDC__
	Xconst char *
	Xpdb_gfx_string(int i)
	X#else
	Xchar *
	Xpdb_gfx_string(i)
	X	int	i;
	X#endif
	X{
	X	switch (i) {
	X	default:			return "UNKNOWN";
	X	case PDB_GFX_POINTS:		return "POINTS";
	X	case PDB_GFX_MARKERS:		return "MARKERS";
	X	case PDB_GFX_LINES:		return "LINES";
	X	case PDB_GFX_LINE_STRIP:	return "LINE-STRIP";
	X	case PDB_GFX_LINE_LOOP:		return "LINE-LOOP";
	X	case PDB_GFX_TRIANGLES:		return "TRIANGLES";
	X	case PDB_GFX_TRIANGLE_STRIP:	return "TRIANGLE-STRIP";
	X	case PDB_GFX_TRIANGLE_FAN:	return "TRIANGLE-FAN";
	X	case PDB_GFX_QUADS:		return "QUADS";
	X	case PDB_GFX_QUAD_STRIP:	return "QUAD-STRIP";
	X	case PDB_GFX_POLYGON:		return "POLYGON";
	X	}
	X}
	X
	X#ifdef __STDC__
	Xint
	Xpdb_gfx_type(const char *type)
	X#else
	Xint
	Xpdb_gfx_type(type)
	X	char	*type;
	X#endif
	X{
	X	switch (type[0]) {
	X	case 'L':
	X		if (strcmp(type + 1, "INE-LOOP") == 0)
	X			return PDB_GFX_LINE_LOOP;
	X		if (strcmp(type + 1, "INE-STRIP") == 0)
	X			return PDB_GFX_LINE_STRIP;
	X		if (strcmp(type + 1, "INES") == 0)
	X			return PDB_GFX_LINES;
	X		break;
	X	case 'M':
	X		if (strcmp(type + 1, "ARKERS") == 0)
	X			return PDB_GFX_MARKERS;
	X		break;
	X	case 'P':
	X		if (strcmp(type + 1, "OINTS") == 0)
	X			return PDB_GFX_POINTS;
	X		if (strcmp(type + 1, "OLYGON") == 0)
	X			return PDB_GFX_POLYGON;
	X		break;
	X	case 'Q':
	X		if (strcmp(type + 1, "UAD-STRIP") == 0)
	X			return PDB_GFX_QUAD_STRIP;
	X		if (strcmp(type + 1, "UADS") == 0)
	X			return PDB_GFX_QUADS;
	X		break;
	X	case 'T':
	X		if (strcmp(type + 1, "RIANGLE-FAN") == 0)
	X			return PDB_GFX_TRIANGLE_FAN;
	X		if (strcmp(type + 1, "RIANGLE-STRIP") == 0)
	X			return PDB_GFX_TRIANGLE_STRIP;
	X		if (strcmp(type + 1, "RIANGLES") == 0)
	X			return PDB_GFX_TRIANGLES;
	X		break;
	X	}
	X	return PDB_GFX_UNKNOWN;
	X}
SHAR_EOF
if test 2700 -ne "`wc -c < 'pdbrun.c'`"
then
	echo shar: "error transmitting 'pdbrun.c'" '(should have been 2700 characters)'
fi
fi
exit 0
#	End of shell archive
Modified: Tue Nov 7 17:00:00 1995 GMT
Page accessed 1521 times since Sat Apr 17 21:33:51 1999 GMT