<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 - The Ciao library browser</TITLE> </HEAD> <BODY> Go to the <A HREF="ciao_1.html">first</A>, <A HREF="ciao_84.html">previous</A>, <A HREF="ciao_86.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="SEC359" HREF="ciao_toc.html#TOC359">The Ciao library browser</A></H1> <P> <A NAME="IDX4670"></A> <P> <STRONG>Author(s):</STRONG> Angel Fernandez Pineda. <P> <STRONG>Version:</STRONG> 1.10#7 (2006/4/26, 19:22:13 CEST) <P> <STRONG>Version of last change:</STRONG> 1.7#21 (2000/9/26, 13:37:17 CEST) <P> <A NAME="IDX4671"></A> <CODE>librowser</CODE> library provides a set of predicates wich enables the user to interactively find Ciao/Prolog libraries and/or any predicate exported by them. <P> This is a simple example: <PRE> ?- apropos('*find*'). persdbrt_sql: dbfindall/4 persdbrtsql: dbfindall/4 conc_aggregates: findall/3 linda: rd_findall/3 vndict: find_name/4 internals: $find_file/8 aggregates: findall/4,findall/3 yes ?- </PRE> <P> Librowser is specially usefull when using inside GNU Emacs, just place the cursor over a librowser response and press C-cTAB in order to get help on the related predicate. Refer to the <STRONG>"Using Ciao inside GNU Emacs"</STRONG> chapter for further information. <UL> <LI><A HREF="ciao_85.html#SEC360">Usage and interface (librowser)</A> <LI><A HREF="ciao_85.html#SEC361">Documentation on exports (librowser)</A> <LI><A HREF="ciao_85.html#SEC362">Documentation on internals (librowser)</A> </UL> <H2><A NAME="SEC360" HREF="ciao_toc.html#TOC360">Usage and interface (<CODE>librowser</CODE>)</A></H2> <div class="cartouche"> <UL> <LI><STRONG>Library usage:</STRONG> It is not necesary to use this library at user programs. It was designed to be used at the Ciao <EM>toplevel</EM> shell: <A NAME="IDX4672"></A> <CODE>ciaosh</CODE>. In order to do so, just make use of <A NAME="IDX4673"></A> <CODE>use_module/1</CODE> as follows: <CODE>use_module(library(librowser))</CODE>. Then, the library interface must be read. This is automatically done when calling any predicate at librowser, and the entire process will take a little moment.So, you should want to perform such a process after loading the Ciao toplevel: <PRE> Ciao 0.9 #75: Fri Apr 30 19:04:24 MEST 1999 ?- use_module(library(librowser)). yes ?- update. </PRE> Whether you want this process to be automatically performed when loading <A NAME="IDX4674"></A> <CODE>ciaosh</CODE>, you may include those lines in your <EM>.ciaorc</EM> personal initialization file. <LI><STRONG>Exports:</STRONG> <UL> <LI><EM>Predicates:</EM> <A NAME="IDX4675"></A> <CODE>update/0</CODE>, <A NAME="IDX4676"></A> <CODE>browse/2</CODE>, <A NAME="IDX4677"></A> <CODE>where/1</CODE>, <A NAME="IDX4678"></A> <CODE>describe/1</CODE>, <A NAME="IDX4679"></A> <CODE>system_lib/1</CODE>, <A NAME="IDX4680"></A> <CODE>apropos/1</CODE>. </UL> <LI><STRONG>Other modules used:</STRONG> <UL> <LI><EM>System library modules:</EM> <A NAME="IDX4681"></A> <CODE>filenames</CODE>, <A NAME="IDX4682"></A> <CODE>read</CODE>, <A NAME="IDX4683"></A> <CODE>fastrw</CODE>, <A NAME="IDX4684"></A> <CODE>system</CODE>, <A NAME="IDX4685"></A> <CODE>streams</CODE>, <A NAME="IDX4686"></A> <CODE>patterns</CODE>, <A NAME="IDX4687"></A> <CODE>lists</CODE>. </UL> </UL> </div class="cartouche"> <H2><A NAME="SEC361" HREF="ciao_toc.html#TOC361">Documentation on exports (<CODE>librowser</CODE>)</A></H2> <P> <A NAME="IDX4688"></A> <A NAME="IDX4689"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>update/0:</B> <DD><A NAME="IDX4690"></A> <P> This predicate will scan the Ciao <A NAME="IDX4691"></A> system libraries for predicate definitions. This may be done once time before calling any other predicate at this library. <P> update/0 will also be automatically called (once) when calling any other predicate at librowser. <P> <STRONG>Usage:</STRONG> <UL> <LI><EM>Description:</EM> Creates an internal database of modules at Ciao <A NAME="IDX4692"></A> system libraries. </UL> </DL> <P> <A NAME="IDX4693"></A> <A NAME="IDX4694"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>browse/2:</B> <DD><A NAME="IDX4695"></A> <P> This predicate is fully reversible, and is provided to inspect concrete predicate specifications. For example: <PRE> ?- browse(M,findall/A). A = 3, M = conc_aggregates ? ; A = 4, M = aggregates ? ; A = 3, M = aggregates ? ; no ?- </PRE> <P> <STRONG>Usage:</STRONG> <CODE>browse(Module, Spec)</CODE> <UL> <LI><EM>Description:</EM> Asocciates the given <CODE>Spec</CODE> predicate specification with the <CODE>Module</CODE> which exports it. <LI><EM>The following properties should hold at call time:</EM> <CODE>Module</CODE> is a module name (an atom) (<CODE>librowser:module_name/1</CODE>) <CODE>Spec</CODE> is a <STRONG>Functor/Arity</STRONG> predicate specification (<CODE>librowser:pred_spec/1</CODE>) </UL> </DL> <P> <A NAME="IDX4696"></A> <A NAME="IDX4697"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>where/1:</B> <DD><A NAME="IDX4698"></A> <P> This predicate will print at the screen the module needed in order to import a given predicate specification. For example: <PRE> ?- where(findall/A). findall/3 exported at module conc_aggregates findall/4 exported at module aggregates findall/3 exported at module aggregates yes ?- </PRE> <P> <STRONG>Usage:</STRONG> <CODE>where(Spec)</CODE> <UL> <LI><EM>Description:</EM> Display what module to load in order to import the given <CODE>Spec</CODE>. <LI><EM>The following properties should hold at call time:</EM> <CODE>Spec</CODE> is a <STRONG>Functor/Arity</STRONG> predicate specification (<CODE>librowser:pred_spec/1</CODE>) </UL> </DL> <P> <A NAME="IDX4699"></A> <A NAME="IDX4700"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>describe/1:</B> <DD><A NAME="IDX4701"></A> <P> This one is used to find out which predicates were exported by a given module. Very usefull when you know the library, but not the concrete predicate. For example: <PRE> ?- describe(librowser). Predicates at library librowser : apropos/1 system_lib/1 describe/1 where/1 browse/2 update/0 yes ?- </PRE> <P> <STRONG>Usage:</STRONG> <CODE>describe(Module)</CODE> <UL> <LI><EM>Description:</EM> Display a list of exported predicates at the given <CODE>Module</CODE> <LI><EM>The following properties should hold at call time:</EM> <CODE>Module</CODE> is a module name (an atom) (<CODE>librowser:module_name/1</CODE>) </UL> </DL> <P> <A NAME="IDX4702"></A> <A NAME="IDX4703"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>system_lib/1:</B> <DD><A NAME="IDX4704"></A> <P> It retrieves on backtracking all Ciao system libraries stored in the internal database. Certainly, those which were scanned at <A NAME="IDX4705"></A> <CODE>update/0</CODE> calling. <P> <STRONG>Usage:</STRONG> <CODE>system_lib(Module)</CODE> <UL> <LI><EM>Description:</EM> <CODE>Module</CODE> variable will be successively instantiated to the system libaries stored in the internal database. <LI><EM>The following properties should hold at call time:</EM> <CODE>Module</CODE> is a module name (an atom) (<CODE>librowser:module_name/1</CODE>) </UL> </DL> <P> <A NAME="IDX4706"></A> <A NAME="IDX4707"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>apropos/1:</B> <DD><A NAME="IDX4708"></A> <P> This tool makes use of <A NAME="IDX4709"></A> regular expresions in order to find predicate specifications. It is very usefull whether you can't remember the full name of a predicate. Regular expresions take the same format as described in library <A NAME="IDX4710"></A> <CODE>patterns</CODE>. Example: <PRE> ?- apropos('atom_*'). terms: atom_concat/2 concurrency: atom_lock_state/2 atomic_basic: atom_concat/3,atom_length/2,atom_codes/2 iso_byte_char: atom_chars/2 yes ?- </PRE> <P> <STRONG>Usage:</STRONG> <CODE>apropos(RegSpec)</CODE> <UL> <LI><EM>Description:</EM> This will search any predicate specification <CODE>Spec</CODE> which matches the given <CODE>RegSpec</CODE> incomplete predicate specification. <LI><EM>The following properties should hold at call time:</EM> <CODE>RegSpec</CODE> is a Pattern/Arity specification. (<CODE>librowser:apropos_spec/1</CODE>) </UL> </DL> <H2><A NAME="SEC362" HREF="ciao_toc.html#TOC362">Documentation on internals (<CODE>librowser</CODE>)</A></H2> <P> <A NAME="IDX4711"></A> <A NAME="IDX4712"></A> <DL> <DT><span class="define">REGTYPE:</span> <B>apropos_spec/1:</B> <DD><A NAME="IDX4713"></A> <P> Defined as: <PRE> apropos_spec(_1). apropos_spec(Pattern/Arity) :- pattern(Pattern), int(Arity). </PRE> <P> <STRONG>Usage:</STRONG> <CODE>apropos_spec(S)</CODE> <UL> <LI><EM>Description:</EM> <CODE>S</CODE> is a Pattern/Arity specification. </UL> </DL> <P><HR><P> Go to the <A HREF="ciao_1.html">first</A>, <A HREF="ciao_84.html">previous</A>, <A HREF="ciao_86.html">next</A>, <A HREF="ciao_241.html">last</A> section, <A HREF="ciao_toc.html">table of contents</A>. </BODY> </HTML>