00001 /* 00002 * Implementation of Free Store Module 00003 * Kirk A. Abbott 00004 * Created Dec 18, 1994 00005 * Version: $Revision: 1.5 $ 00006 * Version control file: $RCSfile: freestore.h,v $ 00007 * Date last modified: $Date: 1998/06/16 16:36:27 $ 00008 * Last modified by: $Author: mthomas $ 00009 * 00010 * This file is part of the Ascend Language Interpreter. 00011 * 00012 * Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly 00013 * 00014 * The Ascend Language Interpreter is free software; you can 00015 * redistribute it and/or modify it under the terms of the GNU 00016 * General Public License as published by the Free Software 00017 * Foundation; either version 2 of the License, or (at your option) 00018 * any later version. 00019 * 00020 * The Ascend Language Interpreter is distributed in hope that it 00021 * will be useful, but WITHOUT ANY WARRANTY; without even the implied 00022 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00023 * See the GNU General Public License for more details. 00024 * 00025 * You should have received a copy of the GNU General Public License 00026 * along with the program; if not, write to the Free Software 00027 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check 00028 * the file named COPYING. 00029 */ 00030 00047 #ifndef ASC_FREESTORE_H 00048 #define ASC_FREESTORE_H 00049 00055 struct FreeStore { 00056 union RelationTermUnion **root; 00057 union RelationTermUnion *next_free; 00058 struct gs_stack_t *returned; 00059 int n_buffers; 00060 int buffer_length; 00061 int row; 00062 int col; 00063 }; 00064 00065 extern long FreeStore_UnitsAllocated(); 00067 extern void FreeStore__Statistics(FILE *fp, struct FreeStore *store); 00070 extern void FreeStore__BlastMem(struct FreeStore *store); 00076 /* 00077 * These are the normal user level routines. 00078 * 00079 * Known Bugs: 00080 * The blocks returned the user are never anything but the size of 00081 * a relation token. This is not highly reuseable. 00082 * 00083 * Features?: 00084 * This module runs a stack of free_stores, which is sometimes 00085 * handy, to avoid passing around a free_store pointer. Note, 00086 * however, that it costs just as much to dereference the global 00087 * variables as it does to pass the store pointer. 00088 */ 00089 00090 extern struct FreeStore *FreeStore_Create(int n_buffers, int buffer_length); 00096 extern void FreeStore_ReInit(struct FreeStore *store); 00105 extern union RelationTermUnion *GetMem(); 00117 extern void FreeMem(union RelationTermUnion *term); 00123 extern union RelationTermUnion 00124 *FreeStoreCheckMem(union RelationTermUnion *term); 00131 extern void FreeStore_SetFreeStore(struct FreeStore *store); 00133 extern struct FreeStore *FreeStore_GetFreeStore(void); 00136 /* @} */ 00137 00138 #endif /* ASC_FREESTORE_H */ 00139
1.5.1