Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > by-pkgid > 2fc07611b08d4a735fd34d5eb60d8e16 > files > 2215

ciao-1.10p8-3mdv2010.0.i586.rpm

<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               - Getting started on Windows machines</TITLE>
</HEAD>
<BODY> 
Go to the <A HREF="ciao_1.html">first</A>, <A HREF="ciao_3.html">previous</A>, <A HREF="ciao_5.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="SEC44" HREF="ciao_toc.html#TOC44">Getting started on Windows machines</A></H1>

<P>
<STRONG>Author(s):</STRONG> M.Hermenegildo.


<P>
<STRONG>Version:</STRONG> 1.10#7 (2006/4/26, 19:22:13 CEST)


<P>
<STRONG>Version of last change:</STRONG> 1.9#116 (2003/12/3, 13:35:35 CET)


<P>
 


<P>
This part guides you through some very basic first steps with Ciao on an MSWindows ("Win32") system. It assumes that Ciao is already installed correctly on your Windows system. If this is not the case, then follow the instructions in section <A HREF="ciao_232.html#SEC905">Installing Ciao from a Win32 binary distribution</A> (or section <A HREF="ciao_231.html#SEC896">Installing Ciao from the source distribution</A>) first. 


<P>
We start with by describing the basics of using Ciao from the Windows explorer and/or a DOS command shell. We strongly recommend reading also section <A HREF="ciao_4.html#SEC54">An introduction to the Ciao emacs environment (Win32)</A> for the basics on using Ciao under 
<A NAME="IDX367"></A>
<CODE>emacs</CODE>, which is a much simpler and much more powerful way of developing Ciao programs, and has the advantage of offering an almost identical environment under Windows and Un*x. 



<UL>
<LI><A HREF="ciao_4.html#SEC45">Testing your Ciao Win32 installation</A>
<LI><A HREF="ciao_4.html#SEC46">Using Ciao from the Windows explorer and command shell</A>
<LI><A HREF="ciao_4.html#SEC54">An introduction to the Ciao emacs environment (Win32)</A>
<LI><A HREF="ciao_4.html#SEC55">Keeping up to date (Win32)</A>
</UL>



<H2><A NAME="SEC45" HREF="ciao_toc.html#TOC45">Testing your Ciao Win32 installation</A></H2>

<P>
It is a good idea to start by performing some tests to check that Ciao is installed correctly on your system (these are the same tests that you are instructed to do during installation, so you can obviously skip them if you have done them already at that time): 


<P>
 

<UL>

<LI>Ciao-related file types (<CODE>.pl</CODE> source files, <CODE>.cpx</CODE> executables, <CODE>.itf,.po,.asr</CODE> interface files, <CODE>.pls</CODE> scripts, etc.) should have specific icons associated with them (you can look at the files in the folders in the Ciao distribution to check).

<LI>Double-clicking on the shortcut to

<A NAME="IDX368"></A>
<CODE>ciaosh</CODE>(<CODE>.cpx</CODE>) on the desktop should start the typical Prolog top-level shell in a window. If this shortcut has not been created on the desktop, then double-clicking on the 
<A NAME="IDX369"></A>
<CODE>ciaosh</CODE>(<CODE>.cpx</CODE>) icon inside the <CODE>shell</CODE> folder within the Ciao source folder should have the same effect. 

<LI>In the top-level shell, Prolog library modules should load correctly. Type for example <CODE>use_module(library(dec10_io)).</CODE> at the Ciao top-level prompt --you should get back a prompt with no errors reported.

<LI>To exit the top level shell, type <CODE>halt.</CODE> as usual, or <KBD>^D</KBD>.

</UL>

<P>
Also, the following documentation-related actions should work: 



<UL>

