Bioplib
Protein Structure C Library
 All Data Structures Files Functions Variables Typedefs Macros Pages
parse.h
Go to the documentation of this file.
1 /************************************************************************/
2 /**
3 
4  \file parse.h
5 
6  \version V1.11
7  \date 14.08.14
8  \brief Include file for the command parser
9 
10  \copyright SciTech Software 1991-2014
11  \author 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  Here are defined the MAKEKEY macro, STRING and NUMBER defines, the
40  KeyWd structure and return values for the parser.
41 
42 **************************************************************************
43 
44  Usage:
45  ======
46 
47 **************************************************************************
48 
49  Revision History:
50  =================
51 - V1.0 11.07.90 Original
52 - V1.1 08.12.92 Defines prototypes
53 - V1.2 16.06.93 Added memory check to MAKEKEY
54 - V1.3-1.6 Skipped
55 - V1.7 01.03.94 Added mparse()
56 - V1.8 11.03.94 Skipped
57 - V1.9 07.07.14 Use bl prefix for functions By: CTP
58 - V1.10 31.07.14 Updated deprecation: Removed deprecated.h and added
59  prototypes for renamed functions. By: CTP
60 - V1.11 14.08.14 Moved deprecated function prototypes to deprecated.h
61  By: CTP
62 
63 *************************************************************************/
64 #ifndef _PARSE_H
65 #define _PARSE_H
66 
67 /************************************************************************/
68 /* Includes
69 */
70 #include "MathType.h"
71 
72 /************************************************************************/
73 /* Defines
74 */
75 
76 #define STRING 1 /* Defines used for the MAKEKEY macro */
77 #define NUMBER 0
78 
79 #define PARSE_ERRC -1 /* Error return values from parse() */
80 #define PARSE_ERRP -2
81 #define PARSE_COMMENT -3
82 
83 /************************************************************************/
84 /* Type definitions
85 */
86 typedef struct /* Used to store keywords for parse() */
87 {
88  char *name;
89  int string, nparam;
90 } KeyWd;
91 
92 typedef struct /* Used to store keywords for mparse() */
93 {
94  char *name;
95  int string, minparam, maxparam;
96 } MKeyWd;
97 
98 /************************************************************************/
99 /* Macros
100 */
101 /* Create a keyword for parse() */
102 #define MAKEKEY(x,w,v,z) \
103  (x).name = (char *)malloc((strlen(w)+2) * sizeof(char)); \
104  if((x).name != NULL) strcpy((x).name,w); \
105  (x).string = v; \
106  (x).nparam = z
107 
108 /* Create a keyword for mparse() */
109 #define MAKEMKEY(x,w,v,mn,mx) \
110  (x).name = (char *)malloc((strlen(w)+2) * sizeof(char)); \
111  if((x).name != NULL) strcpy((x).name,w); \
112  (x).string = v; \
113  (x).minparam = mn; \
114  (x).maxparam = mx
115 
116 /************************************************************************/
117 /* Prototypes
118 */
119 int blParse(char *comline, int nkeys, KeyWd *keywords, REAL *REALparam,
120  char **strparam);
121 int blMparse(char *comline, int nkeys, MKeyWd *keywords, REAL *REALparam,
122  char **strparam, int *nparams);
123 int blMatch(char *comstring, char *string2, int *nletters);
124 int blGetString(char *command, char *strparam);
125 int blGetParam(char *command, REAL *value, int *nletters);
126 
127 
128 /************************************************************************/
129 /* Include deprecated functions */
130 #define _PARSE_H_DEPRECATED
131 # include "deprecated.h"
132 /************************************************************************/
133 
134 
135 #endif
char * name
Definition: parse.h:94
int string
Definition: parse.h:89
Redirect calls to deprecated functions.
char * name
Definition: parse.h:88
int blMatch(char *comstring, char *string2, int *nletters)
Definition: parse.c:304
Definition: parse.h:92
double REAL
Definition: MathType.h:67
int blGetString(char *command, char *strparam)
Definition: parse.c:358
Definition: parse.h:86
int string
Definition: parse.h:95
Type definitions for maths.
int blGetParam(char *command, REAL *value, int *nletters)
Definition: parse.c:412
int blMparse(char *comline, int nkeys, MKeyWd *keywords, REAL *REALparam, char **strparam, int *nparams)
Definition: parse.c:447
int blParse(char *comline, int nkeys, KeyWd *keywords, REAL *REALparam, char **strparam)
Definition: parse.c:202