]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/base/lib_driver.c
ncurses 6.2 - patch 20200404
[ncurses.git] / ncurses / base / lib_driver.c
index 6301a5887d64281eb822c03f12b5b1f1cbbc89e1..546760710cb7506d80950e75db25df5ba06f7906 100644 (file)
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 2008-2010,2012 Free Software Foundation, Inc.              *
+ * Copyright 2018,2020 Thomas E. Dickey                                     *
+ * Copyright 2009-2012,2014 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            *
@@ -33,7 +34,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_driver.c,v 1.4 2012/09/22 19:32:46 tom Exp $")
+MODULE_ID("$Id: lib_driver.c,v 1.8 2020/02/02 23:34:34 tom Exp $")
 
 typedef struct DriverEntry {
     const char *name;
@@ -42,8 +43,8 @@ typedef struct DriverEntry {
 
 static DRIVER_ENTRY DriverTable[] =
 {
-#ifdef __MINGW32__
-    {"win32con", &_nc_WIN_DRIVER},
+#ifdef _WIN32
+    {"win32console", &_nc_WIN_DRIVER},
 #endif
     {"tinfo", &_nc_TINFO_DRIVER}       /* must be last */
 };
@@ -63,24 +64,12 @@ _nc_get_driver(TERMINAL_CONTROL_BLOCK * TCB, const char *name, int *errret)
 
     for (i = 0; i < SIZEOF(DriverTable); i++) {
        res = DriverTable[i].driver;
-       /*
-        * Use "#" (a character which cannot begin a terminal's name) to
-        * select specific driver from the table.
-        *
-        * In principle, we could have more than one non-terminfo driver,
-        * e.g., "win32gui".
-        */
-       if (name != 0 && *name == '#') {
-           size_t n = strlen(name + 1);
-           if (n != 0
-               && strncmp(name + 1, DriverTable[i].name, n)) {
-               continue;
+       if (strcmp(DriverTable[i].name, res->td_name(TCB)) == 0) {
+           if (res->td_CanHandle(TCB, name, errret)) {
+               use = res;
+               break;
            }
        }
-       if (res->CanHandle(TCB, name, errret)) {
-           use = res;
-           break;
-       }
     }
     if (use != 0) {
        TCB->drv = use;
@@ -93,7 +82,7 @@ NCURSES_EXPORT(int)
 NCURSES_SP_NAME(has_key) (SCREEN *sp, int keycode)
 {
     T((T_CALLED("has_key(%p, %d)"), (void *) sp, keycode));
-    returnCode(IsValidTIScreen(sp) ? CallDriver_1(sp, kyExist, keycode) : FALSE);
+    returnCode(IsValidTIScreen(sp) ? CallDriver_1(sp, td_kyExist, keycode) : FALSE);
 }
 
 NCURSES_EXPORT(int)
@@ -108,7 +97,7 @@ NCURSES_SP_NAME(_nc_mcprint) (SCREEN *sp, char *data, int len)
     int code = ERR;
 
     if (0 != TerminalOf(sp))
-       code = CallDriver_2(sp, print, data, len);
+       code = CallDriver_2(sp, td_print, data, len);
     return (code);
 }
 
@@ -126,7 +115,7 @@ NCURSES_SP_NAME(doupdate) (SCREEN *sp)
     T((T_CALLED("doupdate(%p)"), (void *) sp));
 
     if (IsValidScreen(sp))
-       code = CallDriver(sp, update);
+       code = CallDriver(sp, td_update);
 
     returnCode(code);
 }
@@ -144,7 +133,7 @@ NCURSES_SP_NAME(mvcur) (SCREEN *sp, int yold, int xold, int ynew, int xnew)
     TR(TRACE_CALLS | TRACE_MOVE, (T_CALLED("mvcur(%p,%d,%d,%d,%d)"),
                                  (void *) sp, yold, xold, ynew, xnew));
     if (HasTerminal(sp)) {
-       code = CallDriver_4(sp, hwcur, yold, xold, ynew, xnew);
+       code = CallDriver_4(sp, td_hwcur, yold, xold, ynew, xnew);
     }
     returnCode(code);
 }