gpp4
1.3.1
|
00001 /* 00002 ccp4_parser.h: Headers for functions to read in and "parse" CCP4 00003 keyworded input. 00004 Copyright (C) 2001 CCLRC, Peter Briggs 00005 00006 This library is free software: you can redistribute it and/or 00007 modify it under the terms of the GNU Lesser General Public 00008 License as published by the Free Software Foundation, either 00009 version 3 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Lesser General Public License for more details. 00015 00016 You should have received a copy of the GNU Lesser General Public 00017 License along with This library. If not, see 00018 <http://www.gnu.org/licenses/>. 00019 00020 */ 00021 00093 /* Macro definitions */ 00094 00095 00096 #ifndef __CCP4_Parser__ 00097 #define __CCP4_Parser__ 00098 00099 00100 /* note order: these must be outside CCP4 namespace */ 00101 #include <stdio.h> 00102 #include"ccp4_utils.h" 00103 #include"ccp4_spg.h" 00104 00105 /* Macro to make C functions callable from C++ */ 00106 #ifdef __cplusplus 00107 namespace CCP4 { 00108 extern "C" { 00109 typedef CSym::ccp4_symop ccp4_symop; 00110 #endif 00111 00112 00113 /* Parser String Sizes */ 00114 00115 #define CCP4_PARSER_MAXLINELENGTH 200 00116 #define CCP4_PARSER_MAXFILENAMELENGTH 200 00119 /* Structures and typedefs */ 00120 00121 00127 typedef struct { 00128 char *fullstring; 00129 char word[5]; 00130 double value; 00131 int isstring; 00132 int strlength; 00133 int isnumber; 00134 int intdigits; 00136 int frcdigits; 00138 int isquoted; 00139 int isnull; 00140 int ibeg; 00141 int iend; 00142 } CCP4PARSERTOKEN; 00149 typedef struct { 00150 /* "Public" members */ 00151 char keyword[5]; 00152 int ntokens; 00153 CCP4PARSERTOKEN *token; 00154 /* "Private" members */ 00155 FILE *fp; 00156 int maxtokens; 00157 char *delim; 00158 char *nulldelim; 00159 char *comment; 00160 double max_exponent; 00161 double min_exponent; 00162 } CCP4PARSERARRAY; 00165 /* Function Prototypes */ 00166 00167 00168 /* Core cparser functions */ 00169 00176 CCP4PARSERARRAY* ccp4_parse_start(const int maxtokens); 00177 00183 int ccp4_parse_end(CCP4PARSERARRAY *parsePtr); 00184 00185 int ccp4_parse_init_token(const CCP4PARSERARRAY *parsePtr, const int itok); 00186 00187 int ccp4_parse_delimiters(CCP4PARSERARRAY *parsePtr, const char *delim, 00188 const char *nulldelim); 00189 int ccp4_parse_comments(CCP4PARSERARRAY *parsePtr, const char *comment_chars); 00190 00191 int ccp4_parse_maxmin(CCP4PARSERARRAY *parsePtr, const double max_exponent, 00192 const double min_exponent); 00193 int ccp4_parse_reset(CCP4PARSERARRAY *parsePtr); 00194 00195 int ccp4_parse(const char *line, CCP4PARSERARRAY *parser); 00196 00213 int ccp4_parser(char *line, const int n, CCP4PARSERARRAY *parser, 00214 const int print); 00215 00216 /* External utility functions */ 00217 00224 int ccp4_keymatch(const char *keyin1, const char *keyin2); 00225 00226 /* Internal utility functions */ 00227 00233 char *strtoupper (char *str1, const char *str2); 00234 00235 char *strtolower (char *str1, const char *str2); 00236 00237 int strmatch (const char *str1, const char *str2); 00238 00239 int charmatch(const char character, const char *charlist); 00240 00241 int doublefromstr(const char *str, const double max_exp, const double min_exp, 00242 double *valuePtr, double *intvaluePtr, int *intdigitsPtr, 00243 double *frcvaluePtr, int *frcdigitsPtr, 00244 double *expvaluePtr, int *expdigitsPtr); 00245 00252 ccp4_symop symop_to_rotandtrn(const char *symchs_begin, const char *symchs_end); 00253 00263 const char * symop_to_mat4(const char *symchs_begin, const char *symchs_end, float *rot); 00264 00265 /* 00266 int symop_to_mat4_err(const char *symop); 00267 */ 00268 00269 ccp4_symop mat4_to_rotandtrn(const float rsm[4][4]); 00270 00271 /* This is Charles' version of symtr */ 00272 char *rotandtrn_to_symop(char *symchs_begin, char *symchs_end, const ccp4_symop symop); 00273 00274 void rotandtrn_to_mat4(float rsm[4][4], const ccp4_symop symop); 00275 00285 char *mat4_to_symop(char *symchs_begin, char *symchs_end, const float rsm[4][4]); 00286 00296 char *mat4_to_recip_symop(char *symchs_begin, char *symchs_end, const float rsm[4][4]); 00297 00298 #ifdef __cplusplus 00299 } 00300 } 00301 #endif 00302 00303 #endif /* __CCP4_Parser__ */ 00304 00305 /* 00306 Local variables: 00307 mode: font-lock 00308 End: 00309 */