VistaIOReadFile(3) | Library Functions Manual | VistaIOReadFile(3) |
VistaIOReadFile - read a Vista data file
#include <stdio> #include <vistaio.h>
VistaIOAttrList VistaIOReadFile (file, filter)
FILE *file; VistaIOReadFileFilterProc *filter;
typedef VistaIOBoolean VistaIOReadFileFilterProc (VistaIOBundle, VistaIORepnKind);
VistaIOReadFile reads the contents of a Vista data file. It returns a list of the attributes found in the file. Attribute values in that list will have been converted to internal form, as described by VistaIOattribute(3) and VistaIOtype(3).
With the filter argument you may supply a function that gets to decide for each attribute value that is an object whether or not that object's binary data should be read. This mechanism allows you to avoid the expense of reading binary data that is not of interest (e.g., image pixel values when images are not of concern). However, you need only supply a filter function if you are particularly concerned about efficiency. Your filter function should be declared:
VistaIOBoolean MyFilter (bundle, repn)
VistaIOBundle bundle; VistaIORepnKind repn;
Your filter function will be called once for each object encountered at any level in the file. It will be passed a VistaIOBundle representing the object (including its type name and attribute list, but not its binary data), and the repn value obtained by looking up its type name (i.e., the value returned by VistaIOLookupType(3) on the type name, which could be VistaIOUnknownRepn). The object's binary data will be read only if the filter function returns TRUE. If it returns FALSE, the object will be represented in the attribute list as a VistaIOBundle, without binary data — it will not be converted to internal form (e.g., not to a VistaIOImage). If no filter function is supplied (i.e., filter is NULL), VistaIOReadFile will read all binary data associated with all objects.
For backwards compatibility VistaIOReadFile will recognize and read the contents of a UBC image file format (IFF) file. If the first character read from the stream is ``I'', VistaIOReadFile uses VistaIOReadUbcIff to read a single UBC IFF image. The image is returned as a VistaIOImage attribute value in a list containing a single attribute. In this case, the filter argument has no effect.
VistaIOReadData returns an attribute list representing the file's contents, or NULL if an error is encountered. In the case of an error, the stream may not have been completely read.
VistaIOReadObjects(3), VistaIOReadUbcIff(3),
stdio(3),
VistaIOBundle(3), VistaIOattribute(3), VistaIOtype(3)
Data is read from the stream sequentially, permitting the stream to be a pipe. No rewind is performed either before reading or after.
Art Pope <pope@cs.ubc.ca>
Adaption to vistaio: Gert Wollny <gw.fossdev@gmail.com>
26 January 1994 | VistaIO Version 1.2.14 |