console.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. #ifndef PHP_WIN32_CONSOLE_H
  17. #define PHP_WIN32_CONSOLE_H
  18. #ifndef PHP_WINUTIL_API
  19. #ifdef PHP_EXPORTS
  20. # define PHP_WINUTIL_API __declspec(dllexport)
  21. #else
  22. # define PHP_WINUTIL_API __declspec(dllimport)
  23. #endif
  24. #endif
  25. #include "php.h"
  26. #include "php_streams.h"
  27. #include <windows.h>
  28. #ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
  29. #define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
  30. #endif
  31. /*
  32. Check if a file descriptor associated to a stream is a console
  33. (valid fileno, neither redirected nor piped)
  34. */
  35. PHP_WINUTIL_API BOOL php_win32_console_fileno_is_console(zend_long fileno);
  36. /*
  37. Check if the console attached to a file descriptor (screen buffer, not STDIN)
  38. has the ENABLE_VIRTUAL_TERMINAL_PROCESSING flag set
  39. */
  40. PHP_WINUTIL_API BOOL php_win32_console_fileno_has_vt100(zend_long fileno);
  41. /*
  42. Set/unset the ENABLE_VIRTUAL_TERMINAL_PROCESSING flag for the screen buffer (STDOUT/STDERR)
  43. associated to a file descriptor
  44. */
  45. PHP_WINUTIL_API BOOL php_win32_console_fileno_set_vt100(zend_long fileno, BOOL enable);
  46. /* Check, whether the program has its own console. If a process was launched
  47. through a GUI, it will have it's own console. For more info see
  48. http://support.microsoft.com/kb/99115 */
  49. PHP_WINUTIL_API BOOL php_win32_console_is_own(void);
  50. /* Check whether the current SAPI is run on console. */
  51. PHP_WINUTIL_API BOOL php_win32_console_is_cli_sapi(void);
  52. #endif