[pypy-commit] pypy curses_cffi: Fix getsyx() and stuff related to repl setup.

jerith noreply at buildbot.pypy.org
Fri Feb 8 10:21:20 CET 2013


Author: Jeremy Thurgood <firxen at gmail.com>
Branch: curses_cffi
Changeset: r60962:a903bf4f9acf
Date: 2013-02-08 11:20 +0200
http://bitbucket.org/pypy/pypy/changeset/a903bf4f9acf/

Log:	Fix getsyx() and stuff related to repl setup.

diff --git a/lib_pypy/_curses.py b/lib_pypy/_curses.py
--- a/lib_pypy/_curses.py
+++ b/lib_pypy/_curses.py
@@ -244,7 +244,6 @@
 bool wenclose(const WINDOW *, int, int);
 int mouseinterval(int);
 
-void getsyx(int y, int x);
 void setsyx(int y, int x);
 char *unctrl(chtype);
 int use_default_colors(void);
@@ -278,6 +277,8 @@
 int move_panel(PANEL *, int, int);
 int replace_panel(PANEL *,WINDOW *);
 int panel_hidden(const PANEL *);
+
+void _m_getsyx(int *yx);
 """)
 
 
@@ -311,6 +312,10 @@
     return 0;
 #endif
 }
+
+void _m_getsyx(int *yx) {
+    getsyx(yx[0], yx[1]);
+}
 """, libraries=['ncurses', 'panel'])
 
 
@@ -971,7 +976,7 @@
 def getsyx():
     _ensure_initialised()
     yx = ffi.new("int[2]")
-    lib.getsyx(yx[0], yx[1])
+    lib._m_getsyx(yx)
     return (yx[0], yx[1])
 
 
@@ -1094,6 +1099,8 @@
     if _initialised_setupterm:
         return None
 
+    if term is None:
+        term = ffi.NULL
     err = ffi.new("int *")
     if lib.setupterm(term, fd, err) == lib.ERR:
         if err == 0:
@@ -1321,7 +1328,7 @@
 def tigetstr(capname):
     _ensure_initialised_setupterm()
     val = lib.tigetstr(capname)
-    if val == 0 or val == -1:
+    if val in (0, -1, ffi.NULL):
         return None
     return ffi.string(val)
 


More information about the pypy-commit mailing list