Make fn_open and fn_close take a struct file_handle instead of char *
[pspp] / src / data / any-reader.h
index 5614a6007507c3f71539a183197dc01661b46829..998e12441b2894ccad6c1abdfd10e7754c66950f 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 2006, 2010, 2012, 2014 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2010, 2012, 2014, 2015 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -34,9 +34,12 @@ struct any_reader
 
 struct any_reader_class
   {
+    /* The name of this kind of data file, e.g. "SPSS System File". */
     const char *name;
 
-    int (*detect) (FILE *);
+    /* Detects whether FILE contains this type of file.  Returns 1 if so, 0 if
+       not, and a negative errno value if there is an error reading FILE. */
+    int (*detect) (FILE *file);
 
     struct any_reader *(*open) (struct file_handle *);
     bool (*close) (struct any_reader *);
@@ -94,7 +97,7 @@ void any_read_info_destroy (struct any_read_info *);
 struct file_handle;
 struct dictionary;
 
-int any_reader_detect (const char *file_name,
+int any_reader_detect (const struct file_handle *file_name,
                        const struct any_reader_class **);
 
 struct any_reader *any_reader_open (struct file_handle *);