Debian Codegraph @

contrib/ms-sbvar/utilities_dw/include/dw_ascii.h

raw
1 /*
2 * Copyright (C) 1996-2011 Daniel Waggoner
3 *
4 * This free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * It is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * If you did not received a copy of the GNU General Public License
15 * with this software, see <http://www.gnu.org/licenses/>.
16 */
17
18 #ifndef __DW_ASCII_ROUTINES__
19 #define __DW_ASCII_ROUTINES__
20
21 #include <stdio.h>
22 #include "prcsn.h"
23
24 #ifdef __cplusplus
25 extern "C"
26 {
27 #endif
28
29 // Flag codes. See ParseDelimitedString() for explanation.
30 #define REMOVE_EMPTY_FIELDS 0x00000001
31 #define ALLOW_QUOTED_TEXT 0x00000002
32 #define STRIP_LEADING_WHITESPACE 0x00000004
33 #define STRIP_TRAILING_WHITESPACE 0x00000008
34 #define STRIP_WHITESPACE 0x0000000c
35
36 FILE *dw_OpenTextFile(char *filename);
37 FILE *dw_CreateTextFile(char *filename);
38 FILE *dw_AppendTextFile(char *filename);
39
40 int dw_SetFilePosition(FILE *f, char *id);
41 int dw_SetFilePositionNoRewind(FILE *f, char *id);
42 //int dw_SetFilePositionBySection(FILE *f, int n, ...);
43
44 int dw_NumberLines(FILE *f, char* filename);
45 char* dw_ReadLine(FILE *f, char *buffer, int *n);
46 void dw_NextLine(FILE *f, int n);
47 char** dw_ParseDelimitedString(char *buffer, char delimiter, int flag);
48 char** dw_ReadDelimitedLine(FILE *f, char delimiter, int flag);
49 char*** dw_ReadDelimitedFile(FILE *f, char* filename, char delimiter, int flag);
50 int dw_PrintDelimitedArray(FILE *f, void* array, char delimiter);
51
52 PRECISION* dw_ReadDelimitedLine_floating(FILE *f, char delimiter, int flag, PRECISION invalid_identifier);
53 PRECISION** dw_ReadDelimitedFile_floating(FILE *f, char* filename, char delimiter, int flag, PRECISION invalid_identifier);
54
55 //int dw_ReadDelimitedField(FILE *f, char **buffer, int *n);
56 //int dw_ReadDelimitedField(FILE *f, int delimiter, int terminal, int flag, char **buffer, int *n);
57
58 char* dw_DuplicateString(char *buffer);
59
60 #ifdef __cplusplus
61 }
62 #endif
63
64 #endif