generic fixes, mostly indentin
This commit is contained in:
parent
b2369175e5
commit
42e2543ab7
4
C/save.c
4
C/save.c
@ -500,7 +500,7 @@ save_code_info(void)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* and the current character codes */
|
/* and the current character codes */
|
||||||
if (mywrite(splfild, Yap_chtype, NUMBER_OF_CHARS) < 0)
|
if (mywrite(splfild, (char *)Yap_chtype, NUMBER_OF_CHARS*sizeof(char_kind_t)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -950,7 +950,7 @@ get_insts(OPCODE old_ops[])
|
|||||||
static int
|
static int
|
||||||
get_hash(void)
|
get_hash(void)
|
||||||
{
|
{
|
||||||
return myread(splfild, Yap_chtype , NUMBER_OF_CHARS);
|
return myread(splfild, (char *)Yap_chtype , NUMBER_OF_CHARS*sizeof(char_kind_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy all of the old code to the new Heap */
|
/* Copy all of the old code to the new Heap */
|
||||||
|
100
C/stdpreds.c
100
C/stdpreds.c
@ -182,7 +182,7 @@
|
|||||||
* YAP_Error changed.
|
* YAP_Error changed.
|
||||||
*
|
*
|
||||||
* Revision 1.84 2005/03/02 18:35:46 vsc
|
* Revision 1.84 2005/03/02 18:35:46 vsc
|
||||||
* try to make initialisation process more robust
|
* try to make initialization process more robust
|
||||||
* try to make name more robust (in case Lookup new atom fails)
|
* try to make name more robust (in case Lookup new atom fails)
|
||||||
*
|
*
|
||||||
* Revision 1.83 2005/03/01 22:25:09 vsc
|
* Revision 1.83 2005/03/01 22:25:09 vsc
|
||||||
@ -223,13 +223,14 @@
|
|||||||
* replace heap_base by Yap_heap_base, according to Yap's convention for globals.
|
* replace heap_base by Yap_heap_base, according to Yap's convention for globals.
|
||||||
*
|
*
|
||||||
* Revision 1.74 2004/11/19 22:08:43 vsc
|
* Revision 1.74 2004/11/19 22:08:43 vsc
|
||||||
* replace SYSTEM_ERROR_INTERNAL by out OUT_OF_WHATEVER_ERROR whenever appropriate.
|
* replace SYSTEM_ERROR_INTERNAL by out OUT_OF_WHATEVER_ERROR whenever
|
||||||
|
*appropriate.
|
||||||
*
|
*
|
||||||
* Revision 1.73 2004/11/19 17:14:14 vsc
|
* Revision 1.73 2004/11/19 17:14:14 vsc
|
||||||
* a few fixes for 64 bit compiling.
|
* a few fixes for 64 bit compiling.
|
||||||
*
|
*
|
||||||
* Revision 1.72 2004/11/18 22:32:37 vsc
|
* Revision 1.72 2004/11/18 22:32:37 vsc
|
||||||
* fix situation where we might assume nonextsing double initialisation of C
|
* fix situation where we might assume nonextsing double initialization of C
|
||||||
*predicates (use
|
*predicates (use
|
||||||
* Hidden Pred Flag).
|
* Hidden Pred Flag).
|
||||||
* $host_type was double initialised.
|
* $host_type was double initialised.
|
||||||
@ -357,7 +358,6 @@ static Int p_jit(USES_REGS1) { /* '$set_value'(+Atom,+Atomic) */
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* YAP_JIT */
|
#endif /* YAP_JIT */
|
||||||
|
|
||||||
#ifdef BEAM
|
#ifdef BEAM
|
||||||
@ -455,7 +455,8 @@ Int show_time(USES_REGS1) /* MORE PRECISION */
|
|||||||
@defgroup YAPSetVal
|
@defgroup YAPSetVal
|
||||||
@ingroup Internal_Database
|
@ingroup Internal_Database
|
||||||
|
|
||||||
Maintain a light-weight map where the key is an atom, and the value can be any constant.
|
Maintain a light-weight map where the key is an atom, and the value can be
|
||||||
|
any constant.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @pred set_value(+ _A_,+ _C_)
|
/** @pred set_value(+ _A_,+ _C_)
|
||||||
@ -530,7 +531,6 @@ static Int p_values(USES_REGS1) { /* '$values'(Atom,Old,New) */
|
|||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
static Int p_opdec(USES_REGS1) { /* '$opdec'(p,type,atom) */
|
static Int p_opdec(USES_REGS1) { /* '$opdec'(p,type,atom) */
|
||||||
/* we know the arguments are integer, atom, atom */
|
/* we know the arguments are integer, atom, atom */
|
||||||
Term p = Deref(ARG1), t = Deref(ARG2), at = Deref(ARG3);
|
Term p = Deref(ARG1), t = Deref(ARG2), at = Deref(ARG3);
|
||||||
@ -839,7 +839,8 @@ static Int
|
|||||||
}
|
}
|
||||||
out = IntegerOfTerm(t);
|
out = IntegerOfTerm(t);
|
||||||
#if YAP_JIT
|
#if YAP_JIT
|
||||||
if (ExpEnv.analysis_struc.stats_enabled || ExpEnv.analysis_struc.time_pass_enabled) {
|
if (ExpEnv.analysis_struc.stats_enabled ||
|
||||||
|
ExpEnv.analysis_struc.time_pass_enabled) {
|
||||||
if (strcmp(((char *)ExpEnv.analysis_struc.outfile), "STDERR")) {
|
if (strcmp(((char *)ExpEnv.analysis_struc.outfile), "STDERR")) {
|
||||||
int stderrcopy = dup(2);
|
int stderrcopy = dup(2);
|
||||||
if (strcmp(((char *)ExpEnv.analysis_struc.outfile), "STDOUT") == 0) {
|
if (strcmp(((char *)ExpEnv.analysis_struc.outfile), "STDOUT") == 0) {
|
||||||
@ -849,11 +850,13 @@ static Int
|
|||||||
shutdown_llvm();
|
shutdown_llvm();
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
dup2(stderrcopy, 2);
|
dup2(stderrcopy, 2);
|
||||||
}
|
} else {
|
||||||
else {
|
int Outputfile = open(((char *)ExpEnv.analysis_struc.outfile),
|
||||||
int Outputfile = open(((char*)ExpEnv.analysis_struc.outfile), O_CREAT | O_APPEND | O_WRONLY, 0777);
|
O_CREAT | O_APPEND | O_WRONLY, 0777);
|
||||||
if (Outputfile < 0) {
|
if (Outputfile < 0) {
|
||||||
fprintf(stderr, "Error:: I can not write analysis passes's output on %s...\n", ((char*)ExpEnv.analysis_struc.outfile));
|
fprintf(stderr,
|
||||||
|
"Error:: I can not write analysis passes's output on %s...\n",
|
||||||
|
((char *)ExpEnv.analysis_struc.outfile));
|
||||||
fprintf(stderr, " %s...\n", strerror(errno));
|
fprintf(stderr, " %s...\n", strerror(errno));
|
||||||
errno = 0;
|
errno = 0;
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -864,8 +867,7 @@ static Int
|
|||||||
dup2(stderrcopy, 2);
|
dup2(stderrcopy, 2);
|
||||||
}
|
}
|
||||||
close(stderrcopy);
|
close(stderrcopy);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
shutdown_llvm();
|
shutdown_llvm();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -874,25 +876,19 @@ static Int
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool valid_prop(Prop p, Term task) {
|
||||||
valid_prop(Prop p, Term task)
|
|
||||||
{
|
|
||||||
if (RepPredProp(p)->OpcodeOfPred == UNDEF_OPCODE)
|
if (RepPredProp(p)->OpcodeOfPred == UNDEF_OPCODE)
|
||||||
return false;
|
return false;
|
||||||
if ( (RepPredProp(p)->PredFlags & (HiddenPredFlag|StandardPredFlag) ) )
|
if ((RepPredProp(p)->PredFlags & (HiddenPredFlag | StandardPredFlag))) {
|
||||||
{
|
|
||||||
return (task == SYSTEM_MODULE || task == TermTrue);
|
return (task == SYSTEM_MODULE || task == TermTrue);
|
||||||
} else {
|
} else {
|
||||||
return (task == USER_MODULE || task == TermTrue);
|
return (task == USER_MODULE || task == TermTrue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static PropEntry *
|
static PropEntry *followLinkedListOfProps(PropEntry *p, Term task) {
|
||||||
followLinkedListOfProps (PropEntry *p, Term task)
|
|
||||||
{
|
|
||||||
while (p) {
|
while (p) {
|
||||||
if (p->KindOfPE == PEProp &&
|
if (p->KindOfPE == PEProp && valid_prop(p, task)) {
|
||||||
valid_prop(p, task) ) {
|
|
||||||
// found our baby..
|
// found our baby..
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
@ -901,9 +897,7 @@ followLinkedListOfProps (PropEntry *p, Term task)
|
|||||||
return NIL;
|
return NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PropEntry *
|
static PropEntry *getPredProp(PropEntry *p, Term task) {
|
||||||
getPredProp (PropEntry *p, Term task)
|
|
||||||
{
|
|
||||||
PredEntry *pe;
|
PredEntry *pe;
|
||||||
if (p == NIL)
|
if (p == NIL)
|
||||||
return NIL;
|
return NIL;
|
||||||
@ -923,9 +917,7 @@ getPredProp (PropEntry *p, Term task)
|
|||||||
return NIL;
|
return NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PropEntry *
|
static PropEntry *nextPredForAtom(PropEntry *p, Term task) {
|
||||||
nextPredForAtom (PropEntry *p, Term task)
|
|
||||||
{
|
|
||||||
PredEntry *pe;
|
PredEntry *pe;
|
||||||
if (p == NIL)
|
if (p == NIL)
|
||||||
return NIL;
|
return NIL;
|
||||||
@ -946,10 +938,7 @@ nextPredForAtom (PropEntry *p, Term task)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Prop initFunctorSearch(Term t3, Term t2, Term task) {
|
||||||
static Prop
|
|
||||||
initFunctorSearch(Term t3, Term t2, Term task)
|
|
||||||
{
|
|
||||||
if (IsAtomTerm(t3)) {
|
if (IsAtomTerm(t3)) {
|
||||||
Atom at = AtomOfTerm(t3);
|
Atom at = AtomOfTerm(t3);
|
||||||
// access the entry at key address.
|
// access the entry at key address.
|
||||||
@ -963,7 +952,8 @@ initFunctorSearch(Term t3, Term t2, Term task)
|
|||||||
// access the entry at key address.
|
// access the entry at key address.
|
||||||
// a single property (this will be deterministic
|
// a single property (this will be deterministic
|
||||||
p = AbsPredProp(Yap_FindLUIntKey(IntOfTerm(t3)));
|
p = AbsPredProp(Yap_FindLUIntKey(IntOfTerm(t3)));
|
||||||
if (valid_prop(p, task)) return p;
|
if (valid_prop(p, task))
|
||||||
|
return p;
|
||||||
}
|
}
|
||||||
Yap_Error(TYPE_ERROR_CALLABLE, t3, "current_predicate/2");
|
Yap_Error(TYPE_ERROR_CALLABLE, t3, "current_predicate/2");
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -982,21 +972,16 @@ initFunctorSearch(Term t3, Term t2, Term task)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static PredEntry *
|
static PredEntry *firstModulePred(PredEntry *npp, Term task) {
|
||||||
firstModulePred( PredEntry * npp, Term task)
|
|
||||||
{
|
|
||||||
if (!npp)
|
if (!npp)
|
||||||
return NULL;
|
return NULL;
|
||||||
do {
|
do {
|
||||||
npp = npp->NextPredOfModule;
|
npp = npp->NextPredOfModule;
|
||||||
} while (npp &&
|
} while (npp && !valid_prop(AbsPredProp(npp), task));
|
||||||
!valid_prop(AbsPredProp(npp), task));
|
|
||||||
return npp;
|
return npp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PredEntry *
|
static PredEntry *firstModulesPred(PredEntry *npp, Term task) {
|
||||||
firstModulesPred( PredEntry *npp, Term task )
|
|
||||||
{
|
|
||||||
ModEntry *m;
|
ModEntry *m;
|
||||||
if (npp) {
|
if (npp) {
|
||||||
m = Yap_GetModuleEntry(npp->ModuleOfPred);
|
m = Yap_GetModuleEntry(npp->ModuleOfPred);
|
||||||
@ -1018,7 +1003,6 @@ firstModulesPred( PredEntry *npp, Term task )
|
|||||||
return npp;
|
return npp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Int cont_current_predicate(USES_REGS1) {
|
static Int cont_current_predicate(USES_REGS1) {
|
||||||
UInt Arity;
|
UInt Arity;
|
||||||
Term name, task;
|
Term name, task;
|
||||||
@ -1166,11 +1150,10 @@ static Int cont_current_predicate(USES_REGS1) {
|
|||||||
} else {
|
} else {
|
||||||
rc = Yap_unify(t3, name);
|
rc = Yap_unify(t3, name);
|
||||||
}
|
}
|
||||||
rc = rc &&
|
rc = rc && Yap_unify(t2, ModToTerm(pp->ModuleOfPred)) && Yap_unify(t1, name);
|
||||||
Yap_unify(t2, ModToTerm(pp->ModuleOfPred)) &&
|
|
||||||
Yap_unify(t1, name);
|
|
||||||
if (will_cut) {
|
if (will_cut) {
|
||||||
if (rc) cut_succeed();
|
if (rc)
|
||||||
|
cut_succeed();
|
||||||
cut_fail();
|
cut_fail();
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
@ -1248,7 +1231,8 @@ static Int cont_current_op(USES_REGS1) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int init_current_op(USES_REGS1) { /* current_op(-Precedence,-Type,-Atom) */
|
static Int init_current_op(
|
||||||
|
USES_REGS1) { /* current_op(-Precedence,-Type,-Atom) */
|
||||||
EXTRA_CBACK_ARG(5, 1) = (CELL)MkIntegerTerm((CELL)OpList);
|
EXTRA_CBACK_ARG(5, 1) = (CELL)MkIntegerTerm((CELL)OpList);
|
||||||
B->cp_h = HR;
|
B->cp_h = HR;
|
||||||
return cont_current_op(PASS_REGS1);
|
return cont_current_op(PASS_REGS1);
|
||||||
@ -1329,12 +1313,9 @@ void Yap_show_statistics(void) {
|
|||||||
Unsigned(LOCAL_TrailBase))),
|
Unsigned(LOCAL_TrailBase))),
|
||||||
(unsigned long int)(sizeof(tr_fr_ptr) *
|
(unsigned long int)(sizeof(tr_fr_ptr) *
|
||||||
(Unsigned(TR) - Unsigned(LOCAL_TrailBase))));
|
(Unsigned(TR) - Unsigned(LOCAL_TrailBase))));
|
||||||
fprintf(stderr, "Runtime: %lds.\n",
|
fprintf(stderr, "Runtime: %lds.\n", (unsigned long int)(runtime(PASS_REGS1)));
|
||||||
(unsigned long int)(runtime(PASS_REGS1)));
|
fprintf(stderr, "Cputime: %lds.\n", (unsigned long int)(Yap_cputime()));
|
||||||
fprintf(stderr, "Cputime: %lds.\n",
|
fprintf(stderr, "Walltime: %lds.\n", (unsigned long int)(Yap_walltime()));
|
||||||
(unsigned long int)(Yap_cputime()));
|
|
||||||
fprintf(stderr, "Walltime: %lds.\n",
|
|
||||||
(unsigned long int)(Yap_walltime()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int p_statistics_heap_max(USES_REGS1) {
|
static Int p_statistics_heap_max(USES_REGS1) {
|
||||||
@ -1501,7 +1482,8 @@ static Int p_statistics_atom_info(USES_REGS1) {
|
|||||||
while (catom != NIL) {
|
while (catom != NIL) {
|
||||||
Atom ncatom;
|
Atom ncatom;
|
||||||
count++;
|
count++;
|
||||||
spaceused += sizeof(AtomEntry) + strlen((char *)RepAtom(catom)->StrOfAE) + 1;
|
spaceused +=
|
||||||
|
sizeof(AtomEntry) + strlen((char *)RepAtom(catom)->StrOfAE) + 1;
|
||||||
ncatom = RepAtom(catom)->NextOfAE;
|
ncatom = RepAtom(catom)->NextOfAE;
|
||||||
if (ncatom != NIL) {
|
if (ncatom != NIL) {
|
||||||
READ_LOCK(RepAtom(ncatom)->ARWLock);
|
READ_LOCK(RepAtom(ncatom)->ARWLock);
|
||||||
@ -1567,7 +1549,6 @@ static Int p_executable(USES_REGS1) {
|
|||||||
return Yap_unify(MkAtomTerm(Yap_LookupAtom(LOCAL_FileNameBuf)), ARG1);
|
return Yap_unify(MkAtomTerm(Yap_LookupAtom(LOCAL_FileNameBuf)), ARG1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Int p_system_mode(USES_REGS1) {
|
static Int p_system_mode(USES_REGS1) {
|
||||||
Term t1 = Deref(ARG1);
|
Term t1 = Deref(ARG1);
|
||||||
|
|
||||||
@ -1684,7 +1665,6 @@ static Int p_parallel_mode(USES_REGS1) { return FALSE; }
|
|||||||
static Int p_yapor_workers(USES_REGS1) { return FALSE; }
|
static Int p_yapor_workers(USES_REGS1) { return FALSE; }
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
|
|
||||||
|
|
||||||
void Yap_InitCPreds(void) {
|
void Yap_InitCPreds(void) {
|
||||||
/* numerical comparison */
|
/* numerical comparison */
|
||||||
Yap_InitCPred("set_value", 2, p_setval, SafePredFlag | SyncPredFlag);
|
Yap_InitCPred("set_value", 2, p_setval, SafePredFlag | SyncPredFlag);
|
||||||
@ -1758,8 +1738,7 @@ void Yap_InitCPreds(void) {
|
|||||||
Yap_InitCPred("$exit_undefp", 0, p_exitundefp, SafePredFlag);
|
Yap_InitCPred("$exit_undefp", 0, p_exitundefp, SafePredFlag);
|
||||||
|
|
||||||
#ifdef YAP_JIT
|
#ifdef YAP_JIT
|
||||||
Yap_InitCPred("$jit_init", 1, p_jit,
|
Yap_InitCPred("$jit_init", 1, p_jit, SafePredFlag | SyncPredFlag);
|
||||||
SafePredFlag | SyncPredFlag);
|
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
#ifdef INES
|
#ifdef INES
|
||||||
Yap_InitCPred("euc_dist", 3, p_euc_dist, SafePredFlag);
|
Yap_InitCPred("euc_dist", 3, p_euc_dist, SafePredFlag);
|
||||||
@ -1819,8 +1798,7 @@ void Yap_InitCPreds(void) {
|
|||||||
Yap_init_optyap_preds();
|
Yap_init_optyap_preds();
|
||||||
#endif /* YAPOR || TABLING */
|
#endif /* YAPOR || TABLING */
|
||||||
#if YAP_JIT
|
#if YAP_JIT
|
||||||
Yap_InitCPred("jit", 0, p_jit,
|
Yap_InitCPred("jit", 0, p_jit, SafePredFlag | SyncPredFlag);
|
||||||
SafePredFlag | SyncPredFlag);
|
|
||||||
#endif
|
#endif
|
||||||
Yap_InitThreadPreds();
|
Yap_InitThreadPreds();
|
||||||
{
|
{
|
||||||
|
142
C/tracer.c
142
C/tracer.c
@ -26,10 +26,8 @@
|
|||||||
#include "clause.h"
|
#include "clause.h"
|
||||||
#include "tracer.h"
|
#include "tracer.h"
|
||||||
|
|
||||||
|
static void send_tracer_message(char *start, char *name, Int arity, char *mname,
|
||||||
static void
|
CELL *args) {
|
||||||
send_tracer_message(char *start, char *name, Int arity, char *mname, CELL *args)
|
|
||||||
{
|
|
||||||
if (name == NULL) {
|
if (name == NULL) {
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
fprintf(stderr, "(%d)%s", worker_id, start);
|
fprintf(stderr, "(%d)%s", worker_id, start);
|
||||||
@ -43,13 +41,15 @@ send_tracer_message(char *start, char *name, Int arity, char *mname, CELL *args)
|
|||||||
if (args)
|
if (args)
|
||||||
fprintf(stderr, "%s %s:%s(", start, mname, name);
|
fprintf(stderr, "%s %s:%s(", start, mname, name);
|
||||||
else
|
else
|
||||||
fprintf(stderr, "%s %s:%s/%lu", start, mname, name, (unsigned long int)arity);
|
fprintf(stderr, "%s %s:%s/%lu", start, mname, name,
|
||||||
|
(unsigned long int)arity);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "%s %s:%s", start, mname, name);
|
fprintf(stderr, "%s %s:%s", start, mname, name);
|
||||||
}
|
}
|
||||||
if (args) {
|
if (args) {
|
||||||
for (i = 0; i < arity; i++) {
|
for (i = 0; i < arity; i++) {
|
||||||
if (i > 0) fprintf(stderr, ",");
|
if (i > 0)
|
||||||
|
fprintf(stderr, ",");
|
||||||
Yap_plwrite(args[i], NULL, 15, Handle_vars_f | AttVar_Portray_f, 1200);
|
Yap_plwrite(args[i], NULL, 15, Handle_vars_f | AttVar_Portray_f, 1200);
|
||||||
}
|
}
|
||||||
if (arity) {
|
if (arity) {
|
||||||
@ -85,7 +85,8 @@ check_trail_consistency(void) {
|
|||||||
CELL *p = RepPair(TrailTerm(ptr));
|
CELL *p = RepPair(TrailTerm(ptr));
|
||||||
if IsAttVar(p) continue;
|
if IsAttVar(p) continue;
|
||||||
}
|
}
|
||||||
printf("Oops at call %ld, B->cp(%p) TR(%p) pt(%p)\n", vsc_count,B->cp_tr, TR, ptr);
|
printf("Oops at call %ld, B->cp(%p) TR(%p) pt(%p)\n",
|
||||||
|
vsc_count,B->cp_tr, TR, ptr);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,16 +101,13 @@ CELL old_value = 0L, old_value2 = 0L;
|
|||||||
|
|
||||||
void jmp_deb(int), jmp_deb2(void);
|
void jmp_deb(int), jmp_deb2(void);
|
||||||
|
|
||||||
void
|
void jmp_deb2(void) { fprintf(stderr, "Here\n"); }
|
||||||
jmp_deb2( void )
|
|
||||||
{
|
|
||||||
fprintf(stderr,"Here\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void jmp_deb(int i) {
|
||||||
jmp_deb(int i) {
|
if (i)
|
||||||
if (i) printf("Here we go %ld\n", old_value++);
|
printf("Here we go %ld\n", old_value++);
|
||||||
if (old_value == 716) jmp_deb2();
|
if (old_value == 716)
|
||||||
|
jmp_deb2();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct various_codes *sc;
|
struct various_codes *sc;
|
||||||
@ -143,9 +141,7 @@ Term old_x1[10000], old_x2[10000], old_x3[10000];
|
|||||||
|
|
||||||
// static CELL oldv;
|
// static CELL oldv;
|
||||||
|
|
||||||
void
|
void low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args) {
|
||||||
low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
|
||||||
{
|
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
char *s;
|
char *s;
|
||||||
char *mname;
|
char *mname;
|
||||||
@ -159,11 +155,17 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
|||||||
if (pred && port == enter_pred) {
|
if (pred && port == enter_pred) {
|
||||||
UInt flags = ap->PredFlags;
|
UInt flags = ap->PredFlags;
|
||||||
if (ap->ArityOfPE && ap->ModuleOfPred != IDB_MODULE)
|
if (ap->ArityOfPE && ap->ModuleOfPred != IDB_MODULE)
|
||||||
__android_log_print(ANDROID_LOG_INFO, "YAP ", " %s/%ld %lx\n", NameOfFunctor(ap->FunctorOfPred)->StrOfAE, ap->ArityOfPE, flags);
|
__android_log_print(ANDROID_LOG_INFO, "YAP ", " %s/%ld %lx\n",
|
||||||
/* printf(" %s/%ld %lx\n", NameOfFunctor(ap->FunctorOfPred)->StrOfAE, ap->ArityOfPE, flags); */
|
NameOfFunctor(ap->FunctorOfPred)->StrOfAE,
|
||||||
|
ap->ArityOfPE, flags);
|
||||||
|
/* printf(" %s/%ld %lx\n", NameOfFunctor(ap->FunctorOfPred)->StrOfAE,
|
||||||
|
* ap->ArityOfPE, flags); */
|
||||||
else if (ap->ModuleOfPred != IDB_MODULE)
|
else if (ap->ModuleOfPred != IDB_MODULE)
|
||||||
__android_log_print(ANDROID_LOG_INFO, "YAP "," %s/%ld %lx\n", ((Atom)(ap->FunctorOfPred))->StrOfAE, ap->ArityOfPE, flags);
|
__android_log_print(ANDROID_LOG_INFO, "YAP ", " %s/%ld %lx\n",
|
||||||
/* printf(" %s/%ld %lx\n", ((Atom)(ap->FunctorOfPred))->StrOfAE, ap->ArityOfPE, flags); */
|
((Atom)(ap->FunctorOfPred))->StrOfAE, ap->ArityOfPE,
|
||||||
|
flags);
|
||||||
|
/* printf(" %s/%ld %lx\n", ((Atom)(ap->FunctorOfPred))->StrOfAE,
|
||||||
|
* ap->ArityOfPE, flags); */
|
||||||
__android_log_print(ANDROID_LOG_INFO, "YAP ", " %x ", ap->src.OwnerFile);
|
__android_log_print(ANDROID_LOG_INFO, "YAP ", " %x ", ap->src.OwnerFile);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -173,7 +175,6 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
|||||||
LOCK(Yap_heap_regs->low_level_trace_lock);
|
LOCK(Yap_heap_regs->low_level_trace_lock);
|
||||||
sc = Yap_heap_regs;
|
sc = Yap_heap_regs;
|
||||||
// if (vsc_count == 161862) jmp_deb(1);
|
// if (vsc_count == 161862) jmp_deb(1);
|
||||||
fprintf(stderr,"B=%ld ", LCL0-(CELL*)B);
|
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
LOCAL_ThreadHandle.thread_inst_count++;
|
LOCAL_ThreadHandle.thread_inst_count++;
|
||||||
#endif
|
#endif
|
||||||
@ -193,8 +194,10 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
|||||||
b_p = b_p->cp_b;
|
b_p = b_p->cp_b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{ choiceptr myB = B;
|
{
|
||||||
while (myB) myB = myB->cp_b;
|
choiceptr myB = B;
|
||||||
|
while (myB)
|
||||||
|
myB = myB->cp_b;
|
||||||
}
|
}
|
||||||
//*(H0+(0xb65f2850-0xb64b2008)/sizeof(CELL))==0xc ||
|
//*(H0+(0xb65f2850-0xb64b2008)/sizeof(CELL))==0xc ||
|
||||||
// 0x4fd4d
|
// 0x4fd4d
|
||||||
@ -204,7 +207,8 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
|||||||
if (vsc_count % 1LL == 0) {
|
if (vsc_count % 1LL == 0) {
|
||||||
UInt sz = Yap_regp->H0_[17];
|
UInt sz = Yap_regp->H0_[17];
|
||||||
UInt end = sizeof(MP_INT) / sizeof(CELL) + sz + 1;
|
UInt end = sizeof(MP_INT) / sizeof(CELL) + sz + 1;
|
||||||
fprintf(stderr,"VAL %lld %d %x/%x\n",vsc_count,sz,H0[16],H0[16+end]);
|
fprintf(stderr, "VAL %lld %d %x/%x\n", vsc_count, sz, H0[16],
|
||||||
|
H0[16 + end]);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
return;
|
return;
|
||||||
@ -213,17 +217,17 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
|||||||
if (pt[140].term == 0 && pt[140].value != 0)
|
if (pt[140].term == 0 && pt[140].value != 0)
|
||||||
jmp_deb(1);
|
jmp_deb(1);
|
||||||
}
|
}
|
||||||
if (worker_id != 04 || worker_id != 03) return;
|
if (worker_id != 04 || worker_id != 03)
|
||||||
|
return;
|
||||||
// if (vsc_count == 218280)
|
// if (vsc_count == 218280)
|
||||||
// vsc_xstop = 1;
|
// vsc_xstop = 1;
|
||||||
if (vsc_count < 1468068888) {
|
if (vsc_count < 1468068888) {
|
||||||
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (port != enter_pred ||
|
if (port != enter_pred || !pred || pred->ArityOfPE != 4 ||
|
||||||
!pred ||
|
strcmp(RepAtom(NameOfFunctor(pred->FunctorOfPred))->StrOfAE,
|
||||||
pred->ArityOfPE != 4 ||
|
"in_between_target_phrases")) {
|
||||||
strcmp(RepAtom(NameOfFunctor(pred->FunctorOfPred))->StrOfAE,"in_between_target_phrases")) {
|
|
||||||
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -243,7 +247,8 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
|||||||
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (vsc_count == 123536441LL) vsc_xstop = 1;
|
if (vsc_count == 123536441LL)
|
||||||
|
vsc_xstop = 1;
|
||||||
if (vsc_count < 5530257LL) {
|
if (vsc_count < 5530257LL) {
|
||||||
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
||||||
return;
|
return;
|
||||||
@ -259,17 +264,14 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
|||||||
jmp_deb(1);
|
jmp_deb(1);
|
||||||
{
|
{
|
||||||
tr_fr_ptr pt = (tr_fr_ptr)LOCAL_TrailBase;
|
tr_fr_ptr pt = (tr_fr_ptr)LOCAL_TrailBase;
|
||||||
if (pt[153].term == 0 && pt[153].value == 0 &&
|
if (pt[153].term == 0 && pt[153].value == 0 && pt[154].term != 0 &&
|
||||||
pt[154].term != 0 && pt[154].value != 0 && ( TR > pt+154 ||
|
pt[154].value != 0 && (TR > pt + 154 || TR_FZ > pt + 154))
|
||||||
TR_FZ > pt+154))
|
|
||||||
jmp_deb(2);
|
jmp_deb(2);
|
||||||
if (pt[635].term == 0 && pt[635].value == 0 &&
|
if (pt[635].term == 0 && pt[635].value == 0 && pt[636].term != 0 &&
|
||||||
pt[636].term != 0 && pt[636].value != 0 && ( TR > pt+636 ||
|
pt[636].value != 0 && (TR > pt + 636 || TR_FZ > pt + 636))
|
||||||
TR_FZ > pt+636))
|
|
||||||
jmp_deb(3);
|
jmp_deb(3);
|
||||||
if (pt[138].term == 0 && pt[138].value == 0 &&
|
if (pt[138].term == 0 && pt[138].value == 0 && pt[139].term != 0 &&
|
||||||
pt[139].term != 0 && pt[139].value != 0 && ( TR > pt+138 ||
|
pt[139].value != 0 && (TR > pt + 138 || TR_FZ > pt + 138))
|
||||||
TR_FZ > pt+138) )
|
|
||||||
jmp_deb(4);
|
jmp_deb(4);
|
||||||
}
|
}
|
||||||
if (vsc_count == 287939LL)
|
if (vsc_count == 287939LL)
|
||||||
@ -277,8 +279,7 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
|||||||
if (vsc_count == 173118LL)
|
if (vsc_count == 173118LL)
|
||||||
jmp_deb(1);
|
jmp_deb(1);
|
||||||
if (!(vsc_count >= 287934LL && vsc_count <= 287939LL) &&
|
if (!(vsc_count >= 287934LL && vsc_count <= 287939LL) &&
|
||||||
!(vsc_count >= 173100LL && vsc_count <= 173239LL) &&
|
!(vsc_count >= 173100LL && vsc_count <= 173239LL) && vsc_count != -1)
|
||||||
vsc_count != -1)
|
|
||||||
return;
|
return;
|
||||||
if (vsc_count == 51021) {
|
if (vsc_count == 51021) {
|
||||||
printf("Here I go\n");
|
printf("Here I go\n");
|
||||||
@ -287,7 +288,8 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
|||||||
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (vsc_count > 52000) exit(0);
|
if (vsc_count > 52000)
|
||||||
|
exit(0);
|
||||||
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
||||||
return;
|
return;
|
||||||
if (vsc_count == 837074) {
|
if (vsc_count == 837074) {
|
||||||
@ -305,7 +307,8 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
|||||||
PredEntry *pe = EnvPreg(env_ptr[E_CP]);
|
PredEntry *pe = EnvPreg(env_ptr[E_CP]);
|
||||||
|
|
||||||
printf("%p->", env_ptr, pe);
|
printf("%p->", env_ptr, pe);
|
||||||
if (vsc_count == 52LL) printf("\n");
|
if (vsc_count == 52LL)
|
||||||
|
printf("\n");
|
||||||
if (p == pe) {
|
if (p == pe) {
|
||||||
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
||||||
return;
|
return;
|
||||||
@ -405,38 +408,31 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
|||||||
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void toggle_low_level_trace(void) {
|
||||||
toggle_low_level_trace(void)
|
|
||||||
{
|
|
||||||
Yap_do_low_level_trace = !Yap_do_low_level_trace;
|
Yap_do_low_level_trace = !Yap_do_low_level_trace;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int start_low_level_trace( USES_REGS1 )
|
static Int start_low_level_trace(USES_REGS1) {
|
||||||
{
|
|
||||||
Yap_do_low_level_trace = TRUE;
|
Yap_do_low_level_trace = TRUE;
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int total_choicepoints( USES_REGS1 )
|
static Int total_choicepoints(USES_REGS1) {
|
||||||
{
|
|
||||||
return Yap_unify(MkIntegerTerm(LOCAL_total_choicepoints), ARG1);
|
return Yap_unify(MkIntegerTerm(LOCAL_total_choicepoints), ARG1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int reset_total_choicepoints( USES_REGS1 )
|
static Int reset_total_choicepoints(USES_REGS1) {
|
||||||
{
|
|
||||||
LOCAL_total_choicepoints = 0;
|
LOCAL_total_choicepoints = 0;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int show_low_level_trace( USES_REGS1 )
|
static Int show_low_level_trace(USES_REGS1) {
|
||||||
{
|
|
||||||
fprintf(stderr, "Call counter=%lld\n", vsc_count);
|
fprintf(stderr, "Call counter=%lld\n", vsc_count);
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
static Int start_low_level_trace2( USES_REGS1 )
|
static Int start_low_level_trace2(USES_REGS1) {
|
||||||
{
|
|
||||||
thread_trace = IntegerOfTerm(Deref(ARG1)) + 1;
|
thread_trace = IntegerOfTerm(Deref(ARG1)) + 1;
|
||||||
Yap_do_low_level_trace = TRUE;
|
Yap_do_low_level_trace = TRUE;
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
@ -449,12 +445,12 @@ static Int start_low_level_trace2( USES_REGS1 )
|
|||||||
|
|
||||||
Stop displaying messages at procedure entry and retry.
|
Stop displaying messages at procedure entry and retry.
|
||||||
|
|
||||||
Note that using this compile-time option will slow down execution, even if messages are
|
Note that using this compile-time option will slow down execution, even if
|
||||||
|
messages are
|
||||||
not being output.
|
not being output.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
static Int stop_low_level_trace( USES_REGS1 )
|
static Int stop_low_level_trace(USES_REGS1) {
|
||||||
{
|
|
||||||
Yap_do_low_level_trace = FALSE;
|
Yap_do_low_level_trace = FALSE;
|
||||||
LOCAL_do_trace_primitives = TRUE;
|
LOCAL_do_trace_primitives = TRUE;
|
||||||
#if DEBUG_LOCKS
|
#if DEBUG_LOCKS
|
||||||
@ -465,22 +461,20 @@ static Int stop_low_level_trace( USES_REGS1 )
|
|||||||
|
|
||||||
volatile int v_wait;
|
volatile int v_wait;
|
||||||
|
|
||||||
static Int vsc_wait( USES_REGS1 )
|
static Int vsc_wait(USES_REGS1) {
|
||||||
{
|
while (!v_wait)
|
||||||
while (!v_wait);
|
;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int vsc_go( USES_REGS1 )
|
static Int vsc_go(USES_REGS1) {
|
||||||
{
|
|
||||||
v_wait = 1;
|
v_wait = 1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void Yap_InitLowLevelTrace(void) {
|
||||||
Yap_InitLowLevelTrace(void)
|
Yap_InitCPred("start_low_level_trace", 0, start_low_level_trace,
|
||||||
{
|
SafePredFlag);
|
||||||
Yap_InitCPred("start_low_level_trace", 0, start_low_level_trace, SafePredFlag);
|
|
||||||
/** @pred start_low_level_trace
|
/** @pred start_low_level_trace
|
||||||
|
|
||||||
|
|
||||||
@ -489,12 +483,14 @@ Begin display of messages at procedure entry and retry.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
#if THREADS
|
#if THREADS
|
||||||
Yap_InitCPred("start_low_level_trace", 1, start_low_level_trace2, SafePredFlag);
|
Yap_InitCPred("start_low_level_trace", 1, start_low_level_trace2,
|
||||||
|
SafePredFlag);
|
||||||
#endif
|
#endif
|
||||||
Yap_InitCPred("stop_low_level_trace", 0, stop_low_level_trace, SafePredFlag);
|
Yap_InitCPred("stop_low_level_trace", 0, stop_low_level_trace, SafePredFlag);
|
||||||
Yap_InitCPred("show_low_level_trace", 0, show_low_level_trace, SafePredFlag);
|
Yap_InitCPred("show_low_level_trace", 0, show_low_level_trace, SafePredFlag);
|
||||||
Yap_InitCPred("total_choicepoints", 1, total_choicepoints, SafePredFlag);
|
Yap_InitCPred("total_choicepoints", 1, total_choicepoints, SafePredFlag);
|
||||||
Yap_InitCPred("reset_total_choicepoints", 0, reset_total_choicepoints, SafePredFlag);
|
Yap_InitCPred("reset_total_choicepoints", 0, reset_total_choicepoints,
|
||||||
|
SafePredFlag);
|
||||||
Yap_InitCPred("vsc_wait", 0, vsc_wait, SafePredFlag);
|
Yap_InitCPred("vsc_wait", 0, vsc_wait, SafePredFlag);
|
||||||
Yap_InitCPred("vsc_go", 0, vsc_go, SafePredFlag);
|
Yap_InitCPred("vsc_go", 0, vsc_go, SafePredFlag);
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#ifdef SCCS
|
#ifdef SCCS
|
||||||
static char SccsId[] = "%W% %G%";
|
static char SccsId[] = "%W% %G%";
|
||||||
#endif
|
#endif
|
||||||
a
|
|
||||||
/*
|
/*
|
||||||
* This file is an entry for user defined C-predicates.
|
* This file is an entry for user defined C-predicates.
|
||||||
*
|
*
|
||||||
@ -51,8 +51,7 @@ a
|
|||||||
/* You should include here the prototypes for all static functions */
|
/* You should include here the prototypes for all static functions */
|
||||||
|
|
||||||
#ifdef EUROTRA
|
#ifdef EUROTRA
|
||||||
static int
|
static int p_clean(void);
|
||||||
p_clean(void);
|
|
||||||
static int p_namelength(void);
|
static int p_namelength(void);
|
||||||
static int p_getpid(void);
|
static int p_getpid(void);
|
||||||
static int p_exit(void);
|
static int p_exit(void);
|
||||||
|
@ -4607,7 +4607,6 @@ static Int numbervars_in_complex_term(register CELL *pt0, register CELL *pt0_end
|
|||||||
{
|
{
|
||||||
|
|
||||||
register CELL **to_visit0, **to_visit = (CELL **)Yap_PreAllocCodeSpace();
|
register CELL **to_visit0, **to_visit = (CELL **)Yap_PreAllocCodeSpace();
|
||||||
Int numbv0 = numbv;
|
|
||||||
register tr_fr_ptr TR0 = TR;
|
register tr_fr_ptr TR0 = TR;
|
||||||
CELL *InitialH = HR;
|
CELL *InitialH = HR;
|
||||||
|
|
||||||
|
29
C/write.c
29
C/write.c
@ -117,7 +117,8 @@ static void putAtom(Atom, int, struct write_globs *);
|
|||||||
static void writeTerm(Term, int, int, int, struct write_globs *,
|
static void writeTerm(Term, int, int, int, struct write_globs *,
|
||||||
struct rewind_term *);
|
struct rewind_term *);
|
||||||
|
|
||||||
#define wrputc(WF, X) (X)->stream_wputc(X-GLOBAL_Stream, WF) /* writes a character */
|
#define wrputc(WF, X) \
|
||||||
|
(X)->stream_wputc(X - GLOBAL_Stream, WF) /* writes a character */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
protect bracket from merging with previoous character.
|
protect bracket from merging with previoous character.
|
||||||
@ -181,10 +182,10 @@ static void wrputn(Int n,
|
|||||||
protect_close_number(wglb, ob);
|
protect_close_number(wglb, ob);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static void
|
inline static void wrputs(char *s, StreamDesc *stream) {
|
||||||
wrputs(char *s, StreamDesc *stream) {
|
|
||||||
int c;
|
int c;
|
||||||
while ((c = *s++)) wrputc(c, stream);
|
while ((c = *s++))
|
||||||
|
wrputc(c, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wrputws(wchar_t *s, wrf stream) /* writes a string */
|
static void wrputws(wchar_t *s, wrf stream) /* writes a string */
|
||||||
@ -388,7 +389,8 @@ int Yap_FormatFloat(Float f, char **s, size_t sz) {
|
|||||||
int sno;
|
int sno;
|
||||||
char *so;
|
char *so;
|
||||||
|
|
||||||
sno = Yap_open_buf_write_stream(*s, sz, &GLOBAL_Stream[LOCAL_c_output_stream].encoding, 0);
|
sno = Yap_open_buf_write_stream(
|
||||||
|
*s, sz, &GLOBAL_Stream[LOCAL_c_output_stream].encoding, 0);
|
||||||
if (sno < 0)
|
if (sno < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
wglb.stream = GLOBAL_Stream + sno;
|
wglb.stream = GLOBAL_Stream + sno;
|
||||||
@ -485,7 +487,8 @@ static void write_quoted(wchar_t ch, wchar_t quote, wrf stream) {
|
|||||||
wrputc('\'', stream); /* be careful about quotes */
|
wrputc('\'', stream); /* be careful about quotes */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(ch < 0xff && chtype(ch) == BS) && ch != '\'' && ch != '\\' && ch != '`') {
|
if (!(ch < 0xff && chtype(ch) == BS) && ch != '\'' && ch != '\\' &&
|
||||||
|
ch != '`') {
|
||||||
wrputc(ch, stream);
|
wrputc(ch, stream);
|
||||||
} else {
|
} else {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
@ -1200,7 +1203,8 @@ static void writeTerm(Term t, int p, int depth, int rinfixarg,
|
|||||||
EX = oEX;
|
EX = oEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Yap_plwrite(Term t, StreamDesc *mywrite, int max_depth, int flags, int priority)
|
void Yap_plwrite(Term t, StreamDesc *mywrite, int max_depth, int flags,
|
||||||
|
int priority)
|
||||||
/* term to be written */
|
/* term to be written */
|
||||||
/* consumer */
|
/* consumer */
|
||||||
/* write options */
|
/* write options */
|
||||||
@ -1249,10 +1253,8 @@ void Yap_plwrite(Term t, StreamDesc *mywrite, int max_depth, int flags, int prio
|
|||||||
Yap_CloseSlots(sls);
|
Yap_CloseSlots(sls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *Yap_TermToString(Term t, char *s, size_t sz, size_t *length,
|
||||||
char *
|
encoding_t *encp, int flags) {
|
||||||
Yap_TermToString(Term t, char *s, size_t sz, size_t *length, encoding_t *encp, int flags)
|
|
||||||
{
|
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
int sno = Yap_open_buf_write_stream(s, sz, encp, flags);
|
int sno = Yap_open_buf_write_stream(s, sz, encp, flags);
|
||||||
int old_output_stream = LOCAL_c_output_stream;
|
int old_output_stream = LOCAL_c_output_stream;
|
||||||
@ -1268,8 +1270,7 @@ Yap_TermToString(Term t, char *s, size_t sz, size_t *length, encoding_t *encp,
|
|||||||
s = Yap_MemExportStreamPtr(sno);
|
s = Yap_MemExportStreamPtr(sno);
|
||||||
Yap_CloseStream(sno);
|
Yap_CloseStream(sno);
|
||||||
LOCAL_c_output_stream = old_output_stream;
|
LOCAL_c_output_stream = old_output_stream;
|
||||||
if ( EX == 0 ) return s;
|
if (EX == 0)
|
||||||
|
return s;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user