#ifndef nget_H #define nget_H /* Parsing of named parameters, in the format "NAME = VALUE". */ /* Last edited on 2005-01-16 15:01:06 by stolfi */ /* Copyright © 2005 Jorge Stolfi, UNICAMP. See note at end of file. */ /* These procedure are alternatives to {fscanf}, specialized for parsing named parameters, in the format {NAME = VALUE}, where {NAME} is a given string. All procedures below will skip spaces (SPACE, TAB, NUL), but not line or page breaks, before each token. They will abort with assertion failure if the input does not conform to the expected format. Created by J. Stolfi, Dec/2002, from Modula-3 version ca. 1995. */ #include #include void nget_name_eq(FILE *f, char *name); /* Matches the {name} and an "=". The {name} must not contain any blanks. */ char nget_char(FILE *f, char *name); bool nget_bool(FILE *f, char *name); int nget_int(FILE *f, char *name); double nget_double(FILE *f, char *name); char *nget_string(FILE *f, char *name); /* These procedures parse a {NAME = VALUE} pair. The syntax of the {VALUE} token is the same as in the corresponding {fget} procedures. */ #endif /* COPYRIGHT AND AUTHORSHIP NOTICE Copyright © 2005 Jorge Stolfi, Universidade Estadual de Campinas (UNICAMP). Created by Jorge Stolfi in 1992--2005. This source file can be freely distributed, used, and modified, provided that this copyright and authorship notice is preserved in all copies, and that any modified versions of this file are clearly marked as such. This software has NO WARRANTY of correctness or applicability for any purpose. Neither the author nor his employers shall be held responsible for any losses or damages that may result from its use. END OF NOTICE */