[GAP Forum] Re: InstallCharReadHookFunc

Steve Linton sal at dcs.st-and.ac.uk
Tue Apr 13 18:18:53 BST 2004


Dear GAP Forum,

Jose Morais asked:

> gap> func := function()
> >     Print(ReadAll(gapmenustream));
> > end;;
> gap> InstallCharReadHookFunc( gapmenustream, "r", func );
> 
> 	But as soon as there is somethig ready to be read from the stream, I
> get the following error:
> 
> gap> Function: number of arguments must be 0 (not 1)
> not in any function
> Entering break read-eval-print loop ...
> you can 'quit;' to quit to outer loop, or
> you can replace the argument list <args> via 'return <args>;' to
> continue
> 
> 
> 	Can someone tell me what is wrong in this?

The problem here is that the function supplied to InstallCharReadHookFunc must
take one argument (which it can ignore). The manual mentions this, in passing:


Note that handler functions must not return anything and get one integer
							^^^^^^^^^^^^^^^^^
argument, which refers to an index in one of the following arrays (according to
^^^^^^^^
whether the function was installed for input, output or exceptions on the
stream). 

Your message is produced when your function func() which takes no arguments is
called by GAP with one argument.

	Steve

-- 
Steve Linton	School of Computer Science  &
      Centre for Interdisciplinary Research in Computational Algebra
	     University of St Andrews 	 Tel   +44 (1334) 463269
http://www.dcs.st-and.ac.uk/~sal	 Fax   +44 (1334) 463278   




More information about the Forum mailing list