xref: /freebsd/contrib/ncurses/include/ncurses_mingw.h (revision 21817992b3314c908ab50f0bb88d2ee750b9c4ac)
106bfebdeSXin LI /****************************************************************************
2*21817992SBaptiste Daroussin  * Copyright 2018-2020,2021 Thomas E. Dickey                                *
3e1865124SBaptiste Daroussin  * Copyright 2008-2014,2017 Free Software Foundation, Inc.                  *
406bfebdeSXin LI  *                                                                          *
506bfebdeSXin LI  * Permission is hereby granted, free of charge, to any person obtaining a  *
606bfebdeSXin LI  * copy of this software and associated documentation files (the            *
706bfebdeSXin LI  * "Software"), to deal in the Software without restriction, including      *
806bfebdeSXin LI  * without limitation the rights to use, copy, modify, merge, publish,      *
906bfebdeSXin LI  * distribute, distribute with modifications, sublicense, and/or sell       *
1006bfebdeSXin LI  * copies of the Software, and to permit persons to whom the Software is    *
1106bfebdeSXin LI  * furnished to do so, subject to the following conditions:                 *
1206bfebdeSXin LI  *                                                                          *
1306bfebdeSXin LI  * The above copyright notice and this permission notice shall be included  *
1406bfebdeSXin LI  * in all copies or substantial portions of the Software.                   *
1506bfebdeSXin LI  *                                                                          *
1606bfebdeSXin LI  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
1706bfebdeSXin LI  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
1806bfebdeSXin LI  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
1906bfebdeSXin LI  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
2006bfebdeSXin LI  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
2106bfebdeSXin LI  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
2206bfebdeSXin LI  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
2306bfebdeSXin LI  *                                                                          *
2406bfebdeSXin LI  * Except as contained in this notice, the name(s) of the above copyright   *
2506bfebdeSXin LI  * holders shall not be used in advertising or otherwise to promote the     *
2606bfebdeSXin LI  * sale, use or other dealings in this Software without prior written       *
2706bfebdeSXin LI  * authorization.                                                           *
2806bfebdeSXin LI  ****************************************************************************/
2906bfebdeSXin LI 
3006bfebdeSXin LI /****************************************************************************
3106bfebdeSXin LI  * Author: Juergen Pfeifer, 2008-on                                         *
3206bfebdeSXin LI  ****************************************************************************/
3306bfebdeSXin LI 
34*21817992SBaptiste Daroussin /* $Id: ncurses_mingw.h,v 1.7 2021/06/17 21:26:02 tom Exp $ */
3506bfebdeSXin LI 
3606bfebdeSXin LI /*
3773f0a83dSXin LI  * This is a placeholder up to now and describes what needs to be implemented
3806bfebdeSXin LI  * to support I/O to external terminals with ncurses on the Windows OS.
3906bfebdeSXin LI  */
4006bfebdeSXin LI 
41aae38d10SBaptiste Daroussin #ifdef _WIN32
4206bfebdeSXin LI #ifndef _NC_MINGWH
4306bfebdeSXin LI #define _NC_MINGWH
4406bfebdeSXin LI 
4506bfebdeSXin LI #define USE_CONSOLE_DRIVER 1
4606bfebdeSXin LI 
4706bfebdeSXin LI #undef  TERMIOS
4806bfebdeSXin LI #define TERMIOS 1
4906bfebdeSXin LI 
5006bfebdeSXin LI typedef unsigned char cc_t;
5106bfebdeSXin LI typedef unsigned int  tcflag_t;
52aae38d10SBaptiste Daroussin typedef unsigned int  speed_t;
53aae38d10SBaptiste Daroussin typedef unsigned short otcflag_t;
54aae38d10SBaptiste Daroussin typedef unsigned char ospeed_t;
5506bfebdeSXin LI 
56aae38d10SBaptiste Daroussin #define NCCS 18
5706bfebdeSXin LI struct termios
5806bfebdeSXin LI {
59aae38d10SBaptiste Daroussin   tcflag_t	c_iflag;
60aae38d10SBaptiste Daroussin   tcflag_t	c_oflag;
61aae38d10SBaptiste Daroussin   tcflag_t	c_cflag;
62aae38d10SBaptiste Daroussin   tcflag_t	c_lflag;
63aae38d10SBaptiste Daroussin   char		c_line;
64aae38d10SBaptiste Daroussin   cc_t		c_cc[NCCS];
65aae38d10SBaptiste Daroussin   speed_t	c_ispeed;
66aae38d10SBaptiste Daroussin   speed_t	c_ospeed;
6706bfebdeSXin LI };
6806bfebdeSXin LI 
69aae38d10SBaptiste Daroussin extern NCURSES_EXPORT(int)  _nc_mingw_tcsetattr(
70aae38d10SBaptiste Daroussin     int fd,
71aae38d10SBaptiste Daroussin     int optional_actions,
72aae38d10SBaptiste Daroussin     const struct termios* arg);
73aae38d10SBaptiste Daroussin extern NCURSES_EXPORT(int)  _nc_mingw_tcgetattr(
74aae38d10SBaptiste Daroussin     int fd,
75aae38d10SBaptiste Daroussin     struct termios* arg);
76aae38d10SBaptiste Daroussin extern NCURSES_EXPORT(int)  _nc_mingw_tcflush(
77aae38d10SBaptiste Daroussin     int fd,
78aae38d10SBaptiste Daroussin     int queue);
79aae38d10SBaptiste Daroussin extern NCURSES_EXPORT(void) _nc_set_term_driver(void* term);
8006bfebdeSXin LI 
8173f0a83dSXin LI #endif /* _NC_MINGWH */
82aae38d10SBaptiste Daroussin #endif /* _WIN32 */
83