Ticket #1141: readline.patch

File readline.patch, 3.1 KB (added by judahj, 9 years ago)
Line 
1
2New patches:
3
4[Add get/set functions for the rl_attempted_completion_over variable.
5[email protected]**20070211230806] {
6hunk ./System/Console/Readline.hsc 243
7+    setAttemptedCompletionOver,       -- :: Bool -> IO ()
8+    getAttemptedCompletionOver,       -- :: IO Bool
9hunk ./System/Console/Readline.hsc 1223
10+foreign import ccall "&" rl_attempted_completion_over :: Ptr CInt
11+
12+getAttemptedCompletionOver :: IO Bool
13+getAttemptedCompletionOver =
14+    liftM (/=0) (peek rl_attempted_completion_over)
15+
16+setAttemptedCompletionOver :: Bool -> IO ()
17+setAttemptedCompletionOver over =
18+    poke rl_attempted_completion_over (if over then 1 else 0)
19+
20}
21
22[Add interface for rl_completion_word_break_hook (version 5.0 or higher).
23[email protected]**20070211231618] {
24hunk ./System/Console/Readline.hsc 250
25+#if HAVE_READLINE_5
26+    ,
27+    setCompletionWordBreakHook
28+        -- :: Maybe (IO (Maybe String)) -> IO ()
29+#endif
30hunk ./System/Console/Readline.hsc 1016
31+
32hunk ./System/Console/Readline.hsc 1021
33+#if HAVE_READLINE_5
34+type StringFunc = IO (Ptr CChar)
35+
36+foreign import ccall "&" rl_completion_word_break_hook
37+    :: Ptr (FunPtr StringFunc)
38+
39+foreign import ccall "wrapper"
40+    exportStringFunc :: StringFunc -> IO (FunPtr StringFunc)
41+
42+setCompletionWordBreakHook
43+    :: Maybe (IO (Maybe String)) -> IO ()
44+setCompletionWordBreakHook fun =
45+    setFunPtr rl_completion_word_break_hook fun $ \f ->
46+        exportStringFunc $ do
47+            wordBreaks <- f
48+            case wordBreaks of
49+                Nothing -> return nullPtr
50+                Just wordBreaksString -> newCString wordBreaksString
51+
52+#endif
53+
54hunk ./configure.ac 65
55+  AC_CHECK_LIB(readline, rl_completion_word_break_hook,
56+    [AC_DEFINE([HAVE_READLINE_5], [1], [Define to 1 if readline has version >= 5.0.])],
57+    [AC_DEFINE([HAVE_READLINE_5], [0], [Define to 1 if readline has version >= 5.0.])])
58hunk ./configure.ac 71
59+  AC_DEFINE([HAVE_READLINE_5], [0], [Define to 1 if readline has version >= 5.0.])
60}
61
62Context:
63
64[TAG 6.6 release
65Ian Lynagh <[email protected]>**20061011124740]
66[add boilerplate Setup.hs
67Ross Paterson <[email protected]>**20060928231526]
68[Typo (this is the readline, not unix, package)
69Ian Lynagh <[email protected]>**20060823144042]
70[remove unnecessary #include "ghcconfig.h"
71Ross Paterson <[email protected]>**20060809132127]
72[Make the configure test robust against libedit
73Simon Marlow <[email protected]>**20060706120654
74 See #766
75 Thanks to Greg Wright for the fix.
76]
77[make a start on Cabalizing readline
78Ross Paterson <[email protected]>**20060609161024]
79[Move readline configuration into the readline package
80Simon Marlow <[email protected]>**20060609135511
81 
82 Configuration of the readline package is now done with a
83 package-private configure script, which takes it a step closer to
84 being a standalone Cabal package.
85 
86 At the same time I added --with-readline-includes and
87 --with-readline-libraries options to cater for systems where these
88 libraries live in non-std places.
89 
90]
91[TAG Initial conversion from CVS complete
92John Goerzen <[email protected]>**20060112154138]
93Patch bundle hash:
94367b9df2a9175aa446267d40c850b20092a306e8