00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00095
00096
00097
00098 #ifndef __CCP4_Parser__
00099 #define __CCP4_Parser__
00100
00101
00102
00103 #include <stdio.h>
00104 #include"ccp4_utils.h"
00105 #include"ccp4_spg.h"
00106
00107
00108 #ifdef __cplusplus
00109 namespace CCP4 {
00110 extern "C" {
00111 typedef CSym::ccp4_symop ccp4_symop;
00112 #endif
00113
00114
00115
00116
00117 #define CCP4_PARSER_MAXLINELENGTH 200
00118 #define CCP4_PARSER_MAXFILENAMELENGTH 200
00121
00122
00123
00129 typedef struct {
00130 char *fullstring;
00131 char word[5];
00132 double value;
00133 int isstring;
00134 int strlength;
00135 int isnumber;
00136 int intdigits;
00138 int frcdigits;
00140 int isquoted;
00141 int isnull;
00142 int ibeg;
00143 int iend;
00144 } CCP4PARSERTOKEN;
00151 typedef struct {
00152
00153 char keyword[5];
00154 int ntokens;
00155 CCP4PARSERTOKEN *token;
00156
00157 FILE *fp;
00158 int maxtokens;
00159 char *delim;
00160 char *nulldelim;
00161 char *comment;
00162 double max_exponent;
00163 double min_exponent;
00164 } CCP4PARSERARRAY;
00167
00168
00169
00170
00171
00172 CCP4PARSERARRAY* ccp4_parse_start(const int maxtokens);
00173 int ccp4_parse_end(CCP4PARSERARRAY *parsePtr);
00174 int ccp4_parse_init_token(const CCP4PARSERARRAY *parsePtr, const int itok);
00175 int ccp4_parse_delimiters(CCP4PARSERARRAY *parsePtr, const char *delim,
00176 const char *nulldelim);
00177 int ccp4_parse_comments(CCP4PARSERARRAY *parsePtr, const char *comment_chars);
00178 int ccp4_parse_maxmin(CCP4PARSERARRAY *parsePtr, const double max_exponent,
00179 const double min_exponent);
00180 int ccp4_parse_reset(CCP4PARSERARRAY *parsePtr);
00181 int ccp4_parse(const char *line, CCP4PARSERARRAY *parser);
00182 int ccp4_parser(char *line, const int n, CCP4PARSERARRAY *parser,
00183 const int print);
00184
00185
00186
00187 int ccp4_keymatch(const char *keyin1, const char *keyin2);
00188
00189
00190
00191 char *strtoupper (char *str1, const char *str2);
00192 char *strtolower (char *str1, const char *str2);
00193 int strmatch (const char *str1, const char *str2);
00194 int charmatch(const char character, const char *charlist);
00195 int doublefromstr(const char *str, const double max_exp, const double min_exp,
00196 double *valuePtr, double *intvaluePtr, int *intdigitsPtr,
00197 double *frcvaluePtr, int *frcdigitsPtr,
00198 double *expvaluePtr, int *expdigitsPtr);
00199
00200 ccp4_symop symop_to_rotandtrn(const char *symchs_begin, const char *symchs_end);
00201 const char * symop_to_mat4(const char *symchs_begin, const char *symchs_end, float *rot);
00202 static int symop_to_mat4_err(const char *symop);
00203 ccp4_symop mat4_to_rotandtrn(const float rsm[4][4]);
00204 char *rotandtrn_to_symop(char *symchs_begin, char *symchs_end, const ccp4_symop symop);
00205 void rotandtrn_to_mat4(float rsm[4][4], const ccp4_symop symop);
00206 char *mat4_to_symop(char *symchs_begin, char *symchs_end, const float rsm[4][4]);
00207 char *mat4_to_recip_symop(char *symchs_begin, char *symchs_end, const float rsm[4][4]);
00208
00209 #ifdef __cplusplus
00210 }
00211 }
00212 #endif
00213
00214 #endif
00215
00216
00217
00218
00219
00220