17a656419SBaptiste Daroussin /**************************************************************************** 2*21817992SBaptiste Daroussin * Copyright 2018-2020,2021 Thomas E. Dickey * 37a656419SBaptiste Daroussin * Copyright 2008-2014,2017 Free Software Foundation, Inc. * 47a656419SBaptiste Daroussin * * 57a656419SBaptiste Daroussin * Permission is hereby granted, free of charge, to any person obtaining a * 67a656419SBaptiste Daroussin * copy of this software and associated documentation files (the * 77a656419SBaptiste Daroussin * "Software"), to deal in the Software without restriction, including * 87a656419SBaptiste Daroussin * without limitation the rights to use, copy, modify, merge, publish, * 97a656419SBaptiste Daroussin * distribute, distribute with modifications, sublicense, and/or sell * 107a656419SBaptiste Daroussin * copies of the Software, and to permit persons to whom the Software is * 117a656419SBaptiste Daroussin * furnished to do so, subject to the following conditions: * 127a656419SBaptiste Daroussin * * 137a656419SBaptiste Daroussin * The above copyright notice and this permission notice shall be included * 147a656419SBaptiste Daroussin * in all copies or substantial portions of the Software. * 157a656419SBaptiste Daroussin * * 167a656419SBaptiste Daroussin * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * 177a656419SBaptiste Daroussin * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * 187a656419SBaptiste Daroussin * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * 197a656419SBaptiste Daroussin * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * 207a656419SBaptiste Daroussin * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * 217a656419SBaptiste Daroussin * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * 227a656419SBaptiste Daroussin * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 237a656419SBaptiste Daroussin * * 247a656419SBaptiste Daroussin * Except as contained in this notice, the name(s) of the above copyright * 257a656419SBaptiste Daroussin * holders shall not be used in advertising or otherwise to promote the * 267a656419SBaptiste Daroussin * sale, use or other dealings in this Software without prior written * 277a656419SBaptiste Daroussin * authorization. * 287a656419SBaptiste Daroussin ****************************************************************************/ 297a656419SBaptiste Daroussin 307a656419SBaptiste Daroussin /**************************************************************************** 317a656419SBaptiste Daroussin * Author: Juergen Pfeifer, 2008-on * 327a656419SBaptiste Daroussin ****************************************************************************/ 337a656419SBaptiste Daroussin 34*21817992SBaptiste Daroussin /* $Id: win32_curses.h,v 1.3 2021/06/17 21:26:02 tom Exp $ */ 357a656419SBaptiste Daroussin 367a656419SBaptiste Daroussin /* 377a656419SBaptiste Daroussin * This is the interface we use on Windows to mimic the control of the settings 387a656419SBaptiste Daroussin * of what acts like the classic TTY - the Windows Console. 397a656419SBaptiste Daroussin */ 407a656419SBaptiste Daroussin 417a656419SBaptiste Daroussin #if (defined(_WIN32) || defined(_WIN64)) 427a656419SBaptiste Daroussin #ifndef _NC_WIN32_CURSES_H 437a656419SBaptiste Daroussin #define _NC_WIN32_CURSES_H 1 447a656419SBaptiste Daroussin 457a656419SBaptiste Daroussin struct winconmode 467a656419SBaptiste Daroussin { 477a656419SBaptiste Daroussin unsigned long dwFlagIn; 487a656419SBaptiste Daroussin unsigned long dwFlagOut; 497a656419SBaptiste Daroussin }; 507a656419SBaptiste Daroussin 517a656419SBaptiste Daroussin extern NCURSES_EXPORT(void*) _nc_console_fd2handle(int fd); 527a656419SBaptiste Daroussin extern NCURSES_EXPORT(int) _nc_console_setmode(void* handle, const struct winconmode* arg); 537a656419SBaptiste Daroussin extern NCURSES_EXPORT(int) _nc_console_getmode(void* handle, struct winconmode* arg); 547a656419SBaptiste Daroussin extern NCURSES_EXPORT(int) _nc_console_flush(void* handle); 557a656419SBaptiste Daroussin 567a656419SBaptiste Daroussin /* 577a656419SBaptiste Daroussin A few definitions of Unix functions we need to emulate 587a656419SBaptiste Daroussin */ 597a656419SBaptiste Daroussin #define SIGHUP 1 607a656419SBaptiste Daroussin #define SIGKILL 9 617a656419SBaptiste Daroussin 627a656419SBaptiste Daroussin #undef getlogin 637a656419SBaptiste Daroussin #define getlogin() getenv("USERNAME") 647a656419SBaptiste Daroussin 657a656419SBaptiste Daroussin #undef ttyname 667a656419SBaptiste Daroussin #define ttyname(fd) NULL 677a656419SBaptiste Daroussin 687a656419SBaptiste Daroussin #undef sleep 697a656419SBaptiste Daroussin #define sleep(n) Sleep((n) * 1000) 707a656419SBaptiste Daroussin 717a656419SBaptiste Daroussin #undef gettimeofday 727a656419SBaptiste Daroussin #define gettimeofday(tv,tz) _nc_gettimeofday(tv,tz) 737a656419SBaptiste Daroussin 747a656419SBaptiste Daroussin #endif /* _NC_WIN32_CURSES_H */ 757a656419SBaptiste Daroussin #endif /* _WIN32||_WIN64 */ 76