on master help sign in
Merge pull request #23 from toothbrush/prefix-cfunctions

prefixed all c functions to avoid Cabal bug #944

commite476a6547f1e7d9f54e058122298ada7b19c6722 authorCorey O'Connor <coreyoconnor@gmail.com> dateSun 22 Apr 2012, 08:49 (15 years ago) parent68b337254d35d6
8 files changed+18−18
cbits/gwinsz.c+1−1 cbits/gwinsz.h+1−1 cbits/mk_wcwidth.c+10−10 cbits/set_term_timing.c+1−1 src/Codec/Binary/UTF8/Width.hs+2−2 src/Graphics/Vty/LLInput.hs+1−1 src/Graphics/Vty/Terminal/TerminfoBased.hs+1−1 vty.cabal+1−1
cbits/gwinsz.c+1−1
@@ -1,6 +1,6 @@
11#include <sys/ioctl.h>
22
3−unsigned long c_get_window_size(void) {
3+unsigned long vty_c_get_window_size(void) {
44 struct winsize w;
55 if (ioctl (0, TIOCGWINSZ, &w) >= 0)
66 return (w.ws_row << 16) + w.ws_col;
cbits/gwinsz.h+1−1
@@ -1 +1 @@
1−unsigned long c_get_window_size(void);
1+unsigned long vty_c_get_window_size(void);
cbits/mk_wcwidth.c+10−10
@@ -67,7 +67,7 @@ struct interval {
6767};
6868
6969/* auxiliary function for binary search in interval table */
70−static int bisearch(wchar_t ucs, const struct interval *table, int max) {
70+static int vty_bisearch(wchar_t ucs, const struct interval *table, int max) {
7171 int min = 0;
7272 int mid;
7373
@@ -119,7 +119,7 @@ static int bisearch(wchar_t ucs, const struct interval *table, int max) {
119119 * in ISO 10646.
120120 */
121121
122−int mk_wcwidth(wchar_t ucs)
122+int vty_mk_wcwidth(wchar_t ucs)
123123{
124124 /* sorted list of non-overlapping intervals of non-spacing characters */
125125 /* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */
@@ -181,7 +181,7 @@ int mk_wcwidth(wchar_t ucs)
181181 return -1;
182182
183183 /* binary search in table of non-spacing characters */
184− if (bisearch(ucs, combining,
184+ if (vty_bisearch(ucs, combining,
185185 sizeof(combining) / sizeof(struct interval) - 1))
186186 return 0;
187187
@@ -204,12 +204,12 @@ int mk_wcwidth(wchar_t ucs)
204204}
205205
206206
207−int mk_wcswidth(const wchar_t *pwcs, size_t n)
207+int vty_mk_wcswidth(const wchar_t *pwcs, size_t n)
208208{
209209 int w, width = 0;
210210
211211 for (;n-- > 0; pwcs++)
212− if ((w = mk_wcwidth(*pwcs)) < 0)
212+ if ((w = vty_mk_wcwidth(*pwcs)) < 0)
213213 return -1;
214214 else
215215 width += w;
@@ -227,7 +227,7 @@ int mk_wcswidth(const wchar_t *pwcs, size_t n)
227227 * the traditional terminal character-width behaviour. It is not
228228 * otherwise recommended for general use.
229229 */
230−int mk_wcwidth_cjk(wchar_t ucs)
230+int vty_mk_wcwidth_cjk(wchar_t ucs)
231231{
232232 /* sorted list of non-overlapping intervals of East Asian Ambiguous
233233 * characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */
@@ -287,20 +287,20 @@ int mk_wcwidth_cjk(wchar_t ucs)
287287 };
288288
289289 /* binary search in table of non-spacing characters */
290− if (bisearch(ucs, ambiguous,
290+ if (vty_bisearch(ucs, ambiguous,
291291 sizeof(ambiguous) / sizeof(struct interval) - 1))
292292 return 2;
293293
294− return mk_wcwidth(ucs);
294+ return vty_mk_wcwidth(ucs);
295295}
296296
297297
298−int mk_wcswidth_cjk(const wchar_t *pwcs, size_t n)
298+int vty_mk_wcswidth_cjk(const wchar_t *pwcs, size_t n)
299299{
300300 int w, width = 0;
301301
302302 for (;n-- > 0; pwcs++)
303− if ((w = mk_wcwidth_cjk(*pwcs)) < 0)
303+ if ((w = vty_mk_wcwidth_cjk(*pwcs)) < 0)
304304 return -1;
305305 else
306306 width += w;
cbits/set_term_timing.c+1−1
@@ -3,7 +3,7 @@
33#include <unistd.h>
44#include <stdlib.h>
55
6−void set_term_timing(void)
6+void vty_set_term_timing(void)
77{
88 struct termios trm;
99 tcgetattr(STDIN_FILENO, &trm);
src/Codec/Binary/UTF8/Width.hs+2−2
@@ -25,7 +25,7 @@ wcwidth c = unsafePerformIO (withCWString [c] $! \ws -> do
2525 )
2626{-# NOINLINE wcwidth #-}
2727
28−foreign import ccall unsafe "mk_wcwidth" wcwidth' :: CWchar -> CInt
28+foreign import ccall unsafe "vty_mk_wcwidth" wcwidth' :: CWchar -> CInt
2929
3030wcswidth :: String -> Int
3131wcswidth str = unsafePerformIO (withCWStringLen str $! \(ws, ws_len) -> do
@@ -36,4 +36,4 @@ wcswidth str = unsafePerformIO (withCWStringLen str $! \(ws, ws_len) -> do
3636 )
3737{-# NOINLINE wcswidth #-}
3838
39−foreign import ccall unsafe "mk_wcswidth" wcswidth' :: Ptr CWchar -> CSize -> CInt
39+foreign import ccall unsafe "vty_mk_wcswidth" wcswidth' :: Ptr CWchar -> CSize -> CInt
src/Graphics/Vty/LLInput.hs+1−1
@@ -236,4 +236,4 @@ utf8Length c
236236 | c < 0xF0 = 3
237237 | otherwise = 4
238238
239−foreign import ccall "set_term_timing" set_term_timing :: IO ()
239+foreign import ccall "vty_set_term_timing" set_term_timing :: IO ()
src/Graphics/Vty/Terminal/TerminfoBased.hs+1−1
@@ -181,7 +181,7 @@ instance Terminal Term where
181181
182182 output_handle t = return (term_handle t)
183183
184−foreign import ccall "gwinsz.h c_get_window_size" c_get_window_size
184+foreign import ccall "gwinsz.h vty_c_get_window_size" c_get_window_size
185185 :: IO CLong
186186
187187get_window_size :: IO (Int,Int)
vty.cabal+1−1
@@ -1,5 +1,5 @@
11Name: vty
2−Version: 4.7.0.10
2+Version: 4.7.0.11
33License: BSD3
44License-file: LICENSE
55Author: Stefan O'Rear, Corey O'Connor