more write updates.
This commit is contained in:
parent
98b2cf70c2
commit
b454383e30
@ -742,10 +742,10 @@ void ShowCode_new2(int op, int new1,CELL new4)
|
|||||||
switch (ch = *f++)
|
switch (ch = *f++)
|
||||||
{
|
{
|
||||||
case '1':
|
case '1':
|
||||||
Yap_plwrite(MkIntTerm(new1), NULL, 0, 1200);
|
Yap_plwrite(MkIntTerm(new1), NULL, 30, 0, 1200);
|
||||||
break;
|
break;
|
||||||
case '4':
|
case '4':
|
||||||
Yap_plwrite(MkIntTerm(new4), NULL, 0, 1200);
|
Yap_plwrite(MkIntTerm(new4), NULL, 20, 0, 1200);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Yap_DebugPutc (LOCAL_c_error_stream,'%');
|
Yap_DebugPutc (LOCAL_c_error_stream,'%');
|
||||||
|
@ -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)
|
* 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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@ Yap_DebugPutc(int sno, wchar_t ch)
|
|||||||
void
|
void
|
||||||
Yap_DebugPlWrite(Term t)
|
Yap_DebugPlWrite(Term t)
|
||||||
{
|
{
|
||||||
Yap_plwrite(t, NULL, 0, 1200);
|
Yap_plwrite(t, NULL, 15, 0, 1200);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -238,7 +238,7 @@ typedef struct stream_ref
|
|||||||
int beam_write (void)
|
int beam_write (void)
|
||||||
{
|
{
|
||||||
Yap_StartSlots();
|
Yap_StartSlots();
|
||||||
Yap_plwrite (ARG1, NULL, 0, 1200);
|
Yap_plwrite (ARG1, NULL, 0, 0, 1200);
|
||||||
Yap_CloseSlots();
|
Yap_CloseSlots();
|
||||||
if (EX != 0L) {
|
if (EX != 0L) {
|
||||||
Term ball = Yap_PopTermFromDB(EX);
|
Term ball = Yap_PopTermFromDB(EX);
|
||||||
|
@ -57,7 +57,7 @@ send_tracer_message(char *start, char *name, Int arity, char *mname, CELL *args)
|
|||||||
Yap_Portray_delays = TRUE;
|
Yap_Portray_delays = TRUE;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
Yap_plwrite(args[i], NULL, Handle_vars_f, 1200);
|
Yap_plwrite(args[i], NULL, 15, Handle_vars_f, 1200);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
#if COROUTINING
|
#if COROUTINING
|
||||||
Yap_Portray_delays = FALSE;
|
Yap_Portray_delays = FALSE;
|
||||||
|
30
C/write.c
30
C/write.c
@ -76,7 +76,6 @@ typedef struct write_globs {
|
|||||||
} wglbs;
|
} wglbs;
|
||||||
|
|
||||||
STATIC_PROTO(void wrputn, (Int, wrf));
|
STATIC_PROTO(void wrputn, (Int, wrf));
|
||||||
STATIC_PROTO(void wrputs, (char *, wrf));
|
|
||||||
STATIC_PROTO(void wrputf, (Float, wrf));
|
STATIC_PROTO(void wrputf, (Float, wrf));
|
||||||
STATIC_PROTO(void wrputref, (CODEADDR, int, wrf));
|
STATIC_PROTO(void wrputref, (CODEADDR, int, wrf));
|
||||||
STATIC_PROTO(int legalAtom, (unsigned char *));
|
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
|
CACHE_REGS
|
||||||
CELL *pt = RepAppl(t)+1;
|
CELL *pt = RepAppl(t)+1;
|
||||||
|
CELL big_tag = pt[0];
|
||||||
|
|
||||||
#ifdef USE_GMP
|
#ifdef USE_GMP
|
||||||
if (pt[0] == BIG_INT)
|
if (big_tag == BIG_INT)
|
||||||
{
|
{
|
||||||
MP_INT *big = Yap_BigIntOfTerm(t);
|
MP_INT *big = Yap_BigIntOfTerm(t);
|
||||||
write_mpint(big, wglb->stream);
|
write_mpint(big, wglb->stream);
|
||||||
return;
|
return;
|
||||||
} else if (pt[0] == BIG_RATIONAL) {
|
} else if (big_tag == BIG_RATIONAL) {
|
||||||
Term trat = Yap_RatTermToApplTerm(t);
|
Term trat = Yap_RatTermToApplTerm(t);
|
||||||
writeTerm(trat, p, depth, rinfixarg, wglb, rwt);
|
writeTerm(trat, p, depth, rinfixarg, wglb, rwt);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (pt[0] == BLOB_STRING) {
|
if (big_tag == BLOB_STRING) {
|
||||||
if (wglb->Write_strings)
|
if (wglb->Write_strings)
|
||||||
wrputc('`',wglb->stream);
|
wrputc('`',wglb->stream);
|
||||||
else
|
else
|
||||||
@ -216,7 +217,7 @@ writebig(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, stru
|
|||||||
else
|
else
|
||||||
wrputc('"',wglb->stream);
|
wrputc('"',wglb->stream);
|
||||||
return;
|
return;
|
||||||
} else if (pt[0] == BLOB_WIDE_STRING) {
|
} else if (big_tag == BLOB_WIDE_STRING) {
|
||||||
wchar_t *s = Yap_BlobWideStringOfTerm(t);
|
wchar_t *s = Yap_BlobWideStringOfTerm(t);
|
||||||
if (wglb->Write_strings)
|
if (wglb->Write_strings)
|
||||||
wrputc('`',wglb->stream);
|
wrputc('`',wglb->stream);
|
||||||
@ -230,6 +231,15 @@ writebig(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, stru
|
|||||||
else
|
else
|
||||||
wrputc('"',wglb->stream);
|
wrputc('"',wglb->stream);
|
||||||
return;
|
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);
|
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) {
|
if (lastw == alphanum) {
|
||||||
wrputc(' ', wglb->stream);
|
wrputc(' ', wglb->stream);
|
||||||
}
|
}
|
||||||
if (!IsVarTerm(ti) && (IsIntTerm(ti) || IsStringTerm(ti)) || IsAtomTerm(ti)) {
|
if (!IsVarTerm(ti) && (IsIntTerm(ti) || IsStringTerm(ti) || IsAtomTerm(ti))) {
|
||||||
if (IsIntTerm(ti)) {
|
if (IsIntTerm(ti)) {
|
||||||
Int k = IntOfTerm(ti);
|
Int k = IntOfTerm(ti);
|
||||||
if (k == -1) {
|
if (k == -1) {
|
||||||
@ -1041,7 +1051,7 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, str
|
|||||||
lastw = separator;
|
lastw = separator;
|
||||||
for (op = 1; op <= Arity; ++op) {
|
for (op = 1; op <= Arity; ++op) {
|
||||||
if (op == wglb->MaxArgs) {
|
if (op == wglb->MaxArgs) {
|
||||||
wrputs('...', wglb->stream);
|
wrputs("...", wglb->stream);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (wglb->keep_terms) {
|
if (wglb->keep_terms) {
|
||||||
@ -1098,7 +1108,7 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, str
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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 */
|
/* term to be written */
|
||||||
/* consumer */
|
/* consumer */
|
||||||
/* write options */
|
/* write options */
|
||||||
@ -1115,8 +1125,8 @@ Yap_plwrite(Term t, void *mywrite, int flags, int priority)
|
|||||||
wglb.Quote_illegal = flags & Quote_illegal_f;
|
wglb.Quote_illegal = flags & Quote_illegal_f;
|
||||||
wglb.Handle_vars = flags & Handle_vars_f;
|
wglb.Handle_vars = flags & Handle_vars_f;
|
||||||
wglb.Use_portray = flags & Use_portray_f;
|
wglb.Use_portray = flags & Use_portray_f;
|
||||||
wglb.MaxDepth = 15L;
|
wglb.MaxDepth = max_depth;
|
||||||
wglb.MaxArgs = 60L;
|
wglb.MaxArgs = max_depth;
|
||||||
/* notice: we must have ASP well set when using portray, otherwise
|
/* notice: we must have ASP well set when using portray, otherwise
|
||||||
we cannot make recursive Prolog calls */
|
we cannot make recursive Prolog calls */
|
||||||
wglb.keep_terms = (flags & (Use_portray_f|To_heap_f));
|
wglb.keep_terms = (flags & (Use_portray_f|To_heap_f));
|
||||||
|
@ -406,7 +406,7 @@ Int STD_PROTO(Yap_SkipList,(Term *, Term **));
|
|||||||
|
|
||||||
|
|
||||||
/* write.c */
|
/* write.c */
|
||||||
void STD_PROTO(Yap_plwrite,(Term, void *, int, int));
|
void STD_PROTO(Yap_plwrite,(Term, void *, int, int, int));
|
||||||
|
|
||||||
|
|
||||||
/* MYDDAS */
|
/* MYDDAS */
|
||||||
|
@ -207,18 +207,17 @@ writeTerm(term_t t, int prec, write_options *options)
|
|||||||
yap_flag |= Blob_Portray_f;
|
yap_flag |= Blob_Portray_f;
|
||||||
old_module = CurrentModule;
|
old_module = CurrentModule;
|
||||||
CurrentModule = options->module;
|
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;
|
CurrentModule = old_module;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
writeAtomToStream(IOSTREAM *s, atom_t atom)
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
writeAttributeMask(atom_t a)
|
writeAttributeMask(atom_t a)
|
||||||
{ if ( a == ATOM_ignore )
|
{ if ( a == ATOM_ignore )
|
||||||
|
Reference in New Issue
Block a user