]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tinfo/lib_ttyflags.c
ncurses 5.7 - patch 20090510
[ncurses.git] / ncurses / tinfo / lib_ttyflags.c
index a2b38a3327f12e3ca264a85e9afafc59b68f314c..8115662e7fe410ffa8efd584fbef1773e993006e 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
 #include <curses.priv.h>
 #include <term.h>              /* cur_term */
 
-MODULE_ID("$Id: lib_ttyflags.c,v 1.18 2008/08/03 22:10:44 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE 
+#endif
+
+MODULE_ID("$Id: lib_ttyflags.c,v 1.24 2009/05/10 00:48:29 tom Exp $")
 
 NCURSES_EXPORT(int)
-_nc_get_tty_mode(TTY * buf)
+NCURSES_SP_NAME(_nc_get_tty_mode) (NCURSES_SP_DCLx TTY * buf)
 {
     int result = OK;
 
@@ -71,8 +75,16 @@ _nc_get_tty_mode(TTY * buf)
     return (result);
 }
 
+#if NCURSES_SP_FUNCS
 NCURSES_EXPORT(int)
-_nc_set_tty_mode(TTY * buf)
+_nc_get_tty_mode(TTY * buf)
+{
+    return NCURSES_SP_NAME(_nc_get_tty_mode) (CURRENT_SCREEN, buf);
+}
+#endif
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_DCLx TTY * buf)
 {
     int result = OK;
 
@@ -86,8 +98,8 @@ _nc_set_tty_mode(TTY * buf)
                if (SET_TTY(cur_term->Filedes, buf) != 0) {
                    if (errno == EINTR)
                        continue;
-                   if ((errno == ENOTTY) && (SP != 0))
-                       SP->_notty = TRUE;
+                   if ((errno == ENOTTY) && (SP_PARM != 0))
+                       SP_PARM->_notty = TRUE;
                    result = ERR;
                }
                break;
@@ -100,8 +112,16 @@ _nc_set_tty_mode(TTY * buf)
     return (result);
 }
 
+#if NCURSES_SP_FUNCS
 NCURSES_EXPORT(int)
-def_shell_mode(void)
+_nc_set_tty_mode(TTY * buf)
+{
+    return NCURSES_SP_NAME(_nc_set_tty_mode) (CURRENT_SCREEN, buf);
+}
+#endif
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(def_shell_mode) (NCURSES_SP_DCL0)
 {
     int rc = ERR;
 
@@ -125,8 +145,16 @@ def_shell_mode(void)
     returnCode(rc);
 }
 
+#if NCURSES_SP_FUNCS
 NCURSES_EXPORT(int)
-def_prog_mode(void)
+def_shell_mode(void)
+{
+    return NCURSES_SP_NAME(def_shell_mode) (CURRENT_SCREEN);
+}
+#endif
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(def_prog_mode) (NCURSES_SP_DCL0)
 {
     int rc = ERR;
 
@@ -148,17 +176,25 @@ def_prog_mode(void)
     returnCode(rc);
 }
 
+#if NCURSES_SP_FUNCS
 NCURSES_EXPORT(int)
-reset_prog_mode(void)
+def_prog_mode(void)
+{
+    return NCURSES_SP_NAME(def_prog_mode) (CURRENT_SCREEN);
+}
+#endif
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(reset_prog_mode) (NCURSES_SP_DCL0)
 {
     T((T_CALLED("reset_prog_mode()")));
 
     if (cur_term != 0) {
        if (_nc_set_tty_mode(&cur_term->Nttyb) == OK) {
-           if (SP) {
-               if (SP->_keypad_on)
-                   _nc_keypad(SP, TRUE);
-               NC_BUFFERED(TRUE);
+           if (SP_PARM) {
+               if (SP_PARM->_keypad_on)
+                   _nc_keypad(SP_PARM, TRUE);
+               NC_BUFFERED(SP_PARM, TRUE);
            }
            returnCode(OK);
        }
@@ -166,22 +202,38 @@ reset_prog_mode(void)
     returnCode(ERR);
 }
 
+#if NCURSES_SP_FUNCS
 NCURSES_EXPORT(int)
-reset_shell_mode(void)
+reset_prog_mode(void)
+{
+    return NCURSES_SP_NAME(reset_prog_mode) (CURRENT_SCREEN);
+}
+#endif
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(reset_shell_mode) (NCURSES_SP_DCL0)
 {
     T((T_CALLED("reset_shell_mode()")));
 
     if (cur_term != 0) {
-       if (SP) {
-           _nc_keypad(SP, FALSE);
+       if (SP_PARM) {
+           _nc_keypad(SP_PARM, FALSE);
            _nc_flush();
-           NC_BUFFERED(FALSE);
+           NC_BUFFERED(SP_PARM, FALSE);
        }
        returnCode(_nc_set_tty_mode(&cur_term->Ottyb));
     }
     returnCode(ERR);
 }
 
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+reset_shell_mode(void)
+{
+    return NCURSES_SP_NAME(reset_shell_mode) (CURRENT_SCREEN);
+}
+#endif
+
 static TTY *
 saved_tty(void)
 {