03.06.2013 Views

Turbo Prolog

Turbo Prolog

Turbo Prolog

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The project concept has two purposes:<br />

I. The contents of the LIBRARIAN file are used during linkage; the names of the<br />

modules are inserted into the link command (given via PLlNK.BAT) from that file.<br />

2. The project name is used during compilation to identify a symbol table shared by<br />

all modules in that project. The symbol table is stored in a file in the OBJ directory<br />

with the same name as the project and file type .SYM . This file is automatically<br />

generated and updated during compilation.<br />

To achieve the second purpose, the name of the project must be given in each module<br />

via the project compiler directive, which takes the form<br />

project "MYPROJ"<br />

Global Domains and Global Predicates<br />

By default. all names used in a module are local. <strong>Turbo</strong> <strong>Prolog</strong> programs communicate<br />

across module boundaries using predicates defined in a global predicates section.<br />

The domains used in global predicates must be defined as global domains, or else be<br />

domains of standard types.<br />

All the modules in a project need to know exactly the same global predicates and<br />

global domains. The easiest way to achieve this is by writing all -global declarations in<br />

one single file, which can then be included in every relevant module via an include<br />

directive.<br />

global domains<br />

A domain is made global by writing it in a global domains program section. In all other<br />

respects, global domains are the same as ordinary (local) domains.<br />

global predicates<br />

global predicate declarations differ from ordinary (local) predicate declarations in that<br />

they must contain a description of the flow pattern(s) in which each given predicate<br />

may be called. A global predicates declaration must follow the scheme<br />

mypred(dl,d2, .. ,dn) - (f,f, ... ,f)(f,f, .. ,f) ...<br />

where d l,d2, ... ,dn are global domains and each group<br />

(f, f, ... , f)<br />

denotes a flow pattern where each (is either i (input parameter) or 0 (output parameter).<br />

Note that if any global definition is changed, all modules in that project must be<br />

recompiled.<br />

Programmer's Guide 153

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!