Bioplib
Protein Structure C Library
 All Data Structures Files Functions Variables Typedefs Macros Pages
LegalAtomSpec.c
Go to the documentation of this file.
1 /************************************************************************/
2 /**
3 
4  \file LegalAtomSpec.c
5 
6  \version V1.8
7  \date 07.07.14
8  \brief
9 
10  \copyright (c) Dr. Andrew C. R. Martin, University of Reading, 2002-14
11  \author Dr. Andrew C. R. Martin
12  \par
13  Institute of Structural & Molecular Biology,
14  University College London,
15  Gower Street,
16  London.
17  WC1E 6BT.
18  \par
19  andrew@bioinf.org.uk
20  andrew.martin@ucl.ac.uk
21 
22 **************************************************************************
23 
24  This code is NOT IN THE PUBLIC DOMAIN, but it may be copied
25  according to the conditions laid out in the accompanying file
26  COPYING.DOC.
27 
28  The code may be modified as required, but any modifications must be
29  documented so that the person responsible can be identified.
30 
31  The code may not be sold commercially or included as part of a
32  commercial product except as described in the file COPYING.DOC.
33 
34 **************************************************************************
35 
36  Description:
37  ============
38 
39 
40 **************************************************************************
41 
42  Usage:
43  ======
44 
45 **************************************************************************
46 
47  Revision History:
48  =================
49 - V1.0 01.03.94 Original
50 - V1.1 07.07.95 Now non-destructive
51 - V1.2 17.07.95 Now checks that a number was specified as part of the
52  spec. and returns a BOOL
53 - V1.3 23.10.95 Moved FindResidueSpec() from PDBList.c
54 - V1.4 08.02.96 Added FindResidue() and changed FindResidueSpec() to
55  use it
56 - V1.5 23.07.96 Added AtomNameMatch() and LegalAtomSpec()
57 - V1.6 18.03.98 Added option to include a . to separate chain and
58  residue number so numeric chain names can be used
59 - V1.7 11.10.99 Allow a . to be used to start a number (such that the
60  default blank chain name is used). Allows negative
61  residue numbers
62 - V1.8 07.07.14 Use bl prefix for functions By: CTP
63 
64 *************************************************************************/
65 /* Doxygen
66  -------
67  #GROUP Handling PDB Data
68  #SUBGROUP Atom names and elements
69  #FUNCTION blLegalAtomSpec()
70  Partner routine for AtomNameMatch(). Checks whether a wildcard
71  specfication is legal (i.e. will not return an error when used
72  with AtomNameMatch()).
73 */
74 /************************************************************************/
75 /* Includes
76 */
77 #include "SysDefs.h"
78 
79 /************************************************************************/
80 /* Defines and macros
81 */
82 
83 /************************************************************************/
84 /* Globals
85 */
86 
87 /************************************************************************/
88 /* Prototypes
89 */
90 
91 
92 /************************************************************************/
93 /*>BOOL blLegalAtomSpec(char *spec)
94  --------------------------------
95 *//**
96 
97  Partner routine for AtomNameMatch(). Checks whether a wildcard
98  specfication is legal (i.e. will not return an error when used
99  with AtomNameMatch()).
100 
101  The only thing which is not legal is characters following a *
102 
103 - 23.07.96 Original By: ACRM
104 - 07.07.14 Use bl prefix for functions By: CTP
105 */
107 {
108  char *chp;
109 
110  for(chp=spec; *chp; chp++)
111  {
112  if(*chp == '\\')
113  {
114  chp++;
115  }
116  else if(*chp == '*')
117  {
118  chp++;
119  if(*chp && *chp != ' ')
120  return(FALSE);
121  }
122  }
123  return(TRUE);
124 }
125 
short BOOL
Definition: SysDefs.h:64
#define FALSE
Definition: macros.h:223
#define TRUE
Definition: macros.h:219
System-type variable type definitions.