Go to most recent revision | Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line | 
|---|---|---|---|
| 3 | magnus | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  | 
        
| 2 | <html><head>  | 
        ||
| 3 | <title>liboop: Reference</title>  | 
        ||
| 4 | <link rel="stylesheet" type="text/css" href="style.css">  | 
        ||
| 5 | </head><body>  | 
        ||
| 6 | |||
| 7 | <h2>Liboop Reference.</h2>  | 
        ||
| 8 | |||
| 9 | <h4>Event Source Interface.</h4>  | 
        ||
| 10 | |||
| 11 | <pre>  | 
        ||
| 12 | #include <oop.h>  | 
        ||
| 13 | |||
| 14 | /* <em>Applications can set these; liboop libraries will use them.</em> */  | 
        ||
| 15 | extern void *(*<a href="alloc">oop_malloc</a>)(size_t); /* <em>returns NULL on failure</em> */  | 
        ||
| 16 | extern void *(*<a href="alloc">oop_realloc</a>)(void *,size_t); /* <em>returns NULL on failure</em> */  | 
        ||
| 17 | extern void (*<a href="alloc">oop_free</a>)(void *);  | 
        ||
| 18 | |||
| 19 | typedef struct oop_source oop_source;  | 
        ||
| 20 | struct oop_source { | 
        ||
| 21 | /* <em>File descriptor activity events.</em> */  | 
        ||
| 22 | void (*<a href="on_fd">on_fd</a>)(oop_source *,int fd,oop_event,oop_call_fd *,void *);  | 
        ||
| 23 | void (*<a href="on_fd">cancel_fd</a>)(oop_source *,int fd,oop_event);  | 
        ||
| 24 | |||
| 25 | /* <em>Timer events.</em> */  | 
        ||
| 26 | void (*<a href="on_time">on_time</a>)(oop_source *,struct timeval,oop_call_time *,void *);  | 
        ||
| 27 | void (*<a href="on_time">cancel_time</a>)(oop_source *,struct timeval,oop_call_time *,void *);  | 
        ||
| 28 | |||
| 29 | /* <em>UNIX signal events.</em> */  | 
        ||
| 30 | void (*<a href="on_signal">on_signal</a>)(oop_source *,int sig,oop_call_signal *,void *);  | 
        ||
| 31 | void (*<a href="on_signal">cancel_signal</a>)(oop_source *,int sig,oop_call_signal *,void *);  | 
        ||
| 32 | }; | 
        ||
| 33 | </pre>  | 
        ||
| 34 | |||
| 35 | <h4>System Event Source.</h4>  | 
        ||
| 36 | |||
| 37 | <pre>  | 
        ||
| 38 | typedef struct oop_source_sys oop_source_sys;  | 
        ||
| 39 | |||
| 40 | /* <em>Create and destroy a system event source.</em> */  | 
        ||
| 41 | oop_source_sys *<a href="oop_sys">oop_sys_new</a>(void); /* <em>returns NULL on failure</em> */  | 
        ||
| 42 | void <a href="oop_sys">oop_sys_delete</a>(oop_source_sys *);  | 
        ||
| 43 | |||
| 44 | /* <em>Run the system event loop.</em> */  | 
        ||
| 45 | void *<a href="oop_sys_run">oop_sys_run</a>(oop_source_sys *);  | 
        ||
| 46 | void *<a href="oop_sys_run">oop_sys_run_once</a>(oop_source_sys *);  | 
        ||
| 47 | |||
| 48 | /* <em>Get the standard source interface for a system event source.</em> */  | 
        ||
| 49 | oop_source *<a href="oop_sys_source">oop_sys_source</a>(oop_source_sys *);  | 
        ||
| 50 | </pre>  | 
        ||
| 51 | |||
| 52 | <hr>  | 
        ||
| 53 | <h4><a href="http://www.chiark.greenend.org.uk/~ian/adns/">ADNS</a> Event Sink  | 
        ||
| 54 | Adapter.</h4>  | 
        ||
| 55 | |||
| 56 | <p><em>Please note that while the core of liboop is distributed under the  | 
        ||
| 57 | Lesser GPL, ADNS is covered by the  | 
        ||
| 58 | <a href="http://www.fsf.org/copyleft/gpl.html">full GPL</a>.</em></p>  | 
        ||
| 59 | |||
| 60 | <pre>  | 
        ||
| 61 | #include <adns.h>  | 
        ||
| 62 | #include <oop-adns.h>  | 
        ||
| 63 | |||
| 64 | typedef struct oop_adapter_adns oop_adapter_adns;  | 
        ||
| 65 | typedef struct oop_adns_query oop_adns_query;  | 
        ||
| 66 | |||
| 67 | /* <em>Create and destroy a liboop adns adapter, including an instance of adns.</em> */  | 
        ||
| 68 | oop_adapter_adns *<a href="oop_adns">oop_adns_new</a>(oop_source *,adns_initflags,FILE *diag); /* <em>returns NULL on failure</em> */  | 
        ||
| 69 | void <a href="oop_adns">oop_adns_delete</a>(oop_adapter_adns *);  | 
        ||
| 70 | |||
| 71 | /* <em>Submit an asynchronous DNS query.</em> */  | 
        ||
| 72 | oop_adns_query *<a href="oop_adns_query">oop_adns_submit</a>( /* <em>returns NULL on failure</em> */  | 
        ||
| 73 | oop_adapter_adns *,  | 
        ||
| 74 | const char *owner,adns_rrtype type,adns_queryflags flags,  | 
        ||
| 75 |         oop_adns_call *,void *); | 
        ||
