builtin.c File Reference

#include "xsb_config.h"
#include "xsb_debug.h"
#include "debugs/debug_delay.h"
#include "context.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <signal.h>
#include <math.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include "auxlry.h"
#include "cell_xsb.h"
#include "error_xsb.h"
#include "psc_xsb.h"
#include "ubi_BinTree.h"
#include "ubi_SplayTree.h"
#include "hash_xsb.h"
#include "tries.h"
#include "choice.h"
#include "deref.h"
#include "memory_xsb.h"
#include "heap_xsb.h"
#include "register.h"
#include "flags_xsb.h"
#include "loader_xsb.h"
#include "binding.h"
#include "macro_xsb.h"
#include "builtin.h"
#include "sig_xsb.h"
#include "subp.h"
#include "tr_utils.h"
#include "trassert.h"
#include "dynload.h"
#include "cinterf.h"
#include "residual.h"
#include "tables.h"
#include "trie_internals.h"
#include "table_status_defs.h"
#include "rw_lock.h"
#include "deadlock.h"
#include "io_builtins_xsb.h"
#include "storage_xsb.h"
#include "wind2unix.h"
#include "system_xsb.h"
#include "random_xsb.h"
#include "thread_xsb.h"
#include "debug_xsb.h"
#include "ptoc_tag_xsb_i.h"
#include "term_psc_xsb_i.h"
#include "conget_xsb_i.h"
#include "io_builtins_xsb_i.h"
#include "std_pred_xsb_i.h"
#include "call_xsb_i.h"
#include "bineg_xsb_i.h"
#include "std_cases_xsb_i.h"

Data Structures

struct  psc_profile_count_struct

Defines

#define MAXSBUFFS   30
#define ptoc_addr(regnum)   (void *)ptoc_int(CTXTc regnum)
#define is_encoded_addr(term)   (isinteger(term) || isboxedinteger(term))
#define decode_addr(term)   (void *)oint_val(term)
#define ctop_addr(regnum, val)   ctop_int(CTXTc regnum, (prolog_int)val)
#define mini_undo_bindings
#define mini_bind_variable(addr)
#define BuiltinName(Code)   ( (char *)builtin_table[Code][0] )
#define set_builtin_table(Code, String)   builtin_table[Code][0] = (Cell)(String);
#define initial_psc_profile_count_size   100
#define prof_tab_incr   10000
#define MAX_BACKTRACE_LENGTH   50

Typedefs

typedef psc_profile_count_struct psc_profile_count

Functions

token_tGetToken (CTXTdeclc FILE *, STRFILE *, int)
int sys_syscall (CTXTdeclc int)
xsbBool sys_system (CTXTdeclc int)
xsbBool formatted_io (CTXTdecl)
xsbBool read_canonical (CTXTdecl)
xsbBool private_builtin (void)
void xsb_segfault_quitter (int err)
xsbBool startProfileThread ()
void dump_prof_table ()
void retrieve_prof_table ()
xsbBool assert_code_to_buff (CTXTdecl)
xsbBool assert_buff_to_clref (CTXTdecl)
xsbBool gen_retract_all (CTXTdecl)
xsbBool db_retract0 (CTXTdecl)
xsbBool db_get_clause (CTXTdecl)
xsbBool db_get_last_clause (CTXTdecl)
xsbBool db_build_prref (CTXTdecl)
xsbBool db_abolish0 (CTXTdecl)
xsbBool db_reclaim0 (CTXTdecl)
xsbBool db_get_prref (CTXTdecl)
xsbBool dynamic_code_function (CTXTdecl)
char * dirname_canonic (char *)
xsbBool almost_search_module (CTXTdeclc char *)
char * expand_filename (char *filename)
char * existing_file_extension (char *)
char * tilde_expand_filename (char *filename)
xsbBool is_absolute_filename (char *filename)
void parse_filename (char *filenam, char **dir, char **base, char **ext)
int print_xsb_backtrace (CTXTdecl)
prolog_term build_xsb_backtrace (CTXTdecl)
xsbBool xsb_socket_request (CTXTdecl)
int findall_init (CTXTdecl)
int findall_add (CTXTdecl)
int findall_get_solutions (CTXTdecl)
int copy_term (CTXTdecl)
xsbBool substring (CTXTdecl)
xsbBool string_substitute (CTXTdecl)
xsbBool str_cat (CTXTdecl)
xsbBool str_sub (void)
xsbBool str_match (CTXTdecl)
void force_answer_true (BTNptr)
void force_answer_false (BTNptr)
int set_scope_marker (CTXTdecl)
int unwind_stack (CTXTdecl)
int clean_up_block (CTXTdecl)
BTNptr trie_asserted_trienode (CPtr clref)
int gc_dynamic (CTXTdecl)
DllExport prolog_int call_conv ptoc_int (CTXTdeclc int regnum)
DllExport prolog_float call_conv ptoc_float (CTXTdeclc int regnum)
DllExport char *call_conv ptoc_string (CTXTdeclc int regnum)
DllExport prolog_float call_conv ptoc_number (CTXTdeclc int regnum)
void constructString (CTXTdeclc Cell addr, int ivstr)
DllExport char *call_conv ptoc_longstring (CTXTdeclc int regnum)
DllExport void call_conv ctop_int (CTXTdeclc int regnum, prolog_int value)
DllExport void call_conv ctop_float (CTXTdeclc int regnum, prolog_float value)
DllExport void call_conv ctop_string (CTXTdeclc int regnum, char *value)
DllExport void call_conv extern_ctop_string (CTXTdeclc int regnum, char *value)
static void ctop_constr (CTXTdeclc int regnum, Pair psc_pair)
static void ctop_tag (CTXTdeclc int regnum, Cell term)
Cell val_to_hash (Cell term)
Cell det_val_to_hash (Cell term)
static int ground (CTXTdeclc CPtr temp)
int is_proper_list (Cell term)
int is_most_general_term (Cell term)
static void xsb_fprint_variable (CTXTdeclc FILE *fptr, CPtr var)
void xsb_sprint_variable (CTXTdeclc char *sptr, CPtr var)
void init_builtin_table (void)
int builtin_call (CTXTdeclc byte number)
void add_to_profile_count_table (Psc apsc, int count)
int compareItemNode (ubi_btItemPtr itemPtr, ubi_btNodePtr nodePtr)
void log_prog_ctr (CTXTdeclc byte *lpcreg)
void add_prog_seg (Psc psc, byte *code_addr, long code_len)
void remove_prog_seg (byte *code_addr)
void retrieve_prof_table (CTXTdecl)
Psc psc_from_code_addr (byte *code_addr)

