diff options
Diffstat (limited to 'doc/ivy-perl-3.html')
-rw-r--r-- | doc/ivy-perl-3.html | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/doc/ivy-perl-3.html b/doc/ivy-perl-3.html deleted file mode 100644 index bee7734..0000000 --- a/doc/ivy-perl-3.html +++ /dev/null @@ -1,111 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> -<HTML> -<HEAD> - <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.7"> - <TITLE>The Ivy C library guide: Basic functions</TITLE> - <LINK HREF="ivy-perl-4.html" REL=next> - <LINK HREF="ivy-perl-2.html" REL=previous> - <LINK HREF="ivy-perl.html#toc3" REL=contents> -</HEAD> -<BODY> -<A HREF="ivy-perl-4.html">Next</A> -<A HREF="ivy-perl-2.html">Previous</A> -<A HREF="ivy-perl.html#toc3">Contents</A> -<HR> -<H2><A NAME="s3">3. Basic functions</A></H2> - -<H2><A NAME="ss3.1">3.1 Initialization and main loop</A> -</H2> - -<P>Initializing an Ivy agent with the Ivy-Perl library is done by calling function <CODE>Ivy::start</CODE>. 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. -<P>The Ivy Perl library provides two kind of main loop: a "local" loop - for perl code, and a "Tk" loop for perl-tk code. -<P>Here is more details on <CODE>Ivy::start</CODE> function: -<P> -<BLOCKQUOTE><CODE> -<PRE> - Ivy::start(-loopMode => 'TK', - -ivyBus => '2011', - -appName => "TOTO", - -neededApp => "TITI", - -statusFunc => \&statusScan); - -</PRE> -</CODE></BLOCKQUOTE> - -initializes and connects your application to the bus specified in <CODE>ivyBus</CODE>. The string provided -should follow the convention described in section XX. Example: <CODE>"127:2010"</CODE>.. -<P> - -<BLOCKQUOTE><CODE> -<PRE> -MainLoop; -</PRE> -</CODE></BLOCKQUOTE> - -makes your application enter the main loop in which it will handle asynchronous -communications and signals. -<P> -<BLOCKQUOTE><CODE> -<PRE> -Ivy::stop (); -</PRE> -</CODE></BLOCKQUOTE> - -makes your application exit the main loop. -<P> -<P> -<H2><A NAME="ss3.2">3.2 Emitting messages</A> -</H2> - -<P>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 <CODE>IvySendMsg</CODE>, which works like <CODE>printf</CODE>: -<P> -<BLOCKQUOTE><CODE> -<PRE> -Ivy::sendMsg ("..."); -</PRE> -</CODE></BLOCKQUOTE> - -sends a message on the bus. -<P> -<P> -<H2><A NAME="ss3.3">3.3 Subscribing to messages</A> -</H2> - -<P>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 <CODE>main</CODE>. Use function <CODE>Ivy::bindRegexp</CODE> -to bind a callback to a pattern. -<BLOCKQUOTE><CODE> -<PRE> -Ivy::bindRegexp ("^HELLO WORLD", [\&Start]); -</PRE> -</CODE></BLOCKQUOTE> - -binds callback function <CODE>Start</CODE> to the regular expression specified by -<CODE>regex_format</CODE>. -<P> -<BLOCKQUOTE><CODE> -<PRE> -Ivy::bindRegexp ("^HELLO WORLD", NULL); -</PRE> -</CODE></BLOCKQUOTE> - -deletes the binding. -<P> -<P> -<P> -<HR> -<A HREF="ivy-perl-4.html">Next</A> -<A HREF="ivy-perl-2.html">Previous</A> -<A HREF="ivy-perl.html#toc3">Contents</A> -</BODY> -</HTML> |