4fc14456fed62b9b98769c1f29f8019f8601d637
[pspp] / src / data / sys-file-reader.h
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 1997-9, 2000, 2009, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
3
4    This program is 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    This program 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    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <http://www.gnu.org/licenses/>. */
16
17 #ifndef SFM_READ_H
18 #define SFM_READ_H 1
19
20 #include <stdbool.h>
21 #include <stdio.h>
22
23 #include "data/case.h"
24 #include "data/sys-file.h"
25 #include "libpspp/float-format.h"
26 #include "libpspp/integer-format.h"
27
28 /* Reading system files. */
29
30 /* System file info that doesn't fit in struct dictionary.
31
32    The strings in this structure are encoded in UTF-8.  (They are normally in
33    the ASCII subset of UTF-8.) */
34 struct sfm_read_info
35   {
36     char *creation_date;        /* "dd mmm yy". */
37     char *creation_time;        /* "hh:mm:ss". */
38     enum integer_format integer_format;
39     enum float_format float_format;
40     enum sfm_compression compression;
41     casenumber case_cnt;        /* -1 if unknown. */
42     char *product;              /* Product name. */
43     char *product_ext;          /* Extra product info. */
44
45     /* Writer's version number in X.Y.Z format.
46        The version number is not always present; if not, then
47        all of these are set to 0. */
48     int version_major;          /* X. */
49     int version_minor;          /* Y. */
50     int version_revision;       /* Z. */
51   };
52
53 void sfm_read_info_destroy (struct sfm_read_info *);
54
55 struct dictionary;
56 struct file_handle;
57 struct casereader *sfm_open_reader (struct file_handle *, const char *encoding,
58                                     struct dictionary **,
59                                     struct sfm_read_info *);
60 bool sfm_detect (FILE *);
61
62 #endif /* sys-file-reader.h */