Mercurial > hg > octave-terminal
changeset 1448:067f11a46742
[project @ 1995-09-20 03:41:58 by jwe]
author | jwe |
---|---|
date | Wed, 20 Sep 1995 03:41:58 +0000 |
parents | 1c39e0686c99 |
children | df589c97e140 |
files | src/procstream.cc src/procstream.h |
diffstat | 2 files changed, 29 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/src/procstream.cc +++ b/src/procstream.cc @@ -34,13 +34,6 @@ #include "procstream.h" -iprocstream::iprocstream (void) -{ - pbuf = new procbuf (); - - init (pbuf); -} - iprocstream::iprocstream (const char *command, int mode) { pbuf = new procbuf (); @@ -53,7 +46,7 @@ iprocstream::~iprocstream (void) { - close (); + delete pbuf; } void @@ -61,8 +54,12 @@ { clear (); - if (! pbuf) - pbuf = new procbuf (); + if (pbuf) + delete pbuf; + + pbuf = new procbuf (); + + init (pbuf); if (! pbuf->open (command, mode)) set (ios::badbit); @@ -81,7 +78,6 @@ if (is_open ()) { - status = pbuf->sys_close (); if (! pbuf->close ()) @@ -91,11 +87,10 @@ return status; } -oprocstream::oprocstream (void) +void +cleanup_iprocstream (void *buf) { - pbuf = new procbuf (); - - init (pbuf); + delete (iprocstream *) buf; } oprocstream::oprocstream (const char *command, int mode) @@ -110,7 +105,7 @@ oprocstream::~oprocstream (void) { - close (); + delete pbuf; } void @@ -118,8 +113,12 @@ { clear (); - if (! pbuf) - pbuf = new procbuf (); + if (pbuf) + delete pbuf; + + pbuf = new procbuf (); + + init (pbuf); if (! pbuf->open (command, mode)) set (ios::badbit); @@ -138,8 +137,6 @@ if (is_open ()) { - status = pbuf->sys_close (); - if (! pbuf->close ()) set (ios::failbit); } @@ -147,6 +144,12 @@ return status; } +void +cleanup_oprocstream (void *buf) +{ + delete (oprocstream *) buf; +} + /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/src/procstream.h +++ b/src/procstream.h @@ -36,7 +36,7 @@ iprocstream : public ifstream { public: - iprocstream (void); + iprocstream (void) { pbuf = 0; } iprocstream (const char *command, int mode=ios::in); ~iprocstream (void); @@ -51,11 +51,13 @@ procbuf *pbuf; }; +extern void cleanup_iprocstream (void *); + class oprocstream : public ofstream { public: - oprocstream (void); + oprocstream (void) { pbuf = 0; } oprocstream (const char *command, int mode=ios::out); ~oprocstream (void); @@ -70,6 +72,8 @@ procbuf *pbuf; }; +extern void cleanup_oprocstream (void *); + #endif /*