tin  2.4.4
About: TIN is a threaded NNTP and spool based UseNet newsreader.
  Fossies Dox: tin-2.4.4.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

tcurses.h
Go to the documentation of this file.
1 /*
2  * Project : tin - a Usenet reader
3  * Module : tcurses.h
4  * Author : Thomas Dickey
5  * Created : 1997-03-02
6  * Updated : 2011-04-02
7  * Notes : curses #include files, #defines & struct's
8  *
9  * Copyright (c) 1997-2020 Thomas Dickey <dickey@invisible-island.net>
10  * All rights reserved.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  *
16  * 1. Redistributions of source code must retain the above copyright notice,
17  * this list of conditions and the following disclaimer.
18  *
19  * 2. Redistributions in binary form must reproduce the above copyright
20  * notice, this list of conditions and the following disclaimer in the
21  * documentation and/or other materials provided with the distribution.
22  *
23  * 3. Neither the name of the copyright holder nor the names of its
24  * contributors may be used to endorse or promote products derived from
25  * this software without specific prior written permission.
26  *
27  * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
31  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37  * POSSIBILITY OF SUCH DAMAGE.
38  */
39 
40 
41 #ifndef TCURSES_H
42 # define TCURSES_H 1
43 
44 
45 # if defined(USE_CURSES) || defined(NEED_CURSES_H)
46 # ifdef HAVE_XCURSES
47 # include <xcurses.h>
48 # define getattrs(w) (w)->_attrs
49 # else
50 # if defined(HAVE_NCURSESW_NCURSES_H)
51 # ifndef _XOPEN_SOURCE_EXTENDED
52 # define _XOPEN_SOURCE_EXTENDED 1
53 # endif /* _XOPEN_SOURCE_EXTENDED */
54 # include <ncursesw/ncurses.h>
55  /* we need a recent ncursesw for wide-char */
56 # if (NCURSES_VERSION_MAJOR == 5) && (NCURSES_VERSION_MINOR >= 3) || (NCURSES_VERSION_MAJOR >= 6)
57 # define HAVE_NCURSESW 1
58 # endif /* NCURSES_VERSION_MAJOR == 5 && NCURSES_VERSION_MINOR >=3 || NCURSES_VERSION_MAJOR >= 6 */
59 # else
60 # if defined(HAVE_NCURSES_H)
61 # include <ncurses.h>
62 # else
63 # if defined(HAVE_NCURSES_NCURSES_H)
64 # include <ncurses/ncurses.h>
65 # else
66 # undef TRUE
67 # undef FALSE
68 # include <curses.h>
69 # ifndef FALSE
70 # define FALSE 0
71 # endif /* !FALSE */
72 # ifndef TRUE
73 # define TRUE (!FALSE)
74 # endif /* !TRUE */
75 # endif /* HAVE_NCURSES_NCURSES_H */
76 # endif /* HAVE_NCURSES_H */
77 # endif /* HAVE_NCURSESW_NCURSES_H */
78 # endif /* HAVE_NCURSES_H */
79 # endif /* USE_CURSES || NEED_CURSES_H */
80 
81 # ifdef USE_CURSES
82 
83 # ifdef USE_TRACE
84 # ifdef HAVE_NOMACROS_H
85 # include <nomacros.h>
86 # endif /* HAVE_NOMACROS_H */
87 # endif /* USE_TRACE */
88 
89 # define cCRLF "\n"
90 # define my_flush() my_fflush(stdout)
91 # define ClearScreen() my_erase()
92 # define CleartoEOLN() clrtoeol()
93 # define CleartoEOS() clrtobot()
94 # define ScrollScreen(lines_to_scroll) scrl(lines_to_scroll)
95 # define SetScrollRegion(top,bottom) setscrreg(top, bottom)
96 # define WriteLine(row,buffer) write_line(row, buffer)
97 
98 # define HpGlitch(func) /*nothing*/
99 
100 extern int cmdReadCh(void);
101 extern int cmd_get_arrow_key(int prech);
102 extern char *screen_contents(int row, int col, char *buffer);
103 extern void MoveCursor(int row, int col);
104 extern void my_erase(void);
105 extern void my_fflush(FILE *stream);
106 extern void my_fputc(int ch, FILE *stream);
107 extern void my_fputs(const char *str, FILE *stream);
108 # if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
109  extern void my_fputwc(wint_t wc, FILE *fp);
110  extern void my_fputws(const wchar_t *wstr, FILE *fp);
111  extern wint_t cmdReadWch(void);
112  extern wint_t ReadWch(void);
113 # endif /* MULTIBYTE_ABLE && !NO_LOCALE */
114 extern void my_fprintf(FILE *stream, const char *fmt, ...)
115 # if defined(__GNUC__) && !defined(printf)
116  __attribute__((format(printf,2,3)))
117 # endif /* __GNUC__ && !printf */
118  ;
119 extern void my_printf(const char *fmt, ...)
120 # if defined(__GNUC__) && !defined(printf)
121  __attribute__((format(printf,1,2)))
122 # endif /* __GNUC__ && !printf */
123  ;
124 extern void my_retouch(void);
125 # ifdef HAVE_COLOR
126  extern void refresh_color(void);
127  extern void reset_color(void);
128 # endif /* HAVE_COLOR */
129 extern void write_line(int row, char *buffer);
130 
131 # else /* !USE_CURSES */
132 
133 # ifdef NEED_TERM_H
134 # include <curses.h>
135 # ifdef HAVE_NCURSESW_TERM_H
136 # include <ncursesw/term.h>
137 # else
138 # ifdef HAVE_NCURSES_TERM_H
139 # include <ncurses/term.h>
140 # else
141 # include <term.h>
142 # endif /* HAVE_NCURSES_TERM_H */
143 # endif /* HAVE_NCURSESW_TERM_H */
144 # else
145 # ifdef HAVE_TERMCAP_H
146 # include <termcap.h>
147 # endif /* HAVE_TERMCAP_H */
148 # endif /* NEED_TERM_H */
149 
150 # define cCRLF "\r\n"
151 
152 # define my_fputc(ch, stream) fputc(ch, stream)
153 # define my_fputs(str, stream) fputs(str, stream)
154 # if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
155 # define my_fputwc(wc, stream) { \
156  if (fwide(stream, 0) <= 0) \
157  fprintf(stream, "%lc", wc); \
158  else \
159  fputwc(wc, stream); \
160  }
161 # define my_fputws(wstr, stream) { \
162  if (fwide(stream, 0) <= 0) \
163  fprintf(stream, "%ls", wstr); \
164  else \
165  fputws(wstr, stream); \
166  }
167 # endif /* MULTIBYTE_ABLE && !NO_LOCALE */
168 
169 # define my_printf printf
170 # define my_fprintf fprintf
171 # define my_flush() fflush(stdout)
172 # define my_fflush(stream) fflush(stream)
173 # define my_retouch() ClearScreen()
174 # define WriteLine(row,buffer) MoveCursor(row, 0); my_fputs(buffer, stdout);
175 
176 # define HpGlitch(func) if (_hp_glitch) func
177 
178 # endif /* USE_CURSES/!USE_CURSES */
179 
180 extern void my_dummy(void);
181 
182 #endif /* !TCURSES_H */
my_fputc
#define my_fputc(ch, stream)
Definition: tcurses.h:152
MoveCursor
void MoveCursor(int row, int col)
Definition: curses.c:441
my_fprintf
#define my_fprintf
Definition: tcurses.h:170
my_dummy
void my_dummy(void)
my_fputs
#define my_fputs(str, stream)
Definition: tcurses.h:153
my_retouch
#define my_retouch()
Definition: tcurses.h:173
buffer
static uschar * buffer
Definition: pcretest.c:154
my_printf
#define my_printf
Definition: tcurses.h:169
my_fflush
#define my_fflush(stream)
Definition: tcurses.h:172