Fortran API to ccp4_parser.c. More...
#include "ccp4_sysdep.h"
#include "ccp4_fortran.h"
#include "ccp4_parser.h"
#include "ccp4_general.h"
Defines | |
#define | PARSER_DEBUG(x) |
Functions | |
int | fparse_isblank (const char *line, const int line_len) |
int | fparse_strncpypad (char *fstr, const char *cstr, const int lfstr) |
int | fparse_populate_arrays (CCP4PARSERARRAY *parser, int *ibeg, int *iend, int *ityp, float *fvalue, fpstr cvalue, int cvalue_len, int *idec) |
int | fparse_delimiters (CCP4PARSERARRAY *parser, char *new_delimiters, char *new_nulldelimiters) |
FORTRAN_SUBR (PARSER, parser,(fpstr key, fpstr line, int *ibeg, int *iend, int *ityp, float *fvalue, fpstr cvalue, int *idec, int *ntok, ftn_logical *lend, const ftn_logical *print, int key_len, int line_len, int cvalue_len),(fpstr key, fpstr line, int *ibeg, int *iend, int *ityp, float *fvalue, fpstr cvalue, int *idec, int *ntok, ftn_logical *lend, const ftn_logical *print),(fpstr key, int key_len, fpstr line, int line_len, int *ibeg, int *iend, int *ityp, float *fvalue, fpstr cvalue, int cvalue_len, int *idec, int *ntok, ftn_logical *lend, const ftn_logical *print)) | |
FORTRAN_SUBR (PARSE, parse,(fpstr line, int *ibeg, int *iend, int *ityp, float *fvalue, fpstr cvalue, int *idec, int *n, int line_len, int cvalue_len),(fpstr line, int *ibeg, int *iend, int *ityp, float *fvalue, fpstr cvalue, int *idec, int *n),(fpstr line, int line_len, int *ibeg, int *iend, int *ityp, float *fvalue, fpstr cvalue, int cvalue_len, int *idec, int *n)) | |
FORTRAN_SUBR (PARSDL, parsdl,(fpstr newdlm, int *nnewdl, int *nspecd, int newdlm_len),(fpstr newdlm, int *nnewdl, int *nspecd),(fpstr newdlm, int newdlm_len, int *nnewdl, int *nspecd)) |
Fortran API to ccp4_parser.c.
This file contains Fortran API functions which provide the following functionality originally found in the parser.f file:
plus internal utility functions which should not be accessed directly from an application.
FORTRAN_SUBR | ( | PARSDL | , | |
parsdl | , | |||
(fpstr newdlm, int *nnewdl, int *nspecd, int newdlm_len) | , | |||
(fpstr newdlm, int *nnewdl, int *nspecd) | , | |||
(fpstr newdlm, int newdlm_len, int *nnewdl, int *nspecd) | ||||
) |
Set delimiters for PARSE, PARSER
SUBROUTINE PARSDL(NEWDLM,NNEWDL,NSPECD)
References ccperror(), and fparse_delimiters().
FORTRAN_SUBR | ( | PARSE | , | |
parse | , | |||
(fpstr line, int *ibeg, int *iend, int *ityp, float *fvalue,fpstr cvalue, int *idec, int *n, int line_len, int cvalue_len) | , | |||
(fpstr line, int *ibeg, int *iend, int *ityp, float *fvalue,fpstr cvalue, int *idec, int *n) | , | |||
(fpstr line, int line_len, int *ibeg, int *iend,int *ityp, float *fvalue, fpstr cvalue, int cvalue_len, int *idec,int *n) | ||||
) |
This function implements the Fortran equivalent of:
SUBROUTINE PARSE(LINE,IBEG,IEND,ITYP,FVALUE,CVALUE,IDEC,N)
References ccp4_FtoCString(), ccp4_parse(), ccp4_parse_end(), ccp4_parse_start(), fparse_delimiters(), and fparse_populate_arrays().
FORTRAN_SUBR | ( | PARSER | , | |
parser | , | |||
(fpstr key, fpstr line, int *ibeg, int *iend, int *ityp, float *fvalue,fpstr cvalue, int *idec, int *ntok, ftn_logical *lend,const ftn_logical *print, int key_len, int line_len, int cvalue_len) | , | |||
(fpstr key, fpstr line, int *ibeg, int *iend, int *ityp, float *fvalue,fpstr cvalue, int *idec, int *ntok, ftn_logical *lend,const ftn_logical *print) | , | |||
(fpstr key, int key_len, fpstr line, int line_len, int *ibeg, int *iend,int *ityp, float *fvalue, fpstr cvalue, int cvalue_len, int *idec,int *ntok, ftn_logical *lend, const ftn_logical *print) | ||||
) |
This function implements the Fortran equivalent of:
SUBROUTINE PARSER(KEY,LINE,IBEG,IEND,ITYP,FVALUE,CVALUE,IDEC,NTOK,LEND,PRINT)
which is the original CCP4 keyword parser. The function wraps the ccp4_parser routines to mimic the behaviour of the original subroutine.
References ccp4_CtoFString(), ccp4_parse_end(), ccp4_parse_maxmin(), ccp4_parse_start(), ccp4_parser(), ccp4_utils_flength(), ccp4_utils_malloc(), CCP4PARSERARRAY::fp, fparse_delimiters(), fparse_populate_arrays(), and CCP4PARSERARRAY::keyword.
int fparse_delimiters | ( | CCP4PARSERARRAY * | parser, | |
char * | new_delimiters, | |||
char * | new_nulldelimiters | |||
) |
Set and get delimiters for use in ccp4_parse(r). This should only be called internally (from PARSDL).
If called with parser set to NULL, the lists of characters in new_delimiters and new_nulldelimiters are stored.
When called with a valid pointer to a parser structure, the stored lists of characters form the new delimiter sets via a call to ccp4_parse_delimiters.
NB: if delimiter strings are set with a call to fparse_delimiters then they persist in memory unless a subsequent call is made with all arguments set to NULL. This represents a potential memory leak.
References ccp4_parse_delimiters(), ccperror(), CCP4PARSERARRAY::delim, and CCP4PARSERARRAY::nulldelim.
Referenced by FORTRAN_SUBR().
int fparse_isblank | ( | const char * | line, | |
const int | line_len | |||
) |
Given a string and its length, returns 1 if the only characters are whitespace or newlines, and 0 if there are other characters.
References charmatch().
int fparse_populate_arrays | ( | CCP4PARSERARRAY * | parser, | |
int * | ibeg, | |||
int * | iend, | |||
int * | ityp, | |||
float * | fvalue, | |||
fpstr | cvalue, | |||
int | cvalue_len, | |||
int * | idec | |||
) |
Given a pointer to a CCP4PARSERARRAY, will populate the equivalent arrays supplied by the Fortran application.
Should only be called from PARSER or PARSE.
References fparse_strncpypad(), CCP4PARSERTOKEN::iend, CCP4PARSERTOKEN::intdigits, CCP4PARSERARRAY::ntokens, CCP4PARSERTOKEN::strlength, and CCP4PARSERARRAY::token.
Referenced by FORTRAN_SUBR().
int fparse_strncpypad | ( | char * | fstr, | |
const char * | cstr, | |||
const int | lfstr | |||
) |
Copy lfstr characters from C-style string cstr into Fortran-style string fstr. lfstr is the maximum length of the Fortran-style string.
If cstr contains fewer characters than lfstr then fstr is padded with spaces. Note that fstr will not contain an end-of-string null character, so printf using s may also show trailing garbage.
Referenced by fparse_populate_arrays().