~ubuntu-branches/ubuntu/quantal/texmacs/quantal

« back to all changes in this revision

Viewing changes to src/System/Link/pipe_link.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Atsuhito KOHDA
  • Date: 2010-04-23 07:09:40 UTC
  • mfrom: (4.1.8 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100423070940-72mjdmdepfgrvo8f
Tags: 1:1.0.7.4-2
Re-upload, former upload failed with wrong diff.gz perhaps.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
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
 
******************************************************************************/
11
 
 
12
 
#ifndef PIPE_LINK_H
13
 
#define PIPE_LINK_H
14
 
#include "tm_link.hpp"
15
 
#include "socket_notifier.hpp"
16
 
 
17
 
#ifdef OS_WIN32
18
 
#include <sys/pipe.h>
19
 
#else
20
 
extern char **environ;
21
 
#endif
22
 
 
23
 
extern char **environ;
24
 
 
25
 
#define STDIN 0
26
 
#define STDOUT 1
27
 
#define STDERR 2
28
 
#define IN 0
29
 
#define OUT 1
30
 
#define TERMCHAR '\1'
31
 
 
32
 
/******************************************************************************
33
 
* The pipe_link class
34
 
******************************************************************************/
35
 
 
36
 
struct pipe_link_rep: tm_link_rep {
37
 
  string cmd;           // command for launching the pipe
38
 
 
39
 
#ifdef OS_WIN32
40
 
  PIPE_CONN conn;
41
 
#else
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
49
 
#endif
50
 
 
51
 
  string outbuf;        // pending output from plugin
52
 
  string errbuf;        // pending errors from plugin
53
 
 
54
 
  socket_notifier snout, snerr;
55
 
  
56
 
public:
57
 
  pipe_link_rep (string cmd);
58
 
  ~pipe_link_rep ();
59
 
 
60
 
  string  start ();
61
 
  void    write (string s, int channel);
62
 
  string& watch (int channel);
63
 
  string  read (int channel);
64
 
  void    listen (int msecs);
65
 
  void    interrupt ();
66
 
  void    stop ();
67
 
 
68
 
  void    feed (int channel);
69
 
};
70
 
 
71
 
void listen_to_pipes ();
72
 
void close_all_pipes ();
73
 
 
74
 
#endif // PIPE_LINK_H