[project @ 1996-01-08 20:28:12 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 \end{code}
11
12 Wrapper around the callback mechanism to allow Haskell side functions
13 to be callbacks for the Readline library.
14
15 The C function $genericRlCback$ puts the cback args into global
16 variables and enters the Haskell world through the $haskellRlEntry$
17 function. Before exiting, the Haskell function will deposit its result
18 in the global variable $rl_return$.
19
20 \begin{code}
21
22 int current_narg, rl_return, current_kc;
23
24 char* rl_prompt_hack;
25
26 StgStablePtr haskellRlEntry;
27 StgStablePtr cbackList;
28
29
30 int genericRlCback (int narg,int kc)
31 {
32   current_narg = narg;
33   current_kc = kc;
34   
35   performIO(haskellRlEntry);
36
37   return rl_return;
38 }
39
40 \end{code}
41
42
43
44