[project @ 1996-01-11 14:06:51 by partain]
[ghc-hetmet.git] / ghc / runtime / io / ghcReadline.lc
1 %
2 % (c) The GRASP/AQUA Project, Glasgow University, 1995
3 %
4 % Last Modified: Wed Jul 19 12:03:26 1995
5 % Darren J Moffat <moffatd@dcs.gla.ac.uk>
6 \section[LibReadline]{GNU Readline Library Bindings}
7
8 \begin{code}
9 #include "rtsdefs.h"
10
11 #include "ghcReadline.h" /* to make sure the code here agrees...*/
12 \end{code}
13
14 Wrapper around the callback mechanism to allow Haskell side functions
15 to be callbacks for the Readline library.
16
17 The C function $genericRlCback$ puts the cback args into global
18 variables and enters the Haskell world through the $haskellRlEntry$
19 function. Before exiting, the Haskell function will deposit its result
20 in the global variable $rl_return$.
21
22 \begin{code}
23 I_ current_narg, rl_return, current_kc;
24
25 char* rl_prompt_hack;
26
27 StgStablePtr haskellRlEntry;
28 StgStablePtr cbackList;
29
30
31 I_
32 genericRlCback (I_ narg, I_ kc)
33 {
34   current_narg = narg;
35   current_kc = kc;
36   
37   performIO(haskellRlEntry);
38
39   return rl_return;
40 }
41
42 \end{code}
43
44
45
46