Refactor handling of relocatable installs
[survex.git] / src / datain.h
blobf0c19dea6152d05db209c3cae6d01a779ea4a363
1 /* datain.h
2 * Header file for code that...
3 * Reads in survey files, dealing with special characters, keywords & data
4 * Copyright (C) 1994-2002,2005,2010,2012,2014 Olly Betts
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifdef HAVE_SETJMP_H
22 # include <setjmp.h>
23 #endif
25 #include <stdio.h> /* for FILE */
27 typedef struct parse {
28 FILE *fh;
29 const char *filename;
30 unsigned int line;
31 long lpos;
32 bool reported_where;
33 struct parse *parent;
34 #ifdef HAVE_SETJMP_H
35 jmp_buf jbSkipLine;
36 #endif
37 } parse;
39 extern int ch;
40 extern parse file;
41 extern bool f_export_ok;
43 #define nextch() (ch = GETC(file.fh))
45 typedef struct {
46 long offset;
47 int ch;
48 } filepos;
50 void get_pos(filepos *fp);
51 void set_pos(const filepos *fp);
53 void skipblanks(void);
55 /* reads complete data file */
56 void data_file(const char *pth, const char *fnm);
58 void skipline(void);
60 #define DIAG_SEVERITY_MASK 0x03
61 #define DIAG_COL 0x04
62 #define DIAG_SKIP 0x08
63 #define DIAG_BUF 0x10
64 #define DIAG_TOKEN 0x20
65 #define DIAG_UINT 0x40
66 #define DIAG_DATE 0x80
67 #define DIAG_NUM 0x100
69 #define DIAG_WARN 0x00
70 #define DIAG_ERR 0x01
72 void compile_diagnostic(int flags, int en, ...);
74 void compile_diagnostic_at(int flags, const char * file, unsigned line, int en, ...);
75 void compile_diagnostic_pfx(int flags, const prefix * pfx, int en, ...);
77 void compile_diagnostic_token_show(int flags, int en);
78 void compile_diagnostic_buffer(int flags, int en, ...);