Mercurial > hg > octave-thorsten
changeset 5144:25b090e1be9f
[project @ 2005-02-15 12:06:05 by jwe]
author | jwe |
---|---|
date | Tue, 15 Feb 2005 12:06:44 +0000 |
parents | d6e99e773993 |
children | dd07ee8af4b3 |
files | src/ChangeLog src/dirfns.cc src/file-io.cc src/pt-mat.cc src/sighandlers.cc src/sighandlers.h |
diffstat | 6 files changed, 62 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +2005-02-15 John W. Eaton <jwe@octave.org> + + * pt-mat.cc (tree_matrix::rvalue): Min size of ra_idx is 2. + + * file-io.cc (Ffclear): New function. + + * sighandlers.h: Define SIGCHLD if it is not already defined and + SIGCLD is defined. + + * sighandlers.cc (octave_set_signal_handler): Request system calls + restarted if interrupted by signals (except for SIGALRM). + * dirfns.cc (Fls): Don't bother with sleeping or checking errno. + 2005-02-11 John W. Eaton <jwe@octave.org> * sighandlers.cc (sigpipe_handler): Don't try to take action.
--- a/src/dirfns.cc +++ b/src/dirfns.cc @@ -182,16 +182,8 @@ unwind_protect::add (cleanup_iprocstream, cmd); - // XXX FIXME XXX -- Perhaps we should read more than one character - // at a time and find a way to avoid the call to octave_usleep as - // well? - if (cmd && *cmd) { - // This is a bit of a kluge... - - octave_usleep (100); - char ch; OSSTREAM output_buf; @@ -204,16 +196,7 @@ output_buf << ch; } else - { - if (! cmd->eof () && errno == EAGAIN) - { - cmd->clear (); - - octave_usleep (100); - } - else - break; - } + break; } output_buf << OSSTREAM_ENDS;
--- a/src/file-io.cc +++ b/src/file-io.cc @@ -219,6 +219,31 @@ return retval; } +DEFUN (fclear, args, , + "-*- texinfo -*-\n\ +@deftypefn {Built-in Function} {} fclear (@var{fid})\n\ +Clear the stream state for the specified file.\n\ +@end deftypefn") +{ + octave_value retval; + + int nargin = args.length (); + + if (nargin == 1) + { + int fid = octave_stream_list::get_file_number (args (0)); + + octave_stream os = octave_stream_list::lookup (fid, "fclear"); + + if (! error_state) + os.clearerr (); + } + else + print_usage ("fclear"); + + return retval; +} + DEFUN (fflush, args, , "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} fflush (@var{fid})\n\
--- a/src/pt-mat.cc +++ b/src/pt-mat.cc @@ -603,7 +603,8 @@ // Now, extract the values from the individual elements and // insert them in the result matrix. - Array<int> ra_idx (dv.length (), 0); + int dv_len = dv.length (); + Array<int> ra_idx (dv_len > 1 ? dv_len : 2, 0); for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++) { tm_row_const row = *p;
--- a/src/sighandlers.cc +++ b/src/sighandlers.cc @@ -176,11 +176,28 @@ { #if defined (HAVE_POSIX_SIGNALS) struct sigaction act, oact; + act.sa_handler = handler; act.sa_flags = 0; + + if (sig == SIGALRM) + { +#if defined (SA_INTERRUPT) + act.sa_flags |= SA_INTERRUPT; +#endif + } + else + { +#if defined (SA_RESTART) + act.sa_flags |= SA_RESTART; +#endif + } + sigemptyset (&act.sa_mask); sigemptyset (&oact.sa_mask); + sigaction (sig, &act, &oact); + return oact.sa_handler; #else return signal (sig, handler);
--- a/src/sighandlers.h +++ b/src/sighandlers.h @@ -61,6 +61,10 @@ } \ while (0) +#if !defined (SIGCHLD) && defined (SIGCLD) +#define SIGCHLD SIGCLD +#endif + #if defined (HAVE_POSIX_SIGNALS) #define BLOCK_CHILD(nvar, ovar) BLOCK_SIGNAL (SIGCHLD, nvar, ovar) #define UNBLOCK_CHILD(ovar) sigprocmask (SIG_SETMASK, &ovar, 0)