|Did you know ...||Search Documentation:|
|DDE server mode|
library(dde) defines primitives to realise simple
DDE server applications in SWI-Prolog. These features are provided as of
version 2.0.6 and should be regarded as prototypes. The C part of the
DDE server can handle some more primitives, so if you need features not
provided by this interface, please study
executerequests from other applications. To register a service for a DDE request, Template is of the form:
+Service(+Topic, +Item, +Value)Service is the name of the DDE service provided (like progman in the client example above). Topic is either an atom, indicating Goal only handles requests on this topic, or a variable that also appears in Goal. Item and Value are variables that also appear in Goal. Item represents the request data as a Prolog atom.164Up to version 3.4.5 this was a list of character codes. As recent versions have atom garbage collection there is no need for this anymore.
The example below registers the Prolog current_prolog_flag/2 predicate to be accessible from other applications. The request may be given from the same Prolog as well as from another application.
?- dde_register_service(prolog(current_prolog_flag, F, V), current_prolog_flag(F, V)). ?- open_dde_conversation(prolog, current_prolog_flag, Handle), dde_request(Handle, home, Home), close_dde_conversation(Handle). Home = '/usr/local/lib/pl-2.0.6/'
execute requests is very similar. In this
case the template is of the form:
Passing a Value argument is not needed as
requests either succeed or fail. If Goal fails, a‘not
processed' is passed back to the caller of the DDE request.