
EXAMPLES OF CREATING FILE ACCESS OBJECTS AND SOME DEMO PROGRAMS

Object oriented programming allows wonderful mechanisms for reading
and writing special file structures (and practically all file
structures are special).

I call these OOP things for "access objects".  They allow the
specialness of manipulating the data into a file to be encapsolated
and tucked away so that the application program only has to deal
with the data itself and note the file structure.

I have written them for TXT, OBJ, WKS, WK1, WQ1, dBase2, dBase3, DXF
(AutoCADD) files.  And I write them for practically every special
file that I design.  For example writing comma-quote-delimited files
(for import into spreadsheets), partitioned sequential files for
storing and retrieving massive amounts of acoustical emission data,
tStream object files (for filing persistent objects), version
controlled flat files (which allow graceful and fairly painless
changes in the record format), etc.

To illustrate some techniques for making these access objects, I have
put this little package of examples together.  These routines are
not guaranteed, so check them and understand them before using them
on a real project.  While they are meant to be compiled under Delphi,
most of the techniques are from TP and BP.

First example:
U_EGA_0a.pas defines, with a lot of comments, a buffered access reader
    for reading DXF (AutoCADD) text files.  It first defines an
    abstract reader object class, tBasicDFXReaderCls, that has the
    functions that a typical application would need.  Then a simplest
    possible (albeit slow) reader, tSimpleDFXReaderCls, is designed,
    just for use in testing. Finally, a more practical reader object
    class, tBlkIoDFXReaderCls, which uses disk buffering is created.
T_EGA_0a.dpr is the project program for testing both of the working
    readers in U_EGA_0a.
TEST.DXF is a small input (AutoCADD DXF) text file for the testing.

Second example:
U_EGB_0a.pas defines an odd kind of general buffering reader object.
    It returns to the application just a pointer to the data in
    the access object's buffer.  We might call this a "scanner" rather
    a reader.  There are a couple of descendants of the basic scanner.
    Two for reading text files and one for reading files using the
    record format of Lotus 1-2-3.
T_EGB_0a.dpr is the project program for testing the text file
    scanners and readers of U_EGB_0a.

Third example:
T_EGW_0a.pas tests a scanner also defined in U_EGB_0a for Lotus
    1-2-3 file record formats.
TEST.WK1 is a Lotus 1-2-3 format file for testing.

I realize that these things are pretty quick and dirty.  I meant for
them to illustrate techniques rather than be for production use.
If you have any good ideas or comments (such as for making components
or handling exceptions) please send them to me and I will add them
to this package (with credits, of course).

John F Herbster, CIS: 72714,3445, (Herbster Scientific)
12807 Park Royal, Houston, TX, 713-558-2708, July 20, 1995.
