Mercurial > hg > octave-lojdl
changeset 3498:e391aeef2b3c
[project @ 2000-01-31 03:17:14 by jwe]
author | jwe |
---|---|
date | Mon, 31 Jan 2000 03:17:16 +0000 |
parents | 1807b75711df |
children | 3e3e14ad5149 |
files | liboctave/ChangeLog liboctave/oct-time.cc scripts/ChangeLog scripts/image/saveimage.m src/ChangeLog src/input.cc |
diffstat | 6 files changed, 85 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,7 @@ +2000-01-30 John W. Eaton <jwe@bevo.che.wisc.edu> + + * oct-time.cc: Declare strptime extern "C". + 2000-01-29 John W. Eaton <jwe@bevo.che.wisc.edu> * oct-time.cc [! HAVE_STRPTIME]: Provide declaration.
--- a/liboctave/oct-time.cc +++ b/liboctave/oct-time.cc @@ -33,7 +33,7 @@ #include "oct-time.h" #if !defined (HAVE_STRPTIME) -extern char *strptime (const char *buf, const char *format, struct tm *tm); +extern "C" char *strptime (const char *buf, const char *format, struct tm *tm); #endif octave_time::octave_time (const octave_base_tm& tm)
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2000-01-30 John W. Eaton <jwe@bevo.che.wisc.edu> + + * image/saveimage.m: Delete some debugging code. + 2000-01-27 John W. Eaton <jwe@bevo.che.wisc.edu> * signal/sinc.m: Avoid reshaping.
--- a/scripts/image/saveimage.m +++ b/scripts/image/saveimage.m @@ -168,8 +168,6 @@ else img_row = map(img(idx)); endif - img_row - tmp if (img_nc < 8) for j = 1:8 tmp(:,i) = tmp(:,i) + img_row (j) * 2^(8-j);
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2000-01-30 John W. Eaton <jwe@bevo.che.wisc.edu> + + * input.cc (input_event_hook, Finput_event_hook): New functions. + (hook_fcn, user_data): New static variables. + 2000-01-28 John W. Eaton <jwe@bevo.che.wisc.edu> * pt-except.cc (do_catch_code): Don't do anything special for
--- a/src/input.cc +++ b/src/input.cc @@ -880,6 +880,77 @@ return retval; } +static string hook_fcn; +static octave_value user_data; + +static int +input_event_hook (...) +{ + if (user_data.is_defined ()) + feval (hook_fcn, user_data, 0); + else + feval (hook_fcn, octave_value_list (), 0); + + return 0; +} + +DEFUN (input_event_hook, args, , + "-*- texinfo -*-\n\ +@deftypefn {Built-in Function} {[@var{ofcn}, @var{odata}] =} input_event_hook (@var{fcn}, @var{data})\n\ +Given the name of a function as a string and any Octave value object,\n\ +install @var{fcn} as a function to call periodically, when Octave is\n\ +waiting for input. The function should have the form\n\ +@example\n\ +@var{fcn} (@var{data})\n\ +@end example\n\ +\n\ +If @var{data} is omitted, Octave calls the function without any\n\ +arguments. If both @var{fcn} and @var{data} are omitted, Octave\n\ +clears the hook. In all cases, the name of the previous hook function\n\ +and the user data are returned.\n\ +@end deftypefn") +{ + octave_value_list retval; + + int nargin = args.length (); + + if (nargin > 2) + print_usage ("input_event_hook"); + else + { + octave_value tmp_user_data; + + string tmp_hook_fcn; + + if (nargin > 1) + tmp_user_data = args(1); + + if (nargin > 0) + { + tmp_hook_fcn = args(0).string_value (); + + if (error_state) + { + error ("input_event_hook: expecting string as first arg"); + return retval; + } + + command_editor::set_event_hook (input_event_hook); + } + + if (nargin == 0) + command_editor::set_event_hook (0); + + retval(1) = user_data; + retval(0) = hook_fcn; + + hook_fcn = tmp_hook_fcn; + user_data = tmp_user_data; + } + + return retval; +} + static int ps1 (void) {