X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Ffile-handle.h;h=eab80521a2d6fdd7d845b42352940b607bd4528e;hb=d7b5d9144738a5a8989d45a01f4e458a78b68c0b;hp=c7b455053592a7fde5efcb8a39a2225799528add;hpb=f9d47b5bba8416419cf3bcd3aa23c2d40a05fcac;p=pspp diff --git a/src/file-handle.h b/src/file-handle.h index c7b4550535..eab80521a2 100644 --- a/src/file-handle.h +++ b/src/file-handle.h @@ -14,86 +14,30 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #if !file_handle_h #define file_handle_h 1 -/* File handle provider (fhp). - - This module provides file handles in the form of file_handle - structures to the dfm and sfm modules, which are known as file - handle users (fhusers). fhp does not know anything about file - contents. */ +/* File handles. */ #include -#include "error.h" - -/* Record formats. */ -enum - { - FH_RF_FIXED, /* Fixed length records. */ - FH_RF_VARIABLE, /* Variable length records. */ - FH_RF_SPANNED /* ? */ - }; - -/* File modes. */ -enum - { - FH_MD_CHARACTER, /* Character data. */ - FH_MD_IMAGE, /* ? */ - FH_MD_BINARY, /* Character and/or binary data. */ - FH_MD_MULTIPUNCH, /* Column binary data (not supported). */ - FH_MD_360 /* ? */ - }; - -struct file_handle; - -/* Services that fhusers provide to fhp. */ -struct fh_ext_class - { - int magic; /* Magic identifier for fhuser. */ - const char *name; /* String identifier for fhuser. */ +#include "file-handle-def.h" - void (*close) (struct file_handle *); - /* Closes any associated file, etc. */ - }; -/* Opaque structure. The `ext' member is an exception for use by - subclasses. `where.ln' is also acceptable. */ -struct file_handle - { - /* name must be the first member. */ - const char *name; /* File handle identifier. */ - char *norm_fn; /* Normalized filename. */ - char *fn; /* Filename as provided by user. */ - struct file_locator where; /* Used for reporting error messages. */ - int recform; /* One of FH_RF_*. */ - size_t lrecl; /* Length of records for FH_RF_FIXED. */ - int mode; /* One of FH_MD_*. */ +void fh_init(void); +void fh_done(void); - struct fh_ext_class *class; /* Polymorphism support. */ - void *ext; /* Extension struct for fhuser use. */ - }; -/* Pointer to the file handle that corresponds to data in the command - file entered via BEGIN DATA/END DATA. */ -extern struct file_handle *inline_file; +/* Parsing handles. */ +struct file_handle *fh_parse (void); -/* Initialization. */ -void fh_init_files (void); /* Opening and closing handles. */ -struct file_handle *fh_get_handle_by_name (const char name[9]); -struct file_handle *fh_get_handle_by_filename (const char *filename); -struct file_handle *fh_parse_file_handle (void); -void fh_close_handle (struct file_handle *handle); +void **fh_open (struct file_handle *, const char *type, const char *mode); +int fh_close (struct file_handle *, const char *type, const char *mode); -/* Handle info. */ -const char *fh_handle_name (const struct file_handle *handle); -char *fh_handle_filename (struct file_handle *handle); -size_t fh_record_width (struct file_handle *handle); #endif /* !file_handle.h */