~ubuntu-branches/ubuntu/natty/gpp4/natty

« back to all changes in this revision

Viewing changes to src/ccp4_parser.h

  • Committer: Bazaar Package Importer
  • Author(s): Morten Kjeldgaard
  • Date: 2008-12-03 11:21:42 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20081203112142-bvuelg39lt2lnokb
Tags: 1.1.0-0ubuntu1
* New upstream version (LP: #322205)
* Some compilation warnings fixed, patch 01-ubuntu-fixes
  sent upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
169
169
 
170
170
/* Core cparser functions */
171
171
 
 
172
/** Initialise a CCP4PARSERARRAY to be used in subsequent calls to
 
173
 *  ccp4_parser routines. The calling function must supply the maximum 
 
174
 *  number of tokens on a line (including continuation lines).
 
175
 * @param maxtokens maximum number of tokens on a line
 
176
 * @return pointer to a new CCP4PARSERARRAY structure
 
177
 */
172
178
CCP4PARSERARRAY* ccp4_parse_start(const int maxtokens);
 
179
 
 
180
/** Cleans up a CCP4PARSEARRAY after being used by ccp4_parse/
 
181
   ccp4_parser functions.
 
182
 * @param parsePtr pointer to a CCP4PARSERARRAY structure
 
183
 * @return 0 on completion
 
184
 */
173
185
int ccp4_parse_end(CCP4PARSERARRAY *parsePtr);
 
186
 
174
187
int ccp4_parse_init_token(const CCP4PARSERARRAY *parsePtr, const int itok);
 
188
 
175
189
int ccp4_parse_delimiters(CCP4PARSERARRAY *parsePtr, const char *delim,
176
190
                                  const char *nulldelim);
177
191
int ccp4_parse_comments(CCP4PARSERARRAY *parsePtr, const char *comment_chars);
 
192
 
178
193
int ccp4_parse_maxmin(CCP4PARSERARRAY *parsePtr, const double max_exponent,
179
194
                              const double min_exponent);
180
195
int ccp4_parse_reset(CCP4PARSERARRAY *parsePtr);
 
196
 
181
197
int ccp4_parse(const char *line, CCP4PARSERARRAY *parser);
 
198
 
 
199
/** The main function for parsing lines, either supplied or read
 
200
 * from stdin.
 
201
 * @param line pointer to a null-terminated string of characters,
 
202
 * forming the input to be processed. On input can either be an empty 
 
203
 * string ("") which forces reading from stdin, or contain characters 
 
204
 * to be processed. On output "line" will be overwritten with the actual
 
205
 * input line.
 
206
 * @param n maximum number of characters that can be read into
 
207
 * "line" i.e. the size of "line" in memory.
 
208
 * @param parser pointer to a CCP4PARSERARRAY structure which will
 
209
 * be used to hold the results of processing the input line.
 
210
 * @param print flag controlling echoing of input lines to stdout.
 
211
 * print=0: suppress echoing of lines to stdout. Otherwise echoing is 
 
212
 * turned on.
 
213
 * @return Number of tokens found.
 
214
 */
182
215
int ccp4_parser(char *line, const int n, CCP4PARSERARRAY *parser,
183
216
                        const int print);
184
217
 
185
218
/* External utility functions */
186
219
 
 
220
/** Test whether two keywords are identical. Keywords are identical if 
 
221
 * they are the same up to the first four characters, independent of case.
 
222
 * @param keyin1 keyword 1.
 
223
 * @param keyin2 keyword 2.
 
224
 * @return 1 if keywords keyin1 and keyin2 are "identical", 0 otherwise.
 
225
 */
187
226
int ccp4_keymatch(const char *keyin1, const char *keyin2);
188
227
 
189
228
/* Internal utility functions */
190
229
 
 
230
/** Convert string to uppercase.
 
231
 * @param str1 On exit str1 will contain uppercased copy of str2
 
232
 * @param str2 Input string
 
233
 * @return str1
 
234
 */
191
235
char *strtoupper (char *str1, const char *str2);
 
236
 
192
237
char *strtolower (char *str1, const char *str2);
 
238
 
193
239
int strmatch (const char *str1, const char *str2);
 
240
 
194
241
int charmatch(const char character, const char *charlist);
 
242
 
195
243
int doublefromstr(const char *str, const double max_exp, const double min_exp,
196
244
                          double *valuePtr, double *intvaluePtr, int *intdigitsPtr,
197
245
                          double *frcvaluePtr, int *frcdigitsPtr,
198
246
                          double *expvaluePtr, int *expdigitsPtr);
199
247
 
 
248
/** Convert symmetry operator as string to ccp4_symop struct.
 
249
 * @param symchs_begin pointer to beginning of string
 
250
 * @param symchs_end pointer to end of string (i.e. last character
 
251
 *   is *(symchs_end-1) )
 
252
 * @return pointer to ccp4_symop struct
 
253
 */
200
254
ccp4_symop symop_to_rotandtrn(const char *symchs_begin, const char *symchs_end);
 
255
 
 
256
/** Convert symmetry operator as string to matrix.
 
257
 * This is Charles' version of symfr. Note that translations
 
258
 * are held in elements [*][3] and [3][3] is set to 1.0
 
259
 * @param symchs_begin pointer to beginning of string
 
260
 * @param symchs_end pointer to end of string (i.e. last character
 
261
 *   is *(symchs_end-1) )
 
262
 * @param rot 4 x 4 matrix operator
 
263
 * @return  NULL on error, final position pointer on success
 
264
 */
201
265
const char * symop_to_mat4(const char *symchs_begin, const char *symchs_end, float *rot);
202
 
static int symop_to_mat4_err(const char *symop);
 
266
 
 
267
static 
 
268
int symop_to_mat4_err(const char *symop);
 
269
 
203
270
ccp4_symop mat4_to_rotandtrn(const float rsm[4][4]);
 
271
 
 
272
/* This is Charles' version of symtr */
204
273
char *rotandtrn_to_symop(char *symchs_begin, char *symchs_end, const ccp4_symop symop);
 
274
 
205
275
void rotandtrn_to_mat4(float rsm[4][4], const ccp4_symop symop);
 
276
 
 
277
/** Convert symmetry operator as matrix to string.
 
278
 * This is Charles' version of symtr. Note that translations
 
279
 * are held in elements [*][3] and [3][3] is set to 1.0
 
280
 * @param symchs_begin pointer to beginning of string
 
281
 * @param symchs_end pointer to end of string (i.e. last character
 
282
 *   is *(symchs_end-1) )
 
283
 * @param rsm 4 x 4 matrix operator
 
284
 * @return pointer to beginning of string
 
285
 */
206
286
char *mat4_to_symop(char *symchs_begin, char *symchs_end, const float rsm[4][4]);
 
287
 
 
288
/** Convert symmetry operator as matrix to string in reciprocal space notation.
 
289
 * This is Charles' version of symtr. Note that translations
 
290
 * are held in elements [*][3] and [3][3] is set to 1.0
 
291
 * @param symchs_begin pointer to beginning of string
 
292
 * @param symchs_end pointer to end of string (i.e. last character
 
293
 *   is *(symchs_end-1) )
 
294
 * @param rsm 4 x 4 matrix operator
 
295
 * @return pointer to beginning of string
 
296
 */
207
297
char *mat4_to_recip_symop(char *symchs_begin, char *symchs_end, const float rsm[4][4]);
208
298
 
209
299
#ifdef __cplusplus