Mercurial > octave
annotate libinterp/corefcn/oct-procbuf.h @ 31606:dfa5d9c3ae72
maint: merge stable to default
author | Rik <rik@octave.org> |
---|---|
date | Thu, 01 Dec 2022 14:28:07 -0800 |
parents | 2aa5bcaba504 e88a07dec498 |
children | 5f11de0e7440 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
30124
diff
changeset
|
3 // Copyright (C) 1996-2022 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
2094 | 25 |
26 // This class is based on the procbuf class from libg++, written by | |
27 // Per Bothner, Copyright (C) 1993 Free Software Foundation. | |
28 | |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
29 #if ! defined (octave_oct_procbuf_h) |
17822
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
30 #define octave_oct_procbuf_h 1 |
2094 | 31 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
32 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
33 |
2094 | 34 #include <sys/types.h> |
35 | |
3631 | 36 #include "c-file-ptr-stream.h" |
37 | |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
38 OCTAVE_BEGIN_NAMESPACE(octave) |
29991
3988112c7116
move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
39 |
2094 | 40 class |
29991
3988112c7116
move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
41 procbuf : public c_file_ptr_buf |
2094 | 42 { |
43 public: | |
44 | |
29991
3988112c7116
move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
45 procbuf (void) |
30124
041dbcd1f93b
maint: use "m_" prefix for member variables in class procbuf.
Rik <rik@octave.org>
parents:
29991
diff
changeset
|
46 : c_file_ptr_buf (nullptr), m_wstatus (-1), m_open_p (false), |
041dbcd1f93b
maint: use "m_" prefix for member variables in class procbuf.
Rik <rik@octave.org>
parents:
29991
diff
changeset
|
47 m_proc_pid (-1), m_next (nullptr) |
041dbcd1f93b
maint: use "m_" prefix for member variables in class procbuf.
Rik <rik@octave.org>
parents:
29991
diff
changeset
|
48 { } |
2094 | 49 |
29991
3988112c7116
move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
50 procbuf (const char *command, int mode) |
30124
041dbcd1f93b
maint: use "m_" prefix for member variables in class procbuf.
Rik <rik@octave.org>
parents:
29991
diff
changeset
|
51 : c_file_ptr_buf (nullptr), m_wstatus (-1), m_open_p (false), |
041dbcd1f93b
maint: use "m_" prefix for member variables in class procbuf.
Rik <rik@octave.org>
parents:
29991
diff
changeset
|
52 m_proc_pid (-1), m_next (nullptr) |
041dbcd1f93b
maint: use "m_" prefix for member variables in class procbuf.
Rik <rik@octave.org>
parents:
29991
diff
changeset
|
53 { open (command, mode); } |
2094 | 54 |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
55 // No copying! |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
56 |
29991
3988112c7116
move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
57 procbuf (const procbuf&) = delete; |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
58 |
29991
3988112c7116
move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
59 procbuf& operator = (const procbuf&) = delete; |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
60 |
29991
3988112c7116
move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
61 ~procbuf (void) { close (); } |
2094 | 62 |
29991
3988112c7116
move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
63 procbuf * open (const char *command, int mode); |
2094 | 64 |
29991
3988112c7116
move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
65 procbuf * close (void); |
2094 | 66 |
30124
041dbcd1f93b
maint: use "m_" prefix for member variables in class procbuf.
Rik <rik@octave.org>
parents:
29991
diff
changeset
|
67 int wait_status (void) const { return m_wstatus; } |
3189 | 68 |
30124
041dbcd1f93b
maint: use "m_" prefix for member variables in class procbuf.
Rik <rik@octave.org>
parents:
29991
diff
changeset
|
69 bool is_open (void) const { return m_open_p; } |
3631 | 70 |
30124
041dbcd1f93b
maint: use "m_" prefix for member variables in class procbuf.
Rik <rik@octave.org>
parents:
29991
diff
changeset
|
71 pid_t pid (void) const { return m_proc_pid; } |
2094 | 72 |
73 protected: | |
74 | |
30124
041dbcd1f93b
maint: use "m_" prefix for member variables in class procbuf.
Rik <rik@octave.org>
parents:
29991
diff
changeset
|
75 int m_wstatus; |
3189 | 76 |
30124
041dbcd1f93b
maint: use "m_" prefix for member variables in class procbuf.
Rik <rik@octave.org>
parents:
29991
diff
changeset
|
77 bool m_open_p; |
3631 | 78 |
30124
041dbcd1f93b
maint: use "m_" prefix for member variables in class procbuf.
Rik <rik@octave.org>
parents:
29991
diff
changeset
|
79 pid_t m_proc_pid; |
2094 | 80 |
30124
041dbcd1f93b
maint: use "m_" prefix for member variables in class procbuf.
Rik <rik@octave.org>
parents:
29991
diff
changeset
|
81 procbuf *m_next; |
2094 | 82 }; |
83 | |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
84 OCTAVE_END_NAMESPACE(octave) |
29991
3988112c7116
move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
85 |
2094 | 86 #endif |