more write updates.

This commit is contained in:
Vitor Santos Costa 2012-02-14 07:46:37 +00:00
parent 98b2cf70c2
commit b454383e30
7 changed files with 29 additions and 20 deletions

View File

@ -742,10 +742,10 @@ void ShowCode_new2(int op, int new1,CELL new4)
switch (ch = *f++)
{
case '1':
Yap_plwrite(MkIntTerm(new1), NULL, 0, 1200);
Yap_plwrite(MkIntTerm(new1), NULL, 30, 0, 1200);
break;
case '4':
Yap_plwrite(MkIntTerm(new4), NULL, 0, 1200);
Yap_plwrite(MkIntTerm(new4), NULL, 20, 0, 1200);
break;
default:
Yap_DebugPutc (LOCAL_c_error_stream,'%');

View File

@ -4136,7 +4136,7 @@ call_gc(UInt gc_lim, Int predarity, CELL *current_env, yamop *nextop USES_REGS)
}
/*
* debug for(save_total=1; save_total<=N; ++save_total)
* plwrite(XREGS[save_total],Yap_DebugPutc,0);
* plwrite(XREGS[save_total],NULL,30,0,0);
*/
return TRUE;
}

View File

@ -199,7 +199,7 @@ Yap_DebugPutc(int sno, wchar_t ch)
void
Yap_DebugPlWrite(Term t)
{
Yap_plwrite(t, NULL, 0, 1200);
Yap_plwrite(t, NULL, 15, 0, 1200);
}
void
@ -238,7 +238,7 @@ typedef struct stream_ref
int beam_write (void)
{
Yap_StartSlots();
Yap_plwrite (ARG1, NULL, 0, 1200);
Yap_plwrite (ARG1, NULL, 0, 0, 1200);
Yap_CloseSlots();
if (EX != 0L) {
Term ball = Yap_PopTermFromDB(EX);

View File

@ -57,7 +57,7 @@ send_tracer_message(char *start, char *name, Int arity, char *mname, CELL *args)
Yap_Portray_delays = TRUE;
#endif
#endif
Yap_plwrite(args[i], NULL, Handle_vars_f, 1200);
Yap_plwrite(args[i], NULL, 15, Handle_vars_f, 1200);
#if DEBUG
#if COROUTINING
Yap_Portray_delays = FALSE;

View File

@ -76,7 +76,6 @@ typedef struct write_globs {
} wglbs;
STATIC_PROTO(void wrputn, (Int, wrf));
STATIC_PROTO(void wrputs, (char *, wrf));
STATIC_PROTO(void wrputf, (Float, wrf));
STATIC_PROTO(void wrputref, (CODEADDR, int, wrf));
STATIC_PROTO(int legalAtom, (unsigned char *));
@ -193,19 +192,21 @@ writebig(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, stru
{
CACHE_REGS
CELL *pt = RepAppl(t)+1;
CELL big_tag = pt[0];
#ifdef USE_GMP
if (pt[0] == BIG_INT)
if (big_tag == BIG_INT)
{
MP_INT *big = Yap_BigIntOfTerm(t);
write_mpint(big, wglb->stream);
return;
} else if (pt[0] == BIG_RATIONAL) {
} else if (big_tag == BIG_RATIONAL) {
Term trat = Yap_RatTermToApplTerm(t);
writeTerm(trat, p, depth, rinfixarg, wglb, rwt);
return;
}
#endif
if (pt[0] == BLOB_STRING) {
if (big_tag == BLOB_STRING) {
if (wglb->Write_strings)
wrputc('`',wglb->stream);
else
@ -216,7 +217,7 @@ writebig(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, stru
else
wrputc('"',wglb->stream);
return;
} else if (pt[0] == BLOB_WIDE_STRING) {
} else if (big_tag == BLOB_WIDE_STRING) {
wchar_t *s = Yap_BlobWideStringOfTerm(t);
if (wglb->Write_strings)
wrputc('`',wglb->stream);
@ -230,6 +231,15 @@ writebig(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, stru
else
wrputc('"',wglb->stream);
return;
} else if (big_tag >= USER_BLOB_START && big_tag < USER_BLOB_END) {
Opaque_CallOnWrite f;
CELL blob_info;
blob_info = big_tag - USER_BLOB_START;
if (GLOBAL_OpaqueHandlers &&
(f= GLOBAL_OpaqueHandlers[blob_info].write_handler)) {
(f)(wglb->stream, big_tag, (void *)((MP_INT *)(pt+1)), 0);
}
}
wrputs("0",wglb->stream);
}
@ -987,7 +997,7 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, str
if (lastw == alphanum) {
wrputc(' ', wglb->stream);
}
if (!IsVarTerm(ti) && (IsIntTerm(ti) || IsStringTerm(ti)) || IsAtomTerm(ti)) {
if (!IsVarTerm(ti) && (IsIntTerm(ti) || IsStringTerm(ti) || IsAtomTerm(ti))) {
if (IsIntTerm(ti)) {
Int k = IntOfTerm(ti);
if (k == -1) {
@ -1041,7 +1051,7 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, str
lastw = separator;
for (op = 1; op <= Arity; ++op) {
if (op == wglb->MaxArgs) {
wrputs('...', wglb->stream);
wrputs("...", wglb->stream);
break;
}
if (wglb->keep_terms) {
@ -1098,7 +1108,7 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, str
}
void
Yap_plwrite(Term t, void *mywrite, int flags, int priority)
Yap_plwrite(Term t, void *mywrite, int max_depth, int flags, int priority)
/* term to be written */
/* consumer */
/* write options */
@ -1115,8 +1125,8 @@ Yap_plwrite(Term t, void *mywrite, int flags, int priority)
wglb.Quote_illegal = flags & Quote_illegal_f;
wglb.Handle_vars = flags & Handle_vars_f;
wglb.Use_portray = flags & Use_portray_f;
wglb.MaxDepth = 15L;
wglb.MaxArgs = 60L;
wglb.MaxDepth = max_depth;
wglb.MaxArgs = max_depth;
/* notice: we must have ASP well set when using portray, otherwise
we cannot make recursive Prolog calls */
wglb.keep_terms = (flags & (Use_portray_f|To_heap_f));

View File

@ -406,7 +406,7 @@ Int STD_PROTO(Yap_SkipList,(Term *, Term **));
/* write.c */
void STD_PROTO(Yap_plwrite,(Term, void *, int, int));
void STD_PROTO(Yap_plwrite,(Term, void *, int, int, int));
/* MYDDAS */

View File

@ -207,18 +207,17 @@ writeTerm(term_t t, int prec, write_options *options)
yap_flag |= Blob_Portray_f;
old_module = CurrentModule;
CurrentModule = options->module;
Yap_plwrite(Yap_GetFromSlot(t), options->out, yap_flag, prec);
Yap_plwrite(Yap_GetFromSlot(t), options->out, options->max_depth, yap_flag, prec);
CurrentModule = old_module;
return TRUE;
}
int
writeAtomToStream(IOSTREAM *s, atom_t atom)
{ Yap_plwrite(MkAtomTerm(YAP_AtomFromSWIAtom(atom)), s, 0, 1200);
{ Yap_plwrite(MkAtomTerm(YAP_AtomFromSWIAtom(atom)), s, 0, 0, 1200);
return 1;
}
int
writeAttributeMask(atom_t a)
{ if ( a == ATOM_ignore )