| [b0d908e] | 1 | /* datain.h |
|---|
| [d1b1380] | 2 | * Header file for code that... |
|---|
| 3 | * Reads in survey files, dealing with special characters, keywords & data |
|---|
| [93e3492] | 4 | * Copyright (C) 1994-2002,2005,2010,2012,2014 Olly Betts |
|---|
| [846746e] | 5 | * |
|---|
| [89231c4] | 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. |
|---|
| [846746e] | 10 | * |
|---|
| 11 | * This program is distributed in the hope that it will be useful, |
|---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| [89231c4] | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | * GNU General Public License for more details. |
|---|
| [846746e] | 15 | * |
|---|
| [89231c4] | 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 |
|---|
| [ecbc6c18] | 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|---|
| [d1b1380] | 19 | */ |
|---|
| 20 | |
|---|
| [7d5f3c0] | 21 | #ifdef HAVE_SETJMP_H |
|---|
| [647407d] | 22 | # include <setjmp.h> |
|---|
| [d1b1380] | 23 | #endif |
|---|
| 24 | |
|---|
| [a420b49] | 25 | #include <stdio.h> /* for FILE */ |
|---|
| 26 | |
|---|
| 27 | typedef struct parse { |
|---|
| [58cc1fb] | 28 | FILE *fh; |
|---|
| [a63fb408] | 29 | const char *filename; |
|---|
| [a420b49] | 30 | unsigned int line; |
|---|
| [da96015] | 31 | long lpos; |
|---|
| [b0d908e] | 32 | bool reported_where; |
|---|
| [421b7d2] | 33 | struct parse *parent; |
|---|
| [7d5f3c0] | 34 | #ifdef HAVE_SETJMP_H |
|---|
| [58cc1fb] | 35 | jmp_buf jbSkipLine; |
|---|
| [d1b1380] | 36 | #endif |
|---|
| 37 | } parse; |
|---|
| [58cc1fb] | 38 | |
|---|
| 39 | extern int ch; |
|---|
| [d1b1380] | 40 | extern parse file; |
|---|
| [932f7e9] | 41 | extern bool f_export_ok; |
|---|
| [d1b1380] | 42 | |
|---|
| [e02a6a6] | 43 | #define nextch() (ch = GETC(file.fh)) |
|---|
| [c80bd34] | 44 | |
|---|
| 45 | typedef struct { |
|---|
| 46 | long offset; |
|---|
| 47 | int ch; |
|---|
| 48 | } filepos; |
|---|
| 49 | |
|---|
| 50 | void get_pos(filepos *fp); |
|---|
| 51 | void set_pos(const filepos *fp); |
|---|
| [d1b1380] | 52 | |
|---|
| [a9f5117] | 53 | void skipblanks(void); |
|---|
| [d1b1380] | 54 | |
|---|
| [3a54fd29] | 55 | /* reads complete data file */ |
|---|
| [a9f5117] | 56 | void data_file(const char *pth, const char *fnm); |
|---|
| [3a54fd29] | 57 | |
|---|
| [a9f5117] | 58 | void skipline(void); |
|---|
| [d1b1380] | 59 | |
|---|
| [a420b49] | 60 | void compile_warning(int en, ...); |
|---|
| [93e3492] | 61 | void compile_warning_at(const char * file, unsigned line, int en, ...); |
|---|
| 62 | void compile_warning_pfx(const prefix * pfx, int en, ...); |
|---|
| [a420b49] | 63 | void compile_error(int en, ...); |
|---|
| [fa42426] | 64 | void compile_error_skip(int en, ...); |
|---|
| [93e3492] | 65 | void compile_error_at(const char * file, unsigned line, int en, ...); |
|---|
| 66 | void compile_error_pfx(const prefix * pfx, int en, ...); |
|---|
| [39fba51] | 67 | |
|---|
| 68 | void compile_error_token(int en); |
|---|