Patch ncurses-php7-support-again.patch for ncurses Bug #71299
Patch version 2016-09-22 13:04 UTC
Return to Bug #71299 |
Download this patch
Patch Revisions:
Developer: joungkyun@yahoo.com
diff -urNp ncurses-php5/CREDITS ncurses/CREDITS
--- ncurses-php5/CREDITS 2012-06-17 02:05:19.000000000 +0900
+++ ncurses/CREDITS 2016-09-22 21:45:57.928154738 +0900
@@ -1,2 +1,5 @@
ncurses
Ilia Alshanetsky, Wez Furlong, Hartmut Holzgraefe, Georg Richter
+
+PHP7 support
+JoungKyun.Kim <http://oops.org>
diff -urNp ncurses-php5/ncurses.c ncurses/ncurses.c
--- ncurses-php5/ncurses.c 2012-06-17 02:05:19.000000000 +0900
+++ ncurses/ncurses.c 2016-01-07 10:50:17.000000000 +0900
@@ -33,21 +33,19 @@ int le_ncurses_windows;
int le_ncurses_panels;
#endif
-static void ncurses_destruct_window(zend_rsrc_list_entry *rsrc TSRMLS_DC)
+static void ncurses_destruct_window(zend_resource *res)
{
- WINDOW **pwin = (WINDOW **)rsrc->ptr;
+ WINDOW **pwin = (WINDOW **)res->ptr;
delwin(*pwin);
- efree(pwin);
}
#if HAVE_NCURSES_PANEL
-static void ncurses_destruct_panel(zend_rsrc_list_entry *rsrc TSRMLS_DC)
+static void ncurses_destruct_panel(zend_resource *res)
{
- PANEL **ppanel = (PANEL **)rsrc->ptr;
+ PANEL **ppanel = (PANEL **)res->ptr;
del_panel(*ppanel);
- efree(ppanel);
}
#endif
diff -urNp ncurses-php5/ncurses_fe.c ncurses/ncurses_fe.c
--- ncurses-php5/ncurses_fe.c 2012-06-17 02:05:19.000000000 +0900
+++ ncurses/ncurses_fe.c 2016-01-07 14:18:42.000000000 +0900
@@ -205,6 +205,9 @@ zend_function_entry ncurses_functions[]
PHP_FE(ncurses_waddstr, NULL)
PHP_FE(ncurses_wnoutrefresh, NULL)
PHP_FE(ncurses_wclear, NULL)
+ PHP_FE(ncurses_wscrl, NULL)
+ PHP_FE(ncurses_wsetscrreg, NULL)
+ PHP_FE(ncurses_scrollok, NULL)
#ifdef HAVE_NCURSES_COLOR_SET
PHP_FE(ncurses_wcolor_set, NULL)
#endif
diff -urNp ncurses-php5/ncurses_functions.c ncurses/ncurses_functions.c
--- ncurses-php5/ncurses_functions.c 2016-09-22 21:18:41.200011553 +0900
+++ ncurses/ncurses_functions.c 2016-09-22 21:41:29.066499553 +0900
@@ -25,9 +25,16 @@
#include "php_ini.h"
#include "php_ncurses.h"
-#define FETCH_WINRES(r, z) ZEND_FETCH_RESOURCE(r, WINDOW **, z, -1, "ncurses_window", le_ncurses_windows)
+#define FETCH_WINRES(r, z) \
+ if ((r = (WINDOW **)zend_fetch_resource_ex(z, "ncurses_window", le_ncurses_windows)) == NULL) { \
+ RETURN_FALSE; \
+ }
+
#if HAVE_NCURSES_PANEL
-# define FETCH_PANEL(r, z) ZEND_FETCH_RESOURCE(r, PANEL **, z, -1, "ncurses_panel", le_ncurses_panels)
+# define FETCH_PANEL(r, z) \
+ if ((r = (PANEL **)zend_fetch_resource_ex(z, "ncurses_panel", le_ncurses_panels)) == NULL) { \
+ RETURN_FALSE; \
+ }
#endif
#define IS_NCURSES_INITIALIZED() \
@@ -42,7 +49,7 @@ PHP_FUNCTION(ncurses_addch)
{
long ch;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ch) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &ch) == FAILURE) {
return;
}
@@ -59,11 +66,11 @@ PHP_FUNCTION(ncurses_waddch)
zval *handle;
WINDOW **win;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &handle, &ch) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &handle, &ch) == FAILURE) {
return;
}
- FETCH_WINRES(win, &handle);
+ FETCH_WINRES(win, handle);
RETURN_LONG(waddch(*win, ch));
}
@@ -75,7 +82,7 @@ PHP_FUNCTION(ncurses_waddch)
PHP_FUNCTION(ncurses_color_set)
{
long pair;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &pair) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &pair) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -91,13 +98,13 @@ PHP_FUNCTION(ncurses_delwin)
zval *handle;
WINDOW **w;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &handle) == FAILURE) {
return;
}
- FETCH_WINRES(w, &handle);
+ FETCH_WINRES(w, handle);
- zend_list_delete(Z_LVAL_P(handle));
+ zend_list_close(Z_RES_P(handle));
RETURN_TRUE;
}
/* }}} */
@@ -142,16 +149,17 @@ PHP_FUNCTION(ncurses_init)
zend_constant c;
WINDOW **pscr = (WINDOW**)emalloc(sizeof(WINDOW *));
- zval *zscr;
+ zval zscr;
+ zend_resource *zres;
*pscr = stdscr;
- MAKE_STD_ZVAL(zscr);
- ZEND_REGISTER_RESOURCE(zscr, pscr, le_ncurses_windows);
- c.value = *zscr;
+ zres = zend_register_resource(pscr, le_ncurses_windows);
+ ZVAL_RES(&zscr, zres);
+
+ c.value = zscr;
zval_copy_ctor(&c.value);
c.flags = CONST_CS;
- c.name = zend_strndup(ZEND_STRL("STDSCR"));
- c.name_len = sizeof("STDSCR");
+ c.name = zend_string_init(ZEND_STRL("STDSCR"), 0);
zend_register_constant(&c TSRMLS_CC);
/* we need this "interesting" arrangement because the
@@ -159,12 +167,11 @@ PHP_FUNCTION(ncurses_init)
* initialized until after ncurses has been initialized */
#define PHP_NCURSES_DEF_CONST(x) \
- ZVAL_LONG(zscr, x); \
- c.value = *zscr; \
+ ZVAL_LONG(&zscr, x); \
+ c.value = zscr; \
zval_copy_ctor(&c.value); \
c.flags = CONST_CS; \
- c.name = zend_strndup(ZEND_STRL("NCURSES_" #x)); \
- c.name_len = sizeof("NCURSES_" #x); \
+ c.name = zend_string_init(ZEND_STRL("NCURSES_" #x), 0); \
zend_register_constant(&c TSRMLS_CC)
PHP_NCURSES_DEF_CONST(ACS_ULCORNER);
@@ -193,7 +200,7 @@ PHP_FUNCTION(ncurses_init)
PHP_NCURSES_DEF_CONST(ACS_LANTERN);
PHP_NCURSES_DEF_CONST(ACS_BLOCK);
- FREE_ZVAL(zscr);
+ //efree_rel(&zscr);
NCURSES_G(registered_constants) = 1;
}
}
@@ -205,7 +212,7 @@ PHP_FUNCTION(ncurses_init_pair)
{
long pair, fg, bg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &pair, &fg, &bg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &pair, &fg, &bg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -218,7 +225,7 @@ PHP_FUNCTION(ncurses_init_pair)
PHP_FUNCTION(ncurses_move)
{
long x, y;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &y, &x) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &y, &x) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -233,7 +240,7 @@ PHP_FUNCTION(ncurses_newpad)
long rows,cols;
WINDOW **pwin;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &rows, &cols) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &rows, &cols) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -246,8 +253,7 @@ PHP_FUNCTION(ncurses_newpad)
RETURN_FALSE;
}
- ZEND_REGISTER_RESOURCE(return_value, pwin, le_ncurses_windows);
-
+ RETURN_RES(zend_register_resource(pwin, le_ncurses_windows));
}
/* }}} */
@@ -259,12 +265,12 @@ PHP_FUNCTION(ncurses_prefresh)
zval *phandle;
long pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllllll", &phandle, &pminrow,
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rllllll", &phandle, &pminrow,
&pmincol, &sminrow, &smincol, &smaxrow, &smaxcol) == FAILURE) {
return;
}
- FETCH_WINRES(pwin, &phandle);
+ FETCH_WINRES(pwin, phandle);
RETURN_LONG(prefresh(*pwin, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol));
}
@@ -278,12 +284,12 @@ PHP_FUNCTION(ncurses_pnoutrefresh)
zval *phandle;
long pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllllll", &phandle, &pminrow,
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rllllll", &phandle, &pminrow,
&pmincol, &sminrow, &smincol, &smaxrow, &smaxcol) == FAILURE) {
return;
}
- FETCH_WINRES(pwin, &phandle);
+ FETCH_WINRES(pwin, phandle);
RETURN_LONG(pnoutrefresh(*pwin, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol));
}
@@ -298,7 +304,7 @@ PHP_FUNCTION(ncurses_newwin)
long rows,cols,y,x;
WINDOW **pwin;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &rows, &cols, &y, &x) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "llll", &rows, &cols, &y, &x) == FAILURE) {
return;
}
@@ -311,7 +317,7 @@ PHP_FUNCTION(ncurses_newwin)
RETURN_FALSE;
}
- ZEND_REGISTER_RESOURCE(return_value, pwin, le_ncurses_windows);
+ RETURN_RES(zend_register_resource(pwin, le_ncurses_windows));
}
/* }}} */
@@ -505,7 +511,7 @@ PHP_FUNCTION(ncurses_erasechar)
temp[0] = erasechar();
temp[1] = '\0';
- RETURN_STRINGL (temp, 1, 1);
+ RETURN_STRINGL (temp, 1);
}
/* }}} */
@@ -556,7 +562,7 @@ PHP_FUNCTION(ncurses_inch)
temp[0] = inch();
temp[1] = '\0';
- RETURN_STRINGL (temp, 1, 1);
+ RETURN_STRINGL (temp, 1);
}
/* }}} */
@@ -588,7 +594,7 @@ PHP_FUNCTION(ncurses_killchar)
temp[0] = killchar();
temp[1] = '\0';
- RETURN_STRINGL (temp, 1, 1);
+ RETURN_STRINGL (temp, 1);
}
/* }}} */
@@ -653,11 +659,11 @@ PHP_FUNCTION(ncurses_meta)
zval *handle;
WINDOW **win;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb", &handle, &enable) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rb", &handle, &enable) == FAILURE) {
return;
}
- FETCH_WINRES(win, &handle);
+ FETCH_WINRES(win, handle);
RETURN_LONG(meta(*win, enable));
}
@@ -670,11 +676,11 @@ PHP_FUNCTION(ncurses_werase)
zval *handle;
WINDOW **win;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &handle) == FAILURE) {
return;
}
- FETCH_WINRES(win, &handle);
+ FETCH_WINRES(win, handle);
RETURN_LONG(werase(*win));
}
@@ -775,16 +781,15 @@ PHP_FUNCTION(ncurses_slk_touch)
Sets function key labels */
PHP_FUNCTION(ncurses_slk_set)
{
- char *str;
- int len;
+ zend_string *str;
long labelnr;
long format;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsl", &labelnr, &str, &len, &format) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "lSl", &labelnr, &str, &format) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
- RETURN_BOOL(slk_set(labelnr, str, format));
+ RETURN_BOOL(slk_set(labelnr, ZSTR_VAL(str), format));
}
/* }}} */
@@ -795,7 +800,7 @@ PHP_FUNCTION(ncurses_attroff)
{
long intarg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intarg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -809,7 +814,7 @@ PHP_FUNCTION(ncurses_attron)
{
long intarg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intarg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -823,7 +828,7 @@ PHP_FUNCTION(ncurses_attrset)
{
long intarg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intarg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -837,7 +842,7 @@ PHP_FUNCTION(ncurses_bkgd)
{
long intarg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intarg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -851,7 +856,7 @@ PHP_FUNCTION(ncurses_curs_set)
{
long intarg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intarg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -865,7 +870,7 @@ PHP_FUNCTION(ncurses_delay_output)
{
long intarg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intarg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -879,7 +884,7 @@ PHP_FUNCTION(ncurses_echochar)
{
long intarg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intarg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -893,7 +898,7 @@ PHP_FUNCTION(ncurses_halfdelay)
{
long intarg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intarg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -907,7 +912,7 @@ PHP_FUNCTION(ncurses_has_key)
{
long intarg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intarg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -921,7 +926,7 @@ PHP_FUNCTION(ncurses_insch)
{
long intarg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intarg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -935,7 +940,7 @@ PHP_FUNCTION(ncurses_insdelln)
{
long intarg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intarg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -949,7 +954,7 @@ PHP_FUNCTION(ncurses_mouseinterval)
{
long intarg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intarg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -963,7 +968,7 @@ PHP_FUNCTION(ncurses_napms)
{
long intarg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intarg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -977,7 +982,7 @@ PHP_FUNCTION(ncurses_scrl)
{
long intarg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intarg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -991,7 +996,7 @@ PHP_FUNCTION(ncurses_slk_attroff)
{
long intarg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intarg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1005,7 +1010,7 @@ PHP_FUNCTION(ncurses_slk_attron)
{
long intarg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intarg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1019,7 +1024,7 @@ PHP_FUNCTION(ncurses_slk_attrset)
{
long intarg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intarg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1034,7 +1039,7 @@ PHP_FUNCTION(ncurses_slk_color)
{
long intarg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intarg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1049,7 +1054,7 @@ PHP_FUNCTION(ncurses_slk_init)
{
long intarg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intarg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1063,7 +1068,7 @@ PHP_FUNCTION(ncurses_typeahead)
{
long intarg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intarg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1077,7 +1082,7 @@ PHP_FUNCTION(ncurses_ungetch)
{
long intarg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intarg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1091,7 +1096,7 @@ PHP_FUNCTION(ncurses_vidattr)
{
long intarg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intarg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1106,7 +1111,7 @@ PHP_FUNCTION(ncurses_use_extended_names)
{
long intarg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intarg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1121,7 +1126,7 @@ PHP_FUNCTION(ncurses_bkgdset)
{
long intarg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intarg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1162,7 +1167,7 @@ PHP_FUNCTION(ncurses_timeout)
{
long intarg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intarg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1176,7 +1181,7 @@ PHP_FUNCTION(ncurses_use_env)
{
long intarg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intarg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intarg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1188,14 +1193,13 @@ PHP_FUNCTION(ncurses_use_env)
Outputs text at current position */
PHP_FUNCTION(ncurses_addstr)
{
- char *str;
- int str_len;
+ zend_string *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
- RETURN_LONG(addstr(str));
+ RETURN_LONG(addstr(ZSTR_VAL(str)));
}
/* }}} */
@@ -1203,14 +1207,13 @@ PHP_FUNCTION(ncurses_addstr)
??? */
PHP_FUNCTION(ncurses_putp)
{
- char *str;
- int str_len;
+ zend_string *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
- RETURN_LONG(putp(str));
+ RETURN_LONG(putp(ZSTR_VAL(str)));
}
/* }}} */
@@ -1218,14 +1221,13 @@ PHP_FUNCTION(ncurses_putp)
Dumps screen content to file */
PHP_FUNCTION(ncurses_scr_dump)
{
- char *str;
- int str_len;
+ zend_string *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
- RETURN_LONG(scr_dump(str));
+ RETURN_LONG(scr_dump(ZSTR_VAL(str)));
}
/* }}} */
@@ -1233,14 +1235,13 @@ PHP_FUNCTION(ncurses_scr_dump)
Initializes screen from file dump */
PHP_FUNCTION(ncurses_scr_init)
{
- char *str;
- int str_len;
+ zend_string *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
- RETURN_LONG(scr_init(str));
+ RETURN_LONG(scr_init(ZSTR_VAL(str)));
}
/* }}} */
@@ -1248,14 +1249,13 @@ PHP_FUNCTION(ncurses_scr_init)
Restores screen from file dump */
PHP_FUNCTION(ncurses_scr_restore)
{
- char *str;
- int str_len;
+ zend_string *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
- RETURN_LONG(scr_restore(str));
+ RETURN_LONG(scr_restore(ZSTR_VAL(str)));
}
/* }}} */
@@ -1263,14 +1263,13 @@ PHP_FUNCTION(ncurses_scr_restore)
Inherits screen from file dump */
PHP_FUNCTION(ncurses_scr_set)
{
- char *str;
- int str_len;
+ zend_string *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
- RETURN_LONG(scr_set(str));
+ RETURN_LONG(scr_set(ZSTR_VAL(str)));
}
/* }}} */
@@ -1280,7 +1279,7 @@ PHP_FUNCTION(ncurses_mvaddch)
{
long y,x,c;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &y, &x, &c) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &y, &x, &c) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1293,14 +1292,13 @@ PHP_FUNCTION(ncurses_mvaddch)
PHP_FUNCTION(ncurses_mvaddchnstr)
{
long y,x,n;
- char *str;
- int str_len;
+ zend_string *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llsl", &y, &x, &str, &str_len, &n) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "llSl", &y, &x, &str, &n) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
- RETURN_LONG(mvaddchnstr(y,x,(chtype *)str,n));
+ RETURN_LONG(mvaddchnstr(y,x,(chtype *)ZSTR_VAL(str),n));
}
/* }}} */
@@ -1309,14 +1307,13 @@ PHP_FUNCTION(ncurses_mvaddchnstr)
PHP_FUNCTION(ncurses_addchnstr)
{
long n;
- char *str;
- int str_len;
+ zend_string *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &str, &str_len, &n) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sl", &str, &n) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
- RETURN_LONG(addchnstr((chtype *)str,n));
+ RETURN_LONG(addchnstr((chtype *)ZSTR_VAL(str),n));
}
/* }}} */
@@ -1325,14 +1322,13 @@ PHP_FUNCTION(ncurses_addchnstr)
PHP_FUNCTION(ncurses_mvaddchstr)
{
long y,x;
- char *str;
- int str_len;
+ zend_string *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lls", &y, &x, &str, &str_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "llS", &y, &x, &str) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
- RETURN_LONG(mvaddchstr(y,x,(chtype *)str));
+ RETURN_LONG(mvaddchstr(y,x,(chtype *)ZSTR_VAL(str)));
}
/* }}} */
@@ -1340,14 +1336,13 @@ PHP_FUNCTION(ncurses_mvaddchstr)
Adds attributed string at current position */
PHP_FUNCTION(ncurses_addchstr)
{
- char *str;
- int str_len;
+ zend_string *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
- RETURN_LONG(addchstr((chtype *)str));
+ RETURN_LONG(addchstr((chtype *)ZSTR_VAL(str)));
}
/* }}} */
@@ -1356,14 +1351,13 @@ PHP_FUNCTION(ncurses_addchstr)
PHP_FUNCTION(ncurses_mvaddnstr)
{
long y,x,n;
- char *str;
- int str_len;
+ zend_string *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llsl", &y, &x, &str, &str_len, &n) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "llSl", &y, &x, &str, &n) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
- RETURN_LONG(mvaddnstr(y,x,str,n));
+ RETURN_LONG(mvaddnstr(y,x,ZSTR_VAL(str),n));
}
/* }}} */
@@ -1372,14 +1366,13 @@ PHP_FUNCTION(ncurses_mvaddnstr)
PHP_FUNCTION(ncurses_addnstr)
{
long n;
- char *str;
- int str_len;
+ zend_string *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &str, &str_len, &n) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sl", &str, &n) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
- RETURN_LONG(addnstr(str,n));
+ RETURN_LONG(addnstr(ZSTR_VAL(str),n));
}
/* }}} */
@@ -1388,14 +1381,13 @@ PHP_FUNCTION(ncurses_addnstr)
PHP_FUNCTION(ncurses_mvaddstr)
{
long y,x;
- char *str;
- int str_len;
+ zend_string *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lls", &y, &x, &str, &str_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "llS", &y, &x, &str) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
- RETURN_LONG(mvaddstr(y,x,str));
+ RETURN_LONG(mvaddstr(y,x,ZSTR_VAL(str)));
}
/* }}} */
@@ -1405,7 +1397,7 @@ PHP_FUNCTION(ncurses_mvdelch)
{
long y,x;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &y, &x) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &y, &x) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1420,7 +1412,7 @@ PHP_FUNCTION(ncurses_mvgetch)
{
long y,x;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &y, &x) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &y, &x) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1434,7 +1426,7 @@ PHP_FUNCTION(ncurses_mvinch)
{
long y,x;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &y, &x) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &y, &x) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1446,14 +1438,13 @@ PHP_FUNCTION(ncurses_mvinch)
Inserts string at current position, moving rest of line right */
PHP_FUNCTION(ncurses_insstr)
{
- char *str;
- int str_len;
+ zend_string *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
- RETURN_LONG(insstr(str));
+ RETURN_LONG(insstr(ZSTR_VAL(str)));
}
/* }}} */
@@ -1465,7 +1456,7 @@ PHP_FUNCTION(ncurses_instr)
zval *param;
char *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶m) == FAILURE ) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z/", ¶m) == FAILURE ) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1473,7 +1464,7 @@ PHP_FUNCTION(ncurses_instr)
str = (char *)emalloc(COLS + 1);
retval = instr(str);
- ZVAL_STRING(param, str, 1);
+ ZVAL_STRING(param, str);
efree(str);
RETURN_LONG(retval);
@@ -1486,7 +1477,7 @@ PHP_FUNCTION(ncurses_mvhline)
{
long i1,i2,i3,i4;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &i1, &i2, &i3, &i4) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "llll", &i1, &i2, &i3, &i4) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1500,7 +1491,7 @@ PHP_FUNCTION(ncurses_mvvline)
{
long i1,i2,i3,i4;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &i1, &i2, &i3, &i4) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "llll", &i1, &i2, &i3, &i4) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1514,7 +1505,7 @@ PHP_FUNCTION(ncurses_mvcur)
{
long i1,i2,i3,i4;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &i1, &i2, &i3, &i4) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "llll", &i1, &i2, &i3, &i4) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1528,7 +1519,7 @@ PHP_FUNCTION(ncurses_init_color)
{
long i1,i2,i3,i4;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &i1, &i2, &i3, &i4) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "llll", &i1, &i2, &i3, &i4) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1545,7 +1536,7 @@ PHP_FUNCTION(ncurses_color_content)
int retval;
long c;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lzzz", &c, &r, &g, &b) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "lz/z/z/", &c, &r, &g, &b) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1569,7 +1560,7 @@ PHP_FUNCTION(ncurses_pair_content)
int retval;
long p;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lzz", &p, &f, &b) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "lz/z/", &p, &f, &b) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1589,7 +1580,7 @@ PHP_FUNCTION(ncurses_border)
{
long i1,i2,i3,i4,i5,i6,i7,i8;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llllllll", &i1, &i2, &i3, &i4, &i5, &i6, &i7, &i8) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "llllllll", &i1, &i2, &i3, &i4, &i5, &i6, &i7, &i8) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1605,11 +1596,11 @@ PHP_FUNCTION(ncurses_wborder)
zval *handle;
WINDOW **win;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllllllll", &handle, &i1, &i2, &i3, &i4, &i5, &i6, &i7, &i8) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rllllllll", &handle, &i1, &i2, &i3, &i4, &i5, &i6, &i7, &i8) == FAILURE) {
return;
}
- FETCH_WINRES(win, &handle);
+ FETCH_WINRES(win, handle);
RETURN_LONG(wborder(*win,i1,i2,i3,i4,i5,i6,i7,i8));
}
@@ -1622,7 +1613,7 @@ PHP_FUNCTION(ncurses_assume_default_colo
{
long i1,i2;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &i1, &i2) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &i1, &i2) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1636,14 +1627,13 @@ PHP_FUNCTION(ncurses_assume_default_colo
PHP_FUNCTION(ncurses_define_key)
{
long n;
- char *str;
- int str_len;
+ zend_string *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &str, &str_len, &n) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sl", &str, &n) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
- RETURN_LONG(define_key(str,n));
+ RETURN_LONG(define_key(ZSTR_VAL(str),n));
}
/* }}} */
@@ -1653,7 +1643,7 @@ PHP_FUNCTION(ncurses_hline)
{
long i1,i2;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &i1, &i2) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &i1, &i2) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1667,7 +1657,7 @@ PHP_FUNCTION(ncurses_vline)
{
long i1,i2;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &i1, &i2) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &i1, &i2) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1683,11 +1673,11 @@ PHP_FUNCTION(ncurses_whline)
zval *handle;
WINDOW **win;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &handle, &i1, &i2) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rll", &handle, &i1, &i2) == FAILURE) {
return;
}
- FETCH_WINRES(win, &handle);
+ FETCH_WINRES(win, handle);
RETURN_LONG(whline(*win,i1,i2));
}
@@ -1701,10 +1691,10 @@ PHP_FUNCTION(ncurses_wvline)
zval *handle;
WINDOW **win;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &handle, &i1, &i2) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rll", &handle, &i1, &i2) == FAILURE) {
return;
}
- FETCH_WINRES(win, &handle);
+ FETCH_WINRES(win, handle);
RETURN_LONG(wvline(*win,i1,i2));
}
@@ -1716,7 +1706,7 @@ PHP_FUNCTION(ncurses_keyok)
{
long i,b;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &i, &b) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &i, &b) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1730,17 +1720,16 @@ PHP_FUNCTION(ncurses_mvwaddstr)
{
zval *handle;
long y, x;
- int text_len;
- char *text;
+ zend_string *text;
WINDOW **w;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlls", &handle, &y, &x, &text, &text_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rllS", &handle, &y, &x, &text) == FAILURE) {
return;
}
- FETCH_WINRES(w, &handle);
+ FETCH_WINRES(w, handle);
- RETURN_LONG(mvwaddstr(*w,y,x,text));
+ RETURN_LONG(mvwaddstr(*w,y,x,ZSTR_VAL(text)));
}
/* }}} */
@@ -1751,16 +1740,76 @@ PHP_FUNCTION(ncurses_wrefresh)
zval *handle;
WINDOW **w;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &handle) == FAILURE) {
return;
}
- FETCH_WINRES(w, &handle);
+ FETCH_WINRES(w, handle);
RETURN_LONG(wrefresh(*w));
}
/* }}} */
+/* {{{ proto int ncurses_wscrl(resource window, int count)
+ Scrolls window content up or down without changing current position */
+PHP_FUNCTION(ncurses_wscrl)
+{
+ zval *handle;
+ long intarg;
+ WINDOW **w;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &handle, &intarg) == FAILURE) {
+ return;
+ }
+
+ IS_NCURSES_INITIALIZED();
+
+ FETCH_WINRES(w, handle);
+
+ RETURN_LONG(wscrl(*w, intarg));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_wsetscrreg(resource window, int top, int bot)
+ Set region for scrolling */
+PHP_FUNCTION(ncurses_wsetscrreg)
+{
+ zval *handle;
+ long top, bot;
+ WINDOW **w;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rll", &handle, &top, &bot) == FAILURE) {
+ return;
+ }
+
+ IS_NCURSES_INITIALIZED();
+
+ FETCH_WINRES(w, handle);
+
+ RETURN_LONG(wsetscrreg(*w, top, bot));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_scrollok(resource window, bool bf)
+ Enable or disable scrolling of window content */
+PHP_FUNCTION(ncurses_scrollok)
+{
+ zval *handle;
+ zend_bool bf;
+ WINDOW **w;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rb", &handle, &bf) == FAILURE) {
+ return;
+ }
+
+ IS_NCURSES_INITIALIZED();
+
+ FETCH_WINRES(w, handle);
+
+ RETURN_LONG(scrollok(*w, bf));
+}
+/* }}} */
+
/* {{{ proto string ncurses_termname(void)
Returns terminal name */
PHP_FUNCTION(ncurses_termname)
@@ -1771,7 +1820,7 @@ PHP_FUNCTION(ncurses_termname)
strlcpy(temp, termname(), sizeof(temp));
- RETURN_STRINGL (temp, strlen(temp), 1);
+ RETURN_STRINGL (temp, strlen(temp));
}
/* }}} */
@@ -1785,7 +1834,7 @@ PHP_FUNCTION(ncurses_longname)
strlcpy(temp, longname(), sizeof(temp));
- RETURN_STRINGL (temp, strlen(temp), 1);
+ RETURN_STRINGL (temp, strlen(temp));
}
/* }}} */
@@ -1798,7 +1847,7 @@ PHP_FUNCTION(ncurses_mousemask)
zval *param;
long newmask;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz", &newmask, ¶m) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "lz/", &newmask, ¶m) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1819,7 +1868,7 @@ PHP_FUNCTION(ncurses_getmouse)
MEVENT mevent;
ulong retval;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z/", &arg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1843,39 +1892,45 @@ PHP_FUNCTION(ncurses_getmouse)
Pushes mouse event to queue */
PHP_FUNCTION(ncurses_ungetmouse)
{
- zval *arg, **zvalue;
+ zval *arg, *zvalue;
MEVENT mevent;
ulong retval;
+ zend_string *buf;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &arg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &arg) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
- if (zend_hash_find(Z_ARRVAL_P(arg), "id", sizeof("id"), (void **) &zvalue) == SUCCESS) {
- convert_to_long_ex(zvalue);
- mevent.id = Z_LVAL_PP(zvalue);
+ buf = zend_string_init ("id", 2, 0);
+ if ((zvalue = zend_hash_find(Z_ARRVAL_P(arg), buf)) != NULL) {
+ mevent.id = Z_LVAL_P(zvalue);
}
+ zend_string_free(buf);
- if (zend_hash_find(Z_ARRVAL_P(arg), "x", sizeof("x"), (void **) &zvalue) == SUCCESS) {
- convert_to_long_ex(zvalue);
- mevent.x = Z_LVAL_PP(zvalue);
+ buf = zend_string_init ("x", 1, 0);
+ if ((zvalue = zend_hash_find(Z_ARRVAL_P(arg), buf)) != NULL) {
+ mevent.x = Z_LVAL_P(zvalue);
}
+ zend_string_free(buf);
- if (zend_hash_find(Z_ARRVAL_P(arg), "y", sizeof("y"), (void **) &zvalue) == SUCCESS) {
- convert_to_long_ex(zvalue);
- mevent.y = Z_LVAL_PP(zvalue);
+ buf = zend_string_init ("y", 1, 0);
+ if ((zvalue = zend_hash_find(Z_ARRVAL_P(arg), buf)) != NULL) {
+ mevent.y = Z_LVAL_P(zvalue);
}
+ zend_string_free(buf);
- if (zend_hash_find(Z_ARRVAL_P(arg), "z", sizeof("z"), (void **) &zvalue) == SUCCESS) {
- convert_to_long_ex(zvalue);
- mevent.z = Z_LVAL_PP(zvalue);
+ buf = zend_string_init ("z", 1, 0);
+ if ((zvalue = zend_hash_find(Z_ARRVAL_P(arg), buf)) != NULL) {
+ mevent.z = Z_LVAL_P(zvalue);
}
+ zend_string_free(buf);
- if (zend_hash_find(Z_ARRVAL_P(arg), "mmask", sizeof("mmask"), (void **) &zvalue) == SUCCESS) {
- convert_to_long_ex(zvalue);
- mevent.bstate = Z_LVAL_PP(zvalue);
+ buf = zend_string_init ("mmask", 5, 0);
+ if ((zvalue = zend_hash_find(Z_ARRVAL_P(arg), buf)) != NULL) {
+ mevent.bstate = Z_LVAL_P(zvalue);
}
+ zend_string_free(buf);
retval = ungetmouse(&mevent);
@@ -1891,7 +1946,7 @@ PHP_FUNCTION(ncurses_mouse_trafo)
zend_bool toscreen;
int nx, ny, retval;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzb", &y, &x, &toscreen) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z/z/b", &y, &x, &toscreen) == FAILURE) {
return;
}
IS_NCURSES_INITIALIZED();
@@ -1920,11 +1975,11 @@ PHP_FUNCTION(ncurses_wmouse_trafo)
WINDOW **win;
zend_bool toscreen;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rzzb", &handle, &y, &x, &toscreen) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz/z/b", &handle, &y, &x, &toscreen) == FAILURE) {
return;
}
- FETCH_WINRES(win, &handle);
+ FETCH_WINRES(win, handle);
convert_to_long(x);
convert_to_long(y);
@@ -1948,11 +2003,11 @@ PHP_FUNCTION(ncurses_getyx)
zval *handle, *x, *y;
WINDOW **win;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rzz", &handle, &y, &x) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz/z/", &handle, &y, &x) == FAILURE) {
return;
}
- FETCH_WINRES(win, &handle);
+ FETCH_WINRES(win, handle);
convert_to_long(x);
convert_to_long(y);
@@ -1968,11 +2023,11 @@ PHP_FUNCTION(ncurses_getmaxyx)
zval *handle, *x, *y;
WINDOW **win;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rzz", &handle, &y, &x) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz/z/", &handle, &y, &x) == FAILURE) {
return;
}
- FETCH_WINRES(win, &handle);
+ FETCH_WINRES(win, handle);
convert_to_long(x);
convert_to_long(y);
@@ -1988,11 +2043,11 @@ PHP_FUNCTION(ncurses_wmove)
zval *handle, *x, *y;
WINDOW **win;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rzz", &handle, &y, &x) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rzz", &handle, &y, &x) == FAILURE) {
return;
}
- FETCH_WINRES(win, &handle);
+ FETCH_WINRES(win, handle);
convert_to_long(x);
convert_to_long(y);
@@ -2009,11 +2064,11 @@ PHP_FUNCTION(ncurses_keypad)
zend_bool bf;
WINDOW **win;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb", &handle, &bf) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rb", &handle, &bf) == FAILURE) {
return;
}
- FETCH_WINRES(win, &handle);
+ FETCH_WINRES(win, handle);
RETURN_LONG(keypad(*win, bf));
@@ -2029,11 +2084,11 @@ PHP_FUNCTION(ncurses_wcolor_set)
long color_pair;
WINDOW **win;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &handle, &color_pair) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &handle, &color_pair) == FAILURE) {
return;
}
- FETCH_WINRES(win, &handle);
+ FETCH_WINRES(win, handle);
RETURN_LONG(wcolor_set(*win, color_pair, 0));
}
@@ -2047,11 +2102,11 @@ PHP_FUNCTION(ncurses_wclear)
zval *handle;
WINDOW **win;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &handle) == FAILURE) {
return;
}
- FETCH_WINRES(win, &handle);
+ FETCH_WINRES(win, handle);
RETURN_LONG(wclear(*win));
}
@@ -2064,11 +2119,11 @@ PHP_FUNCTION(ncurses_wnoutrefresh)
zval *handle;
WINDOW **win;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &handle) == FAILURE) {
return;
}
- FETCH_WINRES(win, &handle);
+ FETCH_WINRES(win, handle);
RETURN_LONG(wnoutrefresh(*win));
}
@@ -2079,20 +2134,19 @@ PHP_FUNCTION(ncurses_wnoutrefresh)
PHP_FUNCTION(ncurses_waddstr)
{
zval *handle;
- char *str;
- int str_len;
+ zend_string *str;
long n = 0;
WINDOW **win;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &handle, &str, &str_len, &n) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rS|l", &handle, &str, &n) == FAILURE) {
return;
}
- FETCH_WINRES(win, &handle);
+ FETCH_WINRES(win, handle);
if (!n) {
- RETURN_LONG(waddstr(*win, str));
+ RETURN_LONG(waddstr(*win, ZSTR_VAL(str)));
} else {
- RETURN_LONG(waddnstr(*win, str, n));
+ RETURN_LONG(waddnstr(*win, ZSTR_VAL(str), n));
}
}
/* }}} */
@@ -2104,11 +2158,11 @@ PHP_FUNCTION(ncurses_wgetch)
zval *handle;
WINDOW **win;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &handle) == FAILURE) {
return;
}
- FETCH_WINRES(win, &handle);
+ FETCH_WINRES(win, handle);
RETURN_LONG(wgetch(*win));
}
@@ -2122,11 +2176,11 @@ PHP_FUNCTION(ncurses_wattroff)
WINDOW **win;
long attrs;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &handle, &attrs) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &handle, &attrs) == FAILURE) {
return;
}
- FETCH_WINRES(win, &handle);
+ FETCH_WINRES(win, handle);
RETURN_LONG(wattroff(*win, attrs));
}
@@ -2140,11 +2194,11 @@ PHP_FUNCTION(ncurses_wattron)
WINDOW **win;
long attrs;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &handle, &attrs) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &handle, &attrs) == FAILURE) {
return;
}
- FETCH_WINRES(win, &handle);
+ FETCH_WINRES(win, handle);
RETURN_LONG(wattron(*win, attrs));
}
@@ -2158,11 +2212,11 @@ PHP_FUNCTION(ncurses_wattrset)
WINDOW **win;
long attrs;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &handle, &attrs) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &handle, &attrs) == FAILURE) {
return;
}
- FETCH_WINRES(win, &handle);
+ FETCH_WINRES(win, handle);
RETURN_LONG(wattrset(*win, attrs));
}
@@ -2175,11 +2229,11 @@ PHP_FUNCTION(ncurses_wstandend)
zval *handle;
WINDOW **win;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &handle) == FAILURE) {
return;
}
- FETCH_WINRES(win, &handle);
+ FETCH_WINRES(win, handle);
RETURN_LONG(wstandend(*win));
}
@@ -2192,11 +2246,11 @@ PHP_FUNCTION(ncurses_wstandout)
zval *handle;
WINDOW **win;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &handle) == FAILURE) {
return;
}
- FETCH_WINRES(win, &handle);
+ FETCH_WINRES(win, handle);
RETURN_LONG(wstandout(*win));
}
@@ -2211,11 +2265,11 @@ PHP_FUNCTION(ncurses_new_panel)
WINDOW **win;
PANEL **panel;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &handle) == FAILURE) {
return;
}
- FETCH_WINRES(win, &handle);
+ FETCH_WINRES(win, handle);
panel = (PANEL **)emalloc(sizeof(PANEL *));
*panel = new_panel(*win);
@@ -2224,8 +2278,10 @@ PHP_FUNCTION(ncurses_new_panel)
efree(panel);
RETURN_FALSE;
} else {
- long id = ZEND_REGISTER_RESOURCE(return_value, panel, le_ncurses_panels);
- set_panel_userptr(*panel, (void*)id);
+ zend_resource *id = zend_register_resource(panel, le_ncurses_panels);
+ RETVAL_RES(id);
+ //long id = ZEND_REGISTER_RESOURCE(return_value, panel, le_ncurses_panels);
+ set_panel_userptr(*panel, (void*)&id->handle);
}
}
@@ -2237,10 +2293,10 @@ PHP_FUNCTION(ncurses_del_panel)
{
zval *handle;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &handle) == FAILURE) {
return;
}
- zend_list_delete(Z_RESVAL_P(handle));
+ zend_list_close(Z_RES_P(handle));
RETURN_TRUE;
}
@@ -2253,11 +2309,11 @@ PHP_FUNCTION(ncurses_hide_panel)
zval *handle;
PANEL **panel;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &handle) == FAILURE) {
return;
}
- FETCH_PANEL(panel, &handle);
+ FETCH_PANEL(panel, handle);
RETURN_LONG(hide_panel(*panel));
@@ -2271,11 +2327,11 @@ PHP_FUNCTION(ncurses_show_panel)
zval *handle;
PANEL **panel;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &handle) == FAILURE) {
return;
}
- FETCH_PANEL(panel, &handle);
+ FETCH_PANEL(panel, handle);
RETURN_LONG(show_panel(*panel));
@@ -2289,11 +2345,11 @@ PHP_FUNCTION(ncurses_top_panel)
zval *handle;
PANEL **panel;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &handle) == FAILURE) {
return;
}
- FETCH_PANEL(panel, &handle);
+ FETCH_PANEL(panel, handle);
RETURN_LONG(top_panel(*panel));
@@ -2307,11 +2363,11 @@ PHP_FUNCTION(ncurses_bottom_panel)
zval *handle;
PANEL **panel;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &handle) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &handle) == FAILURE) {
return;
}
- FETCH_PANEL(panel, &handle);
+ FETCH_PANEL(panel, handle);
RETURN_LONG(bottom_panel(*panel));
@@ -2326,11 +2382,11 @@ PHP_FUNCTION(ncurses_move_panel)
PANEL **panel;
long startx, starty;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &handle, &startx, &starty) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rll", &handle, &startx, &starty) == FAILURE) {
return;
}
- FETCH_PANEL(panel, &handle);
+ FETCH_PANEL(panel, handle);
RETURN_LONG(move_panel(*panel, startx, starty));
@@ -2345,12 +2401,12 @@ PHP_FUNCTION(ncurses_replace_panel)
PANEL **panel;
WINDOW **window;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr", &phandle, &whandle) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &phandle, &whandle) == FAILURE) {
return;
}
- FETCH_PANEL(panel, &phandle);
- FETCH_WINRES(window, &whandle);
+ FETCH_PANEL(panel, phandle);
+ FETCH_WINRES(window, whandle);
RETURN_LONG(replace_panel(*panel, *window));
@@ -2365,12 +2421,12 @@ PHP_FUNCTION(ncurses_panel_above)
PANEL **panel;
PANEL *above;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r!", &phandle) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r!", &phandle) == FAILURE) {
return;
}
if (phandle) {
- FETCH_PANEL(panel, &phandle);
+ FETCH_PANEL(panel, phandle);
above = panel_above(*panel);
} else {
above = panel_above((PANEL *)0);
@@ -2378,8 +2434,10 @@ PHP_FUNCTION(ncurses_panel_above)
if (above) {
long id = (long)panel_userptr(above);
- zend_list_addref(id);
- RETURN_RESOURCE(id);
+ zval *zid;
+ ZVAL_LONG(zid, id);
+ Z_ADDREF_P(zid);
+ RETURN_RES(Z_RES_P(zid));
} else {
RETURN_FALSE;
}
@@ -2394,20 +2452,22 @@ PHP_FUNCTION(ncurses_panel_below)
PANEL **panel;
PANEL *below;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r!", &phandle) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r!", &phandle) == FAILURE) {
return;
}
if (phandle) {
- FETCH_PANEL(panel, &phandle);
+ FETCH_PANEL(panel, phandle);
below = panel_below(*panel);
} else {
below = panel_below((PANEL *)0);
}
if (below) {
long id = (long)panel_userptr(below);
- zend_list_addref(id);
- RETURN_RESOURCE(id);
+ zval *zid;
+ ZVAL_LONG(zid, id);
+ Z_ADDREF_P(zid);
+ RETURN_RES(Z_RES_P(zid));
} else {
RETURN_FALSE;
}
@@ -2422,11 +2482,11 @@ PHP_FUNCTION(ncurses_panel_window)
PANEL **panel;
WINDOW **win;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &phandle) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &phandle) == FAILURE) {
return;
}
- FETCH_PANEL(panel, &phandle);
+ FETCH_PANEL(panel, phandle);
win = (WINDOW **)emalloc(sizeof(WINDOW *));
*win = panel_window(*panel);
@@ -2435,7 +2495,7 @@ PHP_FUNCTION(ncurses_panel_window)
efree(win);
RETURN_FALSE;
}
- ZEND_REGISTER_RESOURCE(return_value, win, le_ncurses_windows);
+ RETURN_RES(zend_register_resource(win, le_ncurses_windows));
}
/* }}} */
diff -urNp ncurses-php5/php_ncurses.h ncurses/php_ncurses.h
--- ncurses-php5/php_ncurses.h 2012-06-17 02:05:19.000000000 +0900
+++ ncurses/php_ncurses.h 2016-01-07 14:33:33.000000000 +0900
@@ -19,7 +19,7 @@
#ifndef PHP_NCURSES_H
#define PHP_NCURSES_H
-#define PHP_NCURSES_VERSION "1.0.2"
+#define PHP_NCURSES_VERSION "1.0.2/PHP7 epoch"
#ifdef HAVE_NCURSES_H
# include <ncurses.h>
diff -urNp ncurses-php5/php_ncurses_fe.h ncurses/php_ncurses_fe.h
--- ncurses-php5/php_ncurses_fe.h 2012-06-17 02:05:19.000000000 +0900
+++ ncurses/php_ncurses_fe.h 2016-01-07 14:22:13.000000000 +0900
@@ -158,6 +158,9 @@ PHP_FUNCTION(ncurses_newpad);
PHP_FUNCTION(ncurses_prefresh);
PHP_FUNCTION(ncurses_pnoutrefresh);
+PHP_FUNCTION(ncurses_wscrl);
+PHP_FUNCTION(ncurses_wsetscrreg);
+PHP_FUNCTION(ncurses_scrollok);
PHP_FUNCTION(ncurses_wstandout);
PHP_FUNCTION(ncurses_wstandend);
PHP_FUNCTION(ncurses_wattrset);
|