annotate libinterp/corefcn/procstream.cc @ 20654:b65888ec820e draft default tip gccjit

dmalcom gcc jit import
author Stefan Mahr <dac922@gmx.de>
date Fri, 27 Feb 2015 16:59:36 +0100
parents 4197fc428c7d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
1 /*
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
2
19731
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
3 Copyright (C) 1993-2015 John W. Eaton
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
4
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
6
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5307
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5307
diff changeset
10 option) any later version.
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
11
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
15 for more details.
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
16
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5307
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5307
diff changeset
19 <http://www.gnu.org/licenses/>.
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
20
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
21 */
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
22
240
a99f28f5e351 [project @ 1993-11-30 20:24:36 by jwe]
jwe
parents: 1
diff changeset
23 #ifdef HAVE_CONFIG_H
1192
b6360f2d4fa6 [project @ 1995-03-30 21:38:35 by jwe]
jwe
parents: 1009
diff changeset
24 #include <config.h>
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
25 #endif
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
26
8950
d865363208d6 include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
27 #include <iostream>
d865363208d6 include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
28
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
29 #include "procstream.h"
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
30
4051
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3563
diff changeset
31 procstreambase::procstreambase (const std::string& command, int mode)
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3563
diff changeset
32 {
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3563
diff changeset
33 pb_init ();
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3563
diff changeset
34
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3563
diff changeset
35 if (! pb.open (command.c_str (), mode))
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3563
diff changeset
36 std::ios::setstate (std::ios::badbit);
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3563
diff changeset
37 }
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3563
diff changeset
38
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
39 procstreambase::procstreambase (const char *command, int mode)
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
40 {
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
41 pb_init ();
1380
79f80c6229be [project @ 1995-09-12 07:03:33 by jwe]
jwe
parents: 1315
diff changeset
42
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
43 if (! pb.open (command, mode))
3563
7031786b3f27 [project @ 2000-02-03 05:55:18 by jwe]
jwe
parents: 3562
diff changeset
44 std::ios::setstate (std::ios::badbit);
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
45 }
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
46
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
47 void
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
48 procstreambase::open (const char *command, int mode)
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
49 {
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
50 clear ();
1380
79f80c6229be [project @ 1995-09-12 07:03:33 by jwe]
jwe
parents: 1315
diff changeset
51
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
52 if (! pb.open (command, mode))
3563
7031786b3f27 [project @ 2000-02-03 05:55:18 by jwe]
jwe
parents: 3562
diff changeset
53 std::ios::setstate (std::ios::badbit);
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
54 }
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
55
483
41a70d08c1f7 [project @ 1994-06-30 18:30:21 by jwe]
jwe
parents: 453
diff changeset
56 int
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
57 procstreambase::close (void)
1380
79f80c6229be [project @ 1995-09-12 07:03:33 by jwe]
jwe
parents: 1315
diff changeset
58 {
79f80c6229be [project @ 1995-09-12 07:03:33 by jwe]
jwe
parents: 1315
diff changeset
59 int status = 0;
79f80c6229be [project @ 1995-09-12 07:03:33 by jwe]
jwe
parents: 1315
diff changeset
60
79f80c6229be [project @ 1995-09-12 07:03:33 by jwe]
jwe
parents: 1315
diff changeset
61 if (is_open ())
79f80c6229be [project @ 1995-09-12 07:03:33 by jwe]
jwe
parents: 1315
diff changeset
62 {
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
63 if (! pb.close ())
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
64 std::ios::setstate (std::ios::failbit);
3189
bef7b73c0724 [project @ 1998-10-16 18:05:26 by jwe]
jwe
parents: 2847
diff changeset
65
bef7b73c0724 [project @ 1998-10-16 18:05:26 by jwe]
jwe
parents: 2847
diff changeset
66 status = pb.wait_status ();
1380
79f80c6229be [project @ 1995-09-12 07:03:33 by jwe]
jwe
parents: 1315
diff changeset
67 }
79f80c6229be [project @ 1995-09-12 07:03:33 by jwe]
jwe
parents: 1315
diff changeset
68
79f80c6229be [project @ 1995-09-12 07:03:33 by jwe]
jwe
parents: 1315
diff changeset
69 return status;
79f80c6229be [project @ 1995-09-12 07:03:33 by jwe]
jwe
parents: 1315
diff changeset
70 }