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