2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.4 1994-09-26 17:05:54 quinn
10 * Revision 1.3 1994/09/26 16:08:42 quinn
11 * Most of the functionality in place.
13 * Revision 1.2 1994/09/14 13:10:35 quinn
16 * Revision 1.1 1994/09/12 08:02:07 quinn
26 #define IS_MAX_BLOCKTYPES 4
27 #define IS_MAX_RECORD 512
28 #define IS_DEF_REPACK_PERCENT "30" /* how much relative change before repack */
30 typedef unsigned int SYSNO; /* should be somewhere else */
31 typedef unsigned int ISAM_P;
34 * Description of a blocktype (part of an isam file)
36 typedef struct isam_blocktype
38 BFile bf; /* blocked file */
40 int first_block; /* position of first data block */
41 int max_keys_block; /* max num of keys per block */
42 int max_keys_block0; /* max num of keys in first block */
43 int nice_keys_block; /* nice number of keys per block */
44 int max_keys; /* max number of keys per table */
45 int freelist; /* fist free block */
46 int top; /* first unused block */
47 int index; /* placeholder. Always 0. */
48 char *dbuf; /* buffer for use in I/O operations */
52 * Handle to an open isam complex.
54 typedef struct isam_struct
56 isam_blocktype types[IS_MAX_BLOCKTYPES]; /* block_types used in this file */
57 int num_types; /* number of block types used */
59 int keysize; /* size of the keys (records) used */
60 int repack; /* how many percent to grow before repack */
61 int (*cmp)(const void *k1, const void *k2); /* compare function */
65 typedef struct ispt_struct
67 struct is_mtable *tab;
68 struct ispt_struct *next; /* freelist */
71 #define is_type(x) ((x) & 3) /* type part of position */
72 #define is_block(x) ((x) >> 2) /* block # part of position */
74 #define is_keysize(is) ((is)->keysize)
78 *******************************************************************
84 ISAM is_open(const char *name, int writeflag);
89 int is_close(ISAM is);
92 * Locate a table of keys in an isam file. The ISPT is an individual
93 * position marker for that table.
95 ISPT is_position(ISAM is, ISAM_P pos);
100 void is_pt_free(ISPT ip);
103 * Read a key from a table.
105 int is_readkey(ISPT ip, void *buf);
107 int is_writekey(ISPT ip, const void *buf);
109 ISAM_P is_merge(ISAM is, ISAM_P pos, int num, const char *data);