]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tinfo/lib_options.c
ncurses 5.7 - patch 20090704
[ncurses.git] / ncurses / tinfo / lib_options.c
index cfce6c941051665976d789a445be9acf8c5a4811..908ee1b07a98bae4d2f07aacfb01c73923a9474a 100644 (file)
 
 #include <term.h>
 
 
 #include <term.h>
 
-MODULE_ID("$Id: lib_options.c,v 1.60 2009/02/28 21:07:56 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_options.c,v 1.65 2009/07/04 18:14:31 tom Exp $")
 
 
-static int _nc_curs_set(SCREEN *, int);
 static int _nc_meta(SCREEN *, bool);
 
 NCURSES_EXPORT(int)
 idlok(WINDOW *win, bool flag)
 {
 static int _nc_meta(SCREEN *, bool);
 
 NCURSES_EXPORT(int)
 idlok(WINDOW *win, bool flag)
 {
+#if NCURSES_SP_FUNCS
+    SCREEN *sp = CURRENT_SCREEN;
+#endif
     T((T_CALLED("idlok(%p,%d)"), win, flag));
 
     if (win) {
     T((T_CALLED("idlok(%p,%d)"), win, flag));
 
     if (win) {
@@ -64,6 +70,9 @@ idlok(WINDOW *win, bool flag)
 NCURSES_EXPORT(void)
 idcok(WINDOW *win, bool flag)
 {
 NCURSES_EXPORT(void)
 idcok(WINDOW *win, bool flag)
 {
+#if NCURSES_SP_FUNCS
+    SCREEN *sp = CURRENT_SCREEN;
+#endif
     T((T_CALLED("idcok(%p,%d)"), win, flag));
 
     if (win)
     T((T_CALLED("idcok(%p,%d)"), win, flag));
 
     if (win)
@@ -157,15 +166,44 @@ meta(WINDOW *win GCC_UNUSED, bool flag)
 /* curs_set() moved here to narrow the kernel interface */
 
 NCURSES_EXPORT(int)
 /* curs_set() moved here to narrow the kernel interface */
 
 NCURSES_EXPORT(int)
-curs_set(int vis)
+NCURSES_SP_NAME(curs_set) (NCURSES_SP_DCLx int vis)
 {
 {
-    int result;
+    int result = ERR;
 
 
-    T((T_CALLED("curs_set(%d)"), vis));
-    result = _nc_curs_set(SP, vis);
+    T((T_CALLED("curs_set(%p,%d)"), SP_PARM, vis));
+    if (SP_PARM != 0 && vis >= 0 && vis <= 2) {
+       int cursor = SP_PARM->_cursor;
+
+       if (vis == cursor) {
+           result = cursor;
+       } else {
+           switch (vis) {
+           case 2:
+               result = _nc_putp_flush("cursor_visible", cursor_visible);
+               break;
+           case 1:
+               result = _nc_putp_flush("cursor_normal", cursor_normal);
+               break;
+           case 0:
+               result = _nc_putp_flush("cursor_invisible", cursor_invisible);
+               break;
+           }
+           if (result != ERR)
+               result = (cursor == -1 ? 1 : cursor);
+           SP_PARM->_cursor = vis;
+       }
+    }
     returnCode(result);
 }
 
     returnCode(result);
 }
 
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+curs_set(int vis)
+{
+    return (NCURSES_SP_NAME(curs_set) (CURRENT_SCREEN, vis));
+}
+#endif
+
 NCURSES_EXPORT(int)
 NCURSES_SP_NAME(typeahead) (NCURSES_SP_DCLx int fd)
 {
 NCURSES_EXPORT(int)
 NCURSES_SP_NAME(typeahead) (NCURSES_SP_DCLx int fd)
 {
@@ -206,12 +244,20 @@ has_key_internal(int keycode, TRIES * tp)
                || has_key_internal(keycode, tp->sibling));
 }
 
                || has_key_internal(keycode, tp->sibling));
 }
 
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(has_key) (NCURSES_SP_DCLx int keycode)
+{
+    T((T_CALLED("has_key(%p,%d)"), SP_PARM, keycode));
+    returnCode(SP != 0 ? has_key_internal(keycode, SP_PARM->_keytry) : FALSE);
+}
+
+#if NCURSES_SP_FUNCS
 NCURSES_EXPORT(int)
 has_key(int keycode)
 {
 NCURSES_EXPORT(int)
 has_key(int keycode)
 {
-    T((T_CALLED("has_key(%d)"), keycode));
-    returnCode(SP != 0 ? has_key_internal(keycode, SP->_keytry) : FALSE);
+    return NCURSES_SP_NAME(has_key) (CURRENT_SCREEN, keycode);
 }
 }
+#endif
 #endif /* NCURSES_EXT_FUNCS */
 
 /*
 #endif /* NCURSES_EXT_FUNCS */
 
 /*
@@ -219,28 +265,7 @@ has_key(int keycode)
  * than cur_term.
  */
 #undef CUR
  * than cur_term.
  */
 #undef CUR
-#define CUR (sp->_term)->type.
-
-NCURSES_EXPORT(int)
-NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_DCLx
-                          const char *name GCC_UNUSED, const char *value)
-{
-    int rc = ERR;
-
-    if (value) {
-       TPUTS_TRACE(name);
-       rc = putp(value);
-    }
-    return rc;
-}
-
-#if NCURSES_SP_FUNCS
-NCURSES_EXPORT(int)
-_nc_putp(const char *name, const char *value)
-{
-    return NCURSES_SP_NAME(_nc_putp) (CURRENT_SCREEN, name, value);
-}
-#endif
+#define CUR SP_TERMTYPE
 
 NCURSES_EXPORT(int)
 NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_DCLx
 
 NCURSES_EXPORT(int)
 NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_DCLx
@@ -310,37 +335,6 @@ _nc_keypad(SCREEN *sp, bool flag)
     return (rc);
 }
 
     return (rc);
 }
 
-static int
-_nc_curs_set(SCREEN *sp, int vis)
-{
-    int result = ERR;
-
-    T((T_CALLED("curs_set(%d)"), vis));
-    if (sp != 0 && vis >= 0 && vis <= 2) {
-       int cursor = sp->_cursor;
-
-       if (vis == cursor) {
-           result = cursor;
-       } else {
-           switch (vis) {
-           case 2:
-               result = _nc_putp_flush("cursor_visible", cursor_visible);
-               break;
-           case 1:
-               result = _nc_putp_flush("cursor_normal", cursor_normal);
-               break;
-           case 0:
-               result = _nc_putp_flush("cursor_invisible", cursor_invisible);
-               break;
-           }
-           if (result != ERR)
-               result = (cursor == -1 ? 1 : cursor);
-           sp->_cursor = vis;
-       }
-    }
-    returnCode(result);
-}
-
 static int
 _nc_meta(SCREEN *sp, bool flag)
 {
 static int
 _nc_meta(SCREEN *sp, bool flag)
 {