From 70ca40b271254bf4b00fbf91d30d077367c492c3 Mon Sep 17 00:00:00 2001 From: jacomi Date: Tue, 13 Apr 1999 09:03:39 +0000 Subject: doc updated --- doc/ivy-perl-3.html | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 doc/ivy-perl-3.html (limited to 'doc/ivy-perl-3.html') diff --git a/doc/ivy-perl-3.html b/doc/ivy-perl-3.html new file mode 100644 index 0000000..bee7734 --- /dev/null +++ b/doc/ivy-perl-3.html @@ -0,0 +1,111 @@ + + + + + The Ivy C library guide: Basic functions + + + + + +Next +Previous +Contents +
+

3. Basic functions

+ +

3.1 Initialization and main loop +

+ +

Initializing an Ivy agent with the Ivy-Perl library is done by calling function Ivy::start. In theory, initialization is then over. However in +practice, as for any asynchronous communication or interaction library, nothing +happens until your application has reached the main loop. +

The Ivy Perl library provides two kind of main loop: a "local" loop + for perl code, and a "Tk" loop for perl-tk code. +

Here is more details on Ivy::start function: +

+

+
+  Ivy::start(-loopMode => 'TK', 
+             -ivyBus => '2011', 
+             -appName => "TOTO",
+             -neededApp => "TITI",
+             -statusFunc    => \&statusScan);
+
+
+
+ +initializes and connects your application to the bus specified in ivyBus. The string provided +should follow the convention described in section XX. Example: "127:2010".. +

+ +

+
+MainLoop;
+
+
+ +makes your application enter the main loop in which it will handle asynchronous +communications and signals. +

+

+
+Ivy::stop ();
+
+
+ +makes your application exit the main loop. +

+

+

3.2 Emitting messages +

+ +

Emitting a message on an Ivy bus is much like printing a message on the standard +output. However, do not forget that your message will not be emitted if Ivy has +not been properly initialized and if you do not have a main loop of some sort +running. To emit a message, use IvySendMsg, which works like printf: +

+

+
+Ivy::sendMsg ("...");
+
+
+ +sends a message on the bus. +

+

+

3.3 Subscribing to messages +

+ +

Subscribing to messages consists in binding a callback function to a message +pattern. Patterns are described by regular expressions with captures. When a +message matching the regular expression is detected on the bus, the callback +function is called. The captures (ie the bits of the message that match the +parts of regular expression delimited by brackets) are passed to the callback +function much like options are passed to main. Use function Ivy::bindRegexp +to bind a callback to a pattern. +

+
+Ivy::bindRegexp ("^HELLO WORLD", [\&Start]);
+
+
+ +binds callback function Start to the regular expression specified by +regex_format. +

+

+
+Ivy::bindRegexp ("^HELLO WORLD", NULL);
+
+
+ +deletes the binding. +

+

+

+


+Next +Previous +Contents + + -- cgit v1.1