summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2002-10-27 18:15:35 +0000
committerWez Furlong <wez@php.net>2002-10-27 18:15:35 +0000
commit7a71b3ba38b4030b974a7bfd67182e3c79908c62 (patch)
tree32fdd79e661558ca999fb4626d52a61a25b74fd1
parent50dced2eea84ec494fd7efe007035db5d1bb15b4 (diff)
downloadphp-git-7a71b3ba38b4030b974a7bfd67182e3c79908c62.tar.gz
Expose some more ncurses functions.
-rw-r--r--ext/ncurses/ncurses_fe.c3
-rw-r--r--ext/ncurses/ncurses_functions.c57
-rw-r--r--ext/ncurses/php_ncurses_fe.h3
3 files changed, 63 insertions, 0 deletions
diff --git a/ext/ncurses/ncurses_fe.c b/ext/ncurses/ncurses_fe.c
index c19e97c508..187339e2a9 100644
--- a/ext/ncurses/ncurses_fe.c
+++ b/ext/ncurses/ncurses_fe.c
@@ -63,6 +63,7 @@ function_entry ncurses_functions[] = {
PHP_FE(ncurses_doupdate, NULL)
PHP_FE(ncurses_echo, NULL)
PHP_FE(ncurses_erase, NULL)
+ PHP_FE(ncurses_werase, NULL)
PHP_FE(ncurses_erasechar, NULL)
PHP_FE(ncurses_flash, NULL)
PHP_FE(ncurses_flushinp, NULL)
@@ -78,6 +79,7 @@ function_entry ncurses_functions[] = {
PHP_FE(ncurses_nonl, NULL)
PHP_FE(ncurses_noraw, NULL)
PHP_FE(ncurses_raw, NULL)
+ PHP_FE(ncurses_meta, NULL)
PHP_FE(ncurses_resetty, NULL)
PHP_FE(ncurses_savetty, NULL)
PHP_FE(ncurses_termattrs, NULL)
@@ -176,6 +178,7 @@ function_entry ncurses_functions[] = {
PHP_FE(ncurses_whline, NULL)
PHP_FE(ncurses_wvline, NULL)
PHP_FE(ncurses_getyx, secondandthird_args_force_ref)
+ PHP_FE(ncurses_getmaxyx, secondandthird_args_force_ref)
#if HAVE_NCURSES_PANEL
PHP_FE(ncurses_update_panels, NULL)
diff --git a/ext/ncurses/ncurses_functions.c b/ext/ncurses/ncurses_functions.c
index 81ca3ae479..8252739691 100644
--- a/ext/ncurses/ncurses_functions.c
+++ b/ext/ncurses/ncurses_functions.c
@@ -583,6 +583,42 @@ PHP_FUNCTION(ncurses_raw)
}
/* }}} */
+/* {{{ proto long ncurses_meta(resource window, bool 8bit)
+ Enables/Disable 8-bit meta key information */
+PHP_FUNCTION(ncurses_meta)
+{
+ zend_bool enable;
+ zval *handle;
+ WINDOW **win;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb", &handle, &enable)==FAILURE) {
+ return;
+ }
+
+ FETCH_WINRES(win, &handle);
+
+ RETURN_LONG(meta(*win, enable));
+}
+/* }}} */
+
+/* {{{ proto long ncurses_werase(resource window)
+ Erase window contents */
+PHP_FUNCTION(ncurses_werase)
+{
+ zval *handle;
+ WINDOW **win;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle)==FAILURE) {
+ return;
+ }
+
+ FETCH_WINRES(win, &handle);
+
+ RETURN_LONG(werase(*win));
+}
+/* }}} */
+
+
/* {{{ proto bool ncurses_resetty(void)
Restores saved terminal state */
PHP_FUNCTION(ncurses_resetty)
@@ -1816,6 +1852,27 @@ PHP_FUNCTION(ncurses_getyx)
}
/* }}} */
+/* {{{ proto void ncurses_getmaxyx(resource window, int &y, int &x)
+ Returns the size of a window */
+PHP_FUNCTION(ncurses_getmaxyx)
+{
+ zval **handle, **x, **y;
+ WINDOW **win;
+ if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &handle, &y, &x) == FAILURE){
+ WRONG_PARAM_COUNT;
+ }
+
+ FETCH_WINRES(win, handle);
+
+ convert_to_long_ex(x);
+ convert_to_long_ex(y);
+
+ getmaxyx(*win, Z_LVAL_PP(y), Z_LVAL_PP(x));
+}
+/* }}} */
+
+
+
/* {{{ proto int ncurses_wmove(resource window, int y, int x)
Moves windows output position */
PHP_FUNCTION(ncurses_wmove)
diff --git a/ext/ncurses/php_ncurses_fe.h b/ext/ncurses/php_ncurses_fe.h
index 49247fbd4a..f92ace7053 100644
--- a/ext/ncurses/php_ncurses_fe.h
+++ b/ext/ncurses/php_ncurses_fe.h
@@ -48,6 +48,7 @@ PHP_FUNCTION(ncurses_deleteln);
PHP_FUNCTION(ncurses_doupdate);
PHP_FUNCTION(ncurses_echo);
PHP_FUNCTION(ncurses_erase);
+PHP_FUNCTION(ncurses_werase);
PHP_FUNCTION(ncurses_erasechar);
PHP_FUNCTION(ncurses_flash);
PHP_FUNCTION(ncurses_flushinp);
@@ -63,6 +64,7 @@ PHP_FUNCTION(ncurses_noecho);
PHP_FUNCTION(ncurses_nonl);
PHP_FUNCTION(ncurses_noraw);
PHP_FUNCTION(ncurses_raw);
+PHP_FUNCTION(ncurses_meta);
PHP_FUNCTION(ncurses_resetty);
PHP_FUNCTION(ncurses_savetty);
PHP_FUNCTION(ncurses_termattrs);
@@ -162,6 +164,7 @@ PHP_FUNCTION(ncurses_wborder);
PHP_FUNCTION(ncurses_whline);
PHP_FUNCTION(ncurses_wvline);
PHP_FUNCTION(ncurses_getyx);
+PHP_FUNCTION(ncurses_getmaxyx);
#if HAVE_NCURSES_PANEL
PHP_FUNCTION(ncurses_update_panels);
PHP_FUNCTION(ncurses_panel_window);