xref: /php-src/win32/console.h (revision 01b3fc03)
1 /*
2   +----------------------------------------------------------------------+
3   | Copyright (c) The PHP Group                                          |
4   +----------------------------------------------------------------------+
5   | This source file is subject to version 3.01 of the PHP license,      |
6   | that is bundled with this package in the file LICENSE, and is        |
7   | available through the world-wide-web at the following url:           |
8   | https://www.php.net/license/3_01.txt                                 |
9   | If you did not receive a copy of the PHP license and are unable to   |
10   | obtain it through the world-wide-web, please send a note to          |
11   | license@php.net so we can mail you a copy immediately.               |
12   +----------------------------------------------------------------------+
13   | Author: Michele Locati <mlocati@gmail.com>                           |
14   +----------------------------------------------------------------------+
15 */
16 
17 #ifndef PHP_WIN32_CONSOLE_H
18 #define PHP_WIN32_CONSOLE_H
19 
20 #ifndef PHP_WINUTIL_API
21 #ifdef PHP_EXPORTS
22 # define PHP_WINUTIL_API __declspec(dllexport)
23 #else
24 # define PHP_WINUTIL_API __declspec(dllimport)
25 #endif
26 #endif
27 
28 #include "php.h"
29 #include "php_streams.h"
30 #include <windows.h>
31 
32 #ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
33 #define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
34 #endif
35 
36 
37 /*
38 Check if a file descriptor associated to a stream is a console
39 (valid fileno, neither redirected nor piped)
40 */
41 PHP_WINUTIL_API BOOL php_win32_console_fileno_is_console(zend_long fileno);
42 
43 /*
44 Check if the console attached to a file descriptor (screen buffer, not STDIN)
45 has the ENABLE_VIRTUAL_TERMINAL_PROCESSING flag set
46 */
47 PHP_WINUTIL_API BOOL php_win32_console_fileno_has_vt100(zend_long fileno);
48 
49 /*
50 Set/unset the ENABLE_VIRTUAL_TERMINAL_PROCESSING flag for the screen buffer (STDOUT/STDERR)
51 associated to a file descriptor
52 */
53 PHP_WINUTIL_API BOOL php_win32_console_fileno_set_vt100(zend_long fileno, BOOL enable);
54 
55 /* Check, whether the program has its own console. If a process was launched
56 	through a GUI, it will have it's own console. For more info see
57 	http://support.microsoft.com/kb/99115 */
58 PHP_WINUTIL_API BOOL php_win32_console_is_own(void);
59 
60 /* Check whether the current SAPI is run on console. */
61 PHP_WINUTIL_API BOOL php_win32_console_is_cli_sapi(void);
62 
63 #endif
64