From 9101de30141539b5e148491349515e89ab508fe2 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Tue, 23 Sep 2014 22:33:31 +0100 Subject: [PATCH] handl weird cases in writing [] --- C/write.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/C/write.c b/C/write.c index 4faca7b75..cd8dc52a7 100644 --- a/C/write.c +++ b/C/write.c @@ -1032,7 +1032,7 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, str wrclose_bracket(wglb, TRUE); } } else if (!wglb->Ignore_ops && - ( Arity == 1 || ((atom == AtomEmptyBrackets || atom == AtomEmptyCurlyBrackets || atom == AtomEmptySquareBrackets) && !IsVarTerm(ArgOfTerm(1, t)))) && + ( Arity == 1 || ((atom == AtomEmptyBrackets || atom == AtomEmptyCurlyBrackets || atom == AtomEmptySquareBrackets) && Yap_IsListTerm(ArgOfTerm(1, t)))) && Yap_IsPosfixOp(atom, &op, &lp)) { Term tleft = ArgOfTerm(1, t); @@ -1061,7 +1061,7 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, str if (bracket_left) { wrclose_bracket(wglb, TRUE); } - if (Arity > 1) { + if (Arity > 1 ) { if (atom == AtomEmptyBrackets) { wrputc('(', wglb->stream); } else if (atom == AtomEmptySquareBrackets) { @@ -1070,7 +1070,7 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, str wrputc('{', wglb->stream); } lastw = separator; - write_list(ArgOfTerm(1,t), 0, depth, wglb, rwt); + write_list(tleft, 0, depth, wglb, rwt); if (atom == AtomEmptyBrackets) { wrputc(')', wglb->stream); } else if (atom == AtomEmptySquareBrackets) {