2
/******************************************************************************
3
* MODULE : pipe_link.cpp
4
* DESCRIPTION: TeXmacs links by pipes
5
* COPYRIGHT : (C) 2000 Joris van der Hoeven
6
*******************************************************************************
7
* This software falls under the GNU general public license version 3 or later.
8
* It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
9
* in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
10
******************************************************************************/
14
#include "tm_link.hpp"
15
#include "socket_notifier.hpp"
20
extern char **environ;
23
extern char **environ;
32
/******************************************************************************
34
******************************************************************************/
36
struct pipe_link_rep: tm_link_rep {
37
string cmd; // command for launching the pipe
42
int pid; // process identifier of the child
43
int pp_in [2]; // for data going to the child
44
int pp_out[2]; // for data coming from the child
45
int pp_err[2]; // for error messages coming from the child
46
int in; // file descriptor for data going to the child
47
int out; // file descriptor for data coming from the child
48
int err; // file descriptor for errors coming from the child
51
string outbuf; // pending output from plugin
52
string errbuf; // pending errors from plugin
54
socket_notifier snout, snerr;
57
pipe_link_rep (string cmd);
61
void write (string s, int channel);
62
string& watch (int channel);
63
string read (int channel);
64
void listen (int msecs);
68
void feed (int channel);
71
void listen_to_pipes ();
72
void close_all_pipes ();