<HTML> <HEAD> <!-- Created by texi2html 1.56k + clip patches and <A href="http://www.clip.dia.fi.upm.es/Software">lpdoc</A> from ciao.texi on 28 January 2007 --> <LINK rel="stylesheet" href="ciao.css" type="text/css"> <TITLE>The Ciao Prolog System - A simple pretty-printer for Ciao programs</TITLE> </HEAD> <BODY> Go to the <A HREF="ciao_1.html">first</A>, <A HREF="ciao_82.html">previous</A>, <A HREF="ciao_84.html">next</A>, <A HREF="ciao_241.html">last</A> section, <A HREF="ciao_toc.html">table of contents</A>. <P><HR><P> <H1><A NAME="SEC352" HREF="ciao_toc.html#TOC352">A simple pretty-printer for Ciao programs</A></H1> <P> <A NAME="IDX4630"></A> <P> <STRONG>Author(s):</STRONG> The CLIP Group. <P> <STRONG>Version:</STRONG> 1.10#7 (2006/4/26, 19:22:13 CEST) <P> <STRONG>Version of last change:</STRONG> 1.9#248 (2003/12/30, 21:52:0 CET) <P> This library module writes out to standard output a clause or a list of clauses. <UL> <LI><A HREF="ciao_83.html#SEC353">Usage and interface (pretty_print)</A> <LI><A HREF="ciao_83.html#SEC354">Documentation on exports (pretty_print)</A> <LI><A HREF="ciao_83.html#SEC355">Documentation on internals (pretty_print)</A> </UL> <H2><A NAME="SEC353" HREF="ciao_toc.html#TOC353">Usage and interface (<CODE>pretty_print</CODE>)</A></H2> <div class="cartouche"> <UL> <LI><STRONG>Library usage:</STRONG> <CODE>:- use_module(library(pretty_print)).</CODE> <LI><STRONG>Exports:</STRONG> <UL> <LI><EM>Predicates:</EM> <A NAME="IDX4631"></A> <CODE>pretty_print/2</CODE>, <A NAME="IDX4632"></A> <CODE>pretty_print/3</CODE>. </UL> <LI><STRONG>Other modules used:</STRONG> <UL> <LI><EM>System library modules:</EM> <A NAME="IDX4633"></A> <CODE>operators</CODE>, <A NAME="IDX4634"></A> <CODE>vndict</CODE>, <A NAME="IDX4635"></A> <CODE>write</CODE>. </UL> </UL> </div class="cartouche"> <H2><A NAME="SEC354" HREF="ciao_toc.html#TOC354">Documentation on exports (<CODE>pretty_print</CODE>)</A></H2> <P> <A NAME="IDX4636"></A> <A NAME="IDX4637"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>pretty_print/2:</B> <DD><A NAME="IDX4638"></A> <P> <STRONG>Usage:</STRONG> <CODE>pretty_print(Cls, Flags)</CODE> <UL> <LI><EM>Description:</EM> Prints each clause in the list <CODE>Cls</CODE> after numbering its variables. <LI><EM>The following properties should hold at call time:</EM> <CODE>pretty_print:clauses(Cls)</CODE> (<CODE>pretty_print:clauses/1</CODE>) <CODE>Flags</CODE> is a list of <CODE>flag</CODE>s. (<CODE>basic_props:list/2</CODE>) </UL> </DL> <P> <A NAME="IDX4639"></A> <A NAME="IDX4640"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>pretty_print/3:</B> <DD><A NAME="IDX4641"></A> <P> <STRONG>Usage:</STRONG> <CODE>pretty_print(Cls, Flags, Ds)</CODE> <UL> <LI><EM>Description:</EM> Prints each clause in the list <CODE>Cls</CODE> after using the corresponding variable names dictionary in <CODE>Ds</CODE> to name its variables. <LI><EM>The following properties should hold at call time:</EM> <CODE>pretty_print:clauses(Cls)</CODE> (<CODE>pretty_print:clauses/1</CODE>) <CODE>Flags</CODE> is a list of <CODE>flag</CODE>s. (<CODE>basic_props:list/2</CODE>) <CODE>Ds</CODE> is a dictionary of variable names. (<CODE>vndict:varnamedict/1</CODE>) </UL> </DL> <H2><A NAME="SEC355" HREF="ciao_toc.html#TOC355">Documentation on internals (<CODE>pretty_print</CODE>)</A></H2> <P> <A NAME="IDX4642"></A> <A NAME="IDX4643"></A> <DL> <DT><span class="define">REGTYPE:</span> <B>clauses/1:</B> <DD><A NAME="IDX4644"></A> <P> A regular type, defined as follows: <PRE> <PRE> clauses([]). clauses([_1|_2]) :- clause(_1), clauses(_2). clauses(_1) :- clause(_1). </PRE> </PRE> </DL> <P> <A NAME="IDX4645"></A> <A NAME="IDX4646"></A> <DL> <DT><span class="define">REGTYPE:</span> <B>clause/1:</B> <DD><A NAME="IDX4647"></A> <P> A regular type, defined as follows: <PRE> <PRE> clause(_1) :- clterm(_1). clause((_1,_2)) :- clterm(_1), term(_2). </PRE> </PRE> </DL> <P> <A NAME="IDX4648"></A> <A NAME="IDX4649"></A> <DL> <DT><span class="define">REGTYPE:</span> <B>clterm/1:</B> <DD><A NAME="IDX4650"></A> <P> A regular type, defined as follows: <PRE> <PRE> clterm(clause(_1,_2)) :- callable(_1), body(_2). clterm(directive(_1)) :- body(_1). clterm((_1:-_2)) :- callable(_1), body(_2). clterm(_1) :- callable(_1). </PRE> </PRE> </DL> <P> <A NAME="IDX4651"></A> <A NAME="IDX4652"></A> <DL> <DT><span class="define">REGTYPE:</span> <B>body/1:</B> <DD><A NAME="IDX4653"></A> <P> A well formed body, including cge expressions and &-concurrent expressions. The atomic goals may or may not have a key in the form <CODE>^(goal:any)</CODE>, and may or may not be module qualified, but if they are it has to be in the form <CODE>^(^(moddesc:goal):any)</CODE>. <P> <STRONG>Usage:</STRONG> <CODE>body(X)</CODE> <UL> <LI><EM>Description:</EM> <CODE>X</CODE> is a printable body. </UL> </DL> <P> <A NAME="IDX4654"></A> <A NAME="IDX4655"></A> <DL> <DT><span class="define">REGTYPE:</span> <B>flag/1:</B> <DD><A NAME="IDX4656"></A> <P> A keyword <CODE>ask/1</CODE> flags whether to output <EM>asks</EM> or <EM>whens</EM> and <CODE>nl/1</CODE> whether to separate clauses with a blank line or not. <P> <STRONG>Usage:</STRONG> <CODE>flag(X)</CODE> <UL> <LI><EM>Description:</EM> <CODE>X</CODE> is a flag for the pretty-printer. </UL> </DL> <P><HR><P> Go to the <A HREF="ciao_1.html">first</A>, <A HREF="ciao_82.html">previous</A>, <A HREF="ciao_84.html">next</A>, <A HREF="ciao_241.html">last</A> section, <A HREF="ciao_toc.html">table of contents</A>. </BODY> </HTML>