Variables

int mem_flag
int xsb_profiling_enabled
long if_profiling = 0
long profile_thread_started = 0
static long prof_unk_count = 0
static long prof_total = 0
static long total_prog_segments = 0
static long prof_table_length = 0
static long prof_table_count = 0
double realtime_count_gl
Cell flags [MAX_FLAGS]
Cell pflags [MAX_PRIVATE_FLAGS]
static VarStringLSBuff [MAXSBUFFS] = {NULL}
Cell builtin_table [BUILTIN_TBL_SZ][2]
ubi_btRoot TreeRoot
ubi_btRootPtr RootPtr = NULL
ubi_btNodePtr prof_table
ubi_btNodePtr prof_table_free = NULL
static psc_profile_countpsc_profile_count_table = NULL
static int psc_profile_count_max = 0
static int psc_profile_count_num = 0
Psc p3psc = NULL

Define Documentation

#define BuiltinName Code   )     ( (char *)builtin_table[Code][0] )
 

#define ctop_addr regnum,
val   )     ctop_int(CTXTc regnum, (prolog_int)val)
 

#define decode_addr term   )     (void *)oint_val(term)
 

#define initial_psc_profile_count_size   100
 

#define is_encoded_addr term   )     (isinteger(term) || isboxedinteger(term))
 

#define MAX_BACKTRACE_LENGTH   50
 

#define MAXSBUFFS   30
 

#define mini_bind_variable addr   ) 
 

Value:

follow(addr) = makenil;                 \
   *(++mini_trail_top) = (CPtr)addr;

#define mini_undo_bindings
 

Value:

while (mini_trail_top >= mini_trail) {  \
        untrail(*mini_trail_top);               \
        mini_trail_top--;                       \
    }

#define prof_tab_incr   10000
 

#define ptoc_addr regnum   )     (void *)ptoc_int(CTXTc regnum)
 

#define set_builtin_table Code,
String   )     builtin_table[Code][0] = (Cell)(String);
 


Typedef Documentation

typedef struct psc_profile_count_struct psc_profile_count
 


Function Documentation

void add_prog_seg Psc  psc,
byte code_addr,
long  code_len
 

void add_to_profile_count_table Psc  apsc,
int  count
 

xsbBool almost_search_module CTXTdeclc char *   ) 
 

xsbBool assert_buff_to_clref CTXTdecl   ) 
 

xsbBool assert_code_to_buff CTXTdecl   ) 
 

prolog_term build_xsb_backtrace CTXTdecl   ) 
 

int builtin_call CTXTdeclc byte  number  ) 
 

int clean_up_block CTXTdecl   ) 
 

int compareItemNode ubi_btItemPtr  itemPtr,
ubi_btNodePtr  nodePtr
 

void constructString CTXTdeclc Cell  addr,
int  ivstr
 

int copy_term CTXTdecl   ) 
 

static void ctop_constr CTXTdeclc int  regnum,
Pair  psc_pair
[inline, static]
 

DllExport void call_conv ctop_float CTXTdeclc int  regnum,
prolog_float  value
 

DllExport void call_conv ctop_int CTXTdeclc int  regnum,
prolog_int  value
 

DllExport void call_conv ctop_string CTXTdeclc int  regnum,
char *  value
 

