Manual: Highlights of Release 3


Quintus Prolog Manual


(PREV) (NEXT)

A-2: Highlights of Release 3

This chapter summarizes the new functionality in Release 3.

A-2-1: Embeddability

Embeddability means the ability to embed a Prolog sub-program in a program written in some other language or languages. It is described in Chapter I-2. The specific features of this release which contribute towards embeddability are:

A-2-2: QOF Loading and Saving

Since Release 2.5, the Runtime Generator compiler qpc has been made available as part of the Development System. qpc compiles Prolog files into QOF (Quintus Object Format) files. QOF files can be linked together to make an executable file which is an extended version of the development system. If you have a Runtime Generator license, you have the alternative of linking your QOF files into a runtime system which omits development features (the compiler and debugger) and which can be conveniently deployed to different machines since it requires no authorization code in order to be run.

Release 3 introduces the ability to load QOF files directly into a running Prolog system. Loading a QOF file is up to 100 times faster than compiling it from source. File loading has been adapted to take advantage fo this new functionality. For instance, the form


        | ?- [file].

now loads file.qof if it exists and is more recent than file.pl; otherwise it compiles file.pl.

The saved-state produced by save_program/1 is now a QOF file. This means that it is now portable between different hardware and operating systems as well as between all releases of Quintus Prolog. It can still be executed as if it were an executable file, or it can be loaded into a running Prolog system. Another alternative is to call the QOF-linker qld on it to convert it to an executable file. It is also possible to save individual predicates or modules into a QOF file.

Chapter G-4 and Chapter G-5 describe QOF loading and QOF saving respectively. See section H-1-1-5 for how to link QOF files to make an executable file.

A-2-3: QUI: An X-based Development Environment

The Quintus User Interface (QUI) is a new development environment based on the X-Windows system. QUI makes use of windows, buttons and menus to increase programmer productivity, and it includes an internal editor, access to GNU Emacs and access to the on-line manual. See Part C.

A-2-4: Source-linked Debugger

The QUI also includes a source-linked debugger, allowing you to single-step through your source code. The debugger works by modification of compiled code, so there is no longer any need to distinguish between "consulting" and "compiling"; all code is compiled unless declared dynamic.

The new debugger also helps you to find inefficiencies in your program by

The debugger is documented in Chapter E.

A-2-5: Other New Features

A-2-6: Compatibility Issues

A-2-6-1: Saved States

save/[1,2] are gone. Chapter G-5 explains why these have been removed. In most cases save_program/2 can be used in their place, with a little rearrangement of your code.

Foreign code is no longer included in saved-states. When a saved-state is used it needs to be able to find the relevant .o files and cause them to be linked in. Since this linking can be slow, it will often be preferable to use qld to link your saved-state with its .o files into an executable file. See section H-1-1-5 for how to do this.

A-2-6-2: Error Reporting/Handling

In earlier releases, some errors caused simple failures. For example,


| ?- functor(A,B,C).
no

This is not logical, since it is easy to choose A,B,C such that functor(A,B,C) is true. Generally, built-in predicates should enumerate all their logical solutions or else raise an exception in cases such as this one where enumeration is impractical. Thus you now get:

| ?- functor(A,B,C).
! Instantiation error in argument 2 of functor/3
! goal:  functor(_530,_531,_532)

Existing code that relies on the old error behavior will need modification to take this into account. The insertion of appropriate nonvar/1 checks is usually all that is required.

A-2-7: New Built-in Predicates

See the Reference Pages for information on the following new predicates.

absolute_file_name/3
generalization of absolute_file_name/2
add_spypoint/1
add a spypoint
add_advice/3
specify an advice action for a particular port of a predicate
append/3
list concatenation relation
assign/2
assign a value to a foreign data structure
at_end_of_file/0
test if the current input stream is at end of file
at_end_of_file/1
test if the specified stream is at end of file
at_end_of_line/0
test if the current input stream is at end of line
at_end_of_line/1
test if the specified stream is at end of line
callable/1
test if the a term is syntactically valid as an argument to call/1; that is, not a variable, a number or a data base reference
check_advice/0
enable advice-checking for all predicates with advice
check_advice/1
enable advice-checking for the specified predicates
compound/1
test if a term is a compound term
current_advice/3
find out what advice exists
current_spypoint/1
find out what spypoints exist
db_reference/1
test if a term is a data base reference
extern/1
declare predicate to be callable from C
ground/1
test if a term is ground (contains no unbound variables)
hash_term/2
produce a hash-value corresponding to a term
initialization/1
declare a goal to be called when a file is loaded or when an executable file containing it is run
load_files/1
load source or QOF files
load_files/2
load source or QOF files with specified options
nocheck_advice/0
turn off all advice checking
nocheck_advice/1
turn off advice checking for specified predicates
on_exception/3
execute a goal in the context of an exception handler
open/4
open a file with specified options
peek_char/1
return the next character in the current input stream without consuming it
peek_char/2
return the next character in specified stream without consuming it
print_message/2
print an error, warning, help, silent or informational message
print_message_lines/3
auxiliary routine for message printing
prompt/3
examine or change the prompt for a particular stream
raise_exception/1
raise an exception
read_term/2
read a term from current input stream
read_term/3
read a term from specified stream
remove_advice/3
remove advice for specified port of a predicate
remove_spypoint/1
remove a spypoint
save_modules/2
save a module or modules to QOF
save_predicates/2
save a predicate or predicates to QOF
save_program/2
save the program state and specify goal to be run on start-up
seek/4
byte-oriented random access to files
simple/1
opposite of compound/1; true of variables, atoms, numbers and data base references
skip_line/0
skips characters on current input up to end of line
skip_line/1
skips characters on specified stream up to end of line
source_file/3
relation between source file, predicate and clause number
volatile/1
declare that a predicate should be excluded when saving
write_term/2
write a term to current output
write_term/3
write a term to specified stream

A-2-8: New Hook Predicates

These predicates are called at appropriate times by the Prolog system and are defined by the user.

user:display_help_file/3
define how on-line help is displayed
user:message_hook/3
define how messages are displayed
user:generate_message_hook/3
define the textual form of messages
user:query_hook/2
define or bypass user-interaction

A-2-9: Removed Built-in Predicates

save/[1,2] has been removed as discussed above. Their names are still reserved so that we can use them in a future release.

The following predicates were supported only by the interpreter and have now been eliminated. If their functionality is required, it can be achieved by passing an explicit ancestors list to all the predicates that need it as an extra argument.


     ancestors/1
     subgoal_of/1
     maxdepth/1
     depth/1

The following predicates which were previously provided only because they are defined in other Prolog systems have now been removed. The user may supply definitions for them if desired. (Many of these just printed error messages in earlier releases.)


     'LC'/0
     'NOLC'/0
     current_functor/2
     incore/1
     load_foreign_files/3
     log/0
     nolog/0
     plsys/1
     reinitialize/0
     restore/2
     revive/2


Copyright (C) 1998 SICS
contact: product support sales information