<LI>Double-clicking on the shortcut to <CODE>ciao</CODE>(<CODE>.html</CODE>) which appears on the desktop should show the Ciao manual in your default WWW browser. If this shortcut has not been created you can double-click on the <CODE>ciao</CODE>(<CODE>.html</CODE>) file in the <CODE>doc\reference\ciao_html</CODE> folder inside the Ciao source folder. Make sure you configure your browser to use

<A NAME="IDX370"></A>
<A NAME="IDX371"></A>
<EM>style sheets</EM> for correct formatting of the manual (note, however, that some older versions of 
<A NAME="IDX372"></A>
Explorer did not support style sheets well and will give better results turning them off). 

<A NAME="IDX373"></A>
<A NAME="IDX374"></A>
<A NAME="IDX375"></A>
<A NAME="IDX376"></A>
<A NAME="IDX377"></A>
<A NAME="IDX378"></A>

<LI>The <CODE>doc\reference</CODE> folder contains the manual also in the other formats present in the distribution, such as <CODE>info</CODE> (very convenient for users of the

<A NAME="IDX379"></A>
<CODE>emacs</CODE> editor/program development system) and <CODE>postscript</CODE> or <CODE>pdf</CODE>, which are specially useful for printing. See section <A HREF="ciao_4.html#SEC53">Printing manuals (Win32)</A> for instructions. 

</UL>



<H2><A NAME="SEC46" HREF="ciao_toc.html#TOC46">Using Ciao from the Windows explorer and command shell</A></H2>


<UL>
<LI><A HREF="ciao_4.html#SEC47">Starting/exiting the top-level shell (Win32)</A>
<LI><A HREF="ciao_4.html#SEC48">Getting help (Win32)</A>
<LI><A HREF="ciao_4.html#SEC49">Compiling and running programs (Win32)</A>
<LI><A HREF="ciao_4.html#SEC50">Generating executables (Win32)</A>
<LI><A HREF="ciao_4.html#SEC51">Running Ciao scripts (Win32)</A>
<LI><A HREF="ciao_4.html#SEC52">The Ciao initialization file (Win32)</A>
<LI><A HREF="ciao_4.html#SEC53">Printing manuals (Win32)</A>
</UL>



<H3><A NAME="SEC47" HREF="ciao_toc.html#TOC47">Starting/exiting the top-level shell (Win32)</A></H3>

<P>
<A NAME="IDX380"></A>
<A NAME="IDX381"></A>


<P>
The basic methods for starting/exiting the top-level shell have been discussed above. The installation script also leaves a <CODE>ciaosh</CODE>(<CODE>.bat</CODE>) file inside the 
<A NAME="IDX382"></A>
<CODE>shell</CODE> folder of the Ciao distribution which can be used to start the top-level shell from the command line in Windows systems. 




<H3><A NAME="SEC48" HREF="ciao_toc.html#TOC48">Getting help (Win32)</A></H3>

<P>
<A NAME="IDX383"></A>
<A NAME="IDX384"></A>


<P>
The basic methods for accessing the manual on-line have also been discussed above. Use the table of contents and the indices of <EM>predicates</EM>, <EM>libraries</EM>, <EM>concepts</EM>, etc. to find what you are looking for. 
<A NAME="IDX385"></A>
Context-sensitive help is available within the 
<A NAME="IDX386"></A>
<CODE>emacs</CODE> environment (see below). 
 




<H3><A NAME="SEC49" HREF="ciao_toc.html#TOC49">Compiling and running programs (Win32)</A></H3>

<P>
<A NAME="IDX387"></A>
<A NAME="IDX388"></A>
<A NAME="IDX389"></A>
<A NAME="IDX390"></A>
<A NAME="IDX391"></A>
<A NAME="IDX392"></A>


