This file is indexed.

/usr/lib/swi-prolog/doc/Manual/projectfiles.html is in swi-prolog-nox 5.10.4-3ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<HTML>
<HEAD>
<TITLE>SWI-Prolog 5.11.18 Reference Manual: Section 3.1</TITLE><LINK REL=home HREF="index.html">
<LINK REL=contents HREF="Contents.html">
<LINK REL=index HREF="DocIndex.html">
<LINK REL=summary HREF="summary.html">
<LINK REL=previous HREF="IDE.html">
<LINK REL=next HREF="usingmodules.html">
<STYLE type="text/css">
/* Style sheet for SWI-Prolog latex2html
*/

dd.defbody
{ margin-bottom: 1em;
}

dt.pubdef
{ background-color: #c5e1ff;
}

dt.multidef
{ background-color: #c8ffc7;
}

.bib dd
{ margin-bottom: 1em;
}

.bib dt
{ float: left;
margin-right: 1.3ex;
}

pre.code
{ margin-left: 1.5em;
margin-right: 1.5em;
border: 1px dotted;
padding-top: 5px;
padding-left: 5px;
padding-bottom: 5px;
background-color: #f8f8f8;
}

div.navigate
{ text-align: center;
background-color: #f0f0f0;
border: 1px dotted;
padding: 5px;
}

div.title
{ text-align: center;
padding-bottom: 1em;
font-size: 200%;
font-weight: bold;
}

div.author
{ text-align: center;
font-style: italic;
}

div.abstract
{ margin-top: 2em;
background-color: #f0f0f0;
border: 1px dotted;
padding: 5px;
margin-left: 10%; margin-right:10%;
}

div.abstract-title
{ text-align: center;
padding: 5px;
font-size: 120%;
font-weight: bold;
}

div.toc-h1
{ font-size: 200%;
font-weight: bold;
}

div.toc-h2
{ font-size: 120%;
font-weight: bold;
margin-left: 2em;
}

div.toc-h3
{ font-size: 100%;
font-weight: bold;
margin-left: 4em;
}

div.toc-h4
{ font-size: 100%;
margin-left: 6em;
}

span.sec-nr
{
}

span.sec-title
{
}

span.pred-ext
{ font-weight: bold;
}

span.pred-tag
{ float: right;
padding-top: 0.2em;
font-size: 80%;
font-style: italic;
color: #202020;
}

/* Footnotes */

sup.fn { color: blue; text-decoration: underline; }
span.fn-text { display: none; }
sup.fn span {display: none;}
sup:hover span
{ display: block !important;
position: absolute; top: auto; left: auto; width: 80%;
color: #000; background: white;
border: 2px solid;
padding: 5px; margin: 10px; z-index: 100;
font-size: smaller;
}
</STYLE>
</HEAD>
<BODY BGCOLOR="white">
<DIV class="navigate"><A class="nav" href="index.html"><IMG SRC="home.gif" BORDER=0 ALT="Home"></A>
<A class="nav" href="Contents.html"><IMG SRC="index.gif" BORDER=0 ALT="Contents"></A>
<A class="nav" href="DocIndex.html"><IMG SRC="yellow_pages.gif" BORDER=0 ALT="Index"></A>
<A class="nav" href="summary.html"><IMG SRC="info.gif" BORDER=0 ALT="Summary"></A>
<A class="nav" href="IDE.html"><IMG SRC="prev.gif" BORDER=0 ALT="Previous"></A>
<A class="nav" href="usingmodules.html"><IMG SRC="next.gif" BORDER=0 ALT="Next"></A>
</DIV>

<H2><A NAME="sec:3.1"><SPAN class="sec-nr">3.1</SPAN> <SPAN class="sec-title">The 
project source-files</SPAN></A></H2>

<A NAME="sec:projectfiles"></A>

<P>Organisation of source-files depends largely on the size of your 
project. If you are doing exercises for a Prolog course you'll normally 
use one file for each exercise. If you have a small project you'll work 
work with one directory holding a couple of files and some files to link 
it all together. Even bigger projects will be organised in sub-projects 
each using their own directory.

<H3><A NAME="sec:3.1.1"><SPAN class="sec-nr">3.1.1</SPAN> <SPAN class="sec-title">File 
Names and Locations</SPAN></A></H3>

<H4><A NAME="sec:3.1.1.1"><SPAN class="sec-nr">3.1.1.1</SPAN> <SPAN class="sec-title">File 
Name Extensions</SPAN></A></H4>

<A NAME="sec:fileext"></A>

