CParser library

File list

Overview

These functions do CCP4-style parsing, as used for processing keywords of CCP4 programs, MTZ header records, etc.

Usage

The following code snippets illustrate how the functions might be used to read from stdin:

int           ntok=0;
char          line[201],*key;
CCP4PARSERTOKEN * token=NULL;
CCP4PARSERARRAY * parser;

  parser = (CCP4PARSERARRAY *) ccp4_parse_start(20);
  key   = parser->keyword;
  token = parser->token;

  RC   = 0;
  while (!RC) {

    line[0] = '\0';
    ntok = ccp4_parser(line,200,parser,1);

    if (ntok < 1) {

      RC = 111;

    } else {      

      if (ccp4_keymatch("MINDIST",key))  {
        if (ntok != 2) {
          ccperror ( 1,"MINDIST requires a single numerical argument" );
          RC = -100;
        } else {
          minDist = token[1].value;
        }
      } else  {
        printf ( "Unrecognised keyword \"%s\"\n",token[0].fullstring );
        RC = -118;
      }
    }
  }

  ccp4_parse_end ( parser );

Examples

See the distributed programs NCONT and PDBCUR.

Generated on Wed Oct 29 21:05:09 2008 for gpp4 by  doxygen 1.5.6