]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/base/lib_driver.c
ncurses 6.0 - patch 20170325
[ncurses.git] / ncurses / base / lib_driver.c
index 215fb0caa57495421d8f279845375bcd2a3aca6f..fb63b3cd139db3667cc2f344e47135a2518727b8 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2008-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 2008-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 +33,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_driver.c,v 1.2 2010/01/16 21:26:09 tom Exp $")
+MODULE_ID("$Id: lib_driver.c,v 1.6 2014/04/11 08:21:23 jpf Exp $")
 
 typedef struct DriverEntry {
     const char *name;
@@ -43,9 +43,9 @@ typedef struct DriverEntry {
 static DRIVER_ENTRY DriverTable[] =
 {
 #ifdef __MINGW32__
-    {"win", &_nc_WIN_DRIVER},
+    {"win32console", &_nc_WIN_DRIVER},
 #endif
-    {"tinfo", &_nc_TINFO_DRIVER}
+    {"tinfo", &_nc_TINFO_DRIVER}       /* must be last */
 };
 
 NCURSES_EXPORT(int)
@@ -56,15 +56,18 @@ _nc_get_driver(TERMINAL_CONTROL_BLOCK * TCB, const char *name, int *errret)
     TERM_DRIVER *res = (TERM_DRIVER *) 0;
     TERM_DRIVER *use = 0;
 
-    T((T_CALLED("_nc_get_driver(%p, %s, %p)"), TCB, NonNull(name), errret));
+    T((T_CALLED("_nc_get_driver(%p, %s, %p)"),
+       (void *) TCB, NonNull(name), (void *) errret));
 
     assert(TCB != 0);
 
     for (i = 0; i < SIZEOF(DriverTable); i++) {
        res = DriverTable[i].driver;
-       if (res->CanHandle(TCB, name, errret)) {
-           use = res;
-           break;
+       if (strcmp(DriverTable[i].name, res->td_name(TCB)) == 0) {
+           if (res->td_CanHandle(TCB, name, errret)) {
+               use = res;
+               break;
+           }
        }
     }
     if (use != 0) {
@@ -77,8 +80,8 @@ _nc_get_driver(TERMINAL_CONTROL_BLOCK * TCB, const char *name, int *errret)
 NCURSES_EXPORT(int)
 NCURSES_SP_NAME(has_key) (SCREEN *sp, int keycode)
 {
-    T((T_CALLED("has_key(%p, %d)"), sp, keycode));
-    returnCode(IsValidTIScreen(sp) ? CallDriver_1(sp, kyExist, keycode) : FALSE);
+    T((T_CALLED("has_key(%p, %d)"), (void *) sp, keycode));
+    returnCode(IsValidTIScreen(sp) ? CallDriver_1(sp, td_kyExist, keycode) : FALSE);
 }
 
 NCURSES_EXPORT(int)
@@ -93,7 +96,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);
 }
 
@@ -108,10 +111,10 @@ NCURSES_SP_NAME(doupdate) (SCREEN *sp)
 {
     int code = ERR;
 
-    T((T_CALLED("doupdate(%p)"), sp));
+    T((T_CALLED("doupdate(%p)"), (void *) sp));
 
     if (IsValidScreen(sp))
-       code = CallDriver(sp, update);
+       code = CallDriver(sp, td_update);
 
     returnCode(code);
 }
@@ -127,9 +130,9 @@ NCURSES_SP_NAME(mvcur) (SCREEN *sp, int yold, int xold, int ynew, int xnew)
 {
     int code = ERR;
     TR(TRACE_CALLS | TRACE_MOVE, (T_CALLED("mvcur(%p,%d,%d,%d,%d)"),
-                                 sp, yold, xold, ynew, xnew));
+                                 (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);
 }