The user should be aware of the fact that abort/0 does not close any files which may have been opened. If the program under execution is doing file manipulation using see/1 and tell/1, then strange behavior may occur after the program is aborted and restarted, unless the user manually closes the files.
Aborting closes all incomplete tables (those which may not have a complete set of answers). Closed tables are unaffected, even if the tables were created during the aborted computation.
To close a break level and resume the suspended execution, the user can type the the atom end_of_file or the end-of-file character applicable on the system (usually CTRL-d on UNIX systems). Predicate break/0 then succeeds (note in the following example that the calls to break/0 do not succeed), and the execution of the interrupted program is resumed. Alternatively, the suspended execution can be abandoned by calling the standard predicate abort/0, which causes a return to the top level.
An example of break/0 's use is the following:
| ?- break. |
Entering a break closes all incomplete tables (those which may not have a complete set of answers). Closed tables are unaffected, even if the tables were created during the computation for which the break was entered.
An example of prompt/2 's use is the following:
| ?- prompt('Yes master > ', P). |
none
indicating that heap garbage collection is
turned off; it may be the atom sliding
indicating that
sliding garbage collection will be done; or it may be the atom
copying
indicating that the copying garbage collector will
be used.
Additionally, if the emulator is invoked with the '-s' option (see Section 3.5), information is printed out about
Example:
| ?- statistics. memory (total) 1873737 bytes: 171317 in use, 1702420 free permanent space 169801 bytes glob/loc space 786432 bytes: 1080 in use, 785352 free global 152 bytes local 928 bytes trail/cp space 786432 bytes: 436 in use, 785996 free trail 240 bytes choice point 196 bytes SLG subgoal space 0 bytes: 0 in use, 0 free SLG unific. space 65536 bytes: 0 in use, 65536 free SLG completion 65536 bytes: 0 in use, 65536 free SLG trie space 0 bytes: 0 in use, 0 free (call+ret. trie 0 bytes, trie hash tables 0 bytes) Maximum stack use: global 224, local 1384, trail 240, cp 492 Maximum stack use: SLG completion 0. Max level: 0 0 Trail unwinds, 0 levels 0.570 sec. cputime, 5.088 sec. elapsetimeshows how the emulator output looks if it is invoked with the '-s' option (without it the Maximum use line is not shown). Information about the allocation size is provided since the sizes can be changed through emulator options (see Section 3.5).
For example, the call:
?- shell('echo $HOME').
will output in the current output stream of XSB the name of the user's home directory; while the call:
?- File = 'test.c', shell(['cc -c ', File]).
will call the C compiler to compile the file test.c.
Note that in UNIX systems, since shell/1 is executed by forking off a shell process, it cannot be used, for example, to change the working directory of the interpreter. For that reason the standard predicate cd/1 described below should be used.
Exceptions:
Examples of possible uses of predicate edit/1 are:
setenv EDITOR /usr/ucb/vi setenv EDITOR_OPTIONS -la call like:
| ?- edit(foo).will call the vi editor in the mode where left and right parentheses and curly brackets are checked for balance for the file foo.P in the current working directory.
setenv EDITOR /usr/local/bin/emacs setenv EDITOR_OPTIONS -ra call like:
| ?- edit('~/foo').will call the emacs editor in reverse video for the file foo.P in user's home directory.