diff options
| author | Wiimm <wiimm@wiimm.de> | 2022-07-09 11:48:24 +0200 |
|---|---|---|
| committer | Wiimm <wiimm@wiimm.de> | 2022-07-09 11:48:24 +0200 |
| commit | 06ff18cd020779c226f7c25d22016e06b898f303 (patch) | |
| tree | b5c12ca4c6b9b0c86e63d2b6a965b8bd74dd0d86 /project/dclib/dclib-parser.h | |
| parent | f30e94a61fdc9fb13fd1fbd8b75502fedf5a2f71 (diff) | |
SZS v2.28a.beta
Diffstat (limited to 'project/dclib/dclib-parser.h')
| -rw-r--r-- | project/dclib/dclib-parser.h | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/project/dclib/dclib-parser.h b/project/dclib/dclib-parser.h new file mode 100644 index 0000000..b7fa301 --- /dev/null +++ b/project/dclib/dclib-parser.h @@ -0,0 +1,89 @@ + +/*************************************************************************** + * * + * _____ ____ * + * | __ \ / __ \ _ _ _____ * + * | | \ \ / / \_\ | | | | _ \ * + * | | \ \| | | | | | |_| | * + * | | | || | | | | | ___/ * + * | | / /| | __ | | | | _ \ * + * | |__/ / \ \__/ / | |___| | |_| | * + * |_____/ \____/ |_____|_|_____/ * + * * + * Wiimms source code library * + * * + *************************************************************************** + * * + * Copyright (c) 2012-2022 by Dirk Clemens <wiimm@wiimm.de> * + * * + *************************************************************************** + * * + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * See file gpl-2.0.txt or http://www.gnu.org/licenses/gpl-2.0.txt * + * * + ***************************************************************************/ + +#ifndef DCLIB_PARSER_H +#define DCLIB_PARSER_H 1 + +#include "dclib-types.h" + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// ScanText_t /////////////// +/////////////////////////////////////////////////////////////////////////////// +// [[ScanText_t]] + +typedef struct ScanText_t +{ + //-- base data + + ccp data; // begin of text + uint data_size; // total size of text + + ccp fname; // NULL or filename for messages + bool fname_alloced; // true: call FreeString(fname) + + //-- options + + bool ignore_comments; // true: ignore lines with leading '#' + int detect_sections; // >0: detect lines of format '[...]' + + //-- current statee + + ccp ptr; // current text position + ccp eot; // end of text + ccp line; // current line + ccp eol; // end of current line + + bool is_eot; // end of text reached + bool is_section; // new section reached + bool is_term; // := is_eot || is_section +} +ScanText_t; + +/////////////////////////////////////////////////////////////////////////////// + +void SetupScanText ( ScanText_t *st, cvp data, uint data_size ); +void ResetScanText ( ScanText_t *st ); +void SetFilenameScanText( ScanText_t *st, ccp fname, CopyMode_t cm ); + +void RewindScanText ( ScanText_t *st ); +bool NextLineScanText ( ScanText_t *st ); + +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// E N D /////////////// +/////////////////////////////////////////////////////////////////////////////// + +#endif // DCLIB_PARSER_H + |
