on master help sign in
Merge pull request #23 from toothbrush/prefix-cfunctions
e476a65Corey O'Connor
cbits/gwinsz.c+1−1
@@ -1,6 +1,6 @@
1#include <sys/ioctl.h>
1#include <sys/ioctl.h>
2
2
3−unsigned long c_get_window_size(void) {
3+unsigned long vty_c_get_window_size(void) {
4 struct winsize w;
4 struct winsize w;
5 if (ioctl (0, TIOCGWINSZ, &w) >= 0)
5 if (ioctl (0, TIOCGWINSZ, &w) >= 0)
6 return (w.ws_row << 16) + w.ws_col;
6 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 {
67};
67};
68
68
69/* auxiliary function for binary search in interval table */
69/* 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) {
71 int min = 0;
71 int min = 0;
72 int mid;
72 int mid;
73
73
@@ -119,7 +119,7 @@ static int bisearch(wchar_t ucs, const struct interval *table, int max) {
119 * in ISO 10646.
119 * in ISO 10646.
120 */
120 */
121
121
122−int mk_wcwidth(wchar_t ucs)
122+int vty_mk_wcwidth(wchar_t ucs)
123{
123{
124 /* sorted list of non-overlapping intervals of non-spacing characters */
124 /* sorted list of non-overlapping intervals of non-spacing characters */
125 /* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */
125 /* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */
@@ -181,7 +181,7 @@ int mk_wcwidth(wchar_t ucs)
181 return -1;
181 return -1;
182
182
183 /* binary search in table of non-spacing characters */
183 /* binary search in table of non-spacing characters */
184− if (bisearch(ucs, combining,
184+ if (vty_bisearch(ucs, combining,
185 sizeof(combining) / sizeof(struct interval) - 1))
185 sizeof(combining) / sizeof(struct interval) - 1))
186 return 0;
186 return 0;
187
187
@@ -204,12 +204,12 @@ int mk_wcwidth(wchar_t ucs)
204}
204}
205
205
206
206
207−int mk_wcswidth(const wchar_t *pwcs, size_t n)
207+int vty_mk_wcswidth(const wchar_t *pwcs, size_t n)
208{
208{
209 int w, width = 0;
209 int w, width = 0;
210
210
211 for (;n-- > 0; pwcs++)
211 for (;n-- > 0; pwcs++)
212− if ((w = mk_wcwidth(*pwcs)) < 0)
212+ if ((w = vty_mk_wcwidth(*pwcs)) < 0)
213 return -1;
213 return -1;
214 else
214 else
215 width += w;
215 width += w;
@@ -227,7 +227,7 @@ int mk_wcswidth(const wchar_t *pwcs, size_t n)
227 * the traditional terminal character-width behaviour. It is not
227 * the traditional terminal character-width behaviour. It is not
228 * otherwise recommended for general use.
228 * otherwise recommended for general use.
229 */
229 */
230−int mk_wcwidth_cjk(wchar_t ucs)
230+int vty_mk_wcwidth_cjk(wchar_t ucs)
231{
231{
232 /* sorted list of non-overlapping intervals of East Asian Ambiguous
232 /* sorted list of non-overlapping intervals of East Asian Ambiguous
233 * characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */
233 * characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */
@@ -287,20 +287,20 @@ int mk_wcwidth_cjk(wchar_t ucs)
287 };
287 };
288
288
289 /* binary search in table of non-spacing characters */
289 /* binary search in table of non-spacing characters */
290− if (bisearch(ucs, ambiguous,
290+ if (vty_bisearch(ucs, ambiguous,
291 sizeof(ambiguous) / sizeof(struct interval) - 1))
291 sizeof(ambiguous) / sizeof(struct interval) - 1))
292 return 2;
292 return 2;
293
293
294− return mk_wcwidth(ucs);
294+ return vty_mk_wcwidth(ucs);
295}
295}
296
296
297
297
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)
299{
299{
300 int w, width = 0;
300 int w, width = 0;
301
301
302 for (;n-- > 0; pwcs++)
302 for (;n-- > 0; pwcs++)
303− if ((w = mk_wcwidth_cjk(*pwcs)) < 0)
303+ if ((w = vty_mk_wcwidth_cjk(*pwcs)) < 0)
304 return -1;
304 return -1;
305 else
305 else
306 width += w;
306 width += w;
cbits/set_term_timing.c+1−1
@@ -3,7 +3,7 @@
3#include <unistd.h>
3#include <unistd.h>
4#include <stdlib.h>
4#include <stdlib.h>
5
5
6−void set_term_timing(void)
6+void vty_set_term_timing(void)
7{
7{
8 struct termios trm;
8 struct termios trm;
9 tcgetattr(STDIN_FILENO, &trm);
9 tcgetattr(STDIN_FILENO, &trm);
src/Codec/Binary/UTF8/Width.hs+2−2
@@ -25,7 +25,7 @@ wcwidth c = unsafePerformIO (withCWString [c] $! \ws -> do
25 )
25 )
26{-# NOINLINE wcwidth #-}
26{-# NOINLINE wcwidth #-}
27
27
28−foreign import ccall unsafe "mk_wcwidth" wcwidth' :: CWchar -> CInt
28+foreign import ccall unsafe "vty_mk_wcwidth" wcwidth' :: CWchar -> CInt
29
29
30wcswidth :: String -> Int
30wcswidth :: String -> Int
31wcswidth str = unsafePerformIO (withCWStringLen str $! \(ws, ws_len) -> do
31wcswidth str = unsafePerformIO (withCWStringLen str $! \(ws, ws_len) -> do
@@ -36,4 +36,4 @@ wcswidth str = unsafePerformIO (withCWStringLen str $! \(ws, ws_len) -> do
36 )
36 )
37{-# NOINLINE wcswidth #-}
37{-# NOINLINE wcswidth #-}
38
38
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
236 | c < 0xF0 = 3
236 | c < 0xF0 = 3
237 | otherwise = 4
237 | otherwise = 4
238
238
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
181
181
182 output_handle t = return (term_handle t)
182 output_handle t = return (term_handle t)
183
183
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
185 :: IO CLong
185 :: IO CLong
186
186
187get_window_size :: IO (Int,Int)
187get_window_size :: IO (Int,Int)
vty.cabal+1−1
@@ -1,5 +1,5 @@
1Name: vty
1Name: vty
2−Version: 4.7.0.10
2+Version: 4.7.0.11
3License: BSD3
3License: BSD3
4License-file: LICENSE
4License-file: LICENSE
5Author: Stefan O'Rear, Corey O'Connor
5Author: Stefan O'Rear, Corey O'Connor