# HG changeset patch # User jwe # Date 949288636 0 # Node ID e391aeef2b3c49a7043c0f36ce9df791d9ec1d5e # Parent 1807b75711df9d5a1684927612e2956ff08bca65 [project @ 2000-01-31 03:17:14 by jwe] diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,7 @@ +2000-01-30 John W. Eaton + + * oct-time.cc: Declare strptime extern "C". + 2000-01-29 John W. Eaton * oct-time.cc [! HAVE_STRPTIME]: Provide declaration. diff --git a/liboctave/oct-time.cc b/liboctave/oct-time.cc --- 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) diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2000-01-30 John W. Eaton + + * image/saveimage.m: Delete some debugging code. + 2000-01-27 John W. Eaton * signal/sinc.m: Avoid reshaping. diff --git a/scripts/image/saveimage.m b/scripts/image/saveimage.m --- 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); diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2000-01-30 John W. Eaton + + * input.cc (input_event_hook, Finput_event_hook): New functions. + (hook_fcn, user_data): New static variables. + 2000-01-28 John W. Eaton * pt-except.cc (do_catch_code): Don't do anything special for diff --git a/src/input.cc b/src/input.cc --- 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) {