# HG changeset patch # User jwe # Date 1108469204 0 # Node ID 25b090e1be9f3cdd1df5f60fbc58873707311987 # Parent d6e99e773993fac7db016f8328c7c02534dafc3b [project @ 2005-02-15 12:06:05 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +2005-02-15 John W. Eaton + + * 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 * sighandlers.cc (sigpipe_handler): Don't try to take action. diff --git a/src/dirfns.cc b/src/dirfns.cc --- 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; diff --git a/src/file-io.cc b/src/file-io.cc --- 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\ diff --git a/src/pt-mat.cc b/src/pt-mat.cc --- 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 ra_idx (dv.length (), 0); + int dv_len = dv.length (); + Array 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; diff --git a/src/sighandlers.cc b/src/sighandlers.cc --- 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); diff --git a/src/sighandlers.h b/src/sighandlers.h --- 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)