more cleanups.
This commit is contained in:
parent
6f1537475f
commit
da1df3d851
@ -327,7 +327,6 @@
|
||||
|
||||
#define Bool int
|
||||
#define flt double
|
||||
#define YAP_Term Term
|
||||
#define C_INTERFACE
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -348,7 +347,6 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include "iopreds.h"
|
||||
#define HAS_YAP_H 1
|
||||
#include "yap_structs.h"
|
||||
#ifdef TABLING
|
||||
#include "tab.macros.h"
|
||||
|
4
H/Yap.h
4
H/Yap.h
@ -13,6 +13,9 @@
|
||||
* version: $Id: Yap.h,v 1.38 2008-06-18 10:02:27 vsc Exp $ *
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef YAP_H
|
||||
#define YAP_H 1
|
||||
|
||||
#include "config.h"
|
||||
#if defined(ENV_COPY) || defined(TABLING) || defined(THREADS)
|
||||
#include "opt.config.h"
|
||||
@ -1338,3 +1341,4 @@ Yap_CurrentSlot(void) {
|
||||
return IntOfTerm(ASP[0]);
|
||||
}
|
||||
|
||||
#endif /* YAP_H */
|
||||
|
@ -211,7 +211,6 @@ IOLIB_SOURCES=$(srcdir)/packages/PLStream/pl-buffer.c $(srcdir)/packages/PLStrea
|
||||
$(srcdir)/packages/PLStream/pl-stream.c $(srcdir)/packages/PLStream/pl-string.c \
|
||||
$(srcdir)/packages/PLStream/pl-table.c \
|
||||
$(srcdir)/packages/PLStream/pl-text.c \
|
||||
$(srcdir)/packages/PLStream/pl-util.c \
|
||||
$(srcdir)/packages/PLStream/pl-write.c \
|
||||
$(srcdir)/packages/PLStream/pl-yap.c @ENABLE_WINCONSOLE@ $(srcdir)/packages/PLStream/popen.c $(srcdir)/packages/PLStream/uxnt/uxnt.c
|
||||
|
||||
@ -329,7 +328,7 @@ IOLIB_OBJECTS=pl-buffer.o pl-codelist.o pl-ctype.o pl-dtoa.o pl-error.o \
|
||||
pl-read.o \
|
||||
pl-rl.o \
|
||||
pl-stream.o pl-string.o pl-table.o \
|
||||
pl-text.o pl-util.o pl-utf8.o \
|
||||
pl-text.o pl-utf8.o \
|
||||
pl-write.o \
|
||||
pl-yap.o @ENABLE_WINCONSOLE@ uxnt.o
|
||||
|
||||
@ -611,9 +610,6 @@ pl-text.o: $(srcdir)/packages/PLStream/pl-text.c
|
||||
pl-utf8.o: $(srcdir)/packages/PLStream/pl-utf8.c
|
||||
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream $(srcdir)/packages/PLStream/pl-utf8.c -o $@
|
||||
|
||||
pl-util.o: $(srcdir)/packages/PLStream/pl-util.c
|
||||
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream $(srcdir)/packages/PLStream/pl-util.c -o $@
|
||||
|
||||
pl-write.o: $(srcdir)/packages/PLStream/pl-write.c
|
||||
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/packages/PLStream $(srcdir)/packages/PLStream/pl-write.c -o $@
|
||||
|
||||
|
@ -317,18 +317,20 @@ static inline CELL *exec_substitution_loop(gt_node_ptr current_node, CELL **stac
|
||||
} else if (IsApplTerm(t)) {
|
||||
Functor f = (Functor) RepAppl(t);
|
||||
if (f == FunctorDouble) {
|
||||
volatile Float dbl;
|
||||
volatile Term *t_dbl = (Term *)((void *) &dbl);
|
||||
union {
|
||||
Term t_dbl[sizeof(Float)/sizeof(Term)];
|
||||
Float dbl;
|
||||
} u;
|
||||
t = TrNode_entry(current_node);
|
||||
current_node = TrNode_parent(current_node);
|
||||
t_dbl[0] = t;
|
||||
u.t_dbl[0] = t;
|
||||
#if SIZEOF_DOUBLE == 2 * SIZEOF_INT_P
|
||||
t = TrNode_entry(current_node);
|
||||
current_node = TrNode_parent(current_node);
|
||||
t_dbl[1] = t;
|
||||
u.t_dbl[1] = t;
|
||||
#endif /* SIZEOF_DOUBLE x SIZEOF_INT_P */
|
||||
current_node = TrNode_parent(current_node);
|
||||
t = MkFloatTerm(dbl);
|
||||
t = MkFloatTerm(u.dbl);
|
||||
} else if (f == FunctorLongInt) {
|
||||
Int li = TrNode_entry(current_node);
|
||||
current_node = TrNode_parent(current_node);
|
||||
@ -819,17 +821,22 @@ static inline void traverse_trie_node(Term t, char *str, int *str_index_ptr, int
|
||||
arity[arity[0]] = (int) t;
|
||||
mode = TRAVERSE_MODE_DOUBLE2;
|
||||
} else if (mode == TRAVERSE_MODE_DOUBLE2) {
|
||||
volatile Float dbl = 0;
|
||||
volatile Term *t_dbl = (Term *)((void *) &dbl);
|
||||
t_dbl[0] = t;
|
||||
t_dbl[1] = (Term) arity[arity[0]];
|
||||
union {
|
||||
Term t_dbl[sizeof(Float)/sizeof(Term)];
|
||||
Float dbl;
|
||||
} u;
|
||||
u.dbl = 0.0;
|
||||
u.t_dbl[0] = t;
|
||||
u.t_dbl[1] = (Term) arity[arity[0]];
|
||||
arity[0]--;
|
||||
#else /* SIZEOF_DOUBLE == SIZEOF_INT_P */
|
||||
volatile Float dbl;
|
||||
volatile Term *t_dbl = (Term *)((void *) &dbl);
|
||||
t_dbl[0] = t;
|
||||
union {
|
||||
Term t_dbl[sizeof(Float)/sizeof(Term)];
|
||||
Float dbl;
|
||||
} u;
|
||||
u.t_dbl[0] = t;
|
||||
#endif /* SIZEOF_DOUBLE x SIZEOF_INT_P */
|
||||
str_index += sprintf(& str[str_index], "%.15g", dbl);
|
||||
str_index += sprintf(& str[str_index], "%.15g", u.dbl);
|
||||
traverse_update_arity(str, &str_index, arity);
|
||||
if (type == TRAVERSE_TYPE_SUBGOAL)
|
||||
mode = TRAVERSE_MODE_NORMAL;
|
||||
|
@ -938,13 +938,16 @@ static inline sg_node_ptr subgoal_search_loop(tab_ent_ptr tab_ent, sg_node_ptr c
|
||||
} else if (IsApplTerm(t)) {
|
||||
Functor f = FunctorOfTerm(t);
|
||||
if (f == FunctorDouble) {
|
||||
volatile Float dbl = FloatOfTerm(t);
|
||||
volatile Term *t_dbl = (Term *)((void *) &dbl);
|
||||
union {
|
||||
Term t_dbl[sizeof(Float)/sizeof(Term)];
|
||||
Float dbl;
|
||||
} u;
|
||||
u.dbl = FloatOfTerm(t);
|
||||
SUBGOAL_CHECK_INSERT_ENTRY(tab_ent, current_node, AbsAppl((Term *)f));
|
||||
#if SIZEOF_DOUBLE == 2 * SIZEOF_INT_P
|
||||
SUBGOAL_CHECK_INSERT_ENTRY(tab_ent, current_node, t_dbl[1]);
|
||||
SUBGOAL_CHECK_INSERT_ENTRY(tab_ent, current_node, u.t_dbl[1]);
|
||||
#endif /* SIZEOF_DOUBLE x SIZEOF_INT_P */
|
||||
SUBGOAL_CHECK_INSERT_ENTRY(tab_ent, current_node, t_dbl[0]);
|
||||
SUBGOAL_CHECK_INSERT_ENTRY(tab_ent, current_node, u.t_dbl[0]);
|
||||
#ifdef MODE_GLOBAL_TRIE_LOOP
|
||||
SUBGOAL_CHECK_INSERT_ENTRY(tab_ent, current_node, AbsAppl((Term *)f));
|
||||
#endif /* MODE_GLOBAL_TRIE_LOOP */
|
||||
@ -1153,13 +1156,16 @@ static inline ans_node_ptr answer_search_loop(sg_fr_ptr sg_fr, ans_node_ptr curr
|
||||
} else if (IsApplTerm(t)) {
|
||||
Functor f = FunctorOfTerm(t);
|
||||
if (f == FunctorDouble) {
|
||||
volatile Float dbl = FloatOfTerm(t);
|
||||
volatile Term *t_dbl = (Term *)((void *) &dbl);
|
||||
union {
|
||||
Term t_dbl[sizeof(Float)/sizeof(Term)];
|
||||
Float dbl;
|
||||
} u;
|
||||
u.dbl = FloatOfTerm(t);
|
||||
ANSWER_CHECK_INSERT_ENTRY(sg_fr, current_node, AbsAppl((Term *)f), _trie_retry_null + in_pair);
|
||||
#if SIZEOF_DOUBLE == 2 * SIZEOF_INT_P
|
||||
ANSWER_CHECK_INSERT_ENTRY(sg_fr, current_node, t_dbl[1], _trie_retry_extension);
|
||||
ANSWER_CHECK_INSERT_ENTRY(sg_fr, current_node, u.t_dbl[1], _trie_retry_extension);
|
||||
#endif /* SIZEOF_DOUBLE x SIZEOF_INT_P */
|
||||
ANSWER_CHECK_INSERT_ENTRY(sg_fr, current_node, t_dbl[0], _trie_retry_extension);
|
||||
ANSWER_CHECK_INSERT_ENTRY(sg_fr, current_node, u.t_dbl[0], _trie_retry_extension);
|
||||
ANSWER_CHECK_INSERT_ENTRY(sg_fr, current_node, AbsAppl((Term *)f), _trie_retry_double);
|
||||
} else if (f == FunctorLongInt) {
|
||||
Int li = LongIntOfTerm (t);
|
||||
@ -1307,18 +1313,20 @@ static inline CELL *load_answer_loop(ans_node_ptr current_node) {
|
||||
} else if (IsApplTerm(t)) {
|
||||
Functor f = (Functor) RepAppl(t);
|
||||
if (f == FunctorDouble) {
|
||||
volatile Float dbl;
|
||||
volatile Term *t_dbl = (Term *)((void *) &dbl);
|
||||
union {
|
||||
Term t_dbl[sizeof(Float)/sizeof(Term)];
|
||||
Float dbl;
|
||||
} u;
|
||||
t = TrNode_entry(current_node);
|
||||
current_node = TrNode_parent(current_node);
|
||||
t_dbl[0] = t;
|
||||
u.t_dbl[0] = t;
|
||||
#if SIZEOF_DOUBLE == 2 * SIZEOF_INT_P
|
||||
t = TrNode_entry(current_node);
|
||||
current_node = TrNode_parent(current_node);
|
||||
t_dbl[1] = t;
|
||||
u.t_dbl[1] = t;
|
||||
#endif /* SIZEOF_DOUBLE x SIZEOF_INT_P */
|
||||
current_node = TrNode_parent(current_node);
|
||||
t = MkFloatTerm(dbl);
|
||||
t = MkFloatTerm(u.dbl);
|
||||
} else if (f == FunctorLongInt) {
|
||||
Int li = TrNode_entry(current_node);
|
||||
current_node = TrNode_parent(current_node);
|
||||
|
@ -209,6 +209,8 @@
|
||||
#undef HAVE_LOCALTIME
|
||||
#undef HAVE_LSTAT
|
||||
#undef HAVE_MALLINFO
|
||||
#undef HAVE_MBSCASECOLL
|
||||
#undef HAVE_MBSCOLL
|
||||
#undef HAVE_MBSNRTOWCS
|
||||
#undef HAVE_MEMCPY
|
||||
#undef HAVE_MEMMOVE
|
||||
@ -230,11 +232,14 @@
|
||||
#undef HAVE_RENAME
|
||||
#undef HAVE_RINT
|
||||
#undef HAVE_RL_CLEAR_PENDING_INPUT
|
||||
#undef HAVE_RL_CLEANUP_AFTER_SIGNAL
|
||||
#undef HAVE_RL_COMPLETION_MATCHES
|
||||
#undef HAVE_RL_EVENT_HOOK
|
||||
#undef HAVE_RL_FILENAME_COMPLETION_FUNCTION
|
||||
#undef HAVE_RL_FREE_LINE_STATE
|
||||
#undef HAVE_RL_INSERT_CLOSE
|
||||
#undef HAVE_RL_SET_PROMPT
|
||||
#undef HAVE_RL_STATE_INITIALIZED
|
||||
#undef HAVE_SBRK
|
||||
#undef HAVE_SELECT
|
||||
#undef HAVE_SETBUF
|
||||
|
62
configure
vendored
62
configure
vendored
@ -7975,35 +7975,17 @@ fi
|
||||
|
||||
done
|
||||
|
||||
ac_fn_c_check_func "$LINENO" "rl_completion_matches " "ac_cv_func_rl_completion_matches_"
|
||||
if test "x$ac_cv_func_rl_completion_matches_" = x""yes; then :
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_func "$LINENO" "rl_insert_close " "ac_cv_func_rl_insert_close_"
|
||||
if test "x$ac_cv_func_rl_insert_close_" = x""yes; then :
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_func "$LINENO" "rl_filename_completion_function " "ac_cv_func_rl_filename_completion_function_"
|
||||
if test "x$ac_cv_func_rl_filename_completion_function_" = x""yes; then :
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_func "$LINENO" "rl_free_line_state " "ac_cv_func_rl_free_line_state_"
|
||||
if test "x$ac_cv_func_rl_free_line_state_" = x""yes; then :
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_func "$LINENO" "rl_set_prompt " "ac_cv_func_rl_set_prompt_"
|
||||
if test "x$ac_cv_func_rl_set_prompt_" = x""yes; then :
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_func "$LINENO" "rl_clear_pending_input " "ac_cv_func_rl_clear_pending_input_"
|
||||
if test "x$ac_cv_func_rl_clear_pending_input_" = x""yes; then :
|
||||
for ac_func in rl_completion_matches rl_clear_pending_input rl_cleanup_after_signal rl_event_hook rl_filename_completion_function rl_free_line_state rl_insert_close rl_set_prompt rl_state_initialized
|
||||
do :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
fi
|
||||
for ac_header in mpi.h
|
||||
@ -8934,6 +8916,28 @@ _ACEOF
|
||||
fi
|
||||
done
|
||||
|
||||
for ac_func in mbscoll
|
||||
do :
|
||||
ac_fn_c_check_func "$LINENO" "mbscoll" "ac_cv_func_mbscoll"
|
||||
if test "x$ac_cv_func_mbscoll" = x""yes; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_MBSCOLL 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
for ac_func in mbscasecoll
|
||||
do :
|
||||
ac_fn_c_check_func "$LINENO" "mbscasecoll" "ac_cv_func_mbscasecoll"
|
||||
if test "x$ac_cv_func_mbscasecoll" = x""yes; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_MBSCASECOLL 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
for ac_func in mbsnrtowcs
|
||||
do :
|
||||
ac_fn_c_check_func "$LINENO" "mbsnrtowcs" "ac_cv_func_mbsnrtowcs"
|
||||
@ -8981,7 +8985,7 @@ _ACEOF
|
||||
fi
|
||||
done
|
||||
|
||||
for ac_func in rename rint rl_set_prompt sbrk select
|
||||
for ac_func in rename rint sbrk select setbuf
|
||||
do :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||
@ -8993,7 +8997,7 @@ _ACEOF
|
||||
fi
|
||||
done
|
||||
|
||||
for ac_func in setbuf setitimer setsid setlinebuf sigaction
|
||||
for ac_func in setitimer setlocale setsid setlinebuf sigaction
|
||||
do :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||
|
13
configure.in
13
configure.in
@ -1380,12 +1380,7 @@ if test "$yap_cv_readline" != "no"
|
||||
then
|
||||
AC_CHECK_HEADERS( readline/readline.h)
|
||||
AC_CHECK_HEADERS( readline/history.h)
|
||||
AC_CHECK_FUNC( rl_completion_matches )
|
||||
AC_CHECK_FUNC( rl_insert_close )
|
||||
AC_CHECK_FUNC( rl_filename_completion_function )
|
||||
AC_CHECK_FUNC( rl_free_line_state )
|
||||
AC_CHECK_FUNC( rl_set_prompt )
|
||||
AC_CHECK_FUNC( rl_clear_pending_input )
|
||||
AC_CHECK_FUNCS( rl_completion_matches rl_clear_pending_input rl_cleanup_after_signal rl_event_hook rl_filename_completion_function rl_free_line_state rl_insert_close rl_set_prompt rl_state_initialized )
|
||||
fi
|
||||
AC_CHECK_HEADERS(mpi.h)
|
||||
AC_CHECK_HEADERS(mpe.h)
|
||||
@ -1676,12 +1671,14 @@ AC_CHECK_FUNCS(gethrtime getpagesize)
|
||||
AC_CHECK_FUNCS(getpwnam getrlimit getrusage gettimeofday getwd)
|
||||
AC_CHECK_FUNCS(isatty isnan isinf kill labs link lgamma)
|
||||
AC_CHECK_FUNCS(localtime lstat mallinfo)
|
||||
AC_CHECK_FUNCS(mbscoll)
|
||||
AC_CHECK_FUNCS(mbscasecoll)
|
||||
AC_CHECK_FUNCS(mbsnrtowcs)
|
||||
AC_CHECK_FUNCS(memcpy memmove mkstemp mktemp)
|
||||
AC_CHECK_FUNCS(nanosleep mktime opendir)
|
||||
AC_CHECK_FUNCS(putenv rand random readlink regexec)
|
||||
AC_CHECK_FUNCS(rename rint rl_set_prompt sbrk select)
|
||||
AC_CHECK_FUNCS(setbuf setitimer setsid setlinebuf sigaction)
|
||||
AC_CHECK_FUNCS(rename rint sbrk select setbuf)
|
||||
AC_CHECK_FUNCS(setitimer setlocale setsid setlinebuf sigaction)
|
||||
AC_CHECK_FUNCS(siggetmask siginterrupt)
|
||||
AC_CHECK_FUNCS(signal sigprocmask socket stat)
|
||||
AC_CHECK_FUNCS(strchr strerror stricmp strncat strncpy strtod)
|
||||
|
@ -25,7 +25,31 @@
|
||||
#define CONST /* empty */
|
||||
#endif
|
||||
|
||||
#ifndef HAS_YAP_H
|
||||
#ifdef YAP_H
|
||||
|
||||
/* if Yap.h is available, just reexport */
|
||||
|
||||
typedef CELL YAP_CELL;
|
||||
|
||||
typedef Term YAP_Term;
|
||||
|
||||
typedef CELL YAP_Arity;
|
||||
|
||||
typedef Term YAP_Module;
|
||||
|
||||
typedef Functor YAP_Functor;
|
||||
|
||||
typedef Atom YAP_Atom;
|
||||
|
||||
typedef Int YAP_Int;
|
||||
|
||||
typedef UInt YAP_UInt;
|
||||
|
||||
typedef Float YAP_Float;
|
||||
|
||||
typedef int YAP_Bool;
|
||||
|
||||
#else
|
||||
|
||||
/* Type definitions */
|
||||
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include "swi.h"
|
||||
|
||||
extern X_API Atom YAP_AtomFromSWIAtom(atom_t at);
|
||||
extern X_API atom_t YAP_SWIAtomFromAtom(Atom at);
|
||||
extern int PL_error(const char *pred, int arity, const char *msg, int id, ...);
|
||||
|
||||
X_API extern Atom
|
||||
@ -56,6 +57,12 @@ YAP_AtomFromSWIAtom(atom_t at)
|
||||
return SWIAtomToAtom(at);
|
||||
}
|
||||
|
||||
X_API extern atom_t
|
||||
YAP_SWIAtomFromAtom(Atom at)
|
||||
{
|
||||
return AtomToSWIAtom(at);
|
||||
}
|
||||
|
||||
extern X_API Int YAP_PLArityOfSWIFunctor(functor_t at);
|
||||
|
||||
/* This is silly, but let's keep it like that for now */
|
||||
|
@ -681,7 +681,7 @@ so we ignore possible problems.
|
||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
static int
|
||||
initLocale()
|
||||
initLocale(void)
|
||||
{ int rc = TRUE;
|
||||
|
||||
if ( !setlocale(LC_CTYPE, "") )
|
||||
|
@ -66,6 +66,11 @@ handling times must be cleaned, but that not only holds for this module.
|
||||
#undef LD /* fetch LD once per function */
|
||||
#define LD LOCAL_LD
|
||||
|
||||
/* there are two types of stream property functions. In the usual case,
|
||||
they have an argument, but in a few cases they don't */
|
||||
typedef int (*property0_t)(IOSTREAM *s ARG_LD);
|
||||
typedef int (*property_t)(IOSTREAM *s, term_t prop ARG_LD);
|
||||
|
||||
static int bad_encoding(const char *msg, atom_t name);
|
||||
static int noprotocol(void);
|
||||
static PL_blob_t stream_blob;
|
||||
@ -3687,15 +3692,15 @@ stream_close_on_exec_prop(IOSTREAM *s, term_t prop ARG_LD)
|
||||
|
||||
typedef struct
|
||||
{ functor_t functor; /* functor of property */
|
||||
int (*function)(); /* function to generate */
|
||||
property_t function; /* function to generate */
|
||||
} sprop;
|
||||
|
||||
|
||||
static const sprop sprop_list [] =
|
||||
{ { FUNCTOR_file_name1, stream_file_name_propery },
|
||||
{ FUNCTOR_mode1, stream_mode_property },
|
||||
{ FUNCTOR_input0, stream_input_prop },
|
||||
{ FUNCTOR_output0, stream_output_prop },
|
||||
{ FUNCTOR_input0, (property_t)stream_input_prop },
|
||||
{ FUNCTOR_output0, (property_t)stream_output_prop },
|
||||
{ FUNCTOR_alias1, stream_alias_prop },
|
||||
{ FUNCTOR_position1, stream_position_prop },
|
||||
{ FUNCTOR_end_of_stream1, stream_end_of_stream_prop },
|
||||
@ -3798,7 +3803,7 @@ PRED_IMPL("stream_property", 2, stream_property,
|
||||
|
||||
switch(arityFunctor(f))
|
||||
{ case 0:
|
||||
rval = (*p->function)(s PASS_LD);
|
||||
rval = (*(property0_t)p->function)(s PASS_LD);
|
||||
break;
|
||||
case 1:
|
||||
{ term_t a1 = PL_new_term_ref();
|
||||
@ -3873,7 +3878,7 @@ PRED_IMPL("stream_property", 2, stream_property,
|
||||
|
||||
switch(arityFunctor(pe->p->functor))
|
||||
{ case 0:
|
||||
rval = (*pe->p->function)(pe->s PASS_LD);
|
||||
rval = (*(property0_t)pe->p->function)(pe->s PASS_LD);
|
||||
break;
|
||||
case 1:
|
||||
{ _PL_get_arg(1, property, a1);
|
||||
|
@ -668,7 +668,11 @@ word pl_noprotocol(void);
|
||||
IOSTREAM *PL_current_input(void);
|
||||
IOSTREAM *PL_current_output(void);
|
||||
|
||||
extern int reportStreamError(IOSTREAM *s);
|
||||
COMMON(int) stricmp(const char *s1, const char *s2);
|
||||
|
||||
COMMON(word) textToString(PL_chars_t *text);
|
||||
|
||||
COMMON(int) reportStreamError(IOSTREAM *s);
|
||||
|
||||
extern int digitValue(int b, int c);
|
||||
|
||||
|
@ -445,10 +445,11 @@ UsedMemory(void)
|
||||
|
||||
uintptr_t
|
||||
FreeMemory(void)
|
||||
{ uintptr_t used = UsedMemory();
|
||||
|
||||
{
|
||||
#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_DATA)
|
||||
struct rlimit limit;
|
||||
uintptr_t used = UsedMemory();
|
||||
|
||||
struct rlimit limit;
|
||||
|
||||
if ( getrlimit(RLIMIT_DATA, &limit) == 0 )
|
||||
return limit.rlim_cur - used;
|
||||
|
@ -220,20 +220,6 @@ pl_rl_read_history(term_t fn)
|
||||
|
||||
|
||||
|
||||
static int
|
||||
input_on_fd(int fd)
|
||||
{ fd_set rfds;
|
||||
struct timeval tv;
|
||||
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET(fd, &rfds);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
|
||||
return select(fd+1, &rfds, NULL, NULL, &tv) != 0;
|
||||
}
|
||||
|
||||
|
||||
static char *my_prompt = NULL;
|
||||
static int in_readline = 0;
|
||||
static int sig_at_level = -1;
|
||||
@ -364,6 +350,20 @@ reentrant access is tried.
|
||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#ifdef HAVE_RL_EVENT_HOOK
|
||||
static int
|
||||
input_on_fd(int fd)
|
||||
{ fd_set rfds;
|
||||
struct timeval tv;
|
||||
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET(fd, &rfds);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
|
||||
return select(fd+1, &rfds, NULL, NULL, &tv) != 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
event_hook(void)
|
||||
{ if ( Sinput->position )
|
||||
|
@ -125,7 +125,7 @@ static int S__seterror(IOSTREAM *s);
|
||||
#ifdef O_PLMT
|
||||
#define SLOCK(s) if ( s->mutex ) recursiveMutexLock(s->mutex)
|
||||
#define SUNLOCK(s) if ( s->mutex ) recursiveMutexUnlock(s->mutex)
|
||||
inline int
|
||||
static inline int
|
||||
STRYLOCK(IOSTREAM *s)
|
||||
{ if ( s->mutex &&
|
||||
recursiveMutexTryLock(s->mutex) == EBUSY )
|
||||
@ -146,7 +146,7 @@ typedef intptr_t atom_t;
|
||||
#include "pl-error.h"
|
||||
|
||||
extern int fatalError(const char *fm, ...);
|
||||
extern int PL_handle_signals();
|
||||
extern int PL_handle_signals(void);
|
||||
extern IOENC initEncoding(void);
|
||||
extern int reportStreamError(IOSTREAM *s);
|
||||
extern record_t PL_record(term_t t);
|
||||
|
@ -111,6 +111,7 @@ valHandle(term_t tt)
|
||||
|
||||
YAP_Int YAP_PLArityOfSWIFunctor(functor_t f);
|
||||
YAP_Atom YAP_AtomFromSWIAtom(atom_t at);
|
||||
atom_t YAP_SWIAtomFromAtom(YAP_Atom at);
|
||||
PL_blob_t* YAP_find_blob_type(YAP_Atom at);
|
||||
|
||||
void PL_license(const char *license, const char *module);
|
||||
@ -130,7 +131,7 @@ void PL_license(const char *license, const char *module);
|
||||
#define valFloat(w) YAP_FloatOfTerm((w))
|
||||
#define AtomLength(w) YAP_AtomNameLength(w)
|
||||
#define atomValue(atom) YAP_AtomFromSWIAtom(atom)
|
||||
#define atomFromTerm(term) YAP_AtomOfTerm(term)
|
||||
#define atomFromTerm(term) YAP_SWIAtomFromAtom(YAP_AtomOfTerm(term))
|
||||
#define atomName(atom) ((char *)YAP_AtomName(atom))
|
||||
#define nameOfAtom(atom) ((char *)YAP_AtomName(atom))
|
||||
#define atomLength(atom) YAP_AtomNameLength(atom)
|
||||
|
Reference in New Issue
Block a user