merge 64-bit fixes from Fernando Lucas Rodriguez <fernando_lr@terra.es>
[debian/gcpegg] / storage.h
1 /* PROGRAM:     eggsh
2  * FILE:        $Header: /home/egg/src/RCS/storage.h,v 1.3 1998/12/31 22:11:05 ghn Exp $
3  * PURPOSE:     Definitions for data storage functions
4  * AUTHOR:      Greg Nelson
5  * DATE:        98-05-09
6  *
7  * REVISED:
8  * $Log: storage.h,v $
9  * Revision 1.3  1998/12/31 22:11:05  ghn
10  *  Rev 5 code: includes multi-reg support, HTML, etc.
11  *
12  * Revision 1.2  1998/08/01 17:19:48  ghn
13  * Added ResetDatabase function.
14  *
15  * Revision 1.1  1998/07/21 11:35:10  ghn
16  * Initial revision
17  *
18  * Copyright 1998 - Greg Nelson
19  * Redistributable under the terms of the GNU Public Licence (GPL)
20  */
21
22 typedef struct dbase {
23   FILE *fp;
24   int16 eggind;
25   char fn[256];
26 } DBRec;
27
28 /* The initialization provides a way to specify a format for the
29    database file names.  If the argument is null, it uses a default
30    from the environment, or a compiled default.  This string is used
31    as an argument to strftime(3) which replaces certain characters
32    with corresponding fields of the date and time.  This provides an
33    automatic way of generating a logical new filename on a periodic
34    basis.
35
36    The other function of the initialization is to clear static
37    variable used to incrementally collect records for SaveRecord until
38    a complete packet is available for storage to disk. */ 
39 extern int32 InitStorage(char *path);
40
41 /* Save packet is the basic save function.  It does not take a
42    filename, relying on the datafmt variable created during
43    initialization to generate an appropriate filename.  The
44    date for the saved data is based on the timestamp of the packet's
45    first record. */
46 extern int32 SavePacket(EggCarton *cart);
47
48 /* Open database for reading, positioning to specified location.
49    If eggid is less than zero, it will load any packet. */
50 extern int32 OpenDatabase(DBRec *db, uint32 tindex, int16 eggid);
51
52 /* Close database */
53 extern int32 CloseDatabase(DBRec *db);
54
55 /* Reset database allows us to open same file name again. */
56 extern int32 ResetDatabase(DBRec *dbp);
57
58 /* Load next packet following a particular time index and egg id.  If
59    eggid is less than zero, it will load any packet.  This is
60    essentially a shortcut for getting one packet. */
61
62 extern int32 LoadPacket(uint32 tindex, int16 eggid, EggCarton *cart);
63