Changed prototype for chr_map_input - added const.
[idzebra-moved-to-github.git] / include / bfile.h
1 /*
2  * Copyright (C) 1994-1997, Index Data I/S 
3  * All rights reserved.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: bfile.h,v $
7  * Revision 1.14  1997-09-05 15:29:58  adam
8  * Changed prototype for chr_map_input - added const.
9  * Added support for C++, headers uses extern "C" for public definitions.
10  *
11  * Revision 1.13  1996/10/29 13:43:07  adam
12  * Added a few comments.
13  *
14  * Revision 1.12  1996/03/26 16:00:44  adam
15  * The directory of the shadow table can be specified by the new
16  * bf_lockDir call.
17  *
18  * Revision 1.11  1995/12/08  16:20:39  adam
19  * New commit utilities - used for 'save' update.
20  *
21  * Revision 1.10  1995/12/01  16:24:33  adam
22  * Commit files use separate meta file area.
23  *
24  * Revision 1.9  1995/12/01  11:37:46  adam
25  * Cached/commit files implemented as meta-files.
26  *
27  * Revision 1.8  1995/11/30  08:33:29  adam
28  * Started work on commit facility.
29  *
30  * Revision 1.7  1995/09/04  12:33:35  adam
31  * Various cleanup. YAZ util used instead.
32  *
33  * Revision 1.6  1994/09/14  13:10:35  quinn
34  * Small changes
35  *
36  * Revision 1.5  1994/08/24  08:45:52  quinn
37  * Using mfile.
38  *
39  * Revision 1.4  1994/08/17  15:38:28  adam
40  * Include of util.h.
41  *
42  * Revision 1.3  1994/08/17  14:09:47  quinn
43  * Small changes
44  *
45  */
46
47 #ifndef BFILE_H
48 #define BFILE_H
49
50 #include <mfile.h>
51
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55
56 #define bf_blocksize(bf) mf_blocksize(bf->mf)
57
58 typedef struct BFile_struct
59 {
60     MFile mf;
61     struct CFile_struct *cf;
62 } *BFile, BFile_struct;
63
64 /* bf_close: closes bfile.
65    returns 0 if successful; non-zero otherwise 
66  */
67 int bf_close (BFile);
68
69 /* bf_open: opens bfile.
70    opens bfile with name 'name' and with 'block_size' as block size.
71    returns bfile handle is successful; NULL otherwise 
72  */
73 BFile bf_open (const char *name, int block_size, int wflag);
74
75 /* bf_read: reads bytes from bfile 'bf'.
76    reads 'num' bytes (or whole block if 0) from offset 'offset' from
77    block 'no'. stores contents in buffer 'buf'.
78    returns 1 if whole block could be read; 0 otherwise.
79  */
80 int bf_read (BFile bf, int no, int offset, int num, void *buf);
81
82 /* bf_write: writes bytes to bfile 'bf'.
83    writes 'num' bytes (or whole block if 0) at offset 'offset' to
84    block 'no'. retrieves contents from buffer 'buf'.
85    returns 0 if successful; non-zero otherwise.
86  */
87 int bf_write (BFile bf, int no, int offset, int num, const void *buf);
88
89 /* bf_cache: enables/disables bfile cache */
90 void bf_cache (int enableFlag);
91
92 /* bf_lockDir: specifies locking directory for the cache system */
93 void bf_lockDir (const char *lockDir);
94
95 /* bf_commitExists: returns 1 if commit is pending; 0 otherwise */
96 int bf_commitExists (void);
97
98 /* bf_commitExec: executes commit */
99 void bf_commitExec (void);
100
101 /* bf_commitClean: cleans commit files, etc */
102 void bf_commitClean (void);
103
104 #ifdef __cplusplus
105 }
106 #endif
107
108 #endif