1 /* PSPP - computes sample statistics.
2 Copyright (C) 1997-9, 2000,2005 Free Software Foundation, Inc.
3 Written by Ben Pfaff <blp@gnu.org>.
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 #ifndef FILE_HANDLE_DEF_H
21 #define FILE_HANDLE_DEF_H
28 MODE_TEXT, /* New-line delimited lines. */
29 MODE_BINARY /* Fixed-length records. */
32 /* Properties of a file handle. */
35 enum fh_mode mode; /* File mode. */
36 size_t record_width; /* Length of fixed-format records. */
37 size_t tab_width; /* Tab width, 0=do not expand tabs. */
43 /* Creating file handles. */
44 struct file_handle *fh_create (const char *handle_name,
46 const struct fh_properties *);
47 /* Destroy file handle */
48 void fh_free(struct file_handle *);
50 const struct fh_properties *fh_default_properties (void);
52 /* Finding file handles, based on handle name or filename. */
53 struct file_handle *fh_from_name (const char *handle_name);
54 struct file_handle *fh_from_filename (const char *filename);
56 /* Querying properties of file handles. */
57 const char *fh_get_name (const struct file_handle *);
58 const char *fh_get_filename (const struct file_handle *);
59 enum fh_mode fh_get_mode (const struct file_handle *) ;
60 size_t fh_get_record_width (const struct file_handle *);
61 size_t fh_get_tab_width (const struct file_handle *);
63 /* Opening and closing file handles. */
64 void **fh_open (struct file_handle *, const char *type, const char *mode);
65 int fh_close (struct file_handle *, const char *type, const char *mode);