Towards GPL
[idzebra-moved-to-github.git] / isam / memory.h
index 2948448..77bc660 100644 (file)
@@ -1,24 +1,38 @@
-/*
- * Copyright (C) 1994, Index Data I/S 
- * All rights reserved.
- * Sebastian Hammer, Adam Dickmeiss
- *
- * $Log: memory.h,v $
- * Revision 1.1  1994-09-26 17:12:32  quinn
- * Back again
- *
- * Revision 1.1  1994/09/26  16:07:57  quinn
- * Most of the functionality in place.
- *
- */
+/* $Id: memory.h,v 1.8 2002-08-02 19:26:56 adam Exp $
+   Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
+   Index Data Aps
+
+This file is part of the Zebra server.
+
+Zebra is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Zebra; see the file LICENSE.zebra.  If not, write to the
+Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.
+*/
+
+
 
 #ifndef MEMORY_H
 #define MEMORY_H
 
-#include <isam.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 extern int is_mbuf_size[3];
 
+typedef unsigned int ISAM_P;
+
 /*
  * Memory buffer. Used to manage records (keys) in memory for
  * reading and insertion/deletion.
@@ -58,6 +72,7 @@ typedef struct is_mblock
     struct is_mblock *next;       /* next diskblock */
 } is_mblock;
 
+typedef struct isam_struct *ISAM;
 /*
  * Descriptor for a specific table.
  */
@@ -66,6 +81,7 @@ typedef struct is_mtable
     int num_records;               /* total number of records */
     int pos_type;                  /* blocktype */
     is_mblock *cur_mblock;
+    is_mbuf *last_mbuf;
     is_mblock *data;               /* blocks contained in this table */
     ISAM is;
 } is_mtable;
@@ -73,16 +89,26 @@ typedef struct is_mtable
 is_mblock *xmalloc_mblock();
 is_mbuf *xmalloc_mbuf(int type);
 void xfree_mblock(is_mblock *p);
-void xfree_mbuf(is_mblock *p);
+void xfree_mblocks(is_mblock *l);
+void xfree_mbuf(is_mbuf *p);
+void xfree_mbufs(is_mbuf *l);
+void xrelease_mblock(is_mblock *p);
 void is_m_establish_tab(ISAM is, is_mtable *tab, ISAM_P pos);
+void is_m_release_tab(is_mtable *tab);
 void is_m_rewind(is_mtable *tab);
 void is_m_replace_record(is_mtable *tab, const void *rec);
 int is_m_write_record(is_mtable *tab, const void *rec);
 void is_m_unread_record(is_mtable *tab);
-int is_m_read_record(is_mtable *tab, void *buf);
+int is_m_read_record(is_mtable *tab, void *buf, int keep);
 int is_m_seek_record(is_mtable *tab, const void *rec);
 void is_m_delete_record(is_mtable *tab);
 int is_m_peek_record(is_mtable *tab, void *rec);
 int is_m_read_full(is_mtable *tab, is_mblock *mblock);
+int is_m_num_records(is_mtable *tab);
+
+#ifdef __cplusplus
+}
+#endif
+
 
 #endif