• Main Page
  • Related Pages
  • Classes
  • Files
  • File List
  • File Members

src/ccp4_parser.h

Go to the documentation of this file.
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 2.1 of the License, or (at your option) any later
00010      version.
00011 
00012      This library is distributed in the hope that it will be useful,
00013      but WITHOUT ANY WARRANTY; without even the implied warranty of
00014      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015      Lesser General Public License for more details.
00016 
00017      You should have received a copy of the GNU Lesser General Public
00018      License along with this library; if not, write to the Free
00019      Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020      Boston, MA 02110-1301 USA
00021 
00022 */
00023 
00095 /* Macro definitions */
00096 
00097 
00098 #ifndef __CCP4_Parser__
00099 #define __CCP4_Parser__
00100 
00101 
00102 /* note order: these must be outside CCP4 namespace */
00103 #include <stdio.h>
00104 #include"ccp4_utils.h"
00105 #include"ccp4_spg.h"
00106 
00107 /* Macro to make C functions callable from C++ */
00108 #ifdef  __cplusplus
00109 namespace CCP4 {
00110 extern "C" {
00111 typedef CSym::ccp4_symop ccp4_symop;
00112 #endif
00113 
00114 
00115 /* Parser String Sizes */
00116 
00117 #define CCP4_PARSER_MAXLINELENGTH     200  
00118 #define CCP4_PARSER_MAXFILENAMELENGTH 200  
00121 /* Structures and typedefs */
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   /* "Public" members */
00153   char   keyword[5];      
00154   int    ntokens;         
00155   CCP4PARSERTOKEN *token; 
00156   /* "Private" members */
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 /* Function Prototypes */
00168 
00169 
00170 /* Core cparser functions */
00171 
00178 CCP4PARSERARRAY* ccp4_parse_start(const int maxtokens);
00179 
00185 int ccp4_parse_end(CCP4PARSERARRAY *parsePtr);
00186 
00187 int ccp4_parse_init_token(const CCP4PARSERARRAY *parsePtr, const int itok);
00188 
00189 int ccp4_parse_delimiters(CCP4PARSERARRAY *parsePtr, const char *delim,
00190                                   const char *nulldelim);
00191 int ccp4_parse_comments(CCP4PARSERARRAY *parsePtr, const char *comment_chars);
00192 
00193 int ccp4_parse_maxmin(CCP4PARSERARRAY *parsePtr, const double max_exponent,
00194                               const double min_exponent);
00195 int ccp4_parse_reset(CCP4PARSERARRAY *parsePtr);
00196 
00197 int ccp4_parse(const char *line, CCP4PARSERARRAY *parser);
00198 
00215 int ccp4_parser(char *line, const int n, CCP4PARSERARRAY *parser,
00216                         const int print);
00217 
00218 /* External utility functions */
00219 
00226 int ccp4_keymatch(const char *keyin1, const char *keyin2);
00227 
00228 /* Internal utility functions */
00229 
00235 char *strtoupper (char *str1, const char *str2);
00236 
00237 char *strtolower (char *str1, const char *str2);
00238 
00239 int strmatch (const char *str1, const char *str2);
00240 
00241 int charmatch(const char character, const char *charlist);
00242 
00243 int doublefromstr(const char *str, const double max_exp, const double min_exp,
00244                           double *valuePtr, double *intvaluePtr, int *intdigitsPtr,
00245                           double *frcvaluePtr, int *frcdigitsPtr,
00246                           double *expvaluePtr, int *expdigitsPtr);
00247 
00254 ccp4_symop symop_to_rotandtrn(const char *symchs_begin, const char *symchs_end);
00255 
00265 const char * symop_to_mat4(const char *symchs_begin, const char *symchs_end, float *rot);
00266 
00267   /*
00268 int symop_to_mat4_err(const char *symop);
00269   */
00270 
00271 ccp4_symop mat4_to_rotandtrn(const float rsm[4][4]);
00272 
00273 /* This is Charles' version of symtr */
00274 char *rotandtrn_to_symop(char *symchs_begin, char *symchs_end, const ccp4_symop symop);
00275 
00276 void rotandtrn_to_mat4(float rsm[4][4], const ccp4_symop symop);
00277 
00287 char *mat4_to_symop(char *symchs_begin, char *symchs_end, const float rsm[4][4]);
00288 
00298 char *mat4_to_recip_symop(char *symchs_begin, char *symchs_end, const float rsm[4][4]);
00299 
00300 #ifdef __cplusplus
00301 }
00302 }
00303 #endif
00304 
00305 #endif  /* __CCP4_Parser__ */
00306 
00307 /*
00308   Local variables:
00309   mode: font-lock
00310   End:
00311 */

Generated on Mon Jan 10 2011 for gpp4 by  doxygen 1.7.1