Added charmap facility to delete leading articles
[idzebra-moved-to-github.git] / include / isamg.h
1 /* $Id: isamg.h,v 1.2 2002-08-02 19:26:55 adam Exp $
2    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
3    Index Data Aps
4
5 This file is part of the Zebra server.
6
7 Zebra is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
10 version.
11
12 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with Zebra; see the file LICENSE.zebra.  If not, write to the
19 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA.
21 */
22
23
24
25 #ifndef ISAMG_H
26 #define ISAMG_H
27
28 /* #include <bfile.h> */
29
30 YAZ_BEGIN_CDECL
31
32 typedef struct ISAMG_s *ISAMG;
33 typedef int ISAMG_P;
34 typedef struct ISAMG_PP_s *ISAMG_PP;
35
36 #ifdef SKIPTHIS
37 /* File categories etc are no business of users of ISAM-G (or what?) */
38 typedef struct ISAMG_filecat_s {  /* filecategories, mostly block sizes */
39     int bsize;         /* block size */
40     int mblocks;       /* maximum keys before switching to larger sizes */
41 } *ISAMG_filecat;
42 #endif 
43
44
45 #ifdef SKIPTHIS
46 /* The (delta?)encoding will be encapsulated so deep in the isams that */
47 /* nobody needs to see it here... If different encodings needed, make */
48 /* new isam types! */
49
50 typedef struct ISAMG_M_s {
51     ISAMG_filecat filecat;
52
53     int (*compare_item)(const void *a, const void *b);
54
55 #define ISAMG_DECODE 0
56 #define ISAMG_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     void (*code_reset)(void *p);
61
62     int max_blocks_mem;
63     int debug;
64 } *ISAMG_M;
65 #endif
66
67 #ifdef SKIPTHIS
68 /* Is this needed? Shouldn't they all be using the same encapsulation */
69
70 typedef struct ISAMG_I_s {  /* encapsulation of input data */
71     int (*read_item)(void *clientData, char **dst, int *insertMode);
72     void *clientData;
73 } *ISAMG_I;
74 #endif
75
76 #ifdef SKIPTHIS 
77 ISAMG_M isamg_getmethod (ISAMG_M me);
78 /* Does anyone really need this method thing ?? */
79 #endif
80
81 ISAMG isamg_open (BFiles bfs, int writeflag, char *isam_type_name, Res res);
82
83 int isamg_close (ISAMG is);
84
85 ISAMG_P isamg_append (ISAMG is, ISAMG_P pos, ISAMG_I data);
86 /* This may be difficult to generalize! */
87   
88   
89 ISAMG_PP isamg_pp_open (ISAMG is, ISAMG_P pos);
90 void isamg_pp_close (ISAMG_PP pp);
91 /* int isamg_read_item (ISAMG_PP pp, char **dst);      */
92 /* int isamg_read_main_item (ISAMG_PP pp, char **dst); */
93 int isamg_pp_read (ISAMG_PP pp, void *buf);
94 int isamg_pp_num (ISAMG_PP pp);
95
96 #ifdef SKIPTHIS
97 /* all internal stuff */
98 int isamg_block_used (ISAMG is, int type);
99 int isamg_block_size (ISAMG is, int type);
100
101
102 #define isamg_type(x) ((x) & 7)
103 #define isamg_block(x) ((x) >> 3)
104 #define isamg_addr(blk,typ) (((blk)<<3)+(typ))
105
106 void isamg_buildfirstblock(ISAMG_PP pp);
107 void isamg_buildlaterblock(ISAMG_PP pp);
108 #endif
109
110 YAZ_END_CDECL
111
112 #endif  /* ISAMG_H */
113
114
115 /*
116  * $Log: isamg.h,v $
117  * Revision 1.2  2002-08-02 19:26:55  adam
118  * Towards GPL
119  *
120  * Revision 1.1  2001/01/16 19:05:11  heikki
121  * Started to add isamg
122  *
123  *
124  *
125  */