wez Tue Oct 29 21:54:48 2002 EDT Modified files: /php4/ext/ncurses ncurses_fe.c ncurses_functions.c php_ncurses_fe.h Log: And some more ncurses functions. Index: php4/ext/ncurses/ncurses_fe.c diff -u php4/ext/ncurses/ncurses_fe.c:1.18 php4/ext/ncurses/ncurses_fe.c:1.19 --- php4/ext/ncurses/ncurses_fe.c:1.18 Sun Oct 27 13:15:35 2002 +++ php4/ext/ncurses/ncurses_fe.c Tue Oct 29 21:54:48 2002 @@ -29,6 +29,7 @@ static unsigned char firstandsecond_args_force_ref[] = {2, BYREF_FORCE, BYREF_FORCE}; static unsigned char second_args_force_ref[] = {2, BYREF_NONE, BYREF_FORCE}; static unsigned char secondandthird_args_force_ref[] = {3, BYREF_NONE, BYREF_FORCE, BYREF_FORCE}; +static unsigned char second_thru_fourth_args_force_ref[] = {4, BYREF_NONE, +BYREF_FORCE, BYREF_FORCE, BYREF_FORCE}; /* ncurses_functions[] * @@ -43,6 +44,8 @@ PHP_FE(ncurses_has_colors, NULL) PHP_FE(ncurses_init, NULL) PHP_FE(ncurses_init_pair, NULL) + PHP_FE(ncurses_color_content, second_thru_fourth_args_force_ref) + PHP_FE(ncurses_pair_content, secondandthird_args_force_ref) PHP_FE(ncurses_move, NULL) PHP_FE(ncurses_newwin, NULL) PHP_FE(ncurses_refresh, NULL) @@ -57,7 +60,9 @@ PHP_FE(ncurses_clrtobot, NULL) PHP_FE(ncurses_clrtoeol, NULL) PHP_FE(ncurses_def_prog_mode, NULL) + PHP_FE(ncurses_reset_prog_mode, NULL) PHP_FE(ncurses_def_shell_mode, NULL) + PHP_FE(ncurses_reset_shell_mode, NULL) PHP_FE(ncurses_delch, NULL) PHP_FE(ncurses_deleteln, NULL) PHP_FE(ncurses_doupdate, NULL) Index: php4/ext/ncurses/ncurses_functions.c diff -u php4/ext/ncurses/ncurses_functions.c:1.25 php4/ext/ncurses/ncurses_functions.c:1.26 --- php4/ext/ncurses/ncurses_functions.c:1.25 Sun Oct 27 13:15:35 2002 +++ php4/ext/ncurses/ncurses_functions.c Tue Oct 29 21:54:48 2002 @@ -391,6 +391,28 @@ } /* }}} */ +/* {{{ proto int ncurses_reset_prog_mode(void) + Resets the prog mode saved by def_prog_mode */ +PHP_FUNCTION(ncurses_reset_prog_mode) +{ + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } + 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) +{ + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } + RETURN_LONG(reset_shell_mode()); +} +/* }}} */ + /* {{{ proto bool ncurses_def_prog_mode(void) Saves terminals (program) mode */ PHP_FUNCTION(ncurses_def_prog_mode) @@ -1468,6 +1490,67 @@ RETURN_LONG(init_color(i1,i2,i3,i4)); } /* }}} */ + +/* {{{ proto int ncurses_color_content(int color, int &r, int &g, int &b) + Gets the RGB value for color */ +PHP_FUNCTION(ncurses_color_content) +{ + zval **c, **r, **g, **b; + short rv, gv, bv; + int retval; + + if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &c, &r, &g, &b) == +FAILURE) { + WRONG_PARAM_COUNT; + } + + convert_to_long_ex(c); + convert_to_long_ex(r); + convert_to_long_ex(g); + convert_to_long_ex(b); + + rv = Z_LVAL_PP(r); + gv = Z_LVAL_PP(g); + bv = Z_LVAL_PP(b); + + retval = color_content(Z_LVAL_PP(c), &rv, &gv, &bv); + + Z_LVAL_PP(r) = rv; + Z_LVAL_PP(g) = gv; + Z_LVAL_PP(b) = bv; + + 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) +{ + zval **p, **f, **b; + short fv, bv; + int retval; + + if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &p, &f, &b) == FAILURE) { + WRONG_PARAM_COUNT; + } + + convert_to_long_ex(p); + convert_to_long_ex(f); + convert_to_long_ex(b); + + fv = Z_LVAL_PP(f); + bv = Z_LVAL_PP(b); + + retval = pair_content(Z_LVAL_PP(f), &fv, &bv); + + Z_LVAL_PP(f) = fv; + Z_LVAL_PP(b) = bv; + + RETURN_LONG(retval); +} +/* }}} */ + + /* {{{ proto int ncurses_border(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 screen using attributed characters */ Index: php4/ext/ncurses/php_ncurses_fe.h diff -u php4/ext/ncurses/php_ncurses_fe.h:1.18 php4/ext/ncurses/php_ncurses_fe.h:1.19 --- php4/ext/ncurses/php_ncurses_fe.h:1.18 Sun Oct 27 13:15:35 2002 +++ php4/ext/ncurses/php_ncurses_fe.h Tue Oct 29 21:54:48 2002 @@ -28,6 +28,8 @@ PHP_FUNCTION(ncurses_has_colors); PHP_FUNCTION(ncurses_init); PHP_FUNCTION(ncurses_init_pair); +PHP_FUNCTION(ncurses_color_content); +PHP_FUNCTION(ncurses_pair_content); PHP_FUNCTION(ncurses_move); PHP_FUNCTION(ncurses_newwin); PHP_FUNCTION(ncurses_refresh); @@ -42,7 +44,9 @@ PHP_FUNCTION(ncurses_clrtobot); PHP_FUNCTION(ncurses_clrtoeol); PHP_FUNCTION(ncurses_def_prog_mode); +PHP_FUNCTION(ncurses_reset_prog_mode); PHP_FUNCTION(ncurses_def_shell_mode); +PHP_FUNCTION(ncurses_reset_shell_mode); PHP_FUNCTION(ncurses_delch); PHP_FUNCTION(ncurses_deleteln); PHP_FUNCTION(ncurses_doupdate);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php