<P>
Once the shell is started, you can compile and execute Prolog modules inside the interactive toplevel shell in the standard way. E.g., type <CODE>use_module(<EM>file</EM>).</CODE>, <CODE>use_module(library(<EM>file</EM>)).</CODE> for library modules, <CODE>ensure_loaded(<EM>file</EM>).</CODE> for files which are not modules, and <CODE>use_package(<EM>file</EM>).</CODE> for library packages (these are syntactic/semantic packages that extend the Ciao Prolog language in many different ways). Note that the use of 
<A NAME="IDX393"></A>
<CODE>compile/1</CODE> and 
<A NAME="IDX394"></A>
<CODE>consult/1</CODE> is discouraged in Ciao. 


<P>
For example, you may want to type <CODE>use_package(iso)</CODE> to ensure Ciao has loaded all the ISO builtins (whether this is done by default or not depends on your 
<A NAME="IDX395"></A>
<CODE>.ciaorc</CODE> file). Do not worry about any "module already in executable" messages --these are normal and simply mean that a certain module is already pre-loaded in the toplevel shell. At this point, typing <CODE>write(hello).</CODE> should work. 


<P>
Note that some predicates that may be built-ins in other Prologs are available through libraries in Ciao. This facilitates making small executables. 


<P>
To change the working directory to, say, the <CODE>examples</CODE> directory in the Ciao source directory, first do: 



<PRE>
      ?- use_module(library(system)).
</PRE>

<P>
(loading the 
<A NAME="IDX396"></A>
<CODE>system</CODE> library makes a number of system-related predicates such as 
<A NAME="IDX397"></A>
<CODE>cd/1</CODE> accessible) and then: 



<PRE>
      ?- cd('$/examples').  
</PRE>

<P>
(in Ciao the sequence <CODE>$/</CODE> <EM>at the beginning of a path name</EM> is replaced by the path of the Ciao root directory). 


<P>
For more information see section <A HREF="ciao_7.html#SEC65">The interactive top-level shell</A>. 




<H3><A NAME="SEC50" HREF="ciao_toc.html#TOC50">Generating executables (Win32)</A></H3>

<P>
<A NAME="IDX398"></A>
<A NAME="IDX399"></A>
<A NAME="IDX400"></A>
<A NAME="IDX401"></A>


<P>
Executables can be generated from the toplevel shell (using 
<A NAME="IDX402"></A>
<CODE>make_exec/2</CODE>) or using the standalone compiler (
<A NAME="IDX403"></A>
<CODE>ciaoc</CODE>(<CODE>.cpx</CODE>), located in the <CODE>ciaoc</CODE> folder). To be able to make an executable, the file should define the predicate 
<A NAME="IDX404"></A>
<CODE>main/1</CODE> (or 
<A NAME="IDX405"></A>
<CODE>main/0</CODE>), which will be called upon startup (see the corresponding manual section for details). 


<P>
For example, within the 
<A NAME="IDX406"></A>
<CODE>examples</CODE> directory, you can type: 



<PRE>
    ?- make_exec(hw,_).
</PRE>

<P>
which should produce an executable. Double-clicking on this executable should execute it. 


<P>
Another way of creating Ciao executables from source files is by right-clicking on <CODE>.pl</CODE> files and choosing "make executable". This uses the standalone compiler (this has the disadvantage, however, that it is sometimes difficult to see the error messages). 


<P>
For more information see section <A HREF="ciao_7.html#SEC65">The interactive top-level shell</A> and section <A HREF="ciao_6.html#SEC57">The stand-alone command-line compiler</A>. 




<H3><A NAME="SEC51" HREF="ciao_toc.html#TOC51">Running Ciao scripts (Win32)</A></H3>

<P>
<A NAME="IDX407"></A>
<A NAME="IDX408"></A>
<A NAME="IDX409"></A>
<A NAME="IDX410"></A>
<A NAME="IDX411"></A>
<A NAME="IDX412"></A>


