Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword or section
Like this
9Activity

Table Of Contents

Using This Manual
PART 1
Introduction to Visual Prolog
CHAPTER 17
Using Visual Prolog's Visual Development Environment
What Needs to be Installed for This Book?
Starting the Visual Prolog's Visual Development Environment
Creating the TestGoal Project for Running the Examples
Opening an Editor Window
Running and Testing a Program
Testing Language Tutorial Examples
Testing Examples in Test Goal
Testing Examples as Standalone Executables
Handling Errors
PART 2
Tutorial Chapters 35 – 36: Learning Visual Prolog
CHAPTER 37
Prolog Fundamentals
PROgramming in LOGic
Sentences: Facts and Rules
Facts: What Is Known
Rules: What You Can Infer from Given Facts
Queries
Putting Facts, Rules, and Queries Together
Variables: General Sentences
Overview
Exercises
From Natural Language to Prolog Programs
Clauses (Facts and Rules)
More About Facts
More About Rules
Predicates (Relations)
Variables (General Clauses)
How Variables Get Their Values
Anonymous Variables
Goals (Queries)
A Closer Look at Declarations and Rules
Multiple Arity
Rule Syntax
Automatic Type Conversions
Other Program Sections
The Facts Section
The Constants Section
The Global Sections
The Compiler Directives
The include Directive
Visual Prolog's Relentless Search for Solutions
A Detailed Look at Backtracking
Backtracking in Standalone Executables
Controlling the Search for Solutions
Using the fail Predicate
Preventing Backtracking: The Cut
How to Use the Cut
Determinism and the Cut
Prolog from a Procedural Perspective
How Rules and Facts Are Like Procedures
Using Rules Like Case Statements
Performing Tests within the Rule
The cut as a GoTo
Returning Computed Values
CHAPTER 113
Simple and Compound Objects
Simple Data Objects
Variables as Data Objects
Constants as Data Objects
Characters
Numbers
Atoms
Compound Data Objects and Functors
Unification of Compound Objects
Using the Equal Sign to Unify Compound Objects
Treating Several Items as One
An Example Using Compound Objects
Declaring Domains of Compound Objects
Pre- and Post-Actions
Implementing Backtracking with Loops
Recursive Procedures
What the Computer is Really Doing
Advantages of Recursion
Tail Recursion Optimization
Making Tail Recursion Work
How Not to Do Tail Recursion
Cuts to the Rescue
Using Arguments as Loop Variables
Recursive Data Structures
Trees as a Data Type
Traversing a Tree
Creating a Tree
Binary Search Trees
Tree-Based Sorting
CHAPTER 173
Lists and Recursion
What Is a List?
Declaring Lists
Heads and Tails
List Processing
Using Lists
Writing Lists
Counting List Elements
Tail Recursion Revisited
Another Example – Modifying the List
List Membership
Recursion from a Procedural Viewpoint
One Predicate Can Have Different Uses
Finding All the Solutions at Once
Compound Lists
Parsing by Difference Lists
CHAPTER 199
Visual Prolog’s Internal Fact Databases
Declaring the Fact Databases
Using the Fact Databases
Accessing the Fact Databases
Updating the Fact Databases
Adding Facts at Run Time
Removing Facts at Run Time
Keywords Determining Fact Properties
Examples
CHAPTER 204
Arithmetic and Comparison
Arithmetic Expressions
Operations
Order of Evaluation
Functions and Predicates
Generating Random Numbers
random/1
random/2
randominit/1
Integer and Real Arithmetic
mod/2
div/2
abs/1
cos/1
sin/1
tan/1
arctan/1
exp/1
ln/1
log/1
sqrt/1
round/1
trunc/1
val/2
Exercise
Comparisons
Equality and the equal (=) Predicate
Comparing Characters, Strings, and Symbols
Strings
Symbols
CHAPTER 227
Advanced Topics
The Flow Analysis
Compound Flow
Specifying Flow Patterns for Predicates
Controlling the Flow Analysis
Reference Variables
Declaring Domains as Reference
Reference Domains and the Trail Array
Using Reference Domains
Flow Patterns Revisited
Using Binary Trees with Reference Domains
Sorting with Reference Domains
Functions and Return Values
Determinism Monitoring in Visual Prolog
Visual Prologs Determinism Checking System
Predicates as Arguments
Predicate Values
Predicate Domains
Comparison with declaration of predicates
The Binary Domain
Implementation of binary terms
Text syntax of Binary Terms
Creating Binary Terms
makebinary/1
makebinary/2
composebinary/2
getbinarysize/1
Accessing Binary Terms
get*entry/2
set*entry/3
Unifying Binary Terms
Comparing Binary Terms
Example
Converting Terms to Binary Terms
term_bin/3
Modular Programming
Global Declarations
Global Predicates
Projects
Errors and Exception Handling
Exception Handling and Error Trapping
exit/0 and exit/1
errorexit/0 and errorexit/1
trap/3
errormsg/4
Error reporting
errorlevel
Handling Errors from the Term Reader
consulterror/3
readtermerror/2
Break Control (Textmode Only)
break/1
breakpressed/0
Manual Break and Signal Checking in UNIX
signal/2
Critical Error Handling under DOS Textmode
criticalerror/4
fileerror/2
Dynamic Cutting
Free Type Conversions
Programming Style
Rules for Efficient Programming
Determinism vs. Non-determinism: Setting the Cut
CHAPTER 263
Classes and Objects
Encapsulation
Objects and Classes
Inheritance
Identity
Visual Prolog Classes
Class Declarations
Class Implementation
Class Instances - Objects
Destroying Objects
Class Domains
Derived Classes and Inheritance
Virtual Predicates
Static Facts and Predicates
Reference to the Object Itself (Predicate this)
Class Scopes
Classes as Modules
User-defined Constructors and Destructors
Abstract Classes
Protected Predicates, Domains, and Facts
Derived Class Access Control
Object Predicate Values
Object Predicate Domain Declarations
Formal Syntax for Classes
PART 3
Tutorial Chapters 273 – 274: Using Visual Prolog
CHAPTER 275
Writing, Reading, and Files
Writing and Reading
Writing
write/* and nl
writef/*
Reading
readln/1
readint/1, readreal/1, and readchar/1
readterm/2
file_str/2
Binary Block Transfer
readblock/2
writeblock/2
file_bin/2
Visual Prolog's File System
Opening and Closing Files
openread/2
openwrite/2
openappend/2
openmodify/2
filemode/2
closefile/1
readdevice/1
writedevice/1
Redirecting Standard I/O
Working with Files
filepos/3
eof/1
flush/1
existfile/1
existfile/2
searchfile/3
deletefile/1
renamefile/1
disk/1
copyfile/2
File Attributes
Opening and creating files
Special File Modes for DOS >= 4.0 and UNIX
openfile/5
File and Path Names
filenamepath/3
filenameext/3
Directory Searching
diropen/3
dirmatch/10
dirclose/1
dirfiles/11
Manipulating File Attributes
fileattrib/2
Handling terms in text files
Manipulating Facts Like Terms
CHAPTER 300
String-Handling in Visual Prolog
String Processing
Basic String-Handling Predicates
frontchar/3
fronttoken/3
frontstr/4
concat/3
str_len/2
isname/1
format/*
subchar/3
substring/4
searchchar/3
searchstring/3
Type Conversion
char_int/2
str_char/2
str_int/2
str_real/2
upper_lower/2
term_str/3
CHAPTER 311
The External Database System
External Databases in Visual Prolog
An Overview: What's in an External Database?
Naming Convention
External Database Selectors
Chains
External Database Domains
Database Reference Numbers
db_reuserefs/2
Manipulating Whole External Databases
db_create/3
db_open/3
db_copy/3
db_loadems/2 and db_saveems/2
db_openinvalid/3
db_flush/1
db_close/1
db_delete/1
db_garbagecollect/1
db_btrees/2
db_chains/2
db_statistics/5
Manipulating Chains
chain_inserta/5 and chain_insertz/5
chain_insertafter/6
chain_terms/5
chain_delete/2
chain_first/3 and chain_last/3
chain_next/3 and chain_prev/3
Manipulating Terms
term_replace/4
term_delete/3
ref_term/4
A Complete Program Example
B+ Trees
Pages, Order, and Key Length
Duplicate Keys
Multiple Scans
The B+ Tree Standard Predicates
bt_create/5 and bt_create/6
bt_open/3
bt_close/2 and bt_delete/2
bt_copyselector
bt_statistics/8
key_insert/4 and key_delete/4
key_first/3, key_last/3, and key_search/4
key_next/3 and key_prev/3
key_current/4
Example: Accessing a Database via B+ Trees
External Database Programming
Scanning through a Database
Displaying the Contents of a Database
Implementing a Database That Won't Break Down
Updating the Database
Using Internal B+ Tree Pointers
Changing the Structure of a Database
Filesharing and the External Database
Filesharing Domains
Opening the Database in Share Mode
Transactions and Filesharing
Filesharing Predicates
db_open/4
db_begintransaction/2
db_endtransaction/1
db_updated/1
bt_updated/2
db_setretry/3
Programming with Filesharing
Implementing High-level Locking
A Complete Filesharing Example
Implementation Aspects of Visual Prolog Filesharing
Miscellaneous
CHAPTER 328
System-Level Programming
Access to the Operating System
system/1
system/3
envsymbol/2
time/4 and date
comline/1
syspath/2
Timing Services
sleep/1
marktime/2
timeout/1
difftime
beep/0
osversion/1
diskspace/2
storage/3 and storage/11
storage/0
Bit-Level Operations
bitand/3
bitor/3
bitxor/3
bitleft/3
bitright/3
Access to the Hardware: Low-Level Support
bios/3 and bios/4
ptr_dword
membyte, memword, memdword
port_byte/2
CHAPTER 336
Example Prolog Programs
Building a Small Expert System
Prototyping: A Simple Routing Problem
Adventures in a Dangerous Cave
Hardware Simulation
Towers of Hanoi
Dividing Words into Syllables
The N Queens Problem
PART 4
Programmer’s Guide
CHAPTER 366
Elements of the Language
Names
Keywords
Specially-Handled Predicates
Program Sections
Shortening Domain Declarations
Synonyms to Standard Domains
List Domains
Multi-alternative Compound Domains
Domains FILE and DB_SELECTOR
Specially Handled Predefined Domains
Declaring Reference Domains
Declaring Predicate Domains
Determinism Modes
Flow Patterns
Functions
Simple Constants
Terms
Variables
Compound Terms
Predefined Constants
Conditional Compilation
Including Files in Your Program
Modules and Global Programming Constructions
Compilation Units
Names with Global Scope
Include Structure of Multi-modular Programs
Include All Global Declarations in each Module
Where-used Strategy for Including Global Declarations
Qualification Rules for Public Class Members
Compiler Options for Multi-modular Projects
Compiler Directives
code
config
heap
nobreak
printermenu
project
Visual Prolog Memory Management
Memory Restrictions
Stack Size
GStack Size
Releasing Spare Memory Resources
CHAPTER 376
Interfacing with Other Languages
Using DLL’s
Calling Other Languages from Visual Prolog
Declaring External Predicates
Calling Conventions and Parameter Passing
Input parameters
Output parameters
Return Values
Multiple declarations
Parameter pushing order
Leading underscored
32-bit Windows naming convention
Adjustment of stackpointer
Domain Implementation
Simple Domains
Complex Domains
Ordinary Compound Objects and Structures
Memory Considerations
Memory Alignment
Memory Allocation
Pre-allocation of Memory
The sizeof function
malloc and free
List Handling
Calling Prolog from Foreign Languages
Hello
Standard Predicates
Calling an Assembler Routine from Visual Prolog
Index
0 of .
Results for:
No results containing your search query
P. 1
Language

Language

Ratings:

5.0

(1)
|Views: 198|Likes:
Published by Mr_Random

More info:

Published by: Mr_Random on Sep 27, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

01/28/2014

pdf

text

original

You're Reading a Free Preview
Pages 12 to 53 are not shown in this preview.
You're Reading a Free Preview
Pages 70 to 82 are not shown in this preview.
You're Reading a Free Preview
Pages 94 to 133 are not shown in this preview.
You're Reading a Free Preview
Pages 145 to 553 are not shown in this preview.

Activity (9)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
Mr_Random liked this
Huy Vo liked this
agigi9565313 liked this
Mqm Pakistan liked this
satya_2229383 liked this
sureshece52 liked this
Ollamha Anne liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->