#include "xsb_config.h"#include "xsb_debug.h"#include <stdio.h>#include <signal.h>#include <errno.h>#include <string.h>#include <stdlib.h>#include <unistd.h>#include <sys/stat.h>#include "setjmp_xsb.h"#include "auxlry.h"#include "cell_xsb.h"#include "context.h"#include "error_xsb.h"#include "cinterf.h"#include "memory_xsb.h"#include "psc_xsb.h"#include "heap_xsb.h"#include "register.h"#include "flags_xsb.h"#include "inst_xsb.h"#include "loader_xsb.h"#include "subp.h"#include "tries.h"#include "choice.h"#include "macro_xsb.h"#include "io_builtins_xsb.h"#include "wind2unix.h"#include "binding.h"#include "deref.h"#include "findall.h"#include "heap_defs_xsb.h"#include "ptoc_tag_xsb_i.h"Data Structures | |
| struct | fmt_spec |
| struct | next_fmt_state |
Defines | |
| #define | current_substr_start (fmt_state->_current_substr_start) |
| #define | workspace (*(fmt_state->_workspace)) |
| #define | saved_char (fmt_state->_saved_char) |
| #define | TYPE_ERROR_CHK(ch_type, Label) |
| #define | PRINT_ARG(arg) |
| #define | CHECK_ARITY(i, Arity, Label) |
| #define | SPRINT_ARG(arg) |
| #define | FmtBuf (*tsgSBuff1) |
| #define | StrArgBuf (*tsgSBuff2) |
| #define | MAX_SPRINTF_STRING_SIZE MAX_IO_BUFSIZE |
| #define | SAFE_OUT_SIZE MAX_SPRINTF_STRING_SIZE/2 |
| #define | OutString (*tsgLBuff1) |
| #define | FmtBuf (*tsgSBuff1) |
| #define | StrArgBuf (*tsgSBuff2) |
| #define | FmtBuf (*tsgSBuff1) |
| #define | StrArgBuf (*tsgSBuff2) |
| #define | aux_fmt (*tsgLBuff1) |
| #define | ensure_term_space(ptr, size) |
| #define | free_term_buffer() findall_free(CTXTc findall_chunk_index) |
| #define | INIT_STK_SIZE 32 |
| #define | MAX_INIT_STK_SIZE 1000 |
| #define | FUNFUN 0 |
| #define | FUNLIST 1 |
| #define | FUNDTLIST 2 |
| #define | FUNCOMMALIST 3 |
| #define | setvar(loc, op1) |
| #define | expand_opstk |
| #define | expand_funstk |
| #define | wcan_string tsgLBuff1 |
| #define | wcan_atombuff tsgLBuff2 |
| #define | wcan_buff tsgSBuff1 |
Functions | |
| void | next_format_substr (CTXTdeclc char *, struct next_fmt_state *, struct fmt_spec *, int, int) |
| char * | p_charlist_to_c_string (CTXTdeclc prolog_term, VarString *, char *, char *) |
| xsbBool | fmt_write (CTXTdecl) |
| xsbBool | fmt_write_string (CTXTdecl) |
| xsbBool | fmt_read (CTXTdecl) |
| xsbBool | formatted_io (CTXTdecl) |
| CPtr | init_term_buffer (CTXTdeclc int *findall_chunk_index) |
| static int | read_can_error (CTXTdeclc FILE *filep, STRFILE *instr, int prevchar, Cell prologvar, int findall_chunk_index) |
| int | read_canonical (CTXTdecl) |
| Cell | read_canonical_return_var (CTXTdeclc int code) |
| void | bld_boxedfloat_here (CTXTdeclc CPtr *h, CPtr addr, Float value) |
| int | read_canonical_term (CTXTdeclc FILE *filep, STRFILE *instr, int return_location_code) |
| int | xsb_intern_fileptr (FILE *fptr, char *context, char *name, char *strmode) |
| int | xsb_intern_file (char *context, char *addr, int *ioport, char *strmode, int opennew) |
| void | mark_open_filenames () |
| xsbBool | quotes_are_needed (char *string) |
| void | double_quotes (char *string, char *new_string) |
| void | write_quotedname (FILE *file, char *string) |
| void call_conv | write_canonical_term_rec (CTXTdeclc Cell prologterm, int letter_flag) |
| DllExport void call_conv | write_canonical_term (CTXTdeclc Cell prologterm, int letter_flag) |
| void | print_term_canonical (CTXTdeclc FILE *fptr, Cell prologterm, int letterflag) |
Variables | |
| stream_record | open_files [MAX_OPEN_FILES] |
| static Psc | prevpsc = 0 |
| int | opstk_size = 0 |
| int | funstk_size = 0 |
| funstktype * | funstk |
| opstktype * | opstk |
| vartype | rc_vars [MAXVAR] |
| static Psc | dollar_var_psc = NULL |
|
|
|
|
|
Value: |
|
|
|
|
|
Value: if ((ptr+size) > (current_findall->current_chunk + FINDALL_CHUNCK_SIZE -1)) {\ if (!get_more_chunk(CTXT)) xsb_abort("Cannot allocate space for term buffer") ;\ ptr = current_findall->top_of_chunk ;\ } |
|
|
Value: {\
funstk_size = funstk_size+funstk_size;\
funstk = (struct funstktype *)mem_realloc(funstk,(funstk_size/2)*sizeof(struct funstktype),\
funstk_size*sizeof(struct funstktype),READ_CAN_SPACE);\
if (!funstk) xsb_abort("[READ CANONICAL] Out of space for function stack");\
/*printf("RC funstk expanded to %d\n",funstk_size);*/ \
}
|
|
|
Value: {\
opstk_size = opstk_size+opstk_size;\
opstk = (struct opstktype *)mem_realloc(opstk,(opstk_size/2)*sizeof(struct opstktype),\
opstk_size*sizeof(struct opstktype),READ_CAN_SPACE);\
if (!opstk) xsb_abort("[READ_CANONICAL] Out of space for operand stack");\
/*printf("RC opstk expanded to %d\n",opstk_size);*/ \
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Value: |
|
|
|
|
|
|
|
|
Value: |
|
|
Value: XSB_StrEnsureSize(&OutString, OutString.length+SAFE_OUT_SIZE); \ switch (current_fmt_spec->size) { \ case 1: sprintf(OutString.string+OutString.length, \ current_fmt_spec->fmt, arg); \ bytes_formatted = strlen(OutString.string+OutString.length); \ break; \ case 2: sprintf(OutString.string+OutString.length, \ current_fmt_spec->fmt, width, arg); \ bytes_formatted = strlen(OutString.string+OutString.length); \ break; \ case 3: sprintf(OutString.string+OutString.length, \ current_fmt_spec->fmt, \ width, precision, arg); \ bytes_formatted = strlen(OutString.string+OutString.length); \ break; \ } \ OutString.length += bytes_formatted; \ XSB_StrNullTerminate(&OutString); |
|
|
|
|
|
|
|
|
|
|
|
Value: |
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||||||
|
|
|
||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||||||||||||||
|
|
|
||||||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
|
|
|
||||||||||||||||||||||||
|
|
|
|
|
|
|
|
|
||||||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||||||||||||||
|
|
|
||||||||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1.4.5