DLP Release Notes (version 1r18K)
Updates
Contents
- Getting Started
- Builtins / Libraries
- Multi-Threaded Objects
- Foreign Language Interface
top
Download
DLP/JVM is currently a pre-compiled distribution :
dlp1r18K.tar.gz.
The system is actively used on the following platforms:
Cygwin,
Linux, Solaris, Windows 98, Windows NT, and Windows 2000.
Overview of the directory structure of the distribution :
dlp1r18K/
bin/
dlp ## command line execution
dlpc ## compiler shell script (Cygwin / Linux / Solaris)
classes/
dlpsys.jar ## pre-compiled libraries and run-time system
examples/
README.txt
....
*.pl ## DLP program examples
makefile ## for the compilation of the DLP examples
setvars.j122 ## environment variable settings (Linux / Solaris)
setvars.cygw ## environment variable settings (Cygwin)
....
lib/
execomp.qlf ## compiler front-end / back-end
A number of files that are also included in the distribution
are listed here separately (allowing for the incremental update of
your DLP system) :
- Cygwin / Linux / Solaris / Windows :
- classes / dlpsys.zip
Contains the dlpsys.jar file.
Download dlpsys.zip, unzip the file, and put dlpsys.jar in directory
classes. The main reason for distributing dlpsys.jar like this
is that many browsers have a MIME type for jar files that is not suitable
for downloading jar files.
- lib / execomp.zip
Contains the execomp.qlf file. Download, unzip and copy the execomp.qlf
to lib / execomp.qlf
- Cygwin / Linux / Solaris :
- Linux / Solaris :
- Cygwin :
In case you would like to update dlpsys.jar or execomp.qlf, update both files.
The same for the dlpc or setvars.* files : update dlpc as well as the setvars.* file.
Changes will be documented in the Updates section
of this readme file.
A full update (as well as an incremental update of dlpsys.jar and / or
execomp.qlf) requires currently the re-compilation of your DLP program source
files.
top
Installation
- Unzip the downloaded distribution:
gunzip dlp1r18K.tar.gz
- Untar the archive:
tar -xvf dlp1r18K.tar
This will create a "dlp1r18K" subdirectory in the current directory.
- Adjust the required environment variable settings as described in one
of the setvars files.
The settings refer to the jikes compiler : remove the jikes lines in
case you prefer SUN's javac compiler.
Jikes is a fast Java to JVM compiler developed by IBM. See the
Jikes
Home page for more information.
- Change the first line in file bin/dlpc, examples/pxdemo
and examples/setvars.j122 or examples/setvars.cygw
with respect to the location of the bash shell on your local configuration.
- The implementation requires (currently)
SWI Prolog
version 3.3.10 or higher (
Local Copy ).
- Running a DLP program that is compiled to the JVM requires at least the
Java Runtime Environment.
The JRE distribution contains the JVM, core classes and several other
files, but not the compiler, debugger and a number of other tools.
- Compiling and debugging DLP programs requires a full
Java SDK installation.
This distribution includes the JRE.
top
Compilation
When compiling a DLP program "prog.pl" :
dlpc prog.pl
in directory "/home/user/project/qwerty", the generated JVM class files
are written to the corresponding "/home/user/project/qwerty/classes"
subdirectory. As mentioned in the setvars files,
this "classes" subdirectory should also be included in your CLASSPATH or
JIKESPATH environment variable.
top
Execution
- Command line execution
After compiling a DLP source file that contains for example an object
objectname with method main, start the program by
means of the command :
dlp objectname
Execution will be transferred to method main in object objectname.
The command "dlp" is basically a wrapper which starts dlpmain.class
with the specified objectname.
This class file as well as the dlpbrow.class and dlpcons.class
files (see next 2 paragraphs) are included in the classes/dlpsys.jar file of
the distribution.
- Execution of DLP in a browser with an output stream area
In case you have written a DLP program example, e.g. like the
bounded buffer example and
would like to run it in a browser (without VRML), create a file as
shown below :
<html>
<body>
<applet archive="dlpsys.jar, pxbuff.jar" code="dlpbrow.class" width=500 height=500>
<param name="object" value="pxbuff">
<param name="line" value="80">
<param name="rows" value="25">
<param name="cols" value="80">
</applet>
</body>
</html>
The applet tag tells your browser that there are two jar files
involved : dlpsys.jar , which contains all the pre-compiled DLP libraries
including the dlpbrow.class, and your pxbuff.jar file, containing
your program specific class files.
If the jar files are not located in the same directory as your html file that
contains the above-mentioned definitions, add the corresponding (relative)
URLs.
In addition, the applet tag tells your browser to start
dlpbrow.class. This class file will read the parameter value as mentioned in
the param object entry in order to determine which method / object to start
(in this example method main in object pxbuff).
As opposed to dlpcons.class (see below), the dlpbrow.class creates a
Java TextArea like output stream. The number of rows and columns of the TextArea
can be adjusted by means of the param rows and param cols entries.
When executing DLP methods like text_area(Stream) and
set_output(Stream) as illustrated in the
bounded buffer
program, all subsequent output statements write their output to the
TextArea like output stream in your browser. In case you don't invoke the
text_area(Stream) and set_output(Stream) methods all output will
be written to the browser Java console.
If the optional param line entry is mentioned, dlpbrow
creates a Java TextField like input field. Use the DLP built-in predicate
text_field / 1 to specify to which queue input lines are sent for
further asynchronous processing.
Example : browser I/O.
- Execution of DLP + VRML in a browser without an output stream area
Executing a DLP program in the context of a browser VRML plug-in (see for
example the rotation program at
the DLP+VRML examples page) requires
the following html definitions :
<html>
<body>
<embed src="root.wrl" width="900" height="600">
<applet archive="dlpsys.jar , rotation.jar" code="dlpcons.class" MAYSCRIPT>
<param name="command" value="applet_console('ide')">
<param name="object" value="rotation">
</applet>
</body>
</html>
These definitions are essentially the same as in the previous paragraph.
However, the applet tag contains a reference to the dlpcons.class
file instead of the dlpbrow.class file. When using the dlpcons.class
file, no TextArea like output stream is created and DLP output will always be
written to the browser Java console. An example of the root.wrl file can be found
at the DLP+VRML examples page.
- Error Messages
The browser Java console as well as the VRML plug-in console are
important in order to determine whether particular errors occurred.
In Netscape Communicator, click "Communicator" -> "Tools" -> "Java Console".
In Microsoft Internet Explorer, click "View" -> "Java Console". In case
"View" doesn't show a "Java Console" option, activate the console by means of :
"Tools" -> "Internet Options" -> "Advanced" : the "Microsoft VM" section contains
the "Java Console enabled" checkbox.
Using the Blaxxun VRML plug-in, click right mouse button in VRML area ->
"Settings" -> "Console".
- Last but not least ...
Check the cache settings of your browser and VRML plug-in.
When you change your DLP or VRML code, it's not very useful that a browser
or VRML plug-in reload the files from their cache. In addition,
browser Refresh / Reload buttons will often fetch the class files
from cache.
However, when changing your cache settings to "Every visit to the
page" (IExplorer) or "Every time" (Netscape), the class files are
for some browser configurations still fetched from a cache : exit your
browser and restart.
Similar remarks with respect to VRML plug-ins. Use "Empty Cache now ..."
(Blaxxun) to be sure that your new VRML specifications are loaded.
top
Summary of Built-ins
Arithmetic comparison
- +Eval =:= +Eval (arithmetic equal)
- +Eval =\= +Eval (arithmetic not equal)
- +Eval > +Eval (arithmetic greater than)
- +Eval >= +Eval (arithmetic greater than or equal)
- +Eval < +Eval (arithmetic less than)
- +Eval =< +Eval (arithmetic less than or equal)
Arithmetic evaluation
- LogicalVar is Expression (evaluate expression)
Arithmetic functors :
- '+'/2
- '-'/1
- '-'/2
- '*'/2
- '/'/2
- '//'/2
- '<<'/2
- '>>'/2
- '**'/2
- abs/1
- mod/2
- rem/2
- acos/1
- asin/1
- atan/1
- cos/1
- sin/1
- tan/1
- exp/1
- log/1
- random/0
- round/1
- sign/1
- sqrt/1
- truncate/1
Atomic term processing
- atom_chars (+Atom, ?CharList)
atom_chars (?Atom, +CharList)
- atom_codes (+Atom, ?CodeList)
atom_codes (?Atom, +CodeList)
- atom_concat (+Atom1, +Atom2, ?NewAtom)
- atom_list_concat (+AtomList, ?NewAtom)
- atom_length (+Atom, ?Length)
- atom_number(+Atom, ?Number)
atom_number(?Atom, +Number)
- char_code (+Char, ?Code)
char_code (?Char, +Code)
- number_chars (+Number, ?CharList)
number_chars (?Number, +CharList)
- number_codes (+Number, ?CodeList)
number_codes (?Number, +CodeList)
Character input/output
- get_char(?Char)
- get_char(+Stream, ?Char)
- nl
- nl(+Stream)
- put_char(+Char)
- put_char(+Stream, +Char)
Logic and control
- ',' /2 (conjunction)
- '!' /0 (cut)
- fail /0
- halt /1
- not /1, '\+' /1
- once /1
- repeat /0
- true /0
Stream selection and control
- at_end_of_stream/0
- at_end_of_stream(+Stream)
- close(+Stream)
- open(+Source_Sink, +IOmode, -Stream),
atom stream (TBD) + set_output
IOmode = {read | write | append}
- set_input(+Stream)
- set_output(+Stream)
Term comparison
- Term1 == Term2
- Term1 \== Term2
- Term1 @< Term2
- Term1 @> Term2
- Term1 @=< Term2
- Term1 @>= Term2
Term creation and decomposition
- arg (+ArgI, +CompoundTerm, ?ArgV)
- copy_term (?Term, ?Copy)
- functor (+Term, ?Name, ?ArgC)
functor (?Term, +Name, +ArgC)
- +Term =.. ?List
?Term =.. +List
Term input/output
- display (?Term)
- display (+Stream, ?Term)
- format (+Format, +ArgList)
- format (+Stream, +Format, +ArgList)
format specifiers : ~k ~n ~q ~t ~w
- write (?Term)
- write (+Stream, ?Term)
- write_canonical (?Term)
- write_canonical (+Stream, ?Term)
- writeq (?Term)
- writeq (+Stream, ?Term)
Term input from constant terms
- read_from_atom (+Atom, ?Term)
- read_from_atom (+Atom, ?Term, ?VarList)
unifies Term with the term representation
of Atom or an error/2 term.
Term output to constant terms
- format_to_atom (?Atom, +Format, +ArgList)
- format_to_chars (?CharList, +Format, +ArgList)
- format_to_codes (?CodeList, +Format, +ArgList)
Term unification
- ?Term1 = ?Term2 (unify)
- ?Term1 \= ?Term2 (not unifiable)
Type testing
- atom (?Term). Term is an atom.
- atomic (?Term). Term is atomic (atom or number).
- compound (?Term). Term is a compound term.
- float (?Term). Term is a float.
- integer (?Term). Term is an integer.
- nonvar (?Term). Term is instantiated.
- number (?Term). Term is a number (integer or float).
- var(?Term). Term is uninstantiated.
List Processing
- append / 3
- insert(+OldSortedList, +Term, ?NewSortedList) (ascending order)
- length / 2
- member / 2
- memberchk / 2
- reverse / 2
- select / 3
- selectchk / 3
Miscellaneous
- compare(R, Term1, Term2). The first argument
R will be unified with
- '<', when Term1 'term-precedes' Term2
- '=', when Term1 is identical to Term2
- '>', when Term2 'term-precedes' Term1
Predicate compare/3 is used by the term comparison
predicates.
- link_object(ObjectName). Load, link and initialize ObjectName
and all its base objects.
- memory(-TotalKBs, -FreeKBs). Set the total number of KBytes and
the currently available free KBytes.
- sleep(+Msecs). Suspend the execution of the current thread
for Msecs milliseconds.
- get_system_property(+Key, -Value)
set_system_property(+Key, +NewValue, -OldValue)
Java run-time system property predicates.
- stack_trace/0. Show the method/predicate continuations until
the current point of execution.
- text_area(BrowserStream). Argument BrowserStream will be
unified with a Java TextArea like stream.
Combining this predicate with set_output(BrowserStream)
redirects the output of a program to the corresponding BrowserStream,
otherwise program output will be written to the browser "Java Console".
- text_field(InputQueueName).
Asynchronous browser input from a TextField like input line is sent to
the queue as an atom. Example : Browser I/O.
Input in DLP (and Java), like browser
or socket input, is usually processed by a separate thread. Instead of all
kinds of detailed I/O control facilities as found in programming languages
like C or C++, I/O in DLP (and Java) is handled by a thread that communicates
its I/O results to other threads in a multi-threaded safe way.
- trace/0. Turn trace mode on.
All method calls will be displayed (non-interactively).
- notrace/0. Turn trace mode off.
- ...
top
TCP / IP Networking
- Host Identification
- host_address(+HostName, -InternetAddress).
- local_host(-HostName, -InternetAddress).
- code_base_host(-HostName).
Unifies HostName with the name of the host from which the
current program objects are loaded.
When running in a browser HostName will be unified with
the name of the originating host.
(Security issues)
- Server Predicates
- tcp_server(+ServerPort, -ServerSocket).
- tcp_accept(+ServerSocket, -ServerStreamIn,
-ServerStreamOut).
- tcp_accept(+ServerSocket, -ServerStreamIn,
-ServerStreamOut, -ClientHostName).
- Client Predicates
- tcp_client(+ServerHostName, +ServerPort,
-ClientStreamIn, -ClientStreamOut). (TBD)
- tcp_client(+ServerHostName, +ServerPort, +TimeOut,
-ClientStreamIn, -ClientStreamOut).
- Bi-Directional Client / Server Communication
- tcp_get_term(+StreamIn, ?Term).
- tcp_put_term(+StreamOut, +Term).
- ....
- Closing Client / Server Connection
- tcp_close(+Socket).
- tcp_close(+Stream).
- Networking Examples
top
Node::Field Attribute Storage and Retrieval Predicates
DLP can be used to develop multi-threaded stand-alone client / server
systems as well as multi-threaded programs running in the context of
browsers, VRML / EAI frameworks, or other special purpose environments
that support JVM based execution.
When developing distributed VRML / EAI Web based DLP systems it's often
convenient to provide the server part of the system with similar
capabilities as available in the VRML/EAI embedded clients of the system
in order to maintain the (distributed) state of particular nodes.
This allows for a similar modeling approach of several storage and
retrieval aspects in both the client and server parts.
The EAI-like NodeName :: FieldName storage
and retrieval predicates (see below) provide such a functionality. Although
they are primarily intended for stand-alone servers, i.e. servers not
embedded in a VRML / EAI framework, they can also be used for other purposes.
Typically, such a server will handle multiple independently running client
threads, therefore the storage and retrieval predicates are extended to deal
with event driven, i.e. (internally) wait / notify based, processing.
Get / Set Field Predicates :
- set_field(+GlobalFieldName, +Term)
- get_field(+GlobalFieldName, ?Term)
- get_field_block(+GlobalFieldName, ?Term)
- get_field_reset(+GlobalFieldName, ?Term)
- get_field_event(+GlobalFieldName, ?Term)
- set_field(+NodeName, +FieldName, +Term)
- get_field(+NodeName, +FieldName, ?Term)
- get_field_block(+NodeName, +FieldName, ?Term)
- get_field_reset(+NodeName, +FieldName, ?Term)
- get_field_event(+NodeName, +FieldName, ?Term)
The NodeName and FieldName predicate arguments are atoms.
Predicate set_field sets the associated value of the specified
FieldName or NodeName and FieldName combination
to the term as mentioned in the Term argument.
Predicate get_field returns the stored Term value or
returns the atom undefined when not yet defined by a
set_field predicate. The get_field predicate is
non-blocking; it always returns immediately.
Predicate get_field_event blocks until a set_field
operation sets the corresponding value, after which it
returns that value and "resets" the field.
This blocking and reset behavior can be independently
selected by the get_field_block (no reset) or get_field_reset
(no blocking) predicates respectively.
An implicit (get_field_event) or explicit (get_field_reset)
field reset doesn't set the field value to undefined, but
only flags that the value has been retrieved. This allows non-blocking
predicates to get the latest field value.
Summary: get_field and get_field_reset are non-blocking :
they allow for polling a particular field value. Predicates
get_field_block and get_field_event always block
until a new field value has been defined by the set_field
predicate. Blocking and unblocking are (internally) wait / notify
driven.
Get / Set Queue Predicates :
Queue predicates provide a flexible way to construct special purpose
asynchronous interaction patterns or protocols between active objects.
All queue primitives are safe in multi-threaded execution contexts (atomic
queue update).
- new_queue(+GlobalQueueName, +MaxSize)
- set_queue(+GlobalQueueName, +Term)
- get_queue(+GlobalQueueName, ?Term)
- queue_full(+GlobalQueueName)
- queue_empty(+GlobalQueueName)
- queue_length(+GlobalQueueName, -CurrentLength)
- new_queue(+NodeName, +QueueName, +MaxSize)
- set_queue(+NodeName, +QueueName, +Term)
- get_queue(+NodeName, +QueueName, ?Term)
- queue_full(+NodeName, +QueueName)
- queue_empty(+NodeName, +QueueName)
- queue_length(+NodeName, +QueueName, -CurrentLength)
NodeName and QueueName predicate arguments are atoms.
Predicate new_queue creates a unique queue. The maximum number
of queue elements is defined by MaxSize. When a queue isn't
defined yet by new_queue upon the first invocation of a
set_queue or get_queue predicate, a queue descriptor will
automatically be created with a default maximum size of 100.
Predicate set_queue appends a new Term to the
queue. If the queue contains MaxSize elements this operation
will block until a get_queue operation removes an element from the
queue. Predicate get_queue removes the first element from the queue
and unifies this element with Term. In case the queue is empty, this
operation will block until a set_queue operation adds an element to
the queue.
Conditional Queue Lookup Predicates :
- accept_queue_term ( +GlobalQueueName, +AcceptExpressionList, -Term )
- accept_queue_term ( +NodeName, +QueueName, +AcceptExpressionList, -Term )
Accept the first entry in the queue that satifies one of the
AcceptExpressions in the AcceptExpressionList.
( building block for new DLP accept/n implementation )
Get / Set Array Predicates :
- new_array(+NodeName, +ArrayName, +Dim1)
- get_array(+NodeName, +ArrayName, +Idx1, ?Elem)
- set_array(+NodeName, +ArrayName, +Idx1, +Elem)
- new_array(+NodeName, +ArrayName, +Dim1, +Dim2)
- get_array(+NodeName, +ArrayName, +Idx1, +Idx2, ?Elem)
- set_array(+NodeName, +ArrayName, +Idx1, +Idx2, +Elem)
- new_array(+NodeName, +ArrayName, +Dim1, +Dim2, +Dim3)
- get_array(+NodeName, +ArrayName, +Idx1, +Idx2, +Idx3, ?Elem)
- set_array(+NodeName, +ArrayName, +Idx1, +Idx2, +Idx3, +Elem)
- NodeName and ArrayName are atoms.
- Array elements must be explicitly initialized.
Program Examples / Sources
top
DLP Regular Expression Library Predicates
-
Remarks
- rexlib requires
Java SDK 1.4.X
- see the
java.util.regex package for more information :
each Pattern or Matcher predicate mentioned below corresponds
to a single Java method as defined in the java.util.regex package.
-
Program Examples / Sources
-
Pattern Predicates
- compile_pattern ( +RegExpPattern , -PatternRef )
RegExpPattern is an atom.
PatternRef is a foreign language
object reference term.
Compiles the given regular expression into a pattern.
- compile_pattern ( +RegExpPattern , +PatternFlagList , -PatternRef )
PatternFlagList is a list of one or more pattern compilation options:
[ canon_eq, case_insensitive, comments, dotall, multiline,
unicode_case, unix_lines ]
Compiles the given regular expression into a pattern with the given flags.
- pattern_matches ( +RegExpPattern , +InputAtomOrString )
pattern_matches ( +RegExpPattern , +InputAtomOrString , -Boolean )
Compiles the given regular expression and matches the given input against it.
Predicate pattern_matches / 2 either succeeds or fails,
pattern_matches / 3 returns the atom true or false.
Predicate pattern_matches / [2,3] is defined as a convenience for when
a regular expression is used only once.
- split_input ( +PatternRef , +InputAtomOrString , -AtomList )
split_input ( +PatternRef , +InputAtomOrString , +MaxListLength , -AtomList )
Splits the given input sequence around matches of this pattern.
-
Pattern Matcher Creation
- pattern_matcher ( +PatternRef , +InputAtomOrString , -Matcher )
Creates a matcher that will match the given input against this pattern,
many matchers can share the same pattern specification.
Matcher is a matcher foreign language object
reference term.
-
URL's ....
- url_open ( +URL , -URLRef )
- url_read_line ( +URLRef , -LineString )
- url_close ( +URLRef )
Predicates are part of dlplib, not rexlib (Docs will be moved accordingly).
(to be extended)
-
Matcher Predicates
- replacement_buffer ( +BufferSize, -BufferRef)
- append_replacement ( +Matcher , +BufferRef , +Replacement )
append_replacement ( +Matcher , +BufferRef , +Replacement ,
-MatcherOut )
Non-terminal append-and-replace.
- append_tail ( +Matcher , +BufferIn , -AtomOut )
Terminal append-and-replace.
- end_index ( +Matcher , -Index )
Returns the index of the last character matched, plus one.
- end_index ( +Matcher , +GroupNumber , -Index )
Returns the index of the last character, plus one, of the subsequence
captured by the given group during the previous match operation.
GroupNumber = [ 0 ... GroupCount - 1 ]. See also group_count / 2.
- find_next ( +Matcher )
find_next ( +Matcher , -Boolean )
Finds the next subsequence of the input sequence that matches the pattern.
- find_starting_at ( +Matcher , +Index )
find_starting_at ( +Matcher , +Index , -Boolean )
Finds the next subsequence of the input sequence that matches the pattern,
starting at the specified index.
- group ( +Matcher , -Atom )
Returns the input subsequence matched by the previous match
- group ( +Matcher , +GroupNumber , -Atom )
Returns the input subsequence captured by the given group during
the previous match operation
- group_count ( +Matcher , -GroupCount )
Returns the number of capturing groups in this matcher's pattern
- looking_at ( +Matcher )
looking_at ( +Matcher , -Boolean )
Starting at the beginning, match the input sequence against the pattern.
- matches ( +Matcher )
matches ( +Matcher , -Boolean )
Matches the entire input sequence against the pattern.
- replace_all (+Matcher , +Replacement , -Atom )
Replaces every subsequence of the input sequence that matches
the pattern with the given replacement.
- replace_first ( +Matcher , +Replacement , -Atom )
Replaces the first subsequence of the input sequence that
matches the pattern with the given replacement.
- reset_matcher ( +MatcherIn , -MatcherOut )
Resets this matcher.
- reset_matcher ( +MatcherIn , +InputAtomOrString , -MatcherOut )
Resets this matcher with a new input sequence.
- start_index ( +Matcher , -Index )
Returns the start index of the previous match.
- start_index ( +Matcher , +GroupNumber , -Index )
Returns the start index of the subsequence captured by the given group
during the previous match operation.
top
Atom / String Predicates
In logic programming languages, atoms are typically used for the
representation of symbolic constants. Usually they have a relatively
modest size and they can be used efficiently in many contexts.
However, the implementation of atoms is optimized for unification;
all identical atoms have a unique reference, which reduces the
atom related string comparison operations to a single object reference
comparison. Although atoms may be used for several text-like manipulation
and inspection issues, a number of applications require sometimes a
representation that is more appropriate for manipulating text in general.
- Atom/String Predicates
- atom_to_string ( +Atom , ?String )
- string_to_atom ( +String , ?Atom )
- new_string_buffer ( -StringBuffer )
- new_string_buffer ( +Length , -StringBuffer )
- string ( ?Term )
Succeeds when Term is a string.
- string_char_at ( +String , +Index , ?Char )
Char is a single character atom.
- string_code_at ( +String , +Index , ?Code )
Code is an integer.
- string_compare_to ( +String1 , +String2 , ?Result )
Result: < 0 | == 0 | > 0
- string_buffer_to_atom ( +StringBuffer , ?Atom )
- string_buffer_to_string ( +StringBuffer , ?String )
- string_length ( +String , -Length )
- substring ( +String , +BeginIndex , +EndIndex , -SubString )
- ...
- strings should be built-in :
- <@ , >@ , =<@ , >=@ , == / 2 , \== / 2
- = / 2 , \= / 2
- "write_term" output method
- type testing: string(Term)
- copy_term / 2 .
- FLI : StrTerm
- ...
- Program Examples / Sources
top
DLP / JavaScript Interface
- DLP methods (object jsilib)
- get_window ( -JSObject )
- call ( +JSObject, +JSMethodName, +ArgList, -Result )
(t.b.d. arrays < = > lists)
- eval ( +JSObject, +Evaluate, -Result )
see member example w.r.t. netscape/explorer remarks.
- get_member ( +JSObject, +Member, -Result )
- set_member ( +JSObject, +Member, +Value )
- get_slot ( +Member, +Index, -Value) (netscape)
set_slot ( +Member, +Index, +Value) (netscape)
(use call/4 for a portable solution)
- JS method (part of object dlpbrow / dlpcons)
- applet.set_field("namespace", "queuename", term) (t.b.d.)
- applet.set_queue("namespace", "queuename", term)
- var applet = window.document.applets['dlpbrow'];
var applet = window.document.applets['dlpcons'];
Parameters namespace, queuename are strings.
Parameter term is an integer, float, double,
or string :
a string is either :
- "term:" + "aValidTermString"
- "atom:" + "anAtom" (explicit atom)
- or any other string (implicit atom)
- Examples / Sources :
- JS / DLP interface is based on the JS / Java LiveConnect
interface.
See the following JavaScript links
for more information.
top
DLP / XML : Extensible Markup Language Predicates
top
Multi-threaded Objects (Syntax Summary)
- program examples :
- declaration of objects :
- :-object name .
- :-object name : [ base ].
- :-object name : [ base1, base2, ... ].
- :-end_object name .
- declaration non-logical variables (nlv's) :
var i=0, j=[1,2,3], k=f(a,b,c).
- destructive assignment:
nlv := Term
- simplification:
- nlv := Expression
- other nlv occurrences are replaced by their current value.
- object creation:
ObjectRef := new(ObjectNameOrConstructor)
- method invocation:
ObjectRef <- method(...)
- synchronuous accept statement :
accept (AcceptExpression1, AcceptExpression2, ...)
- accept expression:
- method(...) <== [Guard] ==> Body
- method(...) <== [Guard]
- method(...) ==> Body
- method(...)
- any
- accept guard:
- accept body:
- ...
top
DLP Foreign Language Interface
FLI General Remarks
- All Term classes, as mentioned below, are derived from class Word
(and not class Term) because run-time structures (that are
not Term's) should have the same machine word oriented base class.
- The C like macro style of the described interface hides many aspects
of the actual implementation characteristics of Terms. It allows for
a more convenient conversion to different Term implementation schemes.
FLI Program Example
- Source Code
- Compilation
- dlpc pxflin.pl pxjint.java
- Execution
Term Dereferencing
- Word dt = Word.deref (Word t)
Term Creation
- IntTerm it = Word.new_int (int)
- FltTerm ft = Word.new_flt (double)
- ForTerm ft = Word.new_for (Object ref)
foreign object reference term
- FunTerm ft = Word.new_fun (SymTerm func, Word [ ] args)
FunTerm ft = Word.new_fun (SymTerm func, Word arg1)
FunTerm ft = Word.new_fun (SymTerm func, Word arg1, Word arg2)
FunTerm ft = Word.new_fun (SymTerm func, Word arg1, Word arg2, Word arg3)
- LstTerm lt = Word.new_lst (Word head, Word tail)
- NilTerm nt = Word.new_nil ()
- SymTerm st = Word.new_sym ("String".intern())
Term Type Tests
- boolean it = Word.int_term (Word w)
- boolean ft = Word.flt_term (Word w)
- boolean ft = Word.for_term (Word w)
- boolean ft = Word.fun_term (Word w)
- boolean lt = Word.lst_term (Word w)
- boolean nt = Word.nil_term (Word w)
- boolean st = Word.sym_term (Word w)
- boolean vt = Word.var_term (Word w)
Term Type Casts
- IntTerm it = Word.int_cast (Word w)
- FltTerm ft = Word.flt_cast (Word w)
- ForTerm ft = Word.for_cast (Word w)
- FunTerm ft = Word.fun_cast (Word w)
- LstTerm lt = Word.lst_cast (Word w)
- SymTerm st = Word.sym_cast (Word w)
- VarTerm vt = Word.var_cast (Word w)
Term Value Retrieval
- int i = Word.int_val (Word it)
- double f = Word.flt_val (Word ft)
- Object o = Word.for_val (Word ft)
- String n = Word.fun_name (Word ft)
- int argc = Word.fun_argc (Word ft)
- Word argv [ ] = Word.fun_argv (Word ft)
- Word argv = Word.fun_argi (Word ft, int argi)
- Word head = Word.lst_head (Word lt)
- Word tail = Word.lst_tail (Word lt)
- String s = Word.sym_val (Word st)
top
Vectors / Quaternions (vectorlib)
- Predicates
- vector_dot_product(vector(X1,Y1,Z1), vector(X2,Y2,Z2), V1DotV2)
- vector_cross_product(vector(X1,Y1,Z1), vector(X2,Y2,Z2), vector(XN,YN,ZN))
- quaternion_to_rotation(quaternion(W1,X1,Y1,Z1), rotation(X,Y,Z,R))
- rotation_to_quaternion(rotation(X1,Y1,Z1,R1), quaternion(W,X,Y,Z))
- unit_quaternion(quaternion(W1,X1,Y1,Z1), quaternion(W,X,Y,Z))
- quaternion_product(quaternion(W1,X1,Y1,Z1), quaternion(W2,X2,Y2,Z2), quaternion(W,X,Y,Z))
- slerp(F, quaternion(W1,X1,Y1,Z1), quaternion(W2,X2,Y2,Z2), quaternion(W,X,Y,Z))
- ...
top
DLP / EAI: VRML External Authoring Interface Library (Summary)
-
Examples
- Introductory DLP+VRML examples.
- More advanced DLP+VRML
WASP examples.
- DLP / EAI client interface library
source code.
- DLP / EAI server (stub) interface library
source code.
- See also the vectorlib predicates.
-
VRML Browser Predicates
- loadURL( +URL )
- getWorldURL( -URL )
- setDescription( +Description )
Description is an atom
- setTimerInterval( +NewMsecs , -OldMsecs )
- beginUpdate / 0, endUpdate / 0
- createVrmlFromString( +VrmlAtom , -ObjectRefList)
- createVrmlFromString( +VrmlAtom , +ParentObject , -ObjectRefList)
ObjectRefList is a Foreign Object Reference List.
See also the addChildren and removeChildren predicates.
- createVrmlFromURL( +URL , +NotifyNode , +NotifyField )
- addRoute( +FromObject, +EventOutFieldName , +ToObject , +EventInFieldName )
- deleteRoute( +FromObject, +EventOutFieldName, +ToObject, +EventInFieldName )
-
VRML Event Observers
- eventObserverQueue ( +Object, +FieldName, +QueueName )
Object/FieldName events are sent to QueueName as a term:
FieldName(EventValue, EventTime, Object)
- Not available (in the current EAI SDK : EventOut.unAdvise) :
removeEventObserverQueue ( +Object, +FieldName, +QueueName )
-
Agent / Object Coordinates
- getPosition( +Object , -X , -Y , -Z )
- setPosition( +Object , +X , +Y , +Z )
- getRotation( +Object , -X , -Y , -Z , -R )
- setRotation( +Object , +X , +Y , +Z , +R )
- getViewpointPosition( +Agent , -X , -Y , -Z )
- setViewpointPosition( +Agent , +X , +Y , +Z )
- getViewpointOrientation( +Agent , -X , -Y , -Z , -R )
- setViewpointOrientation( +Agent , +X , +Y , +Z , +R )
X, Y, Z, and R values are integers or floats
-
Agent / Object Distance
- distance2D(+X1, +Z1, +X2, +Z2, -Distance)
- distance3D(+X1, +Y1, +Z1, +X2, +Y2, +Z2, -Distance)
-
Vector Products
- vector_dot_product(+X1,+Y1,+Z1, +X2,+Y2,+Z2, -Angle12, -V1dotV2)
V1 dot V2 = | V1 | . | V2 | . cos (Angle12)
- vector_cross_product(+X1,+Y1,+Z1, +X2,+Y2,+Z2, -XN,-YN,-ZN, -Angle12, -VNSize)
| VN | = | V1 cross V2 | = | V1 | . | V2 | . sin (Angle12)
-
Single Field Predicates
- getSFBool(+Object, +Field, -Bool)
- setSFBool(+Object, +Field, +Bool)
Bool is an atom : 'true' or 'false'
- getSFFloat(+Object, +Field, -Float)
- setSFFloat(+Object, +Field, +Float)
- getSFInt32(+Object, +Field, -Int32)
- setSFInt32(+Object, +Field, +Int32)
- getSFString(+Object, +Field, -Atom)
- setSFString(+Object, +Field, +Atom)
- setSFString(+Object, +Field, +Format, +ArgList)
- getSFColor(+Object, +Field, -R,-G,-B)
- setSFColor(+Object, +Field, +R,+G,+B)
R, G, and B values are integers or floats
- getSFNode(+Object, +Field, -ObjectRef)
- setSFNode(+Object, +Field, +NameOrRef)
- getSFRotation(+Object, +Field, -X,-Y,-Z, -R)
- setSFRotation(+Object, +Field, +X,+Y,+Z, +R)
- getSFTime(+Object, +Field, -Time)
- setSFTime(+Object, +Field, +Time)
- getSFVec2f(+Object, +Field, -X,-Y)
- setSFVec2f(+Object, +Field, +X,+Y)
- getSFVec3f(+Object, +Field, -X,-Y,-Z)
- setSFVec3f(+Object, +Field, +X,+Y,+Z)
-
Multi Field Predicates
- getMFFloat(+Object, +Field, -FloatList)
- setMFFloat(+Object, +Field, +FloatList)
- getMFInt32(+Object, +Field, -IntegerList)
- setMFInt32(+Object, +Field, +IntegerList)
- getMFString(+Object, +Field, -AtomList)
- setMFString(+Object, +Field, +AtomList)
- setMFString(+Object, +Field, +Format, +ArgList)
- getMFColor(+Object, +Field, -RGBList)
- setMFColor(+Object, +Field, +RGBList)
RGBList = [ [R1,G1,B1], [R2,G2,B2], .... ]
- getMFNode(+Object, +Field, -ObjectRefList)
- setMFNode(+Object, +Field, +ObjectRefList)
TBD : (mixed) Object or ObjectRef List
- getMFRotation(+Object, +Field, -XYZRList)
- setMFRotation(+Object, +Field, +XYZRList)
XYZRList = [ [X1,Y1,Z1,R1], [X2,Y2,Z2,R2], .... ]
- getMFVec2f(+Object, +Field, -XYList)
- setMFVec2f(+Object, +Field, +XYList)
XYList = [ [X1,Y1], [X2,Y2], .... ]
- getMFVec3f(+Object, +Field, -XYZList)
- setMFVec3f(+Object, +Field, +XYZList)
XYZList = [ [X1,Y1,Z1], [X2,Y2,Z2], .... ]
-
(Incremental) MFNode Updates
- addChildren( +ParentObject, +ObjectRefList )
- removeChildren( +ParentObject, +ObjectRefList )
TBD : (mixed) Object or ObjectRef List
top