00001 /* File: heap_xsb.h 00002 ** Author(s): David S. Warren, Jiyang Xu, Kostis Sagonas 00003 ** Contact: xsb-contact@cs.sunysb.edu 00004 ** 00005 ** Copyright (C) The Research Foundation of SUNY, 1986, 1993-1998 00006 ** Copyright (C) ECRC, Germany, 1990 00007 ** 00008 ** XSB is free software; you can redistribute it and/or modify it under the 00009 ** terms of the GNU Library General Public License as published by the Free 00010 ** Software Foundation; either version 2 of the License, or (at your option) 00011 ** any later version. 00012 ** 00013 ** XSB is distributed in the hope that it will be useful, but WITHOUT ANY 00014 ** WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00015 ** FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for 00016 ** more details. 00017 ** 00018 ** You should have received a copy of the GNU Library General Public License 00019 ** along with XSB; if not, write to the Free Software Foundation, 00020 ** Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00021 ** 00022 ** $Id: heap_xsb.h,v 1.13 2006/04/27 21:08:47 tswift Exp $ 00023 ** 00024 */ 00025 00026 00027 /*---- The following are macros for setting heap values ----------------*/ 00028 00029 #define new_heap_free(sh_reg) bld_free(sh_reg); sh_reg++ 00030 /* make a free variable on the top of the heap */ 00031 00032 #define new_heap_string(sh_reg, str) bld_string(sh_reg, str); sh_reg++ 00033 /* make a new string node on the heap, with a string"str" */ 00034 00035 #define new_heap_nil(sh_reg) bld_nil(sh_reg); sh_reg++ 00036 00037 #define new_heap_num(sh_reg, val) bld_int_tagged(sh_reg, val); sh_reg++ 00038 /* make a new num node on the heap, with value val */ 00039 00040 #define new_heap_float(sh_reg, val) bld_float_tagged(sh_reg, val); sh_reg++ 00041 /* make a new float node on the heap, with value val in tagged format.*/ 00042 00043 #define new_heap_functor(sh_reg, psc) bld_functor(sh_reg++, psc) 00044 /* make a new functor node in heap */ 00045 00046 #define new_heap_node(sh_reg, x) bld_copy(sh_reg++, x) 00047 /* make a new heap node with value x (one word type) */ 00048 00049 /*----------------------------------------------------------------------*/ 00050 00051 #include "heap_defs_xsb.h" 00052 #include "context.h" 00053 00054 /*----- The following functions are used in other parts of the system --*/ 00055 00056 extern int gc_heap(CTXTdeclc int, int); 00057 extern int mark_heap(CTXTdeclc int,int *); 00058 extern xsbBool glstack_ensure_space(CTXTdeclc int,int); 00059 extern xsbBool glstack_realloc(CTXTdeclc int,int); 00060 extern char *string_find_safe(char *str); 00061 00062 extern void print_cp(CTXTdeclc int); 00063 extern void print_tr(CTXTdeclc int); 00064 extern void print_ls(CTXTdeclc int); 00065 extern void print_all_stacks(CTXTdeclc int); 00066 extern void print_regs(CTXTdeclc int,int); 00067 extern void print_heap(CTXTdeclc int,int,int); 00068 extern void print_gc_statistics(CTXTdecl); 00069 #ifndef MULTI_THREAD 00070 extern Cell attv_interrupts[20480][2]; 00071 #endif 00072 /*----------------------------------------------------------------------*/