Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Rev 3 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<title>liboop: Reference</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head><body>

<h2>Liboop Reference.</h2>

<h4>Event Source Interface.</h4>

<pre>
#include &lt;oop.h&gt;

/* <em>Applications can set these; liboop libraries will use them.</em> */
extern void *(*<a href="alloc.html">oop_malloc</a>)(size_t); /* <em>returns NULL on failure</em> */
extern void *(*<a href="alloc.html">oop_realloc</a>)(void *,size_t); /* <em>returns NULL on failure</em> */
extern void (*<a href="alloc.html">oop_free</a>)(void *);

typedef struct oop_source oop_source;
struct oop_source {
    /* <em>File descriptor activity events.</em> */
    void (*<a href="on_fd.html">on_fd</a>)(oop_source *,int fd,oop_event,oop_call_fd *,void *);
    void (*<a href="on_fd.html">cancel_fd</a>)(oop_source *,int fd,oop_event);

    /* <em>Timer events.</em> */
    void (*<a href="on_time.html">on_time</a>)(oop_source *,struct timeval,oop_call_time *,void *);
    void (*<a href="on_time.html">cancel_time</a>)(oop_source *,struct timeval,oop_call_time *,void *);

    /* <em>UNIX signal events.</em> */
    void (*<a href="on_signal.html">on_signal</a>)(oop_source *,int sig,oop_call_signal *,void *);
    void (*<a href="on_signal.html">cancel_signal</a>)(oop_source *,int sig,oop_call_signal *,void *);
};
</pre>

<h4>System Event Source.</h4>

<pre>
typedef struct oop_source_sys oop_source_sys;

/* <em>Create and destroy a system event source.</em> */
oop_source_sys *<a href="oop_sys.html">oop_sys_new</a>(void); /* <em>returns NULL on failure</em> */
void <a href="oop_sys.html">oop_sys_delete</a>(oop_source_sys *);

/* <em>Run the system event loop.</em> */
void *<a href="oop_sys_run.html">oop_sys_run</a>(oop_source_sys *);
void *<a href="oop_sys_run.html">oop_sys_run_once</a>(oop_source_sys *);

/* <em>Get the standard source interface for a system event source.</em> */
oop_source *<a href="oop_sys_source.html">oop_sys_source</a>(oop_source_sys *);
</pre>

<hr>
<h4><a href="http://www.chiark.greenend.org.uk/~ian/adns/">ADNS</a> Event Sink
Adapter.</h4>

<p><em>Please note that while the core of liboop is distributed under the
Lesser GPL, ADNS is covered by the
<a href="http://www.fsf.org/copyleft/gpl.html">full GPL</a>.</em></p>

<pre>
#include &lt;adns.h&gt;
#include &lt;oop-adns.h&gt;

typedef struct oop_adapter_adns oop_adapter_adns;
typedef struct oop_adns_query oop_adns_query;

/* <em>Create and destroy a liboop adns adapter, including an instance of adns.</em> */
oop_adapter_adns *<a href="oop_adns.html">oop_adns_new</a>(oop_source *,adns_initflags,FILE *diag); /* <em>returns NULL on failure</em> */
void <a href="oop_adns.html">oop_adns_delete</a>(oop_adapter_adns *);

/* <em>Submit an asynchronous DNS query.</em> */
oop_adns_query *<a href="oop_adns_query.html">oop_adns_submit</a>( /* <em>returns NULL on failure</em> */
        oop_adapter_adns *,
        const char *owner,adns_rrtype type,adns_queryflags flags,
        oop_adns_call *,void *);

/* <em>Cancel a running query.</em> */
void <a href="oop_adns_query.html">oop_adns_cancel</a>(oop_adns_query *);
</pre>

<hr>
<h4><a href="http://gtk.org/">GLib</a> Event Source Adapter.</h4>

<p><em>GLib is copyrighted by Peter Mattis, Spencer Kimball and Josh MacDonald,
and licensed under the terms of the
<a href="http://www.fsf.org/copyleft/lgpl.html">GNU Library GPL</a>.</em></p>

<pre>
#include &lt;glib.h&gt;
#include &lt;oop-glib.h&gt;

/* <em>Create and destroy a liboop GLib adapter.</em> */
oop_source *<a href="oop_glib.html">oop_glib_new</a>();
void <a href="oop_glib.html">oop_glib_delete</a>();

/* <em>Get the value used to terminate the event loop (e.g. OOP_HALT)</em>. */
void *<a href="oop_glib.html">oop_glib_return</a>();
</pre>

<hr>
<h4><a href="http://www.purl.org/tcl/home/">Tcl/Tk</a>
Event Source Adapter.</h4>

<p><em>Tcl is copyrighted by the Regents of the University of California,
Sun Microsystems, Inc., and other parties.</em></p>

<pre>
#include &lt;oop-tcl.h&gt;

/* <em>Create and destroy a liboop Tcl adapter.</em> */
oop_source *<a href="oop_tcl.html">oop_tcl_new</a>();
void <a href="oop_tcl.html">oop_tcl_delete</a>();
</pre>

<hr>
<h4><a href="http://www.w3.org/Library/">Libwww</a> Event Sink Adapter.</h4>

<p><em>Libwww is covered by this <a
href="http://www.w3.org/Consortium/Legal/libwww-copyright-notice-19980720.html"
>copyright notice</a> and distributed under the terms of the
<a href="http://www.w3.org/Consortium/Legal/copyright-software.html">W3C
Software License</a>.</em></p>

<pre>
#include &lt;HTEvent.h&gt;
#include &lt;oop-www.h&gt;

/* <em>Register a liboop event source as a libwww "event manager".</em> */
void <a href="oop_www.html">oop_www_register</a>(oop_source *);

/* <em>Unregister the event source, leaving libwww with no event manager.
   This function cannot be executed with outstanding event requests.</em> */
void <a href="oop_www.html">oop_www_cancel</a>();

/* <em>Use libwww for liboop's oop_malloc, oop_realloc, and oop_free.
   <b>If you use this, you must call it before any other liboop function!</b></em> */
void <a href="oop_www.html">oop_www_memory</a>();
</pre>

<hr>
<h4><a href="http://cnswww.cns.cwru.edu/~chet/readline/rltop.html">GNU
Readline Library</a> Event Sink Adapter.</h4>

<p><em>Please note that while the core of liboop is distributed under the
Lesser GPL, Readline is covered by the
<a href="http://www.fsf.org/copyleft/gpl.html">full GPL</a>.</em></p>

<pre>
#include &lt;oop-rl.h&gt;

/* <em>Use a liboop event source to call rl_callback_read_char().
   It is up to you to call rl_callback_handler_install().
   Note well that Readline uses malloc(), not oop_malloc().</em> */
void <a href="oop_rl.html">oop_readline_register</a>(oop_source *);

/* <em>Stop notifying readline of input characters.</em> */
void <a href="oop_rl.html">oop_readline_cancel</a>(oop_source *);
</pre>

<hr><a href="">liboop home</a></body></html>