| 76 | |||
| 77 | /* <em>Cancel a running query.</em> */  | 
        ||
| 78 | void <a href="oop_adns_query">oop_adns_cancel</a>(oop_adns_query *);  | 
        ||
| 79 | </pre>  | 
        ||
| 80 | |||
| 81 | <hr>  | 
        ||
| 82 | <h4><a href="http://gtk.org/">GLib</a> Event Source Adapter.</h4>  | 
        ||
| 83 | |||
| 84 | <p><em>GLib is copyrighted by Peter Mattis, Spencer Kimball and Josh MacDonald,  | 
        ||
| 85 | and licensed under the terms of the  | 
        ||
| 86 | <a href="http://www.fsf.org/copyleft/lgpl.html">GNU Library GPL</a>.</em></p>  | 
        ||
| 87 | |||
| 88 | <pre>  | 
        ||
| 89 | #include <glib.h>  | 
        ||
| 90 | #include <oop-glib.h>  | 
        ||
| 91 | |||
| 92 | /* <em>Create and destroy a liboop GLib adapter.</em> */  | 
        ||
| 93 | oop_source *<a href="oop_glib">oop_glib_new</a>();  | 
        ||
| 94 | void <a href="oop_glib">oop_glib_delete</a>();  | 
        ||
| 95 | |||
| 96 | /* <em>Get the value used to terminate the event loop (e.g. OOP_HALT)</em>. */  | 
        ||
| 97 | void *<a href="oop_glib">oop_glib_return</a>();  | 
        ||
| 98 | </pre>  | 
        ||
| 99 | |||
| 100 | <hr>  | 
        ||
| 101 | <h4><a href="http://www.purl.org/tcl/home/">Tcl/Tk</a>  | 
        ||
| 102 | Event Source Adapter.</h4>  | 
        ||
| 103 | |||
| 104 | <p><em>Tcl is copyrighted by the Regents of the University of California,  | 
        ||
| 105 | Sun Microsystems, Inc., and other parties.</em></p>  | 
        ||
| 106 | |||
| 107 | <pre>  | 
        ||
| 108 | #include <oop-tcl.h>  | 
        ||
| 109 | |||
| 110 | /* <em>Create and destroy a liboop Tcl adapter.</em> */  | 
        ||
| 111 | oop_source *<a href="oop_tcl">oop_tcl_new</a>();  | 
        ||
| 112 | void <a href="oop_tcl">oop_tcl_delete</a>();  | 
        ||
| 113 | </pre>  | 
        ||
| 114 | |||
| 115 | <hr>  | 
        ||
| 116 | <h4><a href="http://www.w3.org/Library/">Libwww</a> Event Sink Adapter.</h4>  | 
        ||
| 117 | |||
| 118 | <p><em>Libwww is covered by this <a  | 
        ||
| 119 | href="http://www.w3.org/Consortium/Legal/libwww-copyright-notice-19980720.html"  | 
        ||
| 120 | >copyright notice</a> and distributed under the terms of the  | 
        ||
| 121 | <a href="http://www.w3.org/Consortium/Legal/copyright-software.html">W3C  | 
        ||
| 122 | Software License</a>.</em></p>  | 
        ||
| 123 | |||
| 124 | <pre>  | 
        ||
| 125 | #include <HTEvent.h>  | 
        ||
| 126 | #include <oop-www.h>  | 
        ||
| 127 | |||
| 128 | /* <em>Register a liboop event source as a libwww "event manager".</em> */  | 
        ||
| 129 | void <a href="oop_www">oop_www_register</a>(oop_source *);  | 
        ||
| 130 | |||
| 131 | /* <em>Unregister the event source, leaving libwww with no event manager.  | 
        ||
| 132 | This function cannot be executed with outstanding event requests.</em> */  | 
        ||
| 133 | void <a href="oop_www">oop_www_cancel</a>();  | 
        ||
| 134 | |||
| 135 | /* <em>Use libwww for liboop's oop_malloc, oop_realloc, and oop_free.  | 
        ||
| 136 |    <b>If you use this, you must call it before any other liboop function!</b></em> */ | 
        ||
| 137 | void <a href="oop_www">oop_www_memory</a>(); | 
        ||
| 138 | </pre> | 
        ||
| 139 | |||
| 140 | <hr> | 
        ||
| 141 | <h4><a href="http://cnswww.cns.cwru.edu/~chet/readline/rltop.html">GNU | 
        ||
| 142 | Readline Library</a> Event Sink Adapter.</h4> | 
        ||
| 143 | |||
| 144 | <p><em>Please note that while the core of liboop is distributed under the | 
        ||
| 145 | Lesser GPL, Readline is covered by the | 
        ||
| 146 | <a href="http://www.fsf.org/copyleft/gpl.html">full GPL</a>.</em></p> | 
        ||
| 147 | |||
| 148 | <pre> | 
        ||
| 149 | #include <oop-rl.h> | 
        ||
| 150 | |||
| 151 | /* <em>Use a liboop event source to call rl_callback_read_char(). | 
        ||
| 152 |    It is up to you to call rl_callback_handler_install(). | 
        ||
| 153 |    Note well that Readline uses malloc(), not oop_malloc().</em> */ | 
        ||
| 154 | void <a href="oop_rl">oop_readline_register</a>(oop_source *); | 
        ||
| 155 | |||
| 156 | /* <em>Stop notifying readline of input characters.</em> */ | 
        ||
| 157 | void <a href="oop_rl">oop_readline_cancel</a>(oop_source *); | 
        ||
| 158 | </pre> | 
        ||
| 159 | |||
| 160 | <hr><a href="">liboop home</a></body></html> |