New element, max_blocks_mem, that control how many blocks of max size
[idzebra-moved-to-github.git] / include / isamc.h
1 /*
2  * Copyright (c) 1995-1996, Index Data.
3  * See the file LICENSE for details.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: isamc.h,v $
7  * Revision 1.3  1996-11-01 13:35:03  adam
8  * New element, max_blocks_mem, that control how many blocks of max size
9  * to store in memory during isc_merge.
10  *
11  * Revision 1.2  1996/10/29  16:44:42  adam
12  * Added isc_type, isc_block macros.
13  *
14  * Revision 1.1  1996/10/29  13:40:37  adam
15  * First work.
16  *
17  */
18
19 #ifndef ISAMC_H
20 #define ISAMC_H
21
22 typedef struct ISAMC_s *ISAMC;
23 typedef int ISAMC_P;
24 typedef struct ISAMC_PP_s *ISAMC_PP;
25
26 typedef struct ISAMC_filecat_s {
27     int bsize;         /* block size */
28     int ifill;         /* initial fill */
29     int mfill;         /* minimum fill */
30     int mblocks;       /* maximum blocks */
31 } *ISAMC_filecat;
32
33 typedef struct ISAMC_M_s {
34     ISAMC_filecat filecat;
35
36     int (*compare_item)(const void *a, const void *b);
37
38 #define ISAMC_DECODE 0
39 #define ISAMC_ENCODE 1
40     void *(*code_start)(int mode);
41     void (*code_stop)(int mode, void *p);
42     void (*code_item)(int mode, void *p, char **dst, char **src);
43
44     int max_blocks_mem;
45     int debug;
46 } *ISAMC_M;
47
48 typedef struct ISAMC_I_s {
49     int (*read_item)(void *clientData, char **dst, int *insertMode);
50     void *clientData;
51 } *ISAMC_I;
52
53 ISAMC_M isc_getmethod (void);
54
55 ISAMC isc_open (const char *name, int writeflag, ISAMC_M method);
56 int isc_close (ISAMC is);
57 ISAMC_P isc_merge (ISAMC is, ISAMC_P pos, ISAMC_I data);
58
59 ISAMC_PP isc_pp_open (ISAMC is, ISAMC_P pos);
60 void isc_pp_close (ISAMC_PP pp);
61 int isc_read_item (ISAMC_PP pp, char **dst);
62 int isc_read_key (ISAMC_PP pp, void *buf);
63 int isc_numkeys (ISAMC_PP pp);
64
65 #define isc_type(x) ((x) & 7)
66 #define isc_block(x) ((x) >> 3)
67
68 #endif