]> granicus.if.org Git - php/commitdiff
And some more ncurses functions.
authorWez Furlong <wez@php.net>
Wed, 30 Oct 2002 02:54:48 +0000 (02:54 +0000)
committerWez Furlong <wez@php.net>
Wed, 30 Oct 2002 02:54:48 +0000 (02:54 +0000)
ext/ncurses/ncurses_fe.c
ext/ncurses/ncurses_functions.c
ext/ncurses/php_ncurses_fe.h

index 187339e2a9d3d5cbcc889fa44118be6ea579da3a..00e1402e54e220ed3cdaac0f37804eb61cca0ec6 100644 (file)
@@ -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)
index 8252739691d7be32c8f06981639b4ab55b217d06..5c3e7f60c49d62ac45d17f585f71a27cdbc32b23 100644 (file)
@@ -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)
index f92ace70533983e2b8eb617bd82584c755ea7888..55526f9fa175cbb43457e4813856ef8a39385af1 100644 (file)
@@ -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);