Added coder to reset.
[idzebra-moved-to-github.git] / include / isamc.h
1 /*
2  * Copyright (c) 1995-1997, Index Data.
3  * See the file LICENSE for details.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: isamc.h,v $
7  * Revision 1.8  1999-06-30 09:08:23  adam
8  * Added coder to reset.
9  *
10  * Revision 1.7  1998/03/13 15:30:50  adam
11  * New functions isc_block_used and isc_block_size. Fixed 'leak'
12  * in isc_alloc_block.
13  *
14  * Revision 1.6  1997/09/17 12:19:10  adam
15  * Zebra version corresponds to YAZ version 1.4.
16  * Changed Zebra server so that it doesn't depend on global common_resource.
17  *
18  * Revision 1.5  1997/09/05 15:30:00  adam
19  * Changed prototype for chr_map_input - added const.
20  * Added support for C++, headers uses extern "C" for public definitions.
21  *
22  * Revision 1.4  1996/11/08 11:08:01  adam
23  * New internal release.
24  *
25  * Revision 1.3  1996/11/01 13:35:03  adam
26  * New element, max_blocks_mem, that control how many blocks of max size
27  * to store in memory during isc_merge.
28  *
29  * Revision 1.2  1996/10/29  16:44:42  adam
30  * Added isc_type, isc_block macros.
31  *
32  * Revision 1.1  1996/10/29  13:40:37  adam
33  * First work.
34  *
35  */
36
37 #ifndef ISAMC_H
38 #define ISAMC_H
39
40 #include <bfile.h>
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45
46 typedef struct ISAMC_s *ISAMC;
47 typedef int ISAMC_P;
48 typedef struct ISAMC_PP_s *ISAMC_PP;
49
50 typedef struct ISAMC_filecat_s {
51     int bsize;         /* block size */
52     int ifill;         /* initial fill */
53     int mfill;         /* minimum fill */
54     int mblocks;       /* maximum blocks */
55 } *ISAMC_filecat;
56
57 typedef struct ISAMC_M_s {
58     ISAMC_filecat filecat;
59
60     int (*compare_item)(const void *a, const void *b);
61
62 #define ISAMC_DECODE 0
63 #define ISAMC_ENCODE 1
64     void *(*code_start)(int mode);
65     void (*code_stop)(int mode, void *p);
66     void (*code_item)(int mode, void *p, char **dst, char **src);
67     void (*code_reset)(void *p);
68
69     int max_blocks_mem;
70     int debug;
71 } *ISAMC_M;
72
73 typedef struct ISAMC_I_s {
74     int (*read_item)(void *clientData, char **dst, int *insertMode);
75     void *clientData;
76 } *ISAMC_I;
77
78 ISAMC_M isc_getmethod (void);
79
80 ISAMC isc_open (BFiles bfs, const char *name, int writeflag, ISAMC_M method);
81 int isc_close (ISAMC is);
82 ISAMC_P isc_merge (ISAMC is, ISAMC_P pos, ISAMC_I data);
83
84 ISAMC_PP isc_pp_open (ISAMC is, ISAMC_P pos);
85 void isc_pp_close (ISAMC_PP pp);
86 int isc_read_item (ISAMC_PP pp, char **dst);
87 int isc_pp_read (ISAMC_PP pp, void *buf);
88 int isc_pp_num (ISAMC_PP pp);
89
90 int isc_block_used (ISAMC is, int type);
91 int isc_block_size (ISAMC is, int type);
92
93 #define isc_type(x) ((x) & 7)
94 #define isc_block(x) ((x) >> 3)
95
96 #ifdef __cplusplus
97 }
98 #endif
99
100 #endif