/// @memberof write_canonical/2 word pl_write_canonical2(term_t stream, term_t term) { GET_LD nv_options options; word rc; BEGIN_NUMBERVARS(TRUE); options.functor = FUNCTOR_isovar1; options.on_attvar = AV_SKIP; options.singletons = PL_is_acyclic(term); options.numbered_check = FALSE; rc = ( numberVars(term, &options, 0 PASS_LD) >= 0 && do_write2(stream, term, PL_WRT_QUOTED|PL_WRT_IGNOREOPS|PL_WRT_NUMBERVARS|PLFLAG_BACKQUOTED_STRING) ); END_NUMBERVARS(TRUE); return rc; }
static void rewrite_callable(atom_t *expected, term_t actual) { GET_LD term_t a = 0; int loops = 0; while ( PL_is_functor(actual, FUNCTOR_colon2) ) { if ( !a ) a = PL_new_term_ref(); _PL_get_arg(1, actual, a); if ( !PL_is_atom(a) ) { *expected = ATOM_atom; PL_put_term(actual, a); return; } else { _PL_get_arg(2, actual, a); PL_put_term(actual, a); } if ( ++loops > 100 && !PL_is_acyclic(actual) ) break; } }