write
This commit is contained in:
@@ -2109,7 +2109,9 @@ X_API void YAP_ClearExceptions(void) {
|
||||
X_API int YAP_InitConsult(int mode, const char *fname, char **full,
|
||||
int *osnop) {
|
||||
CACHE_REGS
|
||||
int sno;
|
||||
|
||||
int sno;
|
||||
int lvl = push_text_stack();
|
||||
BACKUP_MACHINE_REGS();
|
||||
const char *fl = NULL;
|
||||
if (mode == YAP_BOOT_MODE) {
|
||||
@@ -2126,8 +2128,6 @@ X_API int YAP_InitConsult(int mode, const char *fname, char **full,
|
||||
}
|
||||
__android_log_print(
|
||||
ANDROID_LOG_INFO, "YAPDroid", "done init_ consult %s ",fl);
|
||||
|
||||
int lvl = push_text_stack();
|
||||
char *d = Malloc(strlen(fl) + 1);
|
||||
strcpy(d, fl);
|
||||
bool consulted = (mode == YAP_CONSULT_MODE);
|
||||
@@ -2136,9 +2136,9 @@ int lvl = push_text_stack();
|
||||
LOCAL_encoding);
|
||||
__android_log_print(
|
||||
ANDROID_LOG_INFO, "YAPDroid", "OpenStream got %d ",sno);
|
||||
pop_text_stack(lvl);
|
||||
if (sno < 0 || !Yap_ChDir(dirname((char *)d))) {
|
||||
*full = NULL;
|
||||
pop_text_stack(lvl);
|
||||
return -1;
|
||||
}
|
||||
LOCAL_PrologMode = UserMode;
|
||||
|
||||
@@ -439,7 +439,7 @@ int Yap_copy_complex_term(register CELL *pt0, register CELL *pt0_end,
|
||||
(ptd0 >= HB && ptd0 < HR)) {
|
||||
/* we have already found this cell */
|
||||
*ptf++ = (CELL)ptd0;
|
||||
} else
|
||||
} else
|
||||
if (copy_att_vars && GlobalIsAttachedTerm((CELL)ptd0)) {
|
||||
/* if unbound, call the standard copy term routine */
|
||||
struct cp_frame *bp;
|
||||
@@ -458,16 +458,16 @@ int Yap_copy_complex_term(register CELL *pt0, register CELL *pt0_end,
|
||||
goto trail_overflow;
|
||||
}
|
||||
}
|
||||
TrailedMaBind(ptd0, new);
|
||||
ptf++;
|
||||
} else {
|
||||
|
||||
} else {
|
||||
/* first time we met this term */
|
||||
RESET_VARIABLE(ptf);
|
||||
if ((ADDR)TR > LOCAL_TrailTop - 16)
|
||||
goto trail_overflow;
|
||||
DO_TRAIL(ptd0, (CELL)ptf);
|
||||
*ptd0 = (CELL)ptf;
|
||||
ptf++;
|
||||
if ((ADDR)TR > LOCAL_TrailTop - 16)
|
||||
goto trail_overflow;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -117,6 +117,8 @@ static wtype AtomIsSymbols(unsigned char *);
|
||||
static void putAtom(Atom, int, struct write_globs *);
|
||||
static void writeTerm(Term, int, int, int, struct write_globs *,
|
||||
struct rewind_term *);
|
||||
static void writeTerm__(Term t, yhandle_t sl, int p, int depth, int rinfixarg,
|
||||
struct write_globs *wglb, struct rewind_term *rwt);
|
||||
|
||||
static void write_list(Term t, int direction, int depth,
|
||||
struct write_globs *wglb, struct rewind_term *rwt);
|
||||
@@ -760,7 +762,7 @@ static void write_list__(Term t, yhandle_t sl, int direction, int depth,
|
||||
if (!IsPairTerm(ti))
|
||||
break;
|
||||
if (check_for_loops(ti,wglb)) return;
|
||||
wglb->sl = Yap_InitHandle(ti);
|
||||
sl = wglb->sl = Yap_InitHandle(ti);
|
||||
ndirection = RepPair(ti) - RepPair(t);
|
||||
/* make sure we're not trapped in loops */
|
||||
if (ndirection > 0) {
|
||||
@@ -793,14 +795,14 @@ static void write_list__(Term t, yhandle_t sl, int direction, int depth,
|
||||
/* we found an infinite loop */
|
||||
/* keep going on the list */
|
||||
wrputc(',', wglb->stream);
|
||||
write_list(ti, direction, depth, wglb, &nrwt);
|
||||
write_list__(ti, sl, direction, depth, wglb, &nrwt);
|
||||
} else if (ti != MkAtomTerm(AtomNil)) {
|
||||
if (lastw == symbol || lastw == separator) {
|
||||
wrputc(' ', wglb->stream);
|
||||
}
|
||||
wrputc('|', wglb->stream);
|
||||
lastw = separator;
|
||||
writeTerm(ti, 999, depth, FALSE, wglb, &nrwt);
|
||||
writeTerm__(ti, sl, 999, depth, FALSE, wglb, &nrwt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user