static void ctop_tag CTXTdeclc int  regnum,
Cell  term
[inline, static]
 

xsbBool db_abolish0 CTXTdecl   ) 
 

xsbBool db_build_prref CTXTdecl   ) 
 

xsbBool db_get_clause CTXTdecl   ) 
 

xsbBool db_get_last_clause CTXTdecl   ) 
 

xsbBool db_get_prref CTXTdecl   ) 
 

xsbBool db_reclaim0 CTXTdecl   ) 
 

xsbBool db_retract0 CTXTdecl   ) 
 

Cell det_val_to_hash Cell  term  ) 
 

char* dirname_canonic char *   ) 
 

void dump_prof_table  ) 
 

xsbBool dynamic_code_function CTXTdecl   ) 
 

char* existing_file_extension char *   ) 
 

char* expand_filename char *  filename  ) 
 

DllExport void call_conv extern_ctop_string CTXTdeclc int  regnum,
char *  value
 

int findall_add CTXTdecl   ) 
 

int findall_get_solutions CTXTdecl   ) 
 

int findall_init CTXTdecl   ) 
 

void force_answer_false BTNptr   ) 
 

void force_answer_true BTNptr   ) 
 

xsbBool formatted_io CTXTdecl   ) 
 

int gc_dynamic CTXTdecl   ) 
 

xsbBool gen_retract_all CTXTdecl   ) 
 

struct token_t* GetToken CTXTdeclc FILE *  ,
STRFILE *  ,
int 
 

static int ground CTXTdeclc CPtr  temp  )  [static]
 

void init_builtin_table void   ) 
 

xsbBool is_absolute_filename char *  filename  ) 
 

int is_most_general_term Cell  term  ) 
 

int is_proper_list Cell  term  ) 
 

void log_prog_ctr CTXTdeclc byte lpcreg  ) 
 

void parse_filename char *  filenam,
char **  dir,
char **  base,
char **  ext
 

int print_xsb_backtrace CTXTdecl   ) 
 

xsbBool private_builtin void   ) 
 

Psc psc_from_code_addr byte code_addr  ) 
 

DllExport prolog_float call_conv ptoc_float CTXTdeclc int  regnum  ) 
 

DllExport prolog_int call_conv ptoc_int CTXTdeclc int  regnum  ) 
 

DllExport char* call_conv ptoc_longstring CTXTdeclc int  regnum  ) 
 

DllExport prolog_float call_conv ptoc_number CTXTdeclc int  regnum  ) 
 

DllExport char* call_conv ptoc_string CTXTdeclc int  regnum  ) 
 

xsbBool read_canonical CTXTdecl   ) 
 

void remove_prog_seg byte code_addr  ) 
 

void retrieve_prof_table CTXTdecl   ) 
 

void retrieve_prof_table  ) 
 

int set_scope_marker CTXTdecl   ) 
 

xsbBool startProfileThread  ) 
 

xsbBool str_cat CTXTdecl   ) 
 

xsbBool str_match CTXTdecl   ) 
 

xsbBool str_sub void   ) 
 

xsbBool string_substitute CTXTdecl   ) 
 

xsbBool substring CTXTdecl   ) 
 

int sys_syscall CTXTdeclc  int  ) 
 

xsbBool sys_system CTXTdeclc  int  ) 
 

char* tilde_expand_filename char *  filename  ) 
 

BTNptr trie_asserted_trienode CPtr  clref  ) 
 

int unwind_stack CTXTdecl   ) 
 

Cell val_to_hash Cell  term  ) 
 

static void xsb_fprint_variable CTXTdeclc FILE *  fptr,
CPtr  var
[inline, static]
 

void xsb_segfault_quitter int  err  ) 
 

xsbBool xsb_socket_request CTXTdecl   ) 
 

void xsb_sprint_variable CTXTdeclc char *  sptr,
CPtr  var
 


Variable Documentation

Cell builtin_table[BUILTIN_TBL_SZ][2]
 

Cell flags[MAX_FLAGS]
 

long if_profiling = 0
 

VarString* LSBuff[MAXSBUFFS] = {NULL} [static]
 

int mem_flag
 

Psc p3psc = NULL
 

Cell pflags[MAX_PRIVATE_FLAGS]
 

ubi_btNodePtr prof_table
 

long prof_table_count = 0 [static]
 

ubi_btNodePtr prof_table_free = NULL
 

long prof_table_length = 0 [static]
 

long prof_total = 0 [static]
 

long prof_unk_count = 0 [static]
 

long profile_thread_started = 0
 

int psc_profile_count_max = 0 [static]
 

int psc_profile_count_num = 0 [static]
 

psc_profile_count* psc_profile_count_table = NULL [static]
 

double realtime_count_gl
 

ubi_btRootPtr RootPtr = NULL
 

long total_prog_segments = 0 [static]
 

ubi_btRoot TreeRoot
 

int xsb_profiling_enabled
 


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