debug_xsb.h

00001 /* File:      debug_xsb.h
00002 ** Author(s): Luís Castro
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: debug_xsb.h,v 1.7 2006/01/09 00:06:30 tswift Exp $
00023 ** 
00024 */
00025 
00026 #ifndef __DEBUG_XSB_H__
00027 #define __DEBUG_XSB_H__
00028 
00029 #define STRIDESIZE     30
00030 
00031 #define EOS     "--------------------BOTTOM_OF_STACK--------------------\n"
00032 #define EOFR    "--------------------------------------------\n"
00033 #define EOSUBG  "------------------------------------------------------------\n"
00034 
00035 #define print_subg_header(SUBG) { \
00036     fprintf(stddbg, "=== Frame for "); print_subgoal(stddbg, SUBG); \
00037     if (is_completed(SUBG)) fprintf(stddbg, " (completed) ===\n"); \
00038     else fprintf(stddbg, " (incomplete) ===\n"); }
00039 
00040 /* extern int cur_log_level; */
00041 #define cur_log_level pflags[VERBOSENESS_LEVEL]
00042 typedef struct subgoal_frame *VariantSF;
00043 /* Verboseness levels */
00044 #define LOG_QUIET 0
00045 #define LOG_SHY 1
00046 #define LOG_VERBOSE 2
00047 #define LOG_LOUD 3
00048 
00049 /* The following is a first approximation at which message categories
00050    fit into each verboseness level */
00051 #define LOG_DEBUG              LOG_SHY
00052 #define LOG_ASSERT             LOG_VERBOSE
00053 #define LOG_RETRACT            LOG_LOUD
00054 #define LOG_RETRACT_GC         LOG_LOUD
00055 #define LOG_DELAY              LOG_LOUD
00056 #define LOG_DELAYVAR           LOG_LOUD
00057 #define LOG_TRIE_STACK         LOG_LOUD
00058 #define LOG_ATTV               LOG_LOUD
00059 #define LOG_GC                 LOG_VERBOSE
00060 #define LOG_HASHTABLE          LOG_LOUD
00061 #define LOG_REALLOC            LOG_VERBOSE
00062 #define LOG_SCHED              LOG_LOUD
00063 #define LOG_STORAGE            LOG_LOUD
00064 #define LOG_STRUCT_MANAGER     LOG_LOUD
00065 #define LOG_TRIE_INSTR         LOG_LOUD
00066 #define LOG_INTERN             LOG_LOUD
00067 #define LOG_TRIE               LOG_LOUD
00068 #define LOG_BD                 LOG_LOUD
00069 #define LOG_COMPLETION         LOG_LOUD
00070 
00071 /* dbg_* macros */
00072 #ifdef DEBUG_VERBOSE
00073 /* in error_xsb.c */
00074 #define xsb_dbgmsg(a)                               \
00075       xsb_dbgmsg1 a
00076 /* in debug_xsb.c */
00077 #define dbg_print_subgoal(LOG_LEVEL,FP,SUBG)          \
00078    if (LOG_LEVEL <= cur_log_level)                    \
00079       print_subgoal(FP,SUBG)
00080 #define dbg_printterm(LOG_LEVEL,FP,TERM,DEPTH)        \
00081    if (LOG_LEVEL <= cur_log_level)                    \
00082       printterm(FP,TERM,DEPTH)
00083 #define dbg_print_completion_stack(LOG_LEVEL)         \
00084    if (LOG_LEVEL <= cur_log_level)                    \
00085       print_completion_stack()
00086 #define dbg_print_delay_list(LOG_LEVEL,FP,DLIST)      \
00087    if (LOG_LEVEL <= cur_log_level)                    \
00088       print_delay_list(FP,DLIST)
00089 
00090 /* in dynamic_stack.c */
00091 #define dbg_dsPrint(LOG_LEVEL,DS,COMMENT)             \
00092    if (LOG_LEVEL <= cur_log_level)                    \
00093       dsPrint(DS,COMMENT)
00094 
00095 
00096 #define dbg_smPrint(LOG_LEVEL,SM_RECORD,STRING)       \
00097    if (LOG_LEVEL <= cur_log_level)                    \
00098       smPrint(SM_RECORD,STRING)
00099 
00100 
00101 /* in tst_utils.c */
00102 #define dbg_printTriePathType(LOG_LEVEL,FP,TYPE,LEAF) \
00103    if (LOG_LEVEL <= cur_log_level)                    \
00104       printTriePathType(FP,TYPE,LEAF)
00105 #define dbg_printTrieNode(LOG_LEVEL,FP,PTN)           \
00106    if (LOG_LEVEL <= cur_log_level)                    \
00107       printTrieNode(FP,PTN)
00108 #define dbg_printAnswerTemplate(LOG_LEVEL,FP,PAT,S)   \
00109    if (LOG_LEVEL <= cur_log_level)                    \
00110       printAnswerTemplate(FP,PAT,S)
00111 extern void print_completion_stack(void);
00112 extern void print_subgoal(FILE *, VariantSF);
00113 extern void print_delay_list(FILE *, CPtr);
00114 extern void printterm(FILE *, Cell, int);
00115 #else
00116 
00117 #define xsb_dbgmsg(a)
00118 #define dbg_print_subgoal(L,F,S)
00119 #define dbg_printterm(L,F,T,D)
00120 #define dbg_print_completion_stack(L)
00121 #define dbg_print_delay_list(L,F,D)
00122 #define dbg_dsPrint(L,D,C)
00123 #define dbg_smPrint(L,SR,ST)
00124 #define dbg_printTriePathType(L,F,T,LF)
00125 #define dbg_printTrieNode(L,F,P)
00126 #define dbg_printAnswerTemplate(L,F,P,S)
00127 
00128 #endif
00129 #endif /* __DEBUG_XSB_H__ */

Generated on Wed Jul 26 13:30:40 2006 for XSB by  doxygen 1.4.5