1 /*
2                                     __
3                                    / _|
4   __ _ _   _ _ __ ___  _ __ __ _  | |_ ___  ___ ___
5  / _` | | | | '__/ _ \| '__/ _` | |  _/ _ \/ __/ __|
6 | (_| | |_| | | | (_) | | | (_| | | || (_) \__ \__ \
7  \__,_|\__,_|_|  \___/|_|  \__,_| |_| \___/|___/___/
8 
9 Copyright (C) 2018-2019 Aurora Free Open Source Software.
10 
11 This file is part of the Aurora Free Open Source Software. This
12 organization promote free and open source software that you can
13 redistribute and/or modify under the terms of the GNU Lesser General
14 Public License Version 3 as published by the Free Software Foundation or
15 (at your option) any later version approved by the Aurora Free Open Source
16 Software Organization. The license is available in the package root path
17 as 'LICENSE' file. Please review the following information to ensure the
18 GNU Lesser General Public License version 3 requirements will be met:
19 https://www.gnu.org/licenses/lgpl.html .
20 
21 Alternatively, this file may be used under the terms of the GNU General
22 Public License version 3 or later as published by the Free Software
23 Foundation. Please review the following information to ensure the GNU
24 General Public License requirements will be met:
25 http://www.gnu.org/licenses/gpl-3.0.html.
26 
27 NOTE: All products, services or anything associated to trademarks and
28 service marks used or referenced on this file are the property of their
29 respective companies/owners or its subsidiaries. Other names and brands
30 may be claimed as the property of others.
31 
32 For more info about intellectual property visit: aurorafoss.org or
33 directly send an email to: contact (at) aurorafoss.org .
34 */
35 
36 module riverd.ncurses.statfun;
37 
38 import riverd.ncurses.types;
39 import core.stdc.stdarg;
40 import core.stdc.stdio;
41 
42 extern(C) @nogc nothrow {
43 
44 	/*
45 	* Function prototypes. This is the complete X/Open Curses list of required
46 	* functions. Those marked `generated' will have sources generated from the
47 	* macro definitions later in this file, in order to satisfy XPG4.2
48 	* requirements.
49 	*/
50 
51 	int addchnstr (const(chtype)*, int);
52 	int addchstr (const(chtype)*);
53 	int addnstr (const(char)*, int);
54 	int addstr (const(char)*);
55 	int attr_get (attr_t*, short*, void*);
56 	int attr_off (attr_t, void*);
57 	int attr_on (attr_t, void*);
58 	int attr_set (attr_t, short, void*);
59 	int baudrate ();
60 	int beep ();
61 	bool can_change_color ();
62 	int cbreak ();
63 	int clearok (WINDOW*, bool);
64 	int color_content (short, short*, short*, short*);
65 	int copywin (const(WINDOW)*, WINDOW*, int, int, int, int, int, int, int);
66 	int curs_set (int);
67 	int def_prog_mode ();
68 	int def_shell_mode ();
69 	int delay_output (int);
70 	void delscreen (SCREEN*);
71 	int delwin (WINDOW*);
72 	WINDOW* derwin (WINDOW*, int, int, int, int);
73 	int doupdate ();
74 	WINDOW* dupwin (WINDOW*);
75 	int echo ();
76 	int endwin ();
77 	char erasechar ();
78 	void filter ();
79 	int flash ();
80 	int flushinp ();
81 	chtype getbkgd (WINDOW*);
82 	WINDOW* getwin (FILE*);
83 	int halfdelay (int);
84 	bool has_colors ();
85 	bool has_ic ();
86 	bool has_il ();
87 	void idcok (WINDOW*, bool);
88 	int idlok (WINDOW*, bool);
89 	void immedok (WINDOW*, bool);
90 	WINDOW* initscr ();
91 	int init_color (short, short, short, short);
92 	int init_pair (short, short, short);
93 	int intrflush (WINDOW*, bool);
94 	bool isendwin ();
95 	bool is_wintouched (WINDOW*);
96 	const(char)* keyname (int);
97 	int keypad (WINDOW*, bool);
98 	char killchar ();
99 	int leaveok (WINDOW*, bool);
100 	char* longname ();
101 	int meta (WINDOW*, bool);
102 	int mvcur (int, int, int, int);
103 	int mvderwin (WINDOW*, int, int);
104 	int mvprintw (int, int, const(char)*, ...);
105 	int mvscanw (int, int, const(char)*, ...);
106 	int mvwin (WINDOW*, int, int);
107 	int mvwprintw (WINDOW*, int, int, const(char)*, ...);
108 	int mvwscanw (WINDOW*, int, int, const(char)*, ...);
109 	int napms (int);
110 	WINDOW* newpad (int, int);
111 	SCREEN* newterm (const(char)*, FILE*, FILE*);
112 	WINDOW* newwin (int, int, int, int);
113 	int nl ();
114 	int nocbreak ();
115 	int nodelay (WINDOW*, bool);
116 	int noecho ();
117 	int nonl ();
118 	void noqiflush ();
119 	int noraw ();
120 	int notimeout (WINDOW*, bool);
121 	int overlay (const(WINDOW)*, WINDOW*);
122 	int overwrite (const(WINDOW)*, WINDOW*);
123 	int pair_content (short, short*, short*);
124 	int PAIR_NUMBER (int);
125 	int pechochar (WINDOW*, const chtype);
126 	int pnoutrefresh (WINDOW*, int, int, int, int, int, int);
127 	int prefresh (WINDOW*, int, int, int, int, int, int);
128 	int printw (const(char)*, ...);
129 	int putwin (WINDOW*, FILE*);
130 	void qiflush ();
131 	int raw ();
132 	int redrawwin (WINDOW*);
133 	int resetty ();
134 	int reset_prog_mode ();
135 	int reset_shell_mode ();
136 	int ripoffline (int, int function (WINDOW*, int));
137 	int savetty ();
138 	int scanw (const(char)*, ...);
139 	int scr_dump (const(char)*);
140 	int scr_init (const(char)*);
141 	int scrollok (WINDOW*, bool);
142 	int scr_restore (const(char)*);
143 	int scr_set (const(char)*);
144 	SCREEN* set_term (SCREEN*);
145 	int slk_attroff (const chtype);
146 	int slk_attron (const chtype);
147 	int slk_attrset (const chtype);
148 	attr_t slk_attr ();
149 	int slk_attr_set (const attr_t, short, void*);
150 	int slk_clear ();
151 	int slk_color (short);
152 	int slk_init (int);
153 	char* slk_label (int);
154 	int slk_noutrefresh ();
155 	int slk_refresh ();
156 	int slk_restore ();
157 	int slk_set (int, const(char)*, int);
158 	int slk_touch ();
159 	int start_color ();
160 	WINDOW* subpad (WINDOW*, int, int, int, int);
161 	WINDOW* subwin (WINDOW*, int, int, int, int);
162 	int syncok (WINDOW*, bool);
163 	chtype termattrs ();
164 	char* termname ();
165 	int typeahead (int);
166 	int ungetch (int);
167 	void use_env (bool);
168 	void use_tioctl (bool);
169 	int vidattr (chtype);
170 	int vidputs (chtype, NCURSES_OUTC);
171 	int vwprintw (WINDOW*, const(char)*, va_list);
172 	int vw_printw (WINDOW*, const(char)*, va_list);
173 	int vwscanw (WINDOW*, const(char)*, va_list);
174 	int vw_scanw (WINDOW*, const(char)*, va_list);
175 	int waddch (WINDOW*, const chtype);
176 	int waddchnstr (WINDOW*, const(chtype)*, int);
177 	int waddchstr (WINDOW*, const(chtype)*);
178 	int waddnstr (WINDOW*, const(char)*, int);
179 	int wattrset (WINDOW*, int);
180 	int wattr_get (WINDOW*, attr_t*, short*, void*);
181 	int wattr_on (WINDOW*, attr_t, void*);
182 	int wattr_off (WINDOW*, attr_t, void*);
183 	int wattr_set (WINDOW*, attr_t, short, void*);
184 	int wbkgd (WINDOW*, chtype);
185 	void wbkgdset (WINDOW*, chtype);
186 	int wborder (WINDOW*, chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype);
187 	int wchgat (WINDOW*, int, attr_t, short, const(void)*);
188 	int wclear (WINDOW*);
189 	int wclrtobot (WINDOW*);
190 	int wclrtoeol (WINDOW*);
191 	int wcolor_set (WINDOW*, short, void*);
192 	void wcursyncup (WINDOW*);
193 	int wdelch (WINDOW*);
194 	int wechochar (WINDOW*, const chtype);
195 	int werase (WINDOW*);
196 	int wgetch (WINDOW*);
197 	int wgetnstr (WINDOW*, char*, int);
198 	int whline (WINDOW*, chtype, int);
199 	chtype winch (WINDOW*);
200 	int winchnstr (WINDOW*, chtype*, int);
201 	int winnstr (WINDOW*, char*, int);
202 	int winsch (WINDOW*, chtype);
203 	int winsdelln (WINDOW*, int);
204 	int winsnstr (WINDOW*, const(char)*, int);
205 	int wmove (WINDOW*, int, int);
206 	int wnoutrefresh (WINDOW*);
207 	int wprintw (WINDOW*, const(char)*, ...);
208 	int wredrawln (WINDOW*, int, int);
209 	int wrefresh (WINDOW*);
210 	int wscanw (WINDOW*, const(char)*, ...);
211 	int wscrl (WINDOW*, int);
212 	int wsetscrreg (WINDOW*, int, int);
213 	void wsyncdown (WINDOW*);
214 	void wsyncup (WINDOW*);
215 	void wtimeout (WINDOW*, int);
216 	int wtouchln (WINDOW*, int, int, int);
217 	int wvline (WINDOW*, chtype, int);
218 
219 	/*
220 	* These are also declared in <term.h>:
221 	*/
222 	int tigetflag (const(char)*);
223 	int tigetnum (const(char)*);
224 	char* tigetstr (const(char)*);
225 	int putp (const(char)*);
226 
227 	char* tparm (const(char)*, ...); /* special */
228 
229 	/* special */
230 	/* special */
231 
232 	char* tiparm (const(char)*, ...); /* special */
233 
234 	/*
235 	* These functions are not in X/Open, but we use them in macro definitions:
236 	*/
237 	int getattrs (const(WINDOW)*);
238 	/*
239 	* These functions are extensions - not in X/Open Curses.
240 	*/
241 	bool is_term_resized (int, int);
242 	char* keybound (int, int);
243 	const(char)* curses_version ();
244 	int alloc_pair (int, int);
245 	int assume_default_colors (int, int);
246 	int define_key (const(char)*, int);
247 	int extended_color_content (int, int*, int*, int*);
248 	int extended_pair_content (int, int*, int*);
249 	int extended_slk_color (int);
250 	int find_pair (int, int);
251 	int free_pair (int);
252 	int get_escdelay ();
253 	int init_extended_color (int, int, int, int);
254 	int init_extended_pair (int, int, int);
255 	int key_defined (const(char)*);
256 	int keyok (int, bool);
257 	void reset_color_pairs ();
258 	int resize_term (int, int);
259 	int resizeterm (int, int);
260 	int set_escdelay (int);
261 	int set_tabsize (int);
262 	int use_default_colors ();
263 	int use_extended_names (bool);
264 	int use_legacy_coding (int);
265 	int use_screen (SCREEN*, NCURSES_SCREEN_CB, void*);
266 	int use_window (WINDOW*, NCURSES_WINDOW_CB, void*);
267 	int wresize (WINDOW*, int, int);
268 	void nofilter ();
269 
270 	/*
271 	* These extensions provide access to information stored in the WINDOW even
272 	* when NCURSES_OPAQUE is set:
273 	*/
274 	WINDOW* wgetparent (const(WINDOW)*);
275 	bool is_cleared (const(WINDOW)*);
276 	bool is_idcok (const(WINDOW)*);
277 	bool is_idlok (const(WINDOW)*);
278 	bool is_immedok (const(WINDOW)*);
279 	bool is_keypad (const(WINDOW)*);
280 	bool is_leaveok (const(WINDOW)*);
281 	bool is_nodelay (const(WINDOW)*);
282 	bool is_notimeout (const(WINDOW)*);
283 	bool is_pad (const(WINDOW)*);
284 	bool is_scrollok (const(WINDOW)*);
285 	bool is_subwin (const(WINDOW)*);
286 	bool is_syncok (const(WINDOW)*);
287 	int wgetdelay (const(WINDOW)*);
288 int wgetscrreg (const(WINDOW)*, int*, int*);
289 
290 	SCREEN* new_prescr (); /* implemented:SP_FUNC */
291 
292 	int baudrate_sp (SCREEN*); /* implemented:SP_FUNC */
293 	int beep_sp (SCREEN*); /* implemented:SP_FUNC */
294 	bool can_change_color_sp (SCREEN*); /* implemented:SP_FUNC */
295 	int cbreak_sp (SCREEN*); /* implemented:SP_FUNC */
296 	int curs_set_sp (SCREEN*, int); /* implemented:SP_FUNC */
297 	int color_content_sp (SCREEN*, short, short*, short*, short*); /* implemented:SP_FUNC */
298 	int def_prog_mode_sp (SCREEN*); /* implemented:SP_FUNC */
299 	int def_shell_mode_sp (SCREEN*); /* implemented:SP_FUNC */
300 	int delay_output_sp (SCREEN*, int); /* implemented:SP_FUNC */
301 	int doupdate_sp (SCREEN*); /* implemented:SP_FUNC */
302 	int echo_sp (SCREEN*); /* implemented:SP_FUNC */
303 	int endwin_sp (SCREEN*); /* implemented:SP_FUNC */
304 	char erasechar_sp (SCREEN*); /* implemented:SP_FUNC */
305 	void filter_sp (SCREEN*); /* implemented:SP_FUNC */
306 	int flash_sp (SCREEN*); /* implemented:SP_FUNC */
307 	int flushinp_sp (SCREEN*); /* implemented:SP_FUNC */
308 	WINDOW* getwin_sp (SCREEN*, FILE*); /* implemented:SP_FUNC */
309 	int halfdelay_sp (SCREEN*, int); /* implemented:SP_FUNC */
310 	bool has_colors_sp (SCREEN*); /* implemented:SP_FUNC */
311 	bool has_ic_sp (SCREEN*); /* implemented:SP_FUNC */
312 	bool has_il_sp (SCREEN*); /* implemented:SP_FUNC */
313 	int init_color_sp (SCREEN*, short, short, short, short); /* implemented:SP_FUNC */
314 	int init_pair_sp (SCREEN*, short, short, short); /* implemented:SP_FUNC */
315 	int intrflush_sp (SCREEN*, WINDOW*, bool); /* implemented:SP_FUNC */
316 	bool isendwin_sp (SCREEN*); /* implemented:SP_FUNC */
317 	const(char)* keyname_sp (SCREEN*, int); /* implemented:SP_FUNC */
318 	char killchar_sp (SCREEN*); /* implemented:SP_FUNC */
319 	char* longname_sp (SCREEN*); /* implemented:SP_FUNC */
320 	int mvcur_sp (SCREEN*, int, int, int, int); /* implemented:SP_FUNC */
321 	int napms_sp (SCREEN*, int); /* implemented:SP_FUNC */
322 	WINDOW* newpad_sp (SCREEN*, int, int); /* implemented:SP_FUNC */
323 	SCREEN* newterm_sp (SCREEN*, const(char)*, FILE*, FILE*); /* implemented:SP_FUNC */
324 	WINDOW* newwin_sp (SCREEN*, int, int, int, int); /* implemented:SP_FUNC */
325 	int nl_sp (SCREEN*); /* implemented:SP_FUNC */
326 	int nocbreak_sp (SCREEN*); /* implemented:SP_FUNC */
327 	int noecho_sp (SCREEN*); /* implemented:SP_FUNC */
328 	int nonl_sp (SCREEN*); /* implemented:SP_FUNC */
329 	void noqiflush_sp (SCREEN*); /* implemented:SP_FUNC */
330 	int noraw_sp (SCREEN*); /* implemented:SP_FUNC */
331 	int pair_content_sp (SCREEN*, short, short*, short*); /* implemented:SP_FUNC */
332 	void qiflush_sp (SCREEN*); /* implemented:SP_FUNC */
333 	int raw_sp (SCREEN*); /* implemented:SP_FUNC */
334 	int reset_prog_mode_sp (SCREEN*); /* implemented:SP_FUNC */
335 	int reset_shell_mode_sp (SCREEN*); /* implemented:SP_FUNC */
336 	int resetty_sp (SCREEN*); /* implemented:SP_FUNC */
337 	int ripoffline_sp (SCREEN*, int, int function (WINDOW*, int)); /* implemented:SP_FUNC */
338 	int savetty_sp (SCREEN*); /* implemented:SP_FUNC */
339 	int scr_init_sp (SCREEN*, const(char)*); /* implemented:SP_FUNC */
340 	int scr_restore_sp (SCREEN*, const(char)*); /* implemented:SP_FUNC */
341 	int scr_set_sp (SCREEN*, const(char)*); /* implemented:SP_FUNC */
342 	int slk_attroff_sp (SCREEN*, const chtype); /* implemented:SP_FUNC */
343 	int slk_attron_sp (SCREEN*, const chtype); /* implemented:SP_FUNC */
344 	int slk_attrset_sp (SCREEN*, const chtype); /* implemented:SP_FUNC */
345 	attr_t slk_attr_sp (SCREEN*); /* implemented:SP_FUNC */
346 	int slk_attr_set_sp (SCREEN*, const attr_t, short, void*); /* implemented:SP_FUNC */
347 	int slk_clear_sp (SCREEN*); /* implemented:SP_FUNC */
348 	int slk_color_sp (SCREEN*, short); /* implemented:SP_FUNC */
349 	int slk_init_sp (SCREEN*, int); /* implemented:SP_FUNC */
350 	char* slk_label_sp (SCREEN*, int); /* implemented:SP_FUNC */
351 	int slk_noutrefresh_sp (SCREEN*); /* implemented:SP_FUNC */
352 	int slk_refresh_sp (SCREEN*); /* implemented:SP_FUNC */
353 	int slk_restore_sp (SCREEN*); /* implemented:SP_FUNC */
354 	int slk_set_sp (SCREEN*, int, const(char)*, int); /* implemented:SP_FUNC */
355 	int slk_touch_sp (SCREEN*); /* implemented:SP_FUNC */
356 	int start_color_sp (SCREEN*); /* implemented:SP_FUNC */
357 	chtype termattrs_sp (SCREEN*); /* implemented:SP_FUNC */
358 	char* termname_sp (SCREEN*); /* implemented:SP_FUNC */
359 	int typeahead_sp (SCREEN*, int); /* implemented:SP_FUNC */
360 	int ungetch_sp (SCREEN*, int); /* implemented:SP_FUNC */
361 	void use_env_sp (SCREEN*, bool); /* implemented:SP_FUNC */
362 	void use_tioctl_sp (SCREEN*, bool); /* implemented:SP_FUNC */
363 	int vidattr_sp (SCREEN*, chtype); /* implemented:SP_FUNC */
364 	int vidputs_sp (SCREEN*, chtype, NCURSES_OUTC_sp); /* implemented:SP_FUNC */
365 
366 	char* keybound_sp (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
367 	int alloc_pair_sp (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
368 	int assume_default_colors_sp (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
369 	int define_key_sp (SCREEN*, const(char)*, int); /* implemented:EXT_SP_FUNC */
370 	int extended_color_content_sp (SCREEN*, int, int*, int*, int*); /* implemented:EXT_SP_FUNC */
371 	int extended_pair_content_sp (SCREEN*, int, int*, int*); /* implemented:EXT_SP_FUNC */
372 	int extended_slk_color_sp (SCREEN*, int); /* implemented:EXT_SP_FUNC */
373 	int get_escdelay_sp (SCREEN*); /* implemented:EXT_SP_FUNC */
374 	int find_pair_sp (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
375 	int free_pair_sp (SCREEN*, int); /* implemented:EXT_SP_FUNC */
376 	int init_extended_color_sp (SCREEN*, int, int, int, int); /* implemented:EXT_SP_FUNC */
377 	int init_extended_pair_sp (SCREEN*, int, int, int); /* implemented:EXT_SP_FUNC */
378 	bool is_term_resized_sp (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
379 	int key_defined_sp (SCREEN*, const(char)*); /* implemented:EXT_SP_FUNC */
380 	int keyok_sp (SCREEN*, int, bool); /* implemented:EXT_SP_FUNC */
381 	void nofilter_sp (SCREEN*); /* implemented:EXT_SP_FUNC */
382 	void reset_color_pairs_sp (SCREEN*); /* implemented:EXT_SP_FUNC */
383 	int resize_term_sp (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
384 	int resizeterm_sp (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
385 	int set_escdelay_sp (SCREEN*, int); /* implemented:EXT_SP_FUNC */
386 	int set_tabsize_sp (SCREEN*, int); /* implemented:EXT_SP_FUNC */
387 	int use_default_colors_sp (SCREEN*); /* implemented:EXT_SP_FUNC */
388 	int use_legacy_coding_sp (SCREEN*, int); /* implemented:EXT_SP_FUNC */
389 
390 	bool has_mouse ();
391 	int getmouse (MEVENT*);
392 	int ungetmouse (MEVENT*);
393 	mmask_t mousemask (mmask_t, mmask_t*);
394 	bool wenclose (const(WINDOW)*, int, int);
395 	int mouseinterval (int);
396 	bool wmouse_trafo (const(WINDOW)*, int*, int*, bool);
397 
398 	bool has_mouse_sp (SCREEN*);
399 	int getmouse_sp (SCREEN*, MEVENT*);
400 	int ungetmouse_sp (SCREEN*, MEVENT*);
401 	mmask_t mousemask_sp (SCREEN*, mmask_t, mmask_t*);
402 	int mouseinterval_sp (SCREEN*, int);
403 
404 	/* other non-XSI functions */
405 
406 	int mcprint (char*, int); /* direct data to printer */
407 	int has_key (int); /* do we have given key? */
408 
409 	int has_key_sp (SCREEN*, int); /* do we have given key? */
410 	int mcprint_sp (SCREEN*, char*, int); /* direct data to printer */
411 
412 	/* Debugging : use with libncurses_g.a */
413 
414 	void _tracef (const(char)*, ...);
415 	char* _traceattr (attr_t);
416 	char* _traceattr2 (int, chtype);
417 	char* _tracechar (int);
418 	char* _tracechtype (chtype);
419 	char* _tracechtype2 (int, chtype);
420 
421 	void trace (const uint);
422 
423 	char* unctrl(chtype);
424 	char* wunctrl(cchar_t*);
425 
426 	/* NCURSES_NOMACROS */
427 
428 	/*
429 	 * Public variables.
430 	 *
431 	 * Notes:
432 	 *	a. ESCDELAY was an undocumented feature under AIX curses.
433 	 *	   It gives the ESC expire time in milliseconds.
434 	 *	b. ttytype is needed for backward compatibility
435 	 */
436 
437 	extern __gshared WINDOW* curscr;
438 	extern __gshared WINDOW* newscr;
439 	extern __gshared WINDOW* stdscr;
440 	extern __gshared char[] ttytype;
441 	extern __gshared int COLORS;
442 	extern __gshared int COLOR_PAIRS;
443 	extern __gshared int COLS;
444 	extern __gshared int ESCDELAY;
445 	extern __gshared int LINES;
446 	extern __gshared int TABSIZE;
447 }