2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.1 1994-09-26 17:12:32 quinn
10 * Revision 1.1 1994/09/26 16:07:57 quinn
11 * Most of the functionality in place.
20 extern int is_mbuf_size[3];
23 * Memory buffer. Used to manage records (keys) in memory for
24 * reading and insertion/deletion.
26 typedef struct is_mbuf
30 #define IS_MBUF_TYPE_SMALL 0
31 #define IS_MBUF_TYPE_MEDIUM 1
32 #define IS_MBUF_TYPE_LARGE 2
37 char *data; /* dummy */
41 * Structure describing the virtual image of a disk block.
42 * (these blocks may grow beyond the blocksize during insertion).
44 typedef struct is_mblock
46 int num_records; /* number of records */
47 int diskpos; /* positive if this block is mapped */
48 int nextpos; /* pos of nxt blk. Only valid imm aft. rd. */
49 int bread; /* number of bytes read */
50 int state; /* state of block in rel. to disk block */
51 #define IS_MBSTATE_UNREAD 0 /* block hasn't been read */
52 #define IS_MBSTATE_PARTIAL 1 /* block has been partially read */
53 #define IS_MBSTATE_CLEAN 2 /* block is clean (unmodified) */
54 #define IS_MBSTATE_DIRTY 3 /* block has been modified */
56 is_mbuf *data; /* data contained in block */
58 struct is_mblock *next; /* next diskblock */
62 * Descriptor for a specific table.
64 typedef struct is_mtable
66 int num_records; /* total number of records */
67 int pos_type; /* blocktype */
68 is_mblock *cur_mblock;
69 is_mblock *data; /* blocks contained in this table */
73 is_mblock *xmalloc_mblock();
74 is_mbuf *xmalloc_mbuf(int type);
75 void xfree_mblock(is_mblock *p);
76 void xfree_mbuf(is_mblock *p);
77 void is_m_establish_tab(ISAM is, is_mtable *tab, ISAM_P pos);
78 void is_m_rewind(is_mtable *tab);
79 void is_m_replace_record(is_mtable *tab, const void *rec);
80 int is_m_write_record(is_mtable *tab, const void *rec);
81 void is_m_unread_record(is_mtable *tab);
82 int is_m_read_record(is_mtable *tab, void *buf);
83 int is_m_seek_record(is_mtable *tab, const void *rec);
84 void is_m_delete_record(is_mtable *tab);
85 int is_m_peek_record(is_mtable *tab, void *rec);
86 int is_m_read_full(is_mtable *tab, is_mblock *mblock);