summaryrefslogtreecommitdiff
path: root/ghc/runtime/io/ghcReadline.lc
diff options
context:
space:
mode:
Diffstat (limited to 'ghc/runtime/io/ghcReadline.lc')
-rw-r--r--ghc/runtime/io/ghcReadline.lc44
1 files changed, 44 insertions, 0 deletions
diff --git a/ghc/runtime/io/ghcReadline.lc b/ghc/runtime/io/ghcReadline.lc
new file mode 100644
index 0000000000..1d2133b8ec
--- /dev/null
+++ b/ghc/runtime/io/ghcReadline.lc
@@ -0,0 +1,44 @@
+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1995
+%
+% Last Modified: Wed Jul 19 12:03:26 1995
+% Darren J Moffat <moffatd@dcs.gla.ac.uk>
+\section[LibReadline]{GNU Readline Library Bindings}
+
+\begin{code}
+#include "rtsdefs.h"
+\end{code}
+
+Wrapper around the callback mechanism to allow Haskell side functions
+to be callbacks for the Readline library.
+
+The C function $genericRlCback$ puts the cback args into global
+variables and enters the Haskell world through the $haskellRlEntry$
+function. Before exiting, the Haskell function will deposit its result
+in the global variable $rl_return$.
+
+\begin{code}
+
+int current_narg, rl_return, current_kc;
+
+char* rl_prompt_hack;
+
+StgStablePtr haskellRlEntry;
+StgStablePtr cbackList;
+
+
+int genericRlCback (int narg,int kc)
+{
+ current_narg = narg;
+ current_kc = kc;
+
+ performIO(haskellRlEntry);
+
+ return rl_return;
+}
+
+\end{code}
+
+
+
+