1
/* Copyright (C) 2000 Damir Zucic */
3
/*=============================================================================
8
Try to recognize input file format; read file if recognized. In
9
fact, this function does almost nothing: file format is recognized
10
by RecogFileFormat_ and ReadPDBFile_ reads PDB file.
13
(1) Pointer to MolComplexS structure (macromolecular complexes). It
14
should point to the first free MolComplexS structure.
15
(2) Input file name (pointer).
16
(3) Pointer to ConfigS structure, with configuration data.
19
(1) If PDB file is recognized, a function which read atomic data
24
(1) Positive on success.
25
(2) Zero if there is nothing to read (strlen (file_nameP) is zero).
26
(3) Negative on failure.
28
========includes:============================================================*/
32
#include <X11/Xutil.h>
34
#include <X11/Xatom.h>
39
/*======function prototypes:=================================================*/
41
int RecogFileFormat_ (char *);
42
int ReadPDBFile_ (MolComplexS *, char *, ConfigS *);
43
void ErrorMessage_ (char *, char *, char *,
44
char *, char *, char *, char *);
46
/*======recognize file format, read file:====================================*/
48
int ReadFile_ (MolComplexS *mol_complexSP, char *file_nameP, ConfigS *configSP)
52
/* Is file name specified at all? */
53
if (strlen (file_nameP) == 0) return 0;
55
/* Try to recognize file format: */
56
file_format = RecogFileFormat_ (file_nameP);
57
if (file_format < 0) return -1;
59
/* Read file (switch could be used here, but I don't like it): */
60
if (file_format == PDB_FORMAT)
62
if (ReadPDBFile_ (mol_complexSP, file_nameP, configSP) < 0) return -2;
66
/* If this point is reached, format is recognized, but file is not read: */
67
ErrorMessage_ ("garlic", "ReadFile_", file_nameP,
68
"Unable to read file - file format not supported!\n", "", "", "");
72
/*===========================================================================*/