<P>
Double-clicking on files ending in <CODE>.pls</CODE>, <EM>Ciao Prolog scripts</EM>, will also execute them. These are files containing Prolog source but which get executed without having to explicitly compile them (in the same way as, e.g., <CODE>.bat</CODE> files or programs in scripting languages). As an example, you can double-click on the file 
<A NAME="IDX413"></A>
<CODE>hw.pls</CODE> in the 
<A NAME="IDX414"></A>
<CODE>examples</CODE> folder and look at the source with an editor. You can try changing the <CODE>Hello world</CODE> message and double-clicking again (no need to recompile!). 


<P>
As you can see, the file should define the predicate 
<A NAME="IDX415"></A>
<CODE>main/1</CODE> (not 
<A NAME="IDX416"></A>
<CODE>main/0</CODE>), which will be called upon startup. The two header lines are only necessary in Un*x. In Windows you can leave them in or you can take them out, but leaving them in has the advantage that the script will also work in Un*x without any change. 


<P>
For more information see section <A HREF="ciao_10.html#SEC86">The script interpreter</A>. 




<H3><A NAME="SEC52" HREF="ciao_toc.html#TOC52">The Ciao initialization file (Win32)</A></H3>

<P>
<A NAME="IDX417"></A>
<A NAME="IDX418"></A>
<A NAME="IDX419"></A>
<A NAME="IDX420"></A>


<P>
The Ciao toplevel can be made to execute upon startup a number of commands (such as, e.g., loading certain files or setting certain Prolog flags) contained in an initialization file. This file should be called 
<A NAME="IDX421"></A>
<CODE>.ciaorc</CODE> and placed in your <EM>home</EM> folder (e.g., the same in which the 
<A NAME="IDX422"></A>
<CODE>.emacs</CODE> file is put). You may need to set the environment variable <CODE>HOME</CODE> to the path of this folder for the Ciao toplevel shell to be able to locate this file on startup. 




<H3><A NAME="SEC53" HREF="ciao_toc.html#TOC53">Printing manuals (Win32)</A></H3>

<P>
<A NAME="IDX423"></A>
<A NAME="IDX424"></A>
<A NAME="IDX425"></A>
<A NAME="IDX426"></A>


