2001-06-12 21:15:49 +00:00
/*
2002-02-28 08:29:35 +00:00
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
2004-01-08 08:18:22 +00:00
| PHP Version 5 |
2002-02-28 08:29:35 +00:00
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
2005-08-03 14:08:58 +00:00
| Copyright ( c ) 1997 - 2005 The PHP Group |
2002-02-28 08:29:35 +00:00
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
2003-06-10 20:04:29 +00:00
| This source file is subject to version 3.0 of the PHP license , |
2002-02-28 08:29:35 +00:00
| that is bundled with this package in the file LICENSE , and is |
2003-06-10 20:04:29 +00:00
| available through the world - wide - web at the following url : |
| http : //www.php.net/license/3_0.txt. |
2002-02-28 08:29:35 +00:00
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world - wide - web , please send a note to |
| license @ php . net so we can mail you a copy immediately . |
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
2002-11-25 12:30:28 +00:00
| Authors : Hartmut Holzgraefe < hholzgra @ php . net > |
2002-02-28 08:29:35 +00:00
| Georg Richter < georg . richter @ php - ev . de > |
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
2001-12-13 09:06:11 +00:00
*/
2001-06-12 21:15:49 +00:00
# ifdef HAVE_CONFIG_H
# include "config.h"
# endif
# include "php.h"
# include "php_ini.h"
# include "php_ncurses.h"
2002-09-27 17:03:53 +00:00
# define FETCH_WINRES(r, z) ZEND_FETCH_RESOURCE(r, WINDOW **, z, -1, "ncurses_window", le_ncurses_windows)
# if HAVE_NCURSES_PANEL
# define FETCH_PANEL(r, z) ZEND_FETCH_RESOURCE(r, PANEL **, z, -1, "ncurses_panel", le_ncurses_panels)
# endif
2001-09-17 21:54:25 +00:00
2002-12-22 19:44:01 +00:00
# define IS_NCURSES_INITIALIZED() \
if ( ! NCURSES_G ( registered_constants ) ) { \
php_error_docref ( NULL TSRMLS_CC , E_WARNING , " You must initialize ncruses via ncurses_init(), before calling any ncurses functions. " ) ; \
RETURN_FALSE ; \
}
2001-06-12 21:15:49 +00:00
/* {{{ proto int ncurses_addch(int ch)
2001-12-31 04:57:25 +00:00
Adds character at current position and advance cursor */
2001-06-12 21:15:49 +00:00
PHP_FUNCTION ( ncurses_addch )
{
2001-12-13 09:06:11 +00:00
long ch ;
2001-12-27 08:49:12 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & ch ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2001-12-13 09:06:11 +00:00
}
2001-12-28 10:35:53 +00:00
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( addch ( ch ) ) ;
2001-06-12 21:15:49 +00:00
}
/* }}} */
2002-09-27 22:33:14 +00:00
/* {{{ proto int ncurses_waddch(resource window, int ch)
Adds character at current position in a window and advance cursor */
PHP_FUNCTION ( ncurses_waddch )
{
long ch ;
zval * handle ;
WINDOW * * win ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " rl " , & handle , & ch ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2002-09-27 22:33:14 +00:00
}
FETCH_WINRES ( win , & handle ) ;
RETURN_LONG ( waddch ( * win , ch ) ) ;
}
/* }}} */
2002-12-24 17:20:33 +00:00
# ifdef HAVE_NCURSES_COLOR_SET
2001-06-12 21:15:49 +00:00
/* {{{ proto int ncurses_color_set(int pair)
2001-12-31 04:57:25 +00:00
Sets fore - and background color */
2001-06-12 21:15:49 +00:00
PHP_FUNCTION ( ncurses_color_set )
{
2001-12-13 09:06:11 +00:00
long pair ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & pair ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( color_set ( pair , NULL ) ) ;
2001-06-12 21:15:49 +00:00
}
/* }}} */
2002-12-24 17:20:33 +00:00
# endif
2001-06-12 21:15:49 +00:00
2005-04-10 21:23:27 +00:00
/* {{{ proto bool ncurses_delwin(resource window)
2001-12-31 04:57:25 +00:00
Deletes a ncurses window */
2001-06-12 21:15:49 +00:00
PHP_FUNCTION ( ncurses_delwin )
{
2002-12-24 17:20:33 +00:00
zval * handle ;
2002-09-27 17:03:53 +00:00
WINDOW * * w ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " r " , & handle ) = = FAILURE ) {
return ;
2001-12-13 09:06:11 +00:00
}
2001-06-12 21:15:49 +00:00
2002-12-24 17:20:33 +00:00
FETCH_WINRES ( w , & handle ) ;
2001-06-12 21:15:49 +00:00
2002-12-24 17:20:33 +00:00
zend_list_delete ( Z_LVAL_P ( handle ) ) ;
2005-04-10 21:23:27 +00:00
RETURN_TRUE ;
2001-06-12 21:15:49 +00:00
}
/* }}} */
2001-12-27 08:49:12 +00:00
/* {{{ proto int ncurses_end(void)
2001-12-31 04:57:25 +00:00
Stops using ncurses , clean up the screen */
2001-06-12 21:15:49 +00:00
PHP_FUNCTION ( ncurses_end )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( endwin ( ) ) ; /* endialize the curses library */
2001-06-12 21:15:49 +00:00
}
/* }}} */
2001-12-27 08:49:12 +00:00
/* {{{ proto int ncurses_getch(void)
2001-12-31 04:57:25 +00:00
Reads a character from keyboard */
2001-06-12 21:15:49 +00:00
PHP_FUNCTION ( ncurses_getch )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( getch ( ) ) ;
2001-06-12 21:15:49 +00:00
}
/* }}} */
2001-12-27 08:49:12 +00:00
/* {{{ proto bool ncurses_has_colors(void)
2001-12-31 04:57:25 +00:00
Checks if terminal has colors */
2001-06-12 21:15:49 +00:00
PHP_FUNCTION ( ncurses_has_colors )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_BOOL ( has_colors ( ) ) ;
2001-06-12 21:15:49 +00:00
}
/* }}} */
2001-12-27 08:49:12 +00:00
/* {{{ proto int ncurses_init(void)
2001-12-31 04:57:25 +00:00
Initializes ncurses */
2001-06-12 21:15:49 +00:00
PHP_FUNCTION ( ncurses_init )
{
2001-12-13 09:06:11 +00:00
initscr ( ) ; /* initialize the curses library */
keypad ( stdscr , TRUE ) ; /* enable keyboard mapping */
( void ) nonl ( ) ; /* tell curses not to do NL->CR/NL on output */
2002-09-27 17:03:53 +00:00
( void ) cbreak ( ) ; /* take input chars one at a time, no wait for \n */
2002-09-27 22:33:14 +00:00
if ( ! NCURSES_G ( registered_constants ) ) {
zend_constant c ;
WINDOW * * pscr = ( WINDOW * * ) emalloc ( sizeof ( WINDOW * ) ) ;
zval * zscr ;
* pscr = stdscr ;
MAKE_STD_ZVAL ( zscr ) ;
ZEND_REGISTER_RESOURCE ( zscr , pscr , le_ncurses_windows ) ;
c . value = * zscr ;
zval_copy_ctor ( & c . value ) ;
c . flags = CONST_CS ;
2005-01-20 02:02:09 +00:00
c . name = zend_strndup ( ZEND_STRL ( " STDSCR " ) ) ;
2003-12-12 00:23:15 +00:00
c . name_len = sizeof ( " STDSCR " ) ;
2002-09-27 22:33:14 +00:00
zend_register_constant ( & c TSRMLS_CC ) ;
/* we need this "interesting" arrangement because the
* underlying values of the ACS_XXX defines are not
* initialized until after ncurses has been initialized */
# define PHP_NCURSES_DEF_CONST(x) \
ZVAL_LONG ( zscr , x ) ; \
c . value = * zscr ; \
zval_copy_ctor ( & c . value ) ; \
c . flags = CONST_CS ; \
2005-01-20 02:02:09 +00:00
c . name = zend_strndup ( ZEND_STRL ( " NCURSES_ " # x ) ) ; \
2002-09-27 22:33:14 +00:00
c . name_len = sizeof ( " NCURSES_ " # x ) ; \
zend_register_constant ( & c TSRMLS_CC )
PHP_NCURSES_DEF_CONST ( ACS_ULCORNER ) ;
PHP_NCURSES_DEF_CONST ( ACS_LLCORNER ) ;
PHP_NCURSES_DEF_CONST ( ACS_URCORNER ) ;
PHP_NCURSES_DEF_CONST ( ACS_LRCORNER ) ;
PHP_NCURSES_DEF_CONST ( ACS_LTEE ) ;
PHP_NCURSES_DEF_CONST ( ACS_RTEE ) ;
PHP_NCURSES_DEF_CONST ( ACS_BTEE ) ;
PHP_NCURSES_DEF_CONST ( ACS_TTEE ) ;
PHP_NCURSES_DEF_CONST ( ACS_HLINE ) ;
PHP_NCURSES_DEF_CONST ( ACS_VLINE ) ;
PHP_NCURSES_DEF_CONST ( ACS_PLUS ) ;
PHP_NCURSES_DEF_CONST ( ACS_S1 ) ;
PHP_NCURSES_DEF_CONST ( ACS_S9 ) ;
PHP_NCURSES_DEF_CONST ( ACS_DIAMOND ) ;
PHP_NCURSES_DEF_CONST ( ACS_CKBOARD ) ;
PHP_NCURSES_DEF_CONST ( ACS_DEGREE ) ;
PHP_NCURSES_DEF_CONST ( ACS_PLMINUS ) ;
PHP_NCURSES_DEF_CONST ( ACS_BULLET ) ;
PHP_NCURSES_DEF_CONST ( ACS_LARROW ) ;
PHP_NCURSES_DEF_CONST ( ACS_RARROW ) ;
PHP_NCURSES_DEF_CONST ( ACS_DARROW ) ;
PHP_NCURSES_DEF_CONST ( ACS_UARROW ) ;
PHP_NCURSES_DEF_CONST ( ACS_BOARD ) ;
PHP_NCURSES_DEF_CONST ( ACS_LANTERN ) ;
PHP_NCURSES_DEF_CONST ( ACS_BLOCK ) ;
FREE_ZVAL ( zscr ) ;
NCURSES_G ( registered_constants ) = 1 ;
}
2002-09-27 17:03:53 +00:00
}
2001-06-12 21:15:49 +00:00
/* }}} */
/* {{{ proto int ncurses_init_pair(int pair, int fg, int bg)
2001-12-31 04:57:25 +00:00
Allocates a color pair */
2001-06-12 21:15:49 +00:00
PHP_FUNCTION ( ncurses_init_pair )
{
2001-12-13 09:06:11 +00:00
long pair , fg , bg ;
2001-06-12 21:15:49 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " lll " , & pair , & fg , & bg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( init_pair ( pair , fg , bg ) ) ;
2001-06-12 21:15:49 +00:00
}
/* }}} */
2001-12-13 09:06:11 +00:00
/* {{{ proto int ncurses_move(int y, int x)
2001-12-27 08:49:12 +00:00
Moves output position */
2001-06-12 21:15:49 +00:00
PHP_FUNCTION ( ncurses_move )
{
2001-12-13 09:06:11 +00:00
long x , y ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " ll " , & y , & x ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( move ( y , x ) ) ;
2001-06-12 21:15:49 +00:00
}
/* }}} */
2002-09-27 17:03:53 +00:00
/* {{{ proto resource ncurses_newpad(int rows, int cols)
Creates a new pad ( window ) */
PHP_FUNCTION ( ncurses_newpad )
{
long rows , cols ;
2002-12-22 20:16:37 +00:00
WINDOW * * pwin ;
2002-09-27 17:03:53 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " ll " , & rows , & cols ) = = FAILURE ) {
2002-09-27 17:03:53 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2002-12-22 20:16:37 +00:00
pwin = ( WINDOW * * ) emalloc ( sizeof ( WINDOW * ) ) ;
2002-09-27 17:03:53 +00:00
* pwin = newpad ( rows , cols ) ;
if ( ! * pwin ) {
efree ( pwin ) ;
RETURN_FALSE ;
}
ZEND_REGISTER_RESOURCE ( return_value , pwin , le_ncurses_windows ) ;
}
/* }}} */
/* {{{ proto int ncurses_prefresh(resource pad, int pminrow, int pmincol, int sminrow, int smincol, int smaxrow, int smaxcol)
Copys a region from a pad into the virtual screen */
PHP_FUNCTION ( ncurses_prefresh )
{
WINDOW * * pwin ;
zval * phandle ;
long pminrow , pmincol , sminrow , smincol , smaxrow , smaxcol ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " rllllll " , & phandle , & pminrow ,
& pmincol , & sminrow , & smincol , & smaxrow , & smaxcol ) = = FAILURE ) {
return ;
}
FETCH_WINRES ( pwin , & phandle ) ;
RETURN_LONG ( prefresh ( * pwin , pminrow , pmincol , sminrow , smincol , smaxrow , smaxcol ) ) ;
}
/* }}} */
/* {{{ proto int ncurses_pnoutrefresh(resource pad, int pminrow, int pmincol, int sminrow, int smincol, int smaxrow, int smaxcol)
Copys a region from a pad into the virtual screen */
PHP_FUNCTION ( ncurses_pnoutrefresh )
{
WINDOW * * pwin ;
zval * phandle ;
long pminrow , pmincol , sminrow , smincol , smaxrow , smaxcol ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " rllllll " , & phandle , & pminrow ,
& pmincol , & sminrow , & smincol , & smaxrow , & smaxcol ) = = FAILURE ) {
return ;
}
FETCH_WINRES ( pwin , & phandle ) ;
RETURN_LONG ( pnoutrefresh ( * pwin , pminrow , pmincol , sminrow , smincol , smaxrow , smaxcol ) ) ;
}
/* }}} */
2001-12-13 09:06:11 +00:00
2001-09-17 21:54:25 +00:00
/* {{{ proto int ncurses_newwin(int rows, int cols, int y, int x)
2001-12-31 04:57:25 +00:00
Creates a new window */
2001-06-12 21:15:49 +00:00
PHP_FUNCTION ( ncurses_newwin )
{
2001-12-13 09:06:11 +00:00
long rows , cols , y , x ;
2002-12-22 20:16:37 +00:00
WINDOW * * pwin ;
2001-06-12 21:15:49 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " llll " , & rows , & cols , & y , & x ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2001-12-27 08:49:12 +00:00
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2002-12-22 20:16:37 +00:00
pwin = ( WINDOW * * ) emalloc ( sizeof ( WINDOW * ) ) ;
2001-12-13 09:06:11 +00:00
* pwin = newwin ( rows , cols , y , x ) ;
2001-12-27 08:49:12 +00:00
2001-12-13 09:06:11 +00:00
if ( ! * pwin ) {
efree ( pwin ) ;
RETURN_FALSE ;
}
2001-06-12 21:15:49 +00:00
2002-09-27 17:03:53 +00:00
ZEND_REGISTER_RESOURCE ( return_value , pwin , le_ncurses_windows ) ;
2001-06-12 21:15:49 +00:00
}
/* }}} */
/* {{{ proto int ncurses_refresh(int ch)
2001-12-13 09:06:11 +00:00
Refresh screen */
2001-06-12 21:15:49 +00:00
PHP_FUNCTION ( ncurses_refresh )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( refresh ( ) ) ;
2001-06-12 21:15:49 +00:00
}
/* }}} */
2001-12-27 08:49:12 +00:00
/* {{{ proto int ncurses_start_color(void)
2001-12-31 04:57:25 +00:00
Starts using colors */
2001-06-12 21:15:49 +00:00
PHP_FUNCTION ( ncurses_start_color )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
RETURN_LONG ( start_color ( ) ) ;
2001-06-12 21:15:49 +00:00
}
/* }}} */
2001-06-13 07:26:41 +00:00
2001-12-27 08:49:12 +00:00
/* {{{ proto int ncurses_standout(void)
2001-12-31 04:57:25 +00:00
Starts using ' standout ' attribute */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_standout )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( standout ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-27 08:49:12 +00:00
/* {{{ proto int ncurses_standend(void)
2001-12-31 04:57:25 +00:00
Stops using ' standout ' attribute */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_standend )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( standend ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-27 08:49:12 +00:00
/* {{{ proto int ncurses_baudrate(void)
2001-12-25 23:30:55 +00:00
Returns baudrate of terminal */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_baudrate )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( baudrate ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-27 08:49:12 +00:00
/* {{{ proto int ncurses_beep(void)
2001-12-13 09:06:11 +00:00
Let the terminal beep */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_beep )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( beep ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-27 08:49:12 +00:00
/* {{{ proto bool ncurses_can_change_color(void)
2001-12-31 04:57:25 +00:00
Checks if we can change terminals colors */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_can_change_color )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( can_change_color ( ) ) ;
2001-12-27 08:49:12 +00:00
}
2001-06-13 07:26:41 +00:00
/* }}} */
2001-12-27 08:49:12 +00:00
/* {{{ proto bool ncurses_cbreak(void)
2001-12-31 04:57:25 +00:00
Switches of input buffering */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_cbreak )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( cbreak ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-27 08:49:12 +00:00
/* {{{ proto bool ncurses_clear(void)
2001-12-31 04:57:25 +00:00
Clears screen */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_clear )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( clear ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-27 08:49:12 +00:00
/* {{{ proto bool ncurses_clrtobot(void)
2001-12-31 04:57:25 +00:00
Clears screen from current position to bottom */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_clrtobot )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( clrtobot ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-27 08:49:12 +00:00
/* {{{ proto bool ncurses_clrtoeol(void)
2001-12-31 04:57:25 +00:00
Clears screen from current position to end of line */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_clrtoeol )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( clrtoeol ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2002-10-30 02:54:48 +00:00
/* {{{ proto int ncurses_reset_prog_mode(void)
Resets the prog mode saved by def_prog_mode */
PHP_FUNCTION ( ncurses_reset_prog_mode )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2002-10-30 02:54:48 +00:00
RETURN_LONG ( reset_prog_mode ( ) ) ;
}
/* }}} */
/* {{{ proto int ncurses_reset_shell_mode(void)
Resets the shell mode saved by def_shell_mode */
PHP_FUNCTION ( ncurses_reset_shell_mode )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2002-10-30 02:54:48 +00:00
RETURN_LONG ( reset_shell_mode ( ) ) ;
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_def_prog_mode(void)
2001-12-31 04:57:25 +00:00
Saves terminals ( program ) mode */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_def_prog_mode )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( def_prog_mode ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_def_shell_mode(void)
2001-12-31 04:57:25 +00:00
Saves terminal ( shell ) mode */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_def_shell_mode )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( def_shell_mode ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_delch(void)
2001-12-31 04:57:25 +00:00
Deletes character at current position , move rest of line left */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_delch )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( delch ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_deleteln(void)
2001-12-31 04:57:25 +00:00
Deletes line at current position , move rest of screen up */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_deleteln )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( deleteln ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_doupdate(void)
2001-12-31 04:57:25 +00:00
Writes all prepared refreshes to terminal */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_doupdate )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( doupdate ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_echo(void)
2001-12-31 04:57:25 +00:00
Activates keyboard input echo */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_echo )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( echo ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_erase(void)
2001-12-31 04:57:25 +00:00
Erases terminal screen */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_erase )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( erase ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-27 08:49:12 +00:00
/* {{{ proto string ncurses_erasechar(void)
2001-12-25 23:30:55 +00:00
Returns current erase character */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_erasechar )
{
2001-12-25 13:34:06 +00:00
char temp [ 2 ] ;
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-25 13:34:06 +00:00
temp [ 0 ] = erasechar ( ) ;
temp [ 1 ] = ' \0 ' ;
RETURN_STRINGL ( temp , 1 , 1 ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_flash(void)
2001-12-31 04:57:25 +00:00
Flashes terminal screen ( visual bell ) */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_flash )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( flash ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_flushinp(void)
2001-12-31 04:57:25 +00:00
Flushes keyboard input buffer */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_flushinp )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( flushinp ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_has_ic(void)
2001-12-31 04:57:25 +00:00
Checks for insert - and delete - capabilities */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_has_ic )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( has_ic ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_has_il(void)
2001-12-31 04:57:25 +00:00
Checks for line insert - and delete - capabilities */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_has_il )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( has_il ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-27 08:49:12 +00:00
/* {{{ proto string ncurses_inch(void)
2001-12-31 04:57:25 +00:00
Gets character and attribute at current position */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_inch )
{
2001-12-25 13:34:06 +00:00
char temp [ 2 ] ;
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-25 13:34:06 +00:00
temp [ 0 ] = inch ( ) ;
temp [ 1 ] = ' \0 ' ;
RETURN_STRINGL ( temp , 1 , 1 ) ;
2001-06-13 07:26:41 +00:00
}
2002-09-27 17:03:53 +00:00
/* }}} */
2001-06-13 07:26:41 +00:00
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_insertln(void)
2001-12-31 04:57:25 +00:00
Inserts a line , move rest of screen down */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_insertln )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( insertln ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_isendwin(void)
2001-12-13 09:06:11 +00:00
Ncurses is in endwin mode , normal screen output may be performed */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_isendwin )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( isendwin ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-27 08:49:12 +00:00
/* {{{ proto string ncurses_killchar(void)
2001-12-25 23:30:55 +00:00
Returns current line kill character */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_killchar )
{
2001-12-25 13:34:06 +00:00
char temp [ 2 ] ;
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-25 13:34:06 +00:00
temp [ 0 ] = killchar ( ) ;
temp [ 1 ] = ' \0 ' ;
RETURN_STRINGL ( temp , 1 , 1 ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_nl(void)
2001-12-31 04:57:25 +00:00
Translates newline and carriage return / line feed */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_nl )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( nl ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_nocbreak(void)
2001-12-31 04:57:25 +00:00
Switches terminal to cooked mode */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_nocbreak )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( nocbreak ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_noecho(void)
2001-12-31 04:57:25 +00:00
Switches off keyboard input echo */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_noecho )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( noecho ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_nonl(void)
2001-12-13 09:06:11 +00:00
Do not ranslate newline and carriage return / line feed */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_nonl )
{
2001-12-13 09:06:11 +00:00
RETURN_LONG ( nonl ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-27 08:49:12 +00:00
/* {{{ proto bool ncurses_noraw(void)
2001-12-31 04:57:25 +00:00
Switches terminal out of raw mode */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_noraw )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( noraw ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_raw(void)
2001-12-31 04:57:25 +00:00
Switches terminal into raw mode */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_raw )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( raw ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_meta(resource window, bool 8bit)
2002-10-27 18:15:35 +00:00
Enables / Disable 8 - bit meta key information */
PHP_FUNCTION ( ncurses_meta )
{
zend_bool enable ;
zval * handle ;
WINDOW * * win ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " rb " , & handle , & enable ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2002-10-27 18:15:35 +00:00
}
FETCH_WINRES ( win , & handle ) ;
RETURN_LONG ( meta ( * win , enable ) ) ;
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_werase(resource window)
2002-10-27 18:15:35 +00:00
Erase window contents */
PHP_FUNCTION ( ncurses_werase )
{
zval * handle ;
WINDOW * * win ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " r " , & handle ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2002-10-27 18:15:35 +00:00
}
FETCH_WINRES ( win , & handle ) ;
RETURN_LONG ( werase ( * win ) ) ;
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_resetty(void)
2001-12-31 04:57:25 +00:00
Restores saved terminal state */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_resetty )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( resetty ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_savetty(void)
2001-12-31 04:57:25 +00:00
Saves terminal state */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_savetty )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( savetty ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_termattrs(void)
2001-12-25 23:30:55 +00:00
Returns a logical OR of all attribute flags supported by terminal */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_termattrs )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( termattrs ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_use_default_colors(void)
2001-12-31 04:57:25 +00:00
Assigns terminal default colors to color id - 1 */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_use_default_colors )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( use_default_colors ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_slk_attr(void)
2001-12-31 04:57:25 +00:00
Returns current soft label keys attribute */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_slk_attr )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( slk_attr ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_slk_clear(void)
2001-12-31 04:57:25 +00:00
Clears soft label keys from screen */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_slk_clear )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( slk_clear ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_slk_noutrefresh(void)
2001-12-31 04:57:25 +00:00
Copies soft label keys to virtual screen */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_slk_noutrefresh )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( slk_noutrefresh ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_slk_refresh(void)
2001-12-31 04:57:25 +00:00
Copies soft label keys to screen */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_slk_refresh )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( slk_refresh ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_slk_restore(void)
2001-12-31 04:57:25 +00:00
Restores soft label keys */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_slk_restore )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( slk_restore ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_slk_touch(void)
2001-12-31 04:57:25 +00:00
Forces output when ncurses_slk_noutrefresh is performed */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_slk_touch )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( slk_touch ( ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-30 19:14:12 +00:00
/* {{{ proto bool ncurses_slk_set(int labelnr, string label, int format)
2001-12-31 04:57:25 +00:00
Sets function key labels */
2001-12-29 11:48:30 +00:00
PHP_FUNCTION ( ncurses_slk_set )
{
char * str ;
int len ;
long labelnr ;
long format ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " lsl " , & labelnr , & str , & len , & format ) = = FAILURE ) {
2001-12-29 11:48:30 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-29 11:48:30 +00:00
RETURN_BOOL ( slk_set ( labelnr , str , format ) ) ;
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_attroff(int attributes)
2001-12-31 04:57:25 +00:00
Turns off the given attributes */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_attroff )
{
2001-12-13 09:06:11 +00:00
long intarg ;
2001-12-27 08:49:12 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & intarg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( attroff ( intarg ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_attron(int attributes)
2001-12-31 04:57:25 +00:00
Turns on the given attributes */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_attron )
{
2001-12-13 09:06:11 +00:00
long intarg ;
2001-12-27 08:49:12 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & intarg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( attron ( intarg ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_attrset(int attributes)
2001-12-31 04:57:25 +00:00
Sets given attributes */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_attrset )
{
2001-12-13 09:06:11 +00:00
long intarg ;
2001-12-27 08:49:12 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & intarg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( attrset ( intarg ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_bkgd(int attrchar)
2001-12-31 04:57:25 +00:00
Sets background property for terminal screen */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_bkgd )
{
2001-12-13 09:06:11 +00:00
long intarg ;
2001-12-27 08:49:12 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & intarg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( bkgd ( intarg ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_curs_set(int visibility)
2001-12-31 04:57:25 +00:00
Sets cursor state */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_curs_set )
{
2001-12-13 09:06:11 +00:00
long intarg ;
2001-12-27 08:49:12 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & intarg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( curs_set ( intarg ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_delay_output(int milliseconds)
2001-12-31 04:57:25 +00:00
Delays output on terminal using padding characters */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_delay_output )
{
2001-12-13 09:06:11 +00:00
long intarg ;
2001-12-27 08:49:12 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & intarg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( delay_output ( intarg ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_echochar(int character)
2001-12-13 09:06:11 +00:00
Single character output including refresh */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_echochar )
{
2001-12-13 09:06:11 +00:00
long intarg ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & intarg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( echochar ( intarg ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_halfdelay(int tenth)
2001-12-31 04:57:25 +00:00
Puts terminal into halfdelay mode */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_halfdelay )
{
2001-12-13 09:06:11 +00:00
long intarg ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & intarg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( halfdelay ( intarg ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_has_key(int keycode)
2001-12-31 04:57:25 +00:00
Checks for presence of a function key on terminal keyboard */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_has_key )
{
2001-12-13 09:06:11 +00:00
long intarg ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & intarg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( has_key ( intarg ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_insch(int character)
2001-12-31 04:57:25 +00:00
Inserts character moving rest of line including character at current position */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_insch )
{
2001-12-13 09:06:11 +00:00
long intarg ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & intarg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( insch ( intarg ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_insdelln(int count)
2001-12-31 04:57:25 +00:00
Inserts lines before current line scrolling down ( negative numbers delete and scroll up ) */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_insdelln )
{
2001-12-13 09:06:11 +00:00
long intarg ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & intarg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( insdelln ( intarg ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_mouseinterval(int milliseconds)
2001-12-31 04:57:25 +00:00
Sets timeout for mouse button clicks */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_mouseinterval )
{
2001-12-13 09:06:11 +00:00
long intarg ;
2001-12-28 10:35:53 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & intarg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( mouseinterval ( intarg ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_napms(int milliseconds)
Sleep */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_napms )
{
2001-12-13 09:06:11 +00:00
long intarg ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & intarg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( napms ( intarg ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_scrl(int count)
2001-12-31 04:57:25 +00:00
Scrolls window content up or down without changing current position */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_scrl )
{
2001-12-13 09:06:11 +00:00
long intarg ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & intarg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( scrl ( intarg ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
/* {{{ proto int ncurses_slk_attroff(int intarg)
2001-12-31 04:57:25 +00:00
? ? ? */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_slk_attroff )
{
2001-12-13 09:06:11 +00:00
long intarg ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & intarg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( slk_attroff ( intarg ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
/* {{{ proto int ncurses_slk_attron(int intarg)
2001-12-31 04:57:25 +00:00
? ? ? */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_slk_attron )
{
2001-12-13 09:06:11 +00:00
long intarg ;
2001-12-28 10:35:53 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & intarg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( slk_attron ( intarg ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
/* {{{ proto int ncurses_slk_attrset(int intarg)
2001-12-31 04:57:25 +00:00
? ? ? */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_slk_attrset )
{
2001-12-13 09:06:11 +00:00
long intarg ;
2001-12-30 19:14:12 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & intarg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( slk_attrset ( intarg ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2002-12-24 17:20:33 +00:00
# ifdef HAVE_NCURSES_SLK_COLOR
2001-06-13 07:26:41 +00:00
/* {{{ proto int ncurses_slk_color(int intarg)
2001-12-31 04:57:25 +00:00
Sets color for soft label keys */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_slk_color )
{
2001-12-13 09:06:11 +00:00
long intarg ;
2001-12-29 11:48:30 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & intarg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( slk_color ( intarg ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2002-12-24 17:20:33 +00:00
# endif
2001-06-13 07:26:41 +00:00
/* {{{ proto int ncurses_slk_init(int intarg)
2001-12-31 04:57:25 +00:00
Inits soft label keys */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_slk_init )
{
2001-12-13 09:06:11 +00:00
long intarg ;
2001-12-29 11:48:30 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & intarg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( slk_init ( intarg ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_typeahead(int fd)
2001-12-31 04:57:25 +00:00
Specifys different filedescriptor for typeahead checking */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_typeahead )
{
2001-12-13 09:06:11 +00:00
long intarg ;
2001-12-29 11:48:30 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & intarg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( typeahead ( intarg ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_ungetch(int keycode)
2001-12-31 04:57:25 +00:00
Puts a character back into the input stream */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_ungetch )
{
2001-12-13 09:06:11 +00:00
long intarg ;
2001-12-29 11:48:30 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & intarg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( ungetch ( intarg ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
/* {{{ proto int ncurses_vidattr(int intarg)
2001-12-31 04:57:25 +00:00
? ? ? */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_vidattr )
{
2001-12-13 09:06:11 +00:00
long intarg ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & intarg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( vidattr ( intarg ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2002-12-24 17:20:33 +00:00
# ifdef HAVE_NCURSES_USE_EXTENDED_NAMES
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_use_extended_names(bool flag)
2001-12-31 04:57:25 +00:00
Controls use of extended names in terminfo descriptions */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_use_extended_names )
{
2001-12-13 09:06:11 +00:00
long intarg ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & intarg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( use_extended_names ( intarg ) ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2002-12-24 17:20:33 +00:00
# endif
2001-06-13 07:26:41 +00:00
2001-12-13 14:40:40 +00:00
/* {{{ proto void ncurses_bkgdset(int attrchar)
2001-12-31 04:57:25 +00:00
Controls screen background */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_bkgdset )
{
2001-12-13 09:06:11 +00:00
long intarg ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & intarg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
bkgdset ( intarg ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto void ncurses_filter(void)
2001-12-13 09:06:11 +00:00
*/
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_filter )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
filter ( ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-27 08:49:12 +00:00
/* {{{ proto int ncurses_noqiflush(void)
2001-12-13 09:06:11 +00:00
Do not flush on signal characters */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_noqiflush )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
noqiflush ( ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto void ncurses_qiflush(void)
2001-12-31 04:57:25 +00:00
Flushes on signal characters */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_qiflush )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
qiflush ( ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto void ncurses_timeout(int millisec)
2001-12-31 04:57:25 +00:00
Sets timeout for special key sequences */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_timeout )
{
2001-12-13 09:06:11 +00:00
long intarg ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & intarg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
timeout ( intarg ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto void ncurses_use_env(int flag)
2001-12-31 04:57:25 +00:00
Controls use of environment information about terminal size */
2001-06-13 07:26:41 +00:00
PHP_FUNCTION ( ncurses_use_env )
{
2001-12-13 09:06:11 +00:00
long intarg ;
2001-12-29 11:48:30 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & intarg ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
use_env ( intarg ) ;
2001-06-13 07:26:41 +00:00
}
/* }}} */
2001-09-17 21:54:25 +00:00
/* {{{ proto int ncurses_addstr(string text)
2001-12-31 04:57:25 +00:00
Outputs text at current position */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_addstr )
{
2001-12-13 09:06:11 +00:00
char * str ;
int str_len ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " s " , & str , & str_len ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( addstr ( str ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
/* {{{ proto int ncurses_putp(string text)
2001-12-31 04:57:25 +00:00
? ? ? */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_putp )
{
2001-12-13 09:06:11 +00:00
char * str ;
int str_len ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " s " , & str , & str_len ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( putp ( str ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_scr_dump(string filename)
2001-12-31 04:57:25 +00:00
Dumps screen content to file */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_scr_dump )
{
2001-12-13 09:06:11 +00:00
char * str ;
int str_len ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " s " , & str , & str_len ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( scr_dump ( str ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_scr_init(string filename)
2001-12-31 04:57:25 +00:00
Initializes screen from file dump */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_scr_init )
{
2001-12-13 09:06:11 +00:00
char * str ;
int str_len ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " s " , & str , & str_len ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( scr_init ( str ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_scr_restore(string filename)
2001-12-31 04:57:25 +00:00
Restores screen from file dump */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_scr_restore )
{
2001-12-13 09:06:11 +00:00
char * str ;
int str_len ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " s " , & str , & str_len ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( scr_restore ( str ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_scr_set(string filename)
2001-12-31 04:57:25 +00:00
Inherits screen from file dump */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_scr_set )
{
2001-12-13 09:06:11 +00:00
char * str ;
int str_len ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " s " , & str , & str_len ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( scr_set ( str ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
2001-12-13 09:06:11 +00:00
/* {{{ proto int ncurses_mvaddch(int y, int x, int c)
2001-12-31 04:57:25 +00:00
Moves current position and add character */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_mvaddch )
{
2001-12-13 09:06:11 +00:00
long y , x , c ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " lll " , & y , & x , & c ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2001-12-13 09:06:11 +00:00
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( mvaddch ( y , x , c ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
2001-12-13 09:06:11 +00:00
/* {{{ proto int ncurses_mvaddchnstr(int y, int x, string s, int n)
2001-12-31 04:57:25 +00:00
Moves position and add attrributed string with specified length */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_mvaddchnstr )
{
2001-12-13 09:06:11 +00:00
long y , x , n ;
char * str ;
int str_len ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " llsl " , & y , & x , & str , & str_len , & n ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2001-12-13 09:06:11 +00:00
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( mvaddchnstr ( y , x , ( chtype * ) str , n ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
/* {{{ proto int ncurses_addchnstr(string s, int n)
2001-12-31 04:57:25 +00:00
Adds attributed string with specified length at current position */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_addchnstr )
{
2001-12-13 09:06:11 +00:00
long n ;
char * str ;
int str_len ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " sl " , & str , & str_len , & n ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2001-12-13 09:06:11 +00:00
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( addchnstr ( ( chtype * ) str , n ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
2001-12-13 09:06:11 +00:00
/* {{{ proto int ncurses_mvaddchstr(int y, int x, string s)
2001-12-31 04:57:25 +00:00
Moves position and add attributed string */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_mvaddchstr )
{
2001-12-13 09:06:11 +00:00
long y , x ;
char * str ;
int str_len ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " lls " , & y , & x , & str , & str_len ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2001-12-13 09:06:11 +00:00
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( mvaddchstr ( y , x , ( chtype * ) str ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
/* {{{ proto int ncurses_addchstr(string s)
2001-12-31 04:57:25 +00:00
Adds attributed string at current position */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_addchstr )
{
2001-12-13 09:06:11 +00:00
char * str ;
int str_len ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " s " , & str , & str_len ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( addchstr ( ( chtype * ) str ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
2001-12-13 09:06:11 +00:00
/* {{{ proto int ncurses_mvaddnstr(int y, int x, string s, int n)
2001-12-31 04:57:25 +00:00
Moves position and add string with specified length */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_mvaddnstr )
{
2001-12-13 09:06:11 +00:00
long y , x , n ;
char * str ;
int str_len ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " llsl " , & y , & x , & str , & str_len , & n ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2001-12-13 09:06:11 +00:00
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( mvaddnstr ( y , x , str , n ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
2001-12-13 09:06:11 +00:00
/* {{{ proto int ncurses_addnstr(string s, int n)
2001-12-31 04:57:25 +00:00
Adds string with specified length at current position */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_addnstr )
{
2001-12-13 09:06:11 +00:00
long n ;
char * str ;
int str_len ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " sl " , & str , & str_len , & n ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2001-12-13 09:06:11 +00:00
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( addnstr ( str , n ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
2001-12-13 09:06:11 +00:00
/* {{{ proto int ncurses_mvaddstr(int y, int x, string s)
2001-12-31 04:57:25 +00:00
Moves position and add string */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_mvaddstr )
{
2001-12-13 09:06:11 +00:00
long y , x ;
char * str ;
int str_len ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " lls " , & y , & x , & str , & str_len ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2001-12-13 09:06:11 +00:00
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( mvaddstr ( y , x , str ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
2001-12-13 09:06:11 +00:00
/* {{{ proto int ncurses_mvdelch(int y, int x)
2001-12-31 04:57:25 +00:00
Moves position and delete character , shift rest of line left */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_mvdelch )
{
2001-12-13 09:06:11 +00:00
long y , x ;
2001-09-17 21:54:25 +00:00
2003-12-21 18:46:15 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " ll " , & y , & x ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2001-12-13 09:06:11 +00:00
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( mvdelch ( y , x ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
2001-12-13 09:06:11 +00:00
/* {{{ proto int ncurses_mvgetch(int y, int x)
2001-12-31 04:57:25 +00:00
Moves position and get character at new position */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_mvgetch )
{
2001-12-13 09:06:11 +00:00
long y , x ;
2001-09-17 21:54:25 +00:00
2003-12-21 18:46:15 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " ll " , & y , & x ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2001-12-13 09:06:11 +00:00
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( mvgetch ( y , x ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
2001-12-13 09:06:11 +00:00
/* {{{ proto int ncurses_mvinch(int y, int x)
2001-12-31 04:57:25 +00:00
Moves position and get attributed character at new position */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_mvinch )
{
2001-12-13 09:06:11 +00:00
long y , x ;
2001-09-17 21:54:25 +00:00
2003-12-21 18:46:15 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " ll " , & y , & x ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2001-12-13 09:06:11 +00:00
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( mvinch ( y , x ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_insstr(string text)
2001-12-31 04:57:25 +00:00
Inserts string at current position , moving rest of line right */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_insstr )
{
2001-12-13 09:06:11 +00:00
char * str ;
int str_len ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " s " , & str , & str_len ) = = FAILURE ) {
2001-12-13 09:06:11 +00:00
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( insstr ( str ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
2002-12-24 17:20:33 +00:00
/* {{{ proto int ncurses_instr(string &buffer)
2001-12-25 23:30:55 +00:00
Reads string from terminal screen */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_instr )
{
2001-12-25 23:30:55 +00:00
ulong retval ;
2002-12-24 17:20:33 +00:00
zval * param ;
2001-12-13 09:06:11 +00:00
char * str ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " z " , & param ) = = FAILURE ) {
return ;
2001-12-13 09:06:11 +00:00
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-25 23:30:55 +00:00
str = ( char * ) emalloc ( COLS + 1 ) ;
retval = instr ( str ) ;
2002-12-24 17:20:33 +00:00
ZVAL_STRING ( param , str , strlen ( str ) ) ;
2001-12-25 23:30:55 +00:00
efree ( str ) ;
RETURN_LONG ( retval ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
2001-12-25 23:30:55 +00:00
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_mvhline(int y, int x, int attrchar, int n)
2001-12-31 04:57:25 +00:00
Sets new position and draw a horizontal line using an attributed character and max . n characters long */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_mvhline )
{
2001-12-13 09:06:11 +00:00
long i1 , i2 , i3 , i4 ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " llll " , & i1 , & i2 , & i3 , & i4 ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2001-12-13 09:06:11 +00:00
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( mvhline ( i1 , i2 , i3 , i4 ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_mvvline(int y, int x, int attrchar, int n)
2001-12-31 04:57:25 +00:00
Sets new position and draw a vertical line using an attributed character and max . n characters long */
2001-12-13 14:40:40 +00:00
PHP_FUNCTION ( ncurses_mvvline )
{
long i1 , i2 , i3 , i4 ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " llll " , & i1 , & i2 , & i3 , & i4 ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2001-12-13 14:40:40 +00:00
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 14:40:40 +00:00
RETURN_LONG ( mvvline ( i1 , i2 , i3 , i4 ) ) ;
}
/* }}} */
/* {{{ proto int ncurses_mvcur(int old_y,int old_x, int new_y, int new_x)
2001-12-31 04:57:25 +00:00
Moves cursor immediately */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_mvcur )
{
2001-12-13 09:06:11 +00:00
long i1 , i2 , i3 , i4 ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " llll " , & i1 , & i2 , & i3 , & i4 ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2001-12-13 09:06:11 +00:00
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( mvcur ( i1 , i2 , i3 , i4 ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_init_color(int color, int r, int g, int b)
2001-12-31 04:57:25 +00:00
Sets new RGB value for color */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_init_color )
{
2001-12-13 09:06:11 +00:00
long i1 , i2 , i3 , i4 ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " llll " , & i1 , & i2 , & i3 , & i4 ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2001-12-13 09:06:11 +00:00
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( init_color ( i1 , i2 , i3 , i4 ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
2002-10-30 02:54:48 +00:00
/* {{{ proto int ncurses_color_content(int color, int &r, int &g, int &b)
Gets the RGB value for color */
PHP_FUNCTION ( ncurses_color_content )
{
2002-12-24 17:20:33 +00:00
zval * r , * g , * b ;
2002-10-30 02:54:48 +00:00
short rv , gv , bv ;
int retval ;
2002-12-24 17:20:33 +00:00
long c ;
2002-10-30 02:54:48 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " lzzz " , & c , & r , & g , & b ) = = FAILURE ) {
return ;
2002-10-30 02:54:48 +00:00
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2002-10-30 02:54:48 +00:00
2002-12-24 17:20:33 +00:00
retval = color_content ( c , & rv , & gv , & bv ) ;
2002-10-30 02:54:48 +00:00
2002-12-24 17:20:33 +00:00
ZVAL_LONG ( r , rv ) ;
ZVAL_LONG ( g , gv ) ;
ZVAL_LONG ( b , bv ) ;
2002-10-30 02:54:48 +00:00
RETURN_LONG ( retval ) ;
}
/* }}} */
/* {{{ proto int ncurses_pair_content(int pair, int &f, int &b)
Gets the RGB value for color */
PHP_FUNCTION ( ncurses_pair_content )
{
2002-12-24 17:20:33 +00:00
zval * f , * b ;
2002-10-30 02:54:48 +00:00
short fv , bv ;
int retval ;
2002-12-24 17:20:33 +00:00
long p ;
2002-10-30 02:54:48 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " lzz " , & p , & f , & b ) = = FAILURE ) {
return ;
2002-10-30 02:54:48 +00:00
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2002-10-30 02:54:48 +00:00
2002-12-24 17:20:33 +00:00
retval = pair_content ( p , & fv , & bv ) ;
2002-10-30 02:54:48 +00:00
2002-12-24 17:20:33 +00:00
ZVAL_LONG ( f , fv ) ;
ZVAL_LONG ( b , bv ) ;
2002-10-30 02:54:48 +00:00
RETURN_LONG ( retval ) ;
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_border(int left, int right, int top, int bottom, int tl_corner, int tr_corner, int bl_corner, int br_corner)
2001-12-31 04:57:25 +00:00
Draws a border around the screen using attributed characters */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_border )
{
2001-12-13 09:06:11 +00:00
long i1 , i2 , i3 , i4 , i5 , i6 , i7 , i8 ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " llllllll " , & i1 , & i2 , & i3 , & i4 , & i5 , & i6 , & i7 , & i8 ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2001-12-13 09:06:11 +00:00
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( border ( i1 , i2 , i3 , i4 , i5 , i6 , i7 , i8 ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
2002-09-27 22:33:14 +00:00
/* {{{ proto int ncurses_wborder(resource window, int left, int right, int top, int bottom, int tl_corner, int tr_corner, int bl_corner, int br_corner)
Draws a border around the window using attributed characters */
PHP_FUNCTION ( ncurses_wborder )
{
long i1 , i2 , i3 , i4 , i5 , i6 , i7 , i8 ;
zval * handle ;
WINDOW * * win ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " rllllllll " , & handle , & i1 , & i2 , & i3 , & i4 , & i5 , & i6 , & i7 , & i8 ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2002-09-27 22:33:14 +00:00
}
2002-12-24 17:20:33 +00:00
FETCH_WINRES ( win , & handle ) ;
2002-09-27 22:33:14 +00:00
RETURN_LONG ( wborder ( * win , i1 , i2 , i3 , i4 , i5 , i6 , i7 , i8 ) ) ;
}
/* }}} */
2002-12-24 17:20:33 +00:00
# ifdef HAVE_NCURSES_ASSUME_DEFAULT_COLORS
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_assume_default_colors(int fg, int bg)
2001-12-31 04:57:25 +00:00
Defines default colors for color 0 */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_assume_default_colors )
{
2001-12-13 09:06:11 +00:00
long i1 , i2 ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " ll " , & i1 , & i2 ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2001-12-13 09:06:11 +00:00
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( assume_default_colors ( i1 , i2 ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
2002-12-24 17:20:33 +00:00
# endif
2001-09-17 21:54:25 +00:00
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_define_key(string definition, int keycode)
2001-12-31 04:57:25 +00:00
Defines a keycode */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_define_key )
{
2001-12-13 09:06:11 +00:00
long n ;
char * str ;
int str_len ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " sl " , & str , & str_len , & n ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2001-12-13 09:06:11 +00:00
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( define_key ( str , n ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_hline(int charattr, int n)
2001-12-31 04:57:25 +00:00
Draws a horizontal line at current position using an attributed character and max . n characters long */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_hline )
{
2001-12-13 09:06:11 +00:00
long i1 , i2 ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " ll " , & i1 , & i2 ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2001-12-13 09:06:11 +00:00
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( hline ( i1 , i2 ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
2001-12-13 14:40:40 +00:00
/* {{{ proto int ncurses_vline(int charattr, int n)
2001-12-31 04:57:25 +00:00
Draws a vertical line at current position using an attributed character and max . n characters long */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_vline )
{
2001-12-13 09:06:11 +00:00
long i1 , i2 ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " ll " , & i1 , & i2 ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2001-12-13 09:06:11 +00:00
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( vline ( i1 , i2 ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
2002-09-27 22:33:14 +00:00
/* {{{ proto int ncurses_whline(resource window, int charattr, int n)
Draws a horizontal line in a window at current position using an attributed character and max . n characters long */
PHP_FUNCTION ( ncurses_whline )
{
long i1 , i2 ;
zval * handle ;
WINDOW * * win ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " rll " , & handle , & i1 , & i2 ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2002-09-27 22:33:14 +00:00
}
2002-12-24 17:20:33 +00:00
FETCH_WINRES ( win , & handle ) ;
2002-09-27 22:33:14 +00:00
RETURN_LONG ( whline ( * win , i1 , i2 ) ) ;
}
/* }}} */
/* {{{ proto int ncurses_wvline(resource window, int charattr, int n)
Draws a vertical line in a window at current position using an attributed character and max . n characters long */
PHP_FUNCTION ( ncurses_wvline )
{
long i1 , i2 ;
zval * handle ;
WINDOW * * win ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " rll " , & handle , & i1 , & i2 ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2002-09-27 22:33:14 +00:00
}
2002-12-24 17:20:33 +00:00
FETCH_WINRES ( win , & handle ) ;
2002-09-27 22:33:14 +00:00
RETURN_LONG ( wvline ( * win , i1 , i2 ) ) ;
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto int ncurses_keyok(int keycode, int enable)
2001-12-31 04:57:25 +00:00
Enables or disable a keycode */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_keyok )
{
2001-12-13 09:06:11 +00:00
long i , b ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " ll " , & i , & b ) = = FAILURE ) {
2002-12-22 19:44:01 +00:00
return ;
2001-12-13 09:06:11 +00:00
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-13 09:06:11 +00:00
RETURN_LONG ( hline ( i , b ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
/* {{{ proto int ncurses_mvwaddstr(resource window, int y, int x, string text)
2001-12-31 04:57:25 +00:00
Adds string at new position in window */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_mvwaddstr )
{
2002-12-24 17:20:33 +00:00
zval * handle ;
long y , x ;
int text_len ;
char * text ;
2001-12-13 09:06:11 +00:00
WINDOW * * w ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " rlls " , & handle , & y , & x , & text , & text_len ) = = FAILURE ) {
return ;
2001-12-13 09:06:11 +00:00
}
2002-12-24 17:20:33 +00:00
FETCH_WINRES ( w , & handle ) ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
RETURN_LONG ( mvwaddstr ( * w , y , x , text ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
/* {{{ proto int ncurses_wrefresh(resource window)
2001-12-31 04:57:25 +00:00
Refreshes window on terminal screen */
2001-09-17 21:54:25 +00:00
PHP_FUNCTION ( ncurses_wrefresh )
{
2002-12-24 17:20:33 +00:00
zval * handle ;
2001-12-13 09:06:11 +00:00
WINDOW * * w ;
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " r " , & handle ) = = FAILURE ) {
return ;
2001-12-13 09:06:11 +00:00
}
2001-09-17 21:54:25 +00:00
2002-12-24 17:20:33 +00:00
FETCH_WINRES ( w , & handle ) ;
2001-09-17 21:54:25 +00:00
2001-12-13 09:06:11 +00:00
RETURN_LONG ( wrefresh ( * w ) ) ;
2001-09-17 21:54:25 +00:00
}
/* }}} */
2001-12-27 08:49:12 +00:00
/* {{{ proto string ncurses_termname(void)
Returns terminal name */
2001-12-25 23:30:55 +00:00
PHP_FUNCTION ( ncurses_termname )
{
char temp [ 15 ] ;
2002-12-24 17:20:33 +00:00
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2002-12-24 17:20:33 +00:00
2002-12-24 17:33:33 +00:00
strlcpy ( temp , termname ( ) , sizeof ( temp ) ) ;
2002-12-24 17:20:33 +00:00
2001-12-25 23:30:55 +00:00
RETURN_STRINGL ( temp , strlen ( temp ) , 1 ) ;
}
/* }}} */
2001-12-27 08:49:12 +00:00
/* {{{ proto string ncurses_longname(void)
Returns terminal description */
2001-12-25 23:30:55 +00:00
PHP_FUNCTION ( ncurses_longname )
{
char temp [ 128 ] ;
2002-12-24 17:20:33 +00:00
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2002-12-24 17:20:33 +00:00
2002-12-24 17:33:33 +00:00
strlcpy ( temp , longname ( ) , sizeof ( temp ) ) ;
2002-12-24 17:20:33 +00:00
2001-12-25 23:30:55 +00:00
RETURN_STRINGL ( temp , strlen ( temp ) , 1 ) ;
}
/* }}} */
2002-09-28 17:03:02 +00:00
/* {{{ proto int ncurses_mousemask(int newmask, int &oldmask)
2001-12-27 08:49:12 +00:00
Returns and sets mouse options */
2001-12-25 23:30:55 +00:00
PHP_FUNCTION ( ncurses_mousemask )
{
ulong oldmask ;
ulong retval ;
2002-12-24 17:20:33 +00:00
zval * param ;
long newmask ;
2001-12-25 23:30:55 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " lz " , & newmask , & param ) = = FAILURE ) {
return ;
2001-12-25 23:30:55 +00:00
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-25 23:30:55 +00:00
2002-12-24 17:20:33 +00:00
retval = mousemask ( newmask , & oldmask ) ;
2001-12-25 23:30:55 +00:00
2002-12-24 17:20:33 +00:00
ZVAL_LONG ( param , oldmask ) ;
2001-12-25 23:30:55 +00:00
RETURN_LONG ( retval ) ;
}
/* }}} */
2002-12-24 17:20:33 +00:00
/* {{{ proto bool ncurses_getmouse(array &mevent)
2003-06-16 16:36:51 +00:00
Reads mouse event from queue . The content of mevent is cleared before new data is added . */
2001-12-28 10:35:53 +00:00
PHP_FUNCTION ( ncurses_getmouse )
{
2002-12-24 17:20:33 +00:00
zval * arg ;
2001-12-28 10:35:53 +00:00
MEVENT mevent ;
ulong retval ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " z " , & arg ) = = FAILURE ) {
return ;
2002-09-28 17:03:02 +00:00
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2002-12-24 17:20:33 +00:00
pval_destructor ( arg ) ;
array_init ( arg ) ;
2001-12-28 10:35:53 +00:00
retval = getmouse ( & mevent ) ;
2002-12-24 17:20:33 +00:00
add_assoc_long ( arg , " id " , mevent . id ) ;
add_assoc_long ( arg , " x " , mevent . x ) ;
add_assoc_long ( arg , " y " , mevent . y ) ;
add_assoc_long ( arg , " z " , mevent . z ) ;
add_assoc_long ( arg , " mmask " , mevent . bstate ) ;
2001-12-28 10:35:53 +00:00
2002-09-28 17:03:02 +00:00
RETURN_BOOL ( retval = = 0 ) ;
2001-12-28 10:35:53 +00:00
}
/* }}} */
/* {{{ proto int ncurses_ungetmouse(array mevent)
2001-12-31 04:57:25 +00:00
Pushes mouse event to queue */
2001-12-28 10:35:53 +00:00
PHP_FUNCTION ( ncurses_ungetmouse )
{
2002-12-24 17:20:33 +00:00
zval * arg , * * pvalue ;
2001-12-28 10:35:53 +00:00
MEVENT mevent ;
ulong retval ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " a " , & arg ) = = FAILURE ) {
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-28 10:35:53 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_hash_find ( Z_ARRVAL_P ( arg ) , " id " , sizeof ( " id " ) , ( void * * ) & pvalue ) = = SUCCESS ) {
2001-12-28 10:35:53 +00:00
convert_to_long_ex ( pvalue ) ;
mevent . id = Z_LVAL_PP ( pvalue ) ;
2002-12-24 17:20:33 +00:00
}
2001-12-28 10:35:53 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_hash_find ( Z_ARRVAL_P ( arg ) , " x " , sizeof ( " x " ) , ( void * * ) & pvalue ) = = SUCCESS ) {
2001-12-28 10:35:53 +00:00
convert_to_long_ex ( pvalue ) ;
mevent . x = Z_LVAL_PP ( pvalue ) ;
2002-12-24 17:20:33 +00:00
}
2001-12-28 10:35:53 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_hash_find ( Z_ARRVAL_P ( arg ) , " y " , sizeof ( " y " ) , ( void * * ) & pvalue ) = = SUCCESS ) {
2001-12-28 10:35:53 +00:00
convert_to_long_ex ( pvalue ) ;
mevent . y = Z_LVAL_PP ( pvalue ) ;
2002-12-24 17:20:33 +00:00
}
2001-12-28 10:35:53 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_hash_find ( Z_ARRVAL_P ( arg ) , " z " , sizeof ( " z " ) , ( void * * ) & pvalue ) = = SUCCESS ) {
2001-12-28 10:35:53 +00:00
convert_to_long_ex ( pvalue ) ;
mevent . z = Z_LVAL_PP ( pvalue ) ;
2002-12-24 17:20:33 +00:00
}
2001-12-28 10:35:53 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_hash_find ( Z_ARRVAL_P ( arg ) , " mmask " , sizeof ( " mmask " ) , ( void * * ) & pvalue ) = = SUCCESS ) {
2001-12-28 10:35:53 +00:00
convert_to_long_ex ( pvalue ) ;
mevent . bstate = Z_LVAL_PP ( pvalue ) ;
2002-12-24 17:20:33 +00:00
}
2001-12-28 10:35:53 +00:00
retval = ungetmouse ( & mevent ) ;
RETURN_LONG ( retval ) ;
}
/* }}} */
2002-12-24 17:20:33 +00:00
/* {{{ proto bool ncurses_mouse_trafo(int &y, int &x, bool toscreen)
2001-12-31 04:57:25 +00:00
Transforms coordinates */
2001-12-28 10:35:53 +00:00
PHP_FUNCTION ( ncurses_mouse_trafo )
{
2002-12-24 17:20:33 +00:00
zval * x , * y ;
zend_bool toscreen ;
2002-08-22 12:15:20 +00:00
int nx , ny , retval ;
2001-12-28 10:35:53 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " zzb " , & y , & x , & toscreen ) = = FAILURE ) {
return ;
}
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2001-12-28 10:35:53 +00:00
2002-12-24 17:20:33 +00:00
convert_to_long ( y ) ;
convert_to_long ( x ) ;
nx = Z_LVAL_P ( x ) ;
ny = Z_LVAL_P ( y ) ;
2001-12-28 10:35:53 +00:00
2002-12-24 17:20:33 +00:00
retval = mouse_trafo ( & ny , & nx , toscreen ) ;
2001-12-28 10:35:53 +00:00
2002-12-24 17:20:33 +00:00
ZVAL_LONG ( x , nx ) ;
ZVAL_LONG ( y , ny ) ;
2001-12-28 10:35:53 +00:00
RETURN_BOOL ( retval ) ;
}
/* }}} */
2002-12-24 17:20:33 +00:00
/* {{{ proto bool ncurses_wmouse_trafo(resource window, int &y, int &x, bool toscreen)
2001-12-31 04:57:25 +00:00
Transforms window / stdscr coordinates */
2001-12-28 10:35:53 +00:00
PHP_FUNCTION ( ncurses_wmouse_trafo )
{
2002-12-24 17:20:33 +00:00
zval * handle , * x , * y ;
2002-08-22 12:15:20 +00:00
int nx , ny , retval ;
2001-12-28 10:35:53 +00:00
WINDOW * * win ;
2002-12-24 17:20:33 +00:00
zend_bool toscreen ;
2001-12-28 10:35:53 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " rzzb " , & handle , & y , & x , & toscreen ) = = FAILURE ) {
return ;
2002-09-28 17:03:02 +00:00
}
2001-12-28 10:35:53 +00:00
2002-12-24 17:20:33 +00:00
FETCH_WINRES ( win , & handle ) ;
2001-12-28 10:35:53 +00:00
2002-12-24 17:20:33 +00:00
convert_to_long ( x ) ;
convert_to_long ( y ) ;
2001-12-28 10:35:53 +00:00
2002-12-24 17:20:33 +00:00
nx = Z_LVAL_P ( x ) ;
ny = Z_LVAL_P ( y ) ;
2001-12-28 10:35:53 +00:00
2002-12-24 17:20:33 +00:00
retval = wmouse_trafo ( * win , & ny , & nx , toscreen ) ;
2001-12-28 10:35:53 +00:00
2002-12-24 17:20:33 +00:00
ZVAL_LONG ( x , nx ) ;
ZVAL_LONG ( y , ny ) ;
2001-12-28 10:35:53 +00:00
RETURN_BOOL ( retval ) ;
}
/* }}} */
2002-09-28 22:50:23 +00:00
/* {{{ proto void ncurses_getyx(resource window, int &y, int &x)
Returns the current cursor position for a window */
PHP_FUNCTION ( ncurses_getyx )
{
2002-12-24 17:20:33 +00:00
zval * handle , * x , * y ;
2002-09-28 22:50:23 +00:00
WINDOW * * win ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " rzz " , & handle , & y , & x ) = = FAILURE ) {
return ;
2002-09-28 22:50:23 +00:00
}
2002-12-24 17:20:33 +00:00
FETCH_WINRES ( win , & handle ) ;
2002-09-28 22:50:23 +00:00
2002-12-24 17:20:33 +00:00
convert_to_long ( x ) ;
convert_to_long ( y ) ;
2002-09-28 22:50:23 +00:00
2002-12-24 17:20:33 +00:00
getyx ( * win , Z_LVAL_P ( y ) , Z_LVAL_P ( x ) ) ;
2002-09-28 22:50:23 +00:00
}
/* }}} */
2001-12-28 10:35:53 +00:00
2002-10-27 18:15:35 +00:00
/* {{{ proto void ncurses_getmaxyx(resource window, int &y, int &x)
Returns the size of a window */
PHP_FUNCTION ( ncurses_getmaxyx )
{
2002-12-24 17:20:33 +00:00
zval * handle , * x , * y ;
2002-10-27 18:15:35 +00:00
WINDOW * * win ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " rzz " , & handle , & y , & x ) = = FAILURE ) {
return ;
2002-10-27 18:15:35 +00:00
}
2002-12-24 17:20:33 +00:00
FETCH_WINRES ( win , & handle ) ;
2002-10-27 18:15:35 +00:00
2002-12-24 17:20:33 +00:00
convert_to_long ( x ) ;
convert_to_long ( y ) ;
2002-10-27 18:15:35 +00:00
2002-12-24 17:20:33 +00:00
getmaxyx ( * win , Z_LVAL_P ( y ) , Z_LVAL_P ( x ) ) ;
2002-10-27 18:15:35 +00:00
}
/* }}} */
2001-12-31 04:57:25 +00:00
/* {{{ proto int ncurses_wmove(resource window, int y, int x)
Moves windows output position */
2001-12-27 08:49:12 +00:00
PHP_FUNCTION ( ncurses_wmove )
{
2002-12-24 17:20:33 +00:00
zval * handle , * x , * y ;
2001-12-27 08:49:12 +00:00
WINDOW * * win ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " rzz " , & handle , & y , & x ) = = FAILURE ) {
return ;
}
FETCH_WINRES ( win , & handle ) ;
2001-12-27 08:49:12 +00:00
2002-12-24 17:20:33 +00:00
convert_to_long ( x ) ;
convert_to_long ( y ) ;
2001-12-27 08:49:12 +00:00
2002-12-24 17:20:33 +00:00
RETURN_LONG ( wmove ( * win , Z_LVAL_P ( y ) , Z_LVAL_P ( x ) ) ) ;
2001-12-27 08:49:12 +00:00
}
2002-09-27 17:03:53 +00:00
/* }}} */
2001-12-27 08:49:12 +00:00
2001-12-31 04:57:25 +00:00
/* {{{ proto int ncurses_keypad(resource window, bool bf)
Turns keypad on or off */
2001-12-27 08:49:12 +00:00
PHP_FUNCTION ( ncurses_keypad )
{
2002-12-24 17:20:33 +00:00
zval * handle ;
zend_bool bf ;
2001-12-27 08:49:12 +00:00
WINDOW * * win ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " rb " , & handle , & bf ) = = FAILURE ) {
return ;
}
2001-12-27 08:49:12 +00:00
2002-12-24 17:20:33 +00:00
FETCH_WINRES ( win , & handle ) ;
2001-12-27 08:49:12 +00:00
2002-12-24 17:20:33 +00:00
RETURN_LONG ( keypad ( * win , bf ) ) ;
2001-12-27 08:49:12 +00:00
}
/* }}} */
2002-12-24 17:20:33 +00:00
# ifdef HAVE_NCURSES_COLOR_SET
2001-12-31 04:57:25 +00:00
/* {{{ proto int ncurses_wcolor_set(resource window, int color_pair)
Sets windows color pairings */
2001-12-27 08:49:12 +00:00
PHP_FUNCTION ( ncurses_wcolor_set )
{
2002-12-24 17:20:33 +00:00
zval * handle ;
long color_pair ;
2001-12-27 08:49:12 +00:00
WINDOW * * win ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " rl " , & handle , & color_pair ) = = FAILURE ) {
return ;
}
2001-12-27 08:49:12 +00:00
2002-12-24 17:20:33 +00:00
FETCH_WINRES ( win , & handle ) ;
2001-12-27 08:49:12 +00:00
2002-12-24 17:20:33 +00:00
RETURN_LONG ( wcolor_set ( * win , color_pair , 0 ) ) ;
2001-12-27 08:49:12 +00:00
}
/* }}} */
2002-12-24 17:20:33 +00:00
# endif
2001-12-27 08:49:12 +00:00
2001-12-31 04:57:25 +00:00
/* {{{ proto int ncurses_wclear(resource window)
Clears window */
2001-12-27 08:49:12 +00:00
PHP_FUNCTION ( ncurses_wclear )
{
2002-12-24 17:20:33 +00:00
zval * handle ;
2001-12-27 08:49:12 +00:00
WINDOW * * win ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " r " , & handle ) = = FAILURE ) {
return ;
}
2001-12-27 08:49:12 +00:00
2002-12-24 17:20:33 +00:00
FETCH_WINRES ( win , & handle ) ;
2001-12-27 08:49:12 +00:00
RETURN_LONG ( wclear ( * win ) ) ;
}
/* }}} */
2001-12-31 04:57:25 +00:00
/* {{{ proto int ncurses_wnoutrefresh(resource window)
Copies window to virtual screen */
2001-12-27 08:49:12 +00:00
PHP_FUNCTION ( ncurses_wnoutrefresh )
{
2002-12-24 17:20:33 +00:00
zval * handle ;
2001-12-27 08:49:12 +00:00
WINDOW * * win ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " r " , & handle ) = = FAILURE ) {
return ;
}
2001-12-27 08:49:12 +00:00
2002-12-24 17:20:33 +00:00
FETCH_WINRES ( win , & handle ) ;
2001-12-27 08:49:12 +00:00
RETURN_LONG ( wnoutrefresh ( * win ) ) ;
}
/* }}} */
2001-12-31 04:57:25 +00:00
/* {{{ proto int ncurses_waddstr(resource window, string str [, int n])
Outputs text at current postion in window */
2001-12-27 08:49:12 +00:00
PHP_FUNCTION ( ncurses_waddstr )
{
2002-12-24 17:20:33 +00:00
zval * handle ;
char * str ;
int str_len ;
long n = 0 ;
2001-12-27 08:49:12 +00:00
WINDOW * * win ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " rs|l " , & handle , & str , & str_len , & n ) = = FAILURE ) {
return ;
}
2001-12-27 08:49:12 +00:00
2002-12-24 17:20:33 +00:00
FETCH_WINRES ( win , & handle ) ;
if ( ! n ) {
RETURN_LONG ( waddstr ( * win , str ) ) ;
} else {
RETURN_LONG ( waddnstr ( * win , str , n ) ) ;
}
2001-12-27 08:49:12 +00:00
}
/* }}} */
2001-12-31 04:57:25 +00:00
/* {{{ proto int ncurses_wgetch(resource window)
Reads a character from keyboard ( window ) */
2001-12-27 08:49:12 +00:00
PHP_FUNCTION ( ncurses_wgetch )
{
2002-12-24 17:20:33 +00:00
zval * handle ;
2001-12-27 08:49:12 +00:00
WINDOW * * win ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " r " , & handle ) = = FAILURE ) {
return ;
}
2001-12-27 08:49:12 +00:00
2002-12-24 17:20:33 +00:00
FETCH_WINRES ( win , & handle ) ;
2001-12-27 08:49:12 +00:00
RETURN_LONG ( wgetch ( * win ) ) ;
}
/* }}} */
2003-03-17 13:11:19 +00:00
/* {{{ proto int ncurses_wattroff(resource window, int attrs)
2002-09-27 17:03:53 +00:00
Turns off attributes for a window */
PHP_FUNCTION ( ncurses_wattroff )
{
zval * handle ;
WINDOW * * win ;
long attrs ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " rl " , & handle , & attrs ) = = FAILURE ) {
return ;
}
FETCH_WINRES ( win , & handle ) ;
RETURN_LONG ( wattroff ( * win , attrs ) ) ;
}
/* }}} */
2003-03-17 13:11:19 +00:00
/* {{{ proto int ncurses_wattron(resource window, int attrs)
2002-09-27 17:03:53 +00:00
Turns on attributes for a window */
PHP_FUNCTION ( ncurses_wattron )
{
zval * handle ;
WINDOW * * win ;
long attrs ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " rl " , & handle , & attrs ) = = FAILURE ) {
return ;
}
FETCH_WINRES ( win , & handle ) ;
RETURN_LONG ( wattron ( * win , attrs ) ) ;
}
/* }}} */
2003-03-17 13:11:19 +00:00
/* {{{ proto int ncurses_wattrset(resource window, int attrs)
2002-09-27 17:03:53 +00:00
Set the attributes for a window */
PHP_FUNCTION ( ncurses_wattrset )
{
zval * handle ;
WINDOW * * win ;
long attrs ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " rl " , & handle , & attrs ) = = FAILURE ) {
return ;
}
FETCH_WINRES ( win , & handle ) ;
RETURN_LONG ( wattrset ( * win , attrs ) ) ;
}
/* }}} */
2003-03-17 13:11:19 +00:00
/* {{{ proto int ncurses_wstandend(resource window)
2002-09-27 17:03:53 +00:00
End standout mode for a window */
PHP_FUNCTION ( ncurses_wstandend )
{
zval * handle ;
WINDOW * * win ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " r " , & handle ) = = FAILURE ) {
return ;
}
FETCH_WINRES ( win , & handle ) ;
RETURN_LONG ( wstandend ( * win ) ) ;
}
/* }}} */
2003-03-17 13:11:19 +00:00
/* {{{ proto int ncurses_wstandout(resource window)
2002-09-27 17:03:53 +00:00
Enter standout mode for a window */
PHP_FUNCTION ( ncurses_wstandout )
{
zval * handle ;
WINDOW * * win ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " r " , & handle ) = = FAILURE ) {
return ;
}
FETCH_WINRES ( win , & handle ) ;
RETURN_LONG ( wstandout ( * win ) ) ;
}
/* }}} */
# if HAVE_NCURSES_PANEL
/* {{{ proto resource ncurses_new_panel(resource window)
Create a new panel and associate it with window */
PHP_FUNCTION ( ncurses_new_panel )
{
2002-12-24 17:20:33 +00:00
zval * handle ;
2002-09-27 17:03:53 +00:00
WINDOW * * win ;
2002-12-22 20:16:37 +00:00
PANEL * * panel ;
2002-09-27 17:03:53 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " r " , & handle ) = = FAILURE ) {
return ;
}
2002-09-27 17:03:53 +00:00
2002-12-24 17:20:33 +00:00
FETCH_WINRES ( win , & handle ) ;
2002-09-27 17:03:53 +00:00
2002-12-22 20:16:37 +00:00
panel = ( PANEL * * ) emalloc ( sizeof ( PANEL * ) ) ;
2002-09-27 17:03:53 +00:00
* panel = new_panel ( * win ) ;
if ( * panel = = NULL ) {
efree ( panel ) ;
RETURN_FALSE ;
} else {
2002-09-29 22:55:09 +00:00
long id = ZEND_REGISTER_RESOURCE ( return_value , panel , le_ncurses_panels ) ;
set_panel_userptr ( * panel , ( void * ) id ) ;
2002-09-27 17:03:53 +00:00
}
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto bool ncurses_del_panel(resource panel)
2002-09-27 17:03:53 +00:00
Remove panel from the stack and delete it ( but not the associated window ) */
PHP_FUNCTION ( ncurses_del_panel )
{
2002-12-24 17:20:33 +00:00
zval * handle ;
2002-09-27 17:03:53 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " r " , & handle ) = = FAILURE ) {
return ;
}
2003-06-14 13:31:51 +00:00
zend_list_delete ( Z_RESVAL_P ( handle ) ) ;
2002-09-27 17:03:53 +00:00
2003-06-06 19:02:30 +00:00
RETURN_TRUE ;
2002-09-27 17:03:53 +00:00
}
/* }}} */
/* {{{ proto int ncurses_hide_panel(resource panel)
Remove panel from the stack , making it invisible */
PHP_FUNCTION ( ncurses_hide_panel )
{
2002-12-24 17:20:33 +00:00
zval * handle ;
2002-09-27 17:03:53 +00:00
PANEL * * panel ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " r " , & handle ) = = FAILURE ) {
return ;
}
FETCH_PANEL ( panel , & handle ) ;
2002-09-27 17:03:53 +00:00
RETURN_LONG ( hide_panel ( * panel ) ) ;
}
/* }}} */
/* {{{ proto int ncurses_show_panel(resource panel)
Places an invisible panel on top of the stack , making it visible */
PHP_FUNCTION ( ncurses_show_panel )
{
2002-12-24 17:20:33 +00:00
zval * handle ;
2002-09-27 17:03:53 +00:00
PANEL * * panel ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " r " , & handle ) = = FAILURE ) {
return ;
}
2002-09-27 17:03:53 +00:00
2002-12-24 17:20:33 +00:00
FETCH_PANEL ( panel , & handle ) ;
2002-09-27 17:03:53 +00:00
RETURN_LONG ( show_panel ( * panel ) ) ;
}
/* }}} */
/* {{{ proto int ncurses_top_panel(resource panel)
Moves a visible panel to the top of the stack */
PHP_FUNCTION ( ncurses_top_panel )
{
2002-12-24 17:20:33 +00:00
zval * handle ;
2002-09-27 17:03:53 +00:00
PANEL * * panel ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " r " , & handle ) = = FAILURE ) {
return ;
}
2002-09-27 17:03:53 +00:00
2002-12-24 17:20:33 +00:00
FETCH_PANEL ( panel , & handle ) ;
2002-09-27 17:03:53 +00:00
RETURN_LONG ( top_panel ( * panel ) ) ;
}
/* }}} */
/* {{{ proto int ncurses_bottom_panel(resource panel)
Moves a visible panel to the bottom of the stack */
PHP_FUNCTION ( ncurses_bottom_panel )
{
2002-12-24 17:20:33 +00:00
zval * handle ;
2002-09-27 17:03:53 +00:00
PANEL * * panel ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " r " , & handle ) = = FAILURE ) {
return ;
}
2002-09-27 17:03:53 +00:00
2002-12-24 17:20:33 +00:00
FETCH_PANEL ( panel , & handle ) ;
2002-09-27 17:03:53 +00:00
RETURN_LONG ( bottom_panel ( * panel ) ) ;
}
/* }}} */
/* {{{ proto int ncurses_move_panel(resource panel, int startx, int starty)
Moves a panel so that it ' s upper - left corner is at [ startx , starty ] */
PHP_FUNCTION ( ncurses_move_panel )
{
zval * handle ;
PANEL * * panel ;
long startx , starty ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " rll " , & handle , & startx , & starty ) = = FAILURE ) {
2002-09-27 17:03:53 +00:00
return ;
}
FETCH_PANEL ( panel , & handle ) ;
RETURN_LONG ( move_panel ( * panel , startx , starty ) ) ;
}
/* }}} */
/* {{{ proto int ncurses_replace_panel(resource panel, resource window)
Replaces the window associated with panel */
PHP_FUNCTION ( ncurses_replace_panel )
{
zval * phandle , * whandle ;
PANEL * * panel ;
WINDOW * * window ;
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " rr " , & phandle , & whandle ) = = FAILURE ) {
2002-09-27 17:03:53 +00:00
return ;
}
FETCH_PANEL ( panel , & phandle ) ;
FETCH_WINRES ( window , & whandle ) ;
RETURN_LONG ( replace_panel ( * panel , * window ) ) ;
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto resource ncurses_panel_above(resource panel)
2002-09-27 17:03:53 +00:00
Returns the panel above panel . If panel is null , returns the bottom panel in the stack */
PHP_FUNCTION ( ncurses_panel_above )
{
zval * phandle = NULL ;
PANEL * * panel ;
2002-09-29 22:55:09 +00:00
PANEL * above ;
2002-09-27 17:03:53 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " r! " , & phandle ) = = FAILURE ) {
2002-09-27 17:03:53 +00:00
return ;
}
if ( phandle ) {
FETCH_PANEL ( panel , & phandle ) ;
2002-09-29 22:55:09 +00:00
above = panel_above ( * panel ) ;
2002-09-27 17:03:53 +00:00
} else {
2002-09-29 22:55:09 +00:00
above = panel_above ( ( PANEL * ) 0 ) ;
2002-09-27 17:03:53 +00:00
}
2002-09-29 22:55:09 +00:00
if ( above ) {
long id = ( long ) panel_userptr ( above ) ;
zend_list_addref ( id ) ;
RETURN_RESOURCE ( id ) ;
} else {
2002-09-27 17:03:53 +00:00
RETURN_FALSE ;
}
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto resource ncurses_panel_below(resource panel)
2002-09-27 17:03:53 +00:00
Returns the panel below panel . If panel is null , returns the top panel in the stack */
PHP_FUNCTION ( ncurses_panel_below )
{
zval * phandle = NULL ;
PANEL * * panel ;
2002-09-29 22:55:09 +00:00
PANEL * below ;
2002-09-27 17:03:53 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " r! " , & phandle ) = = FAILURE ) {
2002-09-27 17:03:53 +00:00
return ;
}
if ( phandle ) {
FETCH_PANEL ( panel , & phandle ) ;
2002-09-29 22:55:09 +00:00
below = panel_below ( * panel ) ;
2002-09-27 17:03:53 +00:00
} else {
2002-09-29 22:55:09 +00:00
below = panel_below ( ( PANEL * ) 0 ) ;
2002-09-27 17:03:53 +00:00
}
2002-09-29 22:55:09 +00:00
if ( below ) {
long id = ( long ) panel_userptr ( below ) ;
zend_list_addref ( id ) ;
RETURN_RESOURCE ( id ) ;
} else {
2002-09-27 17:03:53 +00:00
RETURN_FALSE ;
}
}
/* }}} */
2003-06-16 16:36:51 +00:00
/* {{{ proto resource ncurses_panel_window(resource panel)
2002-09-27 17:03:53 +00:00
Returns the window associated with panel */
PHP_FUNCTION ( ncurses_panel_window )
{
zval * phandle = NULL ;
PANEL * * panel ;
2002-12-22 20:16:37 +00:00
WINDOW * * win ;
2002-09-27 17:03:53 +00:00
2002-12-24 17:20:33 +00:00
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " r " , & phandle ) = = FAILURE ) {
2002-09-27 17:03:53 +00:00
return ;
}
FETCH_PANEL ( panel , & phandle ) ;
2002-12-22 20:16:37 +00:00
win = ( WINDOW * * ) emalloc ( sizeof ( WINDOW * ) ) ;
2002-09-27 17:03:53 +00:00
* win = panel_window ( * panel ) ;
if ( * win = = NULL ) {
efree ( win ) ;
RETURN_FALSE ;
}
ZEND_REGISTER_RESOURCE ( return_value , win , le_ncurses_windows ) ;
}
/* }}} */
/* {{{ proto void ncurses_update_panels(void)
Refreshes the virtual screen to reflect the relations between panels in the stack . */
PHP_FUNCTION ( ncurses_update_panels )
{
2002-12-22 19:44:01 +00:00
IS_NCURSES_INITIALIZED ( ) ;
2002-09-27 17:03:53 +00:00
update_panels ( ) ;
}
/* }}} */
# endif /* HAVE_NCURSES_PANEL */
2001-12-27 08:49:12 +00:00
2001-09-17 22:00:38 +00:00
/*
* Local variables :
* tab - width : 4
* c - basic - offset : 4
* End :
* vim600 : sw = 4 ts = 4 fdm = marker
* vim < 600 : sw = 4 ts = 4
*/