2094
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
2094
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
2094
|
21 |
|
22 */ |
|
23 |
|
24 // This class is based on the procbuf class from libg++, written by |
|
25 // Per Bothner, Copyright (C) 1993 Free Software Foundation. |
|
26 |
|
27 #if !defined (octave_octave_procbuf_h) |
|
28 #define octave_octave_procbuf_h 1 |
|
29 |
|
30 #ifdef HAVE_SYS_TYPES_H |
|
31 #include <sys/types.h> |
|
32 #endif |
|
33 |
3631
|
34 #include "c-file-ptr-stream.h" |
|
35 |
2094
|
36 class |
3631
|
37 octave_procbuf : public c_file_ptr_buf |
2094
|
38 { |
|
39 public: |
|
40 |
|
41 octave_procbuf (void) |
3631
|
42 : c_file_ptr_buf (0), wstatus (-1), open_p (false), proc_pid (-1), |
|
43 next (0) { } |
2094
|
44 |
|
45 octave_procbuf (const char *command, int mode) |
3631
|
46 : c_file_ptr_buf (0), wstatus (-1), open_p (false), proc_pid (-1), |
|
47 next (0) { open (command, mode); } |
2094
|
48 |
|
49 ~octave_procbuf (void) { close (); } |
|
50 |
|
51 octave_procbuf *open (const char *command, int mode); |
|
52 |
3631
|
53 octave_procbuf *close (void); |
2094
|
54 |
3189
|
55 int wait_status (void) const { return wstatus; } |
|
56 |
3631
|
57 bool is_open (void) const { return open_p; } |
|
58 |
6316
|
59 pid_t pid (void) const { return proc_pid; } |
2094
|
60 |
|
61 protected: |
|
62 |
3189
|
63 int wstatus; |
|
64 |
3631
|
65 bool open_p; |
|
66 |
2094
|
67 pid_t proc_pid; |
|
68 |
|
69 octave_procbuf *next; |
|
70 }; |
|
71 |
3174
|
72 extern void symbols_of_oct_procbuf (void); |
|
73 |
2094
|
74 #endif |
|
75 |
|
76 /* |
|
77 ;;; Local Variables: *** |
|
78 ;;; mode: C++ *** |
|
79 ;;; End: *** |
|
80 */ |