<P>
As mentioned before, the manual is available in several formats in the <CODE>reference</CODE> folder within Ciao's <CODE>doc</CODE> folder, including <CODE>postscript</CODE> or <CODE>pdf</CODE>, which are specially useful for printing. This can be done using an application such as 
<A NAME="IDX427"></A>
<CODE>ghostview</CODE> (freely available from <A HREF="http://www.cs.wisc.edu/~ghost/index.html">http://www.cs.wisc.edu/~ghost/index.html</A>) or 
<A NAME="IDX428"></A>
<CODE>acrobat reader</CODE> (<A HREF="http://www.adobe.com">http://www.adobe.com</A>, only <CODE>pdf</CODE>). 
<A NAME="IDX429"></A>
<A NAME="IDX430"></A>
<A NAME="IDX431"></A>
<A NAME="IDX432"></A>




<H2><A NAME="SEC54" HREF="ciao_toc.html#TOC54">An introduction to the Ciao emacs environment (Win32)</A></H2>

<P>
 
<A NAME="IDX433"></A>
<A NAME="IDX434"></A>
While it is easy to use Ciao with any editor of your choice, using it within the 
<A NAME="IDX435"></A>
<CODE>emacs</CODE> editor/program development system is highly recommended: Ciao includes an 
<A NAME="IDX436"></A>
<CODE>emacs</CODE> <EM>mode</EM> which provides a very complete 
<A NAME="IDX437"></A>
<A NAME="IDX438"></A>
<EM>application development environment</EM> which greatly simplifies many program development tasks. See section <A HREF="ciao_12.html#SEC93">Using Ciao inside GNU emacs</A> for details on the capabilities of 
<A NAME="IDX439"></A>
<CODE>ciao</CODE>/
<A NAME="IDX440"></A>
<CODE>emacs</CODE> combination. 


<P>
If the (freely available) 
<A NAME="IDX441"></A>
<CODE>emacs</CODE> editor/environment is not installed in your system, we highly recommend that you also install it at this point (there are instructions for where to find 
<A NAME="IDX442"></A>
<CODE>emacs</CODE> and how to install it in the Ciao installation instructions). After having done this you can try for example the following things: 



<UL>

<LI>A few basic things:

 

<UL>

<LI>Typing <KBD>^H</KBD> <KBD>i</KBD> (or in the menus <CODE>Help-&#62;Manuals-&#62;Browse Manuals with Info</CODE>) should open a list of manuals in info format in which the Ciao manual(s) should appear.

<LI>When opening a Prolog file, i.e., a file with <CODE>.pl</CODE> or <CODE>.pls</CODE> ending, using <KBD>^X</KBD><KBD>^F</KBD><CODE>filename</CODE> (or using the menus) the code should appear highlighted according to syntax (e.g., comments in red), and <CODE>Ciao/Prolog</CODE> menus should appear in the menu bar on top of the

<A NAME="IDX443"></A>
<CODE>emacs</CODE> window. 

<LI>Loading the file using the <CODE>Ciao/Prolog</CODE> menu (or typing <KBD>^C</KBD> <KBD>l</KBD>) should start in another emacs buffer the Ciao toplevel shell and load the file. You should now be able to switch the the toplevel shell and make queries from within

<A NAME="IDX444"></A>
<CODE>emacs</CODE>. 

</UL>

<STRONG>Note:</STRONG> when using 
<A NAME="IDX445"></A>
<CODE>emacs</CODE> it is <EM>very convenient</EM> to swap the locations of the (normally not very useful) <KBD>Caps Lock</KBD> key and the (very useful in 
<A NAME="IDX446"></A>
<CODE>emacs</CODE>) <KBD>Ctrl</KBD> key on the keyboard. How to do this is explained in the 
<A NAME="IDX447"></A>
<CODE>emacs</CODE> frequently asked questions FAQs (see the 
<A NAME="IDX448"></A>
<CODE>emacs</CODE> download instructions for their location). 

(if these things do not work the system or emacs may not be installed properly). 

<LI>You can go to the location of most of the errors that may be reported during compilation by typing <KBD>^C</KBD> <KBD>`</KBD>.

<LI>You can also, e.g., create executables from the <CODE>Ciao/Prolog</CODE> menu, as well as compile individual files, or generate active modules.

<LI>Loading a file for source-level debugging using the <CODE>Ciao/Prolog</CODE> menu (or typing <KBD>^C</KBD> <KBD>d</KBD>) and then issuing a query should start the source-level debugger and move a marker on the code in a window while execution is stepped through in the window running the Ciao top level.

<LI>You can add the lines needed in Un*x for turning any file defining

<A NAME="IDX449"></A>
<CODE>main/1</CODE> into a script from the Ciao/Prolog menu or by typing <KBD>^C</KBD> <KBD>I</KBD> <KBD>S</KBD>. 

<LI>You can also work with the preprocessor and auto-documenter directly from emacs: see their manuals or browse through the corresponding menus that appear when editing <CODE>.pl</CODE> files.

</UL>

<P>
We encourage you once more to read section <A HREF="ciao_12.html#SEC93">Using Ciao inside GNU emacs</A> to discover the many other functionalities of this environment. 




<H2><A NAME="SEC55" HREF="ciao_toc.html#TOC55">Keeping up to date (Win32)</A></H2>

<P>
You may want to read section <A HREF="ciao_233.html#SEC912">Beyond installation</A> for instructions on how to sign up on the Ciao user's mailing list, receive announcements regarding new versions, download new versions, report bugs, etc. 


<P><HR><P>
Go to the <A HREF="ciao_1.html">first</A>, <A HREF="ciao_3.html">previous</A>, <A HREF="ciao_5.html">next</A>, <A HREF="ciao_241.html">last</A> section, <A HREF="ciao_toc.html">table of contents</A>.
</BODY>
</HTML>