<P><A NAME="idx:pl:271"></A><A NAME="idx:pro:272"></A>The first 
consideration is what extension to use for the source-files. Tradition 
calls for <CODE>.pl</CODE>, but conflicts with Perl force the use of 
another extension on systems where extensions have global meaning, such 
as MS-Windows. On such systems <CODE>.pro</CODE> is the common 
alternative.<SUP class="fn">13<SPAN class="fn-text">On MS-Windows, the 
alternative extension is stored in the registry-key <CODE>HKEY_CURRENT_USER/Software/SWI/Prolog/fileExtension</CODE> 
or <CODE>HKEY_LOCAL_MACHINE/Software/SWI/Prolog/fileExtension</CODE></SPAN></SUP>

<P>All versions of SWI-Prolog load files with the extension <CODE>.pl</CODE> 
as well as with the registered alternative extension without explicitly 
specifying the extension. For portability reasons we propose the 
following convention:

<DL class="latex">
<DT><B>If there is no conflict</B></DT>
<DD>
because you do not use a conflicting application or the system does not 
force a unique relation between extension and application, use <CODE>.pl</CODE>.</DD>
<DT><B>With a conflict</B></DT>
<DD>
choose <CODE>.pro</CODE> and use this extension for the files you want 
to load through your file-manager. Use
<CODE>.pl</CODE> for all other files for maximal portability.
</DD>
</DL>

<H4><A NAME="sec:3.1.1.2"><SPAN class="sec-nr">3.1.1.2</SPAN> <SPAN class="sec-title">Project 
Directories</SPAN></A></H4>

<P><A NAME="idx:Sdiv:273"></A><A NAME="idx:chrSneg:274"></A>Large 
projects are generally composed of sub-projects, each using their own 
directory or directory-structure. If nobody else will ever touch your 
files and you use only one computer there is little to worry about, but 
this is rarely the case with a large project.

<P>To improve portability, SWI-Prolog uses the POSIX notation for 
filenames, which uses the forward slash (<CODE><CODE>/</CODE></CODE>) to 
separate directories. Just before hitting the file-system it uses
<A NAME="idx:prologtoosfilename2:275"></A><A class="pred" href="files.html#prolog_to_os_filename/2">prolog_to_os_filename/2</A> 
to convert the filename to the conventions used by the hosting operating 
system. It is <EM>strongly</EM> advised to write paths using the <CODE><CODE>/</CODE></CODE>, 
especially on systems using the
<CODE><CODE>\</CODE></CODE> for this purpose (MS-Windows). Using <CODE><CODE>\</CODE></CODE> 
violates the portability rules and requires you to <EM>double</EM> the <CODE><CODE>\</CODE></CODE> 
due to the Prolog quoted-atom escape rules.

<P>Portable code should use <A NAME="idx:prologtoosfilename2:276"></A><A class="pred" href="files.html#prolog_to_os_filename/2">prolog_to_os_filename/2</A> 
to convert computed paths into system-paths when constructing commands 
for <A NAME="idx:shell1:277"></A><A class="pred" href="system.html#shell/1">shell/1</A> 
and friends.

<H4><A NAME="sec:3.1.1.3"><SPAN class="sec-nr">3.1.1.3</SPAN> <SPAN class="sec-title">Sub-projects 
using search-paths</SPAN></A></H4>

<P>Thanks to Quintus, Prolog adapted an extensible mechanism for 
searching files using <A NAME="idx:filesearchpath2:278"></A><A class="pred" href="consulting.html#file_search_path/2">file_search_path/2</A>. 
This mechanism allows for comfortable and readable specifications.

<P>Suppose you have extensive library packages on graph-algorithms, 
set-operations and GUI-primitives. These sub-projects are likely 
candidates for re-use in future projects. A good choice is to create a 
directory with sub-directories for each of these sub-projects.

<P>Next, there are three options. One is to add the sub-projects to the 
directory-hierarchy of the current project. Another is to use a 
completely dislocated directory and finally the sub-project can be added 
to the SWI-Prolog hierarchy. Using local installation, a typical <A NAME="idx:filesearchpath2:279"></A><A class="pred" href="consulting.html#file_search_path/2">file_search_path/2</A> 
is:

<PRE class="code">
:- prolog_load_context(directory, Dir),
   asserta(user:file_search_path(myapp, Dir)).

user:file_search_path(graph, myapp(graph)).
user:file_search_path(ui,    myapp(ui)).
</PRE>

<P>For using sub-projects in the SWI-Prolog hierarchy one should use the 
path-alias <CODE>swi</CODE> as basis. For a system-wide installation use 
an absolute-path.

<P>Extensive sub-projects with a small well-defined API should define a 
load-file using <A NAME="idx:usemodule1:280"></A><A class="pred" href="import.html#use_module/1">use_module/1</A> 
calls to import the various library-components and export the API.

