1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<title>libModglue: a C++ library for handling co-processes</title>
<link rel="stylesheet" type="text/css" href="../software.css">
</head>
<body bgcolor="white">
<h1>libModglue: a C++ library for handling co-processes</h1>
<h2 class="author">Kasper Peeters, kasper.peeters (at) aei.mpg.de</h2>
<h2>Overview</h2>
<div class="text">
The libModglue library is a C++ library with classes for forking external
processes and asynchronous reading from streams. It takes
away the burden of all subtleties involving the Unix <tt>fork</tt>
call. The asynchronous read facility enables one to read on
multiple input streams at the same time, without losing any
of the standard C++ stream facilities.</div>
<div class="text">
There are also several small additional programs bundled with modglue,
such as a program to add readline capability to any command line
program. Moreover, the modglue library extends the idea of standard
Unix pipes by providing a general framework for the creation of new
processes with more than just the standard stdin/stdout/stderr
pipes.</div>
<h2>Simple example<h2>
<blockquote>
<table width="80%"><tr><td bgcolor="#e0e0e0"><pre>
#include <modglue/modglue.hh>
modglue::pipe foopipe("foo", modglue::pipe::input, 0);
modglue::pipe barpipe("bar", modglue::pipe::output, 1);
void print(const string& txt)
{
cout << "received " << txt << " on foo pipe" << endl;
cout << "sending something on bar pipe" << endl;
while(txt!="end") {
string str;
if(!foopipe.read(str,2))
break;
}
barpipe.sender("thank you!");
}
int main(int argc, char **argv)
{
modglue::main mm(&argc, &argv);
mm.add(pipe1);
mm.add(pipe2);
foopipe.receiver.connect(slot(print));
mm.run();
}
</table></blockquote>
<h2>Download</h2>
<blockquote>
For all download information please visit
the <a href="http://www.aei.mpg.de/~peekas/cadabra/download.html">download
page of cadabra</a>.
</blockquote>
<h2>Utilities</h2>
<blockquote>
Several small programs are bundled with modglue. They provide some
additional functionality that was easy to implement with the library,
or are generally useful for command-line driven programs.
<dl>
<dt><a name="ptywrap"><strong>ptywrap</strong></a></dt>
<dd>Starts a program with stdin/stdout/stderr connected to a pseudo
tty device, and map them to fd 0,1,2. This can be used to trick
programs like <tt>ftp</tt> or <tt>sed</tt> into thinking that
they are running interactively.
<blockquote><small>
<pre>> ptywrap [unix executable]</pre></small></blockquote>
is all you need to know.
</dd>
<p>
<dt><a name="prompt"><strong>prompt</strong></a></dt>
<dd>The prompt utility wraps other programs such that their input
has the well-known readline behaviour. In other words, you can
use the cursor keys for editing, there is a history, and so on.
Useful for programs like <tt>ftp</tt> that lack this
functionality.
</dd>
</dl>
</blockquote>
<p><br><p>
</body>
</html>
|