1
/* Copyright (C) 2000 Damir Zucic */
3
/*=============================================================================
8
Check the input line; if recognized as mandatory record, copy
9
the line to HeaderS structure, which is member of MolComplexS
10
structure. The trailing newline is removed (if present at all).
11
The PDB header contains, among others, a keyword called HEADER.
12
Don't get confused with the usage of word "header"!
15
(1) Pointer to HeaderS structure, where line should be added if
16
recognized as mandatory record.
18
(3) The first character in the line.
21
(1) If line is mandatory, it will be added to HeaderS structure.
25
(1) Positive if line added to HeaderS structure.
26
(2) Zero if line does not contain mandatory record.
27
(3) Negative if line does contain mandatory record, but the
28
maximal number of records of this type is reached already.
30
========includes:============================================================*/
35
#include <X11/Xutil.h>
37
#include <X11/Xatom.h>
42
/*======check line, copy it if contains mandatory record:====================*/
44
int CopyHeaderLine_ (HeaderS *hSP, char *lineP, int first_char)
50
/* Check is there a mandatory record in input line: */
54
if (strstr (lineP, "HEADER") != lineP) return 0;
55
if (hSP->header_linesN >= MAXHEADERLINES) return -1;
57
P += hSP->header_offset + hSP->header_linesN * HEADERLINESIZE;
60
if (strstr (lineP, "TITLE") != lineP) return 0;
61
if (hSP->title_linesN >= MAXTITLELINES) return -2;
63
P += hSP->title_offset + hSP->title_linesN * HEADERLINESIZE;
66
if (strstr (lineP, "COMPND") != lineP) return 0;
67
if (hSP->compnd_linesN >= MAXCOMPNDLINES) return -3;
69
P += hSP->compnd_offset + hSP->compnd_linesN * HEADERLINESIZE;
72
if (strstr (lineP, "SOURCE") != lineP) return 0;
73
if (hSP->source_linesN >= MAXSOURCELINES) return -4;
75
P += hSP->source_offset + hSP->source_linesN * HEADERLINESIZE;
78
if (strstr (lineP, "EXPDTA") != lineP) return 0;
79
if (hSP->expdta_linesN >= MAXEXPDTALINES) return -5;
81
P += hSP->expdta_offset + hSP->expdta_linesN * HEADERLINESIZE;
84
if (strstr (lineP, "AUTHOR") != lineP) return 0;
85
if (hSP->author_linesN >= MAXAUTHORLINES) return -6;
87
P += hSP->author_offset + hSP->author_linesN * HEADERLINESIZE;
93
/* If this point is reached, line contains mandatory record - copy it: */
94
strncpy (P, lineP, HEADERLINESIZE - 1);
95
*(P + HEADERLINESIZE - 1) = '\0';
100
/*===========================================================================*/