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