<H3><A NAME="sec:3.1.2"><SPAN class="sec-nr">3.1.2</SPAN> <SPAN class="sec-title">Project 
Special Files</SPAN></A></H3>

<P>There are a number of tasks you typically carry out on your project, 
such as loading it, creating a saved-state, debugging it, etc. Good 
practice on large projects is to define small files that hold the 
commands to execute such a task, name this file after the task and give 
it a file-extension that makes starting easy (see
<A class="sec" href="projectfiles.html">section 3.1.1.1</A>). The task <EM>load</EM> 
is generally central to these tasks. Here is a tentative list.

<P>
<UL class="latex">
<LI><I><CODE>load.pl</CODE></I><BR>
Use this file to set up the environment (Prolog flags and file search 
paths) and load the sources. Quite commonly this file also provides 
convenient predicates to parse command-line options and start the 
application.

<P>
<LI><I><CODE>run.pl</CODE></I><BR>
Use this file to start the application. Normally it loads <CODE>load.pl</CODE> 
in silent-mode, and calls one of the starting predicates from
<CODE>load.pl</CODE>.

<P>
<LI><I><CODE>save.pl</CODE></I><BR>
Use this file to create a saved-state of the application by loading
<CODE>load.pl</CODE> and call <A NAME="idx:qsaveprogram2:281"></A><A class="pred" href="runtime.html#qsave_program/2">qsave_program/2</A> 
to generate a saved-state with the proper options.

<P>
<LI><I><CODE>debug.pl</CODE></I><BR>
Loads the program for debugging. In addition to loading <CODE>load.pl</CODE> 
this file defines rules for <A NAME="idx:portray1:282"></A><A class="pred" href="termrw.html#portray/1">portray/1</A> 
to modify printing rules for complex terms and customisation rules for 
the debugger and editing environment. It may start some of these tools.
</UL>

<H3><A NAME="sec:3.1.3"><SPAN class="sec-nr">3.1.3</SPAN> <SPAN class="sec-title">International 
source files</SPAN></A></H3>

<A NAME="sec:intsrcfile"></A>

<P>As discussed in <A class="sec" href="widechars.html">section 2.17</A>, 
SWI-Prolog supports international character handling. Its internal 
encoding is UNICODE. I/O streams convert to/from this internal format. 
This sections discusses the options for source-files not in US-ASCII.

<P>SWI-Prolog can read files in any of the encodings described in
<A class="sec" href="widechars.html">section 2.17</A>. Two encodings are 
of particular interest. The
<CODE>text</CODE> encoding deals with the current <EM>locale</EM>, the 
default used by this computer for representing text files. The encodings
<CODE>utf8</CODE>, <CODE>unicode_le</CODE> and <CODE>unicode_be</CODE> 
are
<EM>UNICODE</EM> encodings: they can represent---in the same 
file---characters of virtually any known language. In addition, they do 
so unambiguously.

<P>If one wants to represent non US-ASCII text as Prolog terms in a 
source-file there are several options:

<P>
<UL class="latex">
<LI><I>Use escape sequences</I><BR>
This approach describes NON-ASCII as sequences of the form
<CODE>\</CODE><I>octal</I><CODE>\</CODE>. The numerical argument is 
interpreted as a UNICODE character.<SUP class="fn">14<SPAN class="fn-text">To 
my knowledge, the ISO escape sequences is limited to 3 octal digits, 
which means most characters cannot be represented.</SPAN></SUP> The 
resulting Prolog file is strict 7-bit US-ASCII, but if there are many 
NON-ASCII characters it becomes very unreadable.

<P>
<LI><I>Use local conventions</I><BR>
Alternatively the file may be specified using local conventions, such as 
the EUC encoding for Japanese text. The disadvantage is portability. If 
the file is moved to another machine this machine must be using the same <EM>locale</EM> 
or the file is unreadable. There is no elegant if files from multiple 
locales must be united in one application using this technique. In other 
words, it is fine for local projects in countries with uniform locale 
conventions.

<P>
<LI><I>Using UTF-8 files</I><BR>
The best way to specify source files with many NON-ASCII characters is 
definitely the use of UTF-8 encoding. Prolog can be notified two ways of 
this encoding, using a UTF-8 <EM>BOM</EM> (see <A class="sec" href="widechars.html">section 
2.17.1.1</A>) or using the directive <CODE>:- encoding(utf8).</CODE>. 
Many todays text editors, including PceEmacs, are capable of editing 
UTF-8 files. Projects that started using local conventions can be be 
re-coded using the Unix
<B>iconv</B> tool or often using a commands offered by the editor.
</UL>

<P></BODY></HTML>