diff options
author | Wez Furlong <wez@php.net> | 2002-10-30 02:54:48 +0000 |
---|---|---|
committer | Wez Furlong <wez@php.net> | 2002-10-30 02:54:48 +0000 |
commit | 54f02722f61687e4e23de4c6b4e5f70253581993 (patch) | |
tree | 6b15e9eca19dd84ca49a1ef5a0d1209c9e30bf34 /ext/ncurses | |
parent | 880855f5ee875ab29a9f6e986ceac60a1fe34f60 (diff) | |
download | php-git-54f02722f61687e4e23de4c6b4e5f70253581993.tar.gz |
And some more ncurses functions.
Diffstat (limited to 'ext/ncurses')
-rw-r--r-- | ext/ncurses/ncurses_fe.c | 5 | ||||
-rw-r--r-- | ext/ncurses/ncurses_functions.c | 83 | ||||
-rw-r--r-- | ext/ncurses/php_ncurses_fe.h | 4 |
3 files changed, 92 insertions, 0 deletions
diff --git a/ext/ncurses/ncurses_fe.c b/ext/ncurses/ncurses_fe.c index 187339e2a9..00e1402e54 100644 --- a/ext/ncurses/ncurses_fe.c +++ b/ext/ncurses/ncurses_fe.c @@ -29,6 +29,7 @@ static unsigned char first_args_force_ref[] = {1, BYREF_FORCE}; 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 @@ function_entry ncurses_functions[] = { 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 @@ function_entry ncurses_functions[] = { 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) diff --git a/ext/ncurses/ncurses_functions.c b/ext/ncurses/ncurses_functions.c index 8252739691..5c3e7f60c4 100644 --- a/ext/ncurses/ncurses_functions.c +++ b/ext/ncurses/ncurses_functions.c @@ -391,6 +391,28 @@ PHP_FUNCTION(ncurses_clrtoeol) } /* }}} */ +/* {{{ 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) @@ -1469,6 +1491,67 @@ PHP_FUNCTION(ncurses_init_color) } /* }}} */ +/* {{{ 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 */ PHP_FUNCTION(ncurses_border) diff --git a/ext/ncurses/php_ncurses_fe.h b/ext/ncurses/php_ncurses_fe.h index f92ace7053..55526f9fa1 100644 --- a/ext/ncurses/php_ncurses_fe.h +++ b/ext/ncurses/php_ncurses_fe.h @@ -28,6 +28,8 @@ PHP_FUNCTION(ncurses_getch); 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_clear); 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); |