From help-octave-request at bevo dot che dot wisc dot edu Fri Feb 4 17:12:51 2000 Subject: Re: perlTK From: "John W. Eaton" To: Joao Cardoso Cc: "help-octave at bevo dot che dot wisc dot edu" Date: Fri, 4 Feb 2000 17:13:28 -0600 (CST) On 4-Feb-2000, Joao Cardoso wrote: | "John W. Eaton" wrote: | | > On 31-Jan-2000, Joao Cardoso wrote: | > | > | Couldn't Octave have a function to do it? Something like | > | | > | on_idle("user function","user data") | > | > Sure, I've appended a solution. | | Thanks! | | But is seems that I have misunderstood its usage: | | octave:2> function po(data); printf("%s\n",data);fflush(stdout);endfunction | octave:3> po("Hello") | Hello | octave:4> input_event_hook ("po","meee") | error: segmentation violation -- stopping myself... | | I have tryed it with the last cvs. Hints? It worked when I first wrote it, but then I broke the event hook mechanism in liboctave when I was making changes to allow Octave to be compiled by compilers other than g++. Please try the following patch. Thanks, jwe 2000-02-04 John W. Eaton * oct-rl-edit.c (octave_rl_set_event_hook): Take address of rl_event_hook before casting to void **. (octave_rl_set_startup_hook): Likewise, for rl_startup_hook. Index: oct-rl-edit.c =================================================================== RCS file: /usr/local/cvsroot/octave/liboctave/oct-rl-edit.c,v retrieving revision 1.5 diff -u -r1.5 oct-rl-edit.c --- oct-rl-edit.c 2000/02/02 06:22:13 1.5 +++ oct-rl-edit.c 2000/02/04 23:10:39 at @ -203,7 +203,7 @@ void octave_rl_set_startup_hook (rl_startup_hook_fcn_ptr f) { - void **fp = (void **) rl_startup_hook; + void **fp = (void **) (&rl_startup_hook); *fp = (void *) f; } at @ -216,7 +216,7 @@ void octave_rl_set_event_hook (rl_event_hook_fcn_ptr f) { - void **fp = (void **) rl_event_hook; + void **fp = (void **) (&rl_event_hook); *fp = (void *) f; } ----------------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.che.wisc.edu/octave/octave.html How to fund new projects: http://www.che.wisc.edu/octave/funding.html Subscription information: http://www.che.wisc.edu/octave/archive.html -----------------------------------------------------------------------