]> granicus.if.org Git - php/commitdiff
some more function implementations
authorHartmut Holzgraefe <hholzgra@php.net>
Mon, 17 Sep 2001 21:54:25 +0000 (21:54 +0000)
committerHartmut Holzgraefe <hholzgra@php.net>
Mon, 17 Sep 2001 21:54:25 +0000 (21:54 +0000)
ext/ncurses/c-prototypes
ext/ncurses/ncurses.c
ext/ncurses/ncurses_fe.c
ext/ncurses/ncurses_functions.c
ext/ncurses/php_ncurses_fe.h

index c76c8feb517b7bb8a3c0208ccd1443e0a30aa138..c98bd29730c9808b40e6bfab6ba0f9ddfc0e718a 100644 (file)
@@ -1,9 +1,9 @@
 + int addch(int);                              
-- int addchnstr(int *,int);            
-- int addchstr(int *);                 
-- int addnstr(string,int);                     
-- int addstr(string);                  
-- int assume_default_colors (int,int);
++ int addchnstr(int *,int);            
++ int addchstr(int *);                 
++ int addnstr(string,int);                     
++ int addstr(string);                  
++ int assume_default_colors (int,int);
 - int attr_get(int *,int *,void *);            
 - int attr_off(int,void *);                    
 - int attr_on(int,void *);                     
@@ -15,7 +15,7 @@
 + int beep(void);                                      
 + int bkgd(int);                               
 + void bkgdset(int);                           
-- int border(int,int,int,int,int,int,int,int); 
++ int border(int,int,int,int,int,int,int,int); 
 - int box(resource,int,int);           
 + bool can_change_color(void);                 
 + int cbreak(void);                            
@@ -30,7 +30,7 @@
 + int curs_set(int);                           
 + int def_prog_mode(void);                             
 + int def_shell_mode(void);                    
-- int define_key (string,int);
++ int define_key (string,int);
 + int delay_output(int);                               
 + int delch(void);                                     
 + int deleteln(void);                          
 + bool has_ic(void);                           
 + bool has_il(void);                           
 + int has_key(int);            /* do we have given key? */
-- int hline(int,int);                          
++ int hline(int,int);                          
 - void idcok(resource,bool);                   
 - int idlok(resource,bool);                    
 - void immedok(resource,bool);                 
 + int inch(void);                              
-- int inchnstr(int *,int);                     
+-ma int inchnstr(int *,int);                   
 - int inchstr(int *);                          
-- int init_color(int,int,int,int);             
++ int init_color(int,int,int,int);             
 + int init_pair(int,int,int);          
 - int innstr(string,int);                              
 + int insch(int);                              
 + int insdelln(int);                           
 + int insertln(void);                          
 - int insnstr(string,int);                     
-- int insstr(string);                  
-- int instr(string);                           
++ int insstr(string);                  
++ int instr(string);                           
 - int intrflush(resource,bool);                        
 - bool is_linetouched(resource,int);           
 - bool is_wintouched(resource);                        
 + int mouseinterval(int);
 - mmask_t mousemask(mmask_t,mmask_t *);
 + int move(int,int);                           
-- int mvaddch(int,int,int);            
-- int mvaddchnstr(int,int,int *,int);  
-- int mvaddchstr(int,int,int *);       
-- int mvaddnstr(int,int,string,int);   
-- int mvaddstr(int,int,string);                
++ int mvaddch(int,int,int);            
++ int mvaddchnstr(int,int,int *,int);  
++ int mvaddchstr(int,int,int *);       
++ int mvaddnstr(int,int,string,int);   
++ int mvaddstr(int,int,string);                
 - int mvchgat(int,int,int,int,int,void *);     
-- int mvcur(int,int,int,int);                  
-- int mvdelch(int,int);                                
++ int mvcur(int,int,int,int);                  
++ int mvdelch(int,int);                                
 - int mvderwin(resource,int,int);              
-- int mvgetch(int,int);                                
++ int mvgetch(int,int);                                
 - int mvgetnstr(int,int,string,int);           
 - int mvgetstr(int,int,string);                        
-- int mvhline(int,int,int,int);                
-- int mvinch(int,int);                         
++ int mvhline(int,int,int,int);                
++ int mvinch(int,int);                         
 - int mvinchnstr(int,int,int *,int);           
 - int mvinchstr(int,int,int *);                
 - int mvinnstr(int,int,string,int);            
 - int pnoutrefresh(resource,int,int,int,int,int,int);
 - int prefresh(resource,int,int,int,int,int,int);      
 - int printw( string,...);             
-- int putp(string);                            
++ int putp(string);                            
 - int putwin(resource,FILE *);                 
 + void qiflush(void);                          
 + int raw(void);                                       
 - int ripoffline(int,int (*init)(resource,int));       
 + int savetty(void);                           
 - int scanw( string,...);              
-- int scr_dump(string);                        
-- int scr_init(string);                        
-- int scr_restore(string);                     
-- int scr_set(string);                 
++ int scr_dump(string);                        
++ int scr_init(string);                        
++ int scr_restore(string);                     
++ int scr_set(string);                 
 + int scrl(int);                                       
 - int scroll(resource);                                
 - int scrollok(resource,bool);                 
index 8e5c47dac2522070a426616d074f3bc1e717be39..fda1d16810a3daba2e97dbcb6d6ff5b552a4b5ca 100644 (file)
@@ -86,7 +86,7 @@ PHP_MINIT_FUNCTION(ncurses)
        PHP_NCURSES_CONST(COLOR_CYAN);
        PHP_NCURSES_CONST(COLOR_WHITE);
        
-       le_ncurses = zend_register_list_destructors_ex(ncurses_destruct, NULL, "ncurses_hanlde", module_number);        
+       le_ncurses = zend_register_list_destructors_ex(ncurses_destruct, NULL, "ncurses_handle", module_number);        
 
        return SUCCESS;
 }
index 05512da331239c6c9156389edaa0ad8c9d6716db..05c7830b3aeef74944bb452d26c19c24c8c92764 100644 (file)
  */
 function_entry ncurses_functions[] = {
        PHP_FE(confirm_ncurses_compiled,        NULL)           /* For testing, remove later. */
-       PHP_FE(ncurses_init,    NULL)
-       PHP_FE(ncurses_end,    NULL)
-       PHP_FE(ncurses_getch,    NULL)
-       PHP_FE(ncurses_move,    NULL)
-       PHP_FE(ncurses_addch,    NULL)
-       PHP_FE(ncurses_refresh,    NULL)
-       PHP_FE(ncurses_has_colors,    NULL)
-       PHP_FE(ncurses_start_color,    NULL)
-       PHP_FE(ncurses_color_set,    NULL)
-       PHP_FE(ncurses_init_pair,    NULL)
-       PHP_FE(ncurses_newwin,    NULL)
-       PHP_FE(ncurses_delwin,    NULL)
-       PHP_FE(ncurses_standout,    NULL)
-       PHP_FE(ncurses_standend,    NULL)
-       PHP_FE(ncurses_baudrate,    NULL)
-       PHP_FE(ncurses_beep,    NULL)
-       PHP_FE(ncurses_can_change_color,    NULL)
-       PHP_FE(ncurses_cbreak,    NULL)
-       PHP_FE(ncurses_clear,    NULL)
-  PHP_FE(ncurses_clrtobot,    NULL)
-  PHP_FE(ncurses_clrtoeol,    NULL)
-  PHP_FE(ncurses_def_prog_mode,    NULL)
-  PHP_FE(ncurses_def_shell_mode,    NULL)
-  PHP_FE(ncurses_delch,    NULL)
-  PHP_FE(ncurses_deleteln,    NULL)
-  PHP_FE(ncurses_doupdate,    NULL)
-  PHP_FE(ncurses_echo,    NULL)
-  PHP_FE(ncurses_erase,    NULL)
-  PHP_FE(ncurses_erasechar,    NULL)
-  PHP_FE(ncurses_flash,    NULL)
-  PHP_FE(ncurses_flushinp,    NULL)
-  PHP_FE(ncurses_has_ic,    NULL)
-  PHP_FE(ncurses_has_il,    NULL)
-  PHP_FE(ncurses_inch,    NULL)
-  PHP_FE(ncurses_insertln,    NULL)
-  PHP_FE(ncurses_isendwin,    NULL)
-  PHP_FE(ncurses_killchar,    NULL)
-  PHP_FE(ncurses_nl, NULL)
-  PHP_FE(ncurses_nocbreak, NULL)
-  PHP_FE(ncurses_noecho, NULL)
-  PHP_FE(ncurses_nonl, NULL)
-  PHP_FE(ncurses_noraw, NULL)
-  PHP_FE(ncurses_raw, NULL)
-  PHP_FE(ncurses_resetty, NULL)
-  PHP_FE(ncurses_savetty, NULL)
-  PHP_FE(ncurses_termattrs, NULL)
-  PHP_FE(ncurses_use_default_colors, NULL)
-  PHP_FE(ncurses_slk_attr, NULL)
-  PHP_FE(ncurses_slk_clear, NULL)
-  PHP_FE(ncurses_slk_noutrefresh, NULL)
-  PHP_FE(ncurses_slk_refresh, NULL)
-  PHP_FE(ncurses_slk_restore, NULL)
-  PHP_FE(ncurses_slk_touch, NULL)
-  PHP_FE(ncurses_attroff, NULL)
-  PHP_FE(ncurses_attron, NULL)
-  PHP_FE(ncurses_attrset, NULL)
-  PHP_FE(ncurses_bkgd, NULL)
-  PHP_FE(ncurses_curs_set, NULL)
-  PHP_FE(ncurses_delay_output, NULL)
-  PHP_FE(ncurses_echochar, NULL)
-  PHP_FE(ncurses_halfdelay, NULL)
-  PHP_FE(ncurses_has_key, NULL)
-  PHP_FE(ncurses_insch, NULL)
-  PHP_FE(ncurses_insdelln, NULL)
-  PHP_FE(ncurses_mouseinterval, NULL)
-  PHP_FE(ncurses_napms, NULL)
-  PHP_FE(ncurses_scrl, NULL)
-  PHP_FE(ncurses_slk_attroff, NULL)
-  PHP_FE(ncurses_slk_attron, NULL)
-  PHP_FE(ncurses_slk_attrset, NULL)
-  PHP_FE(ncurses_slk_color, NULL)
-  PHP_FE(ncurses_slk_init, NULL)
-  PHP_FE(ncurses_typeahead, NULL)
-  PHP_FE(ncurses_ungetch, NULL)
-  PHP_FE(ncurses_vidattr, NULL)
-  PHP_FE(ncurses_use_extended_names, NULL)
-  PHP_FE(ncurses_bkgdset, NULL)
-  PHP_FE(ncurses_filter, NULL)
-  PHP_FE(ncurses_noqiflush, NULL)
-  PHP_FE(ncurses_qiflush, NULL)
-  PHP_FE(ncurses_timeout, NULL)
-  PHP_FE(ncurses_use_env, NULL)
+       PHP_FE(ncurses_addch, NULL)
+       PHP_FE(ncurses_color_set, NULL)
+       PHP_FE(ncurses_delwin, NULL)
+       PHP_FE(ncurses_end, NULL)
+       PHP_FE(ncurses_getch, NULL)
+       PHP_FE(ncurses_has_colors, NULL)
+       PHP_FE(ncurses_init, NULL)
+       PHP_FE(ncurses_init_pair, NULL)
+       PHP_FE(ncurses_move, NULL)
+       PHP_FE(ncurses_newwin, NULL)
+       PHP_FE(ncurses_refresh, NULL)
+       PHP_FE(ncurses_start_color, NULL)
+       PHP_FE(ncurses_standout, NULL)
+       PHP_FE(ncurses_standend, NULL)
+       PHP_FE(ncurses_baudrate, NULL)
+       PHP_FE(ncurses_beep, NULL)
+       PHP_FE(ncurses_can_change_color, NULL)
+       PHP_FE(ncurses_cbreak, NULL)
+       PHP_FE(ncurses_clear, NULL)
+       PHP_FE(ncurses_clrtobot, NULL)
+       PHP_FE(ncurses_clrtoeol, NULL)
+       PHP_FE(ncurses_def_prog_mode, NULL)
+       PHP_FE(ncurses_def_shell_mode, NULL)
+       PHP_FE(ncurses_delch, NULL)
+       PHP_FE(ncurses_deleteln, NULL)
+       PHP_FE(ncurses_doupdate, NULL)
+       PHP_FE(ncurses_echo, NULL)
+       PHP_FE(ncurses_erase, NULL)
+       PHP_FE(ncurses_erasechar, NULL)
+       PHP_FE(ncurses_flash, NULL)
+       PHP_FE(ncurses_flushinp, NULL)
+       PHP_FE(ncurses_has_ic, NULL)
+       PHP_FE(ncurses_has_il, NULL)
+       PHP_FE(ncurses_inch, NULL)
+       PHP_FE(ncurses_insertln, NULL)
+       PHP_FE(ncurses_isendwin, NULL)
+       PHP_FE(ncurses_killchar, NULL)
+       PHP_FE(ncurses_nl, NULL)
+       PHP_FE(ncurses_nocbreak, NULL)
+       PHP_FE(ncurses_noecho, NULL)
+       PHP_FE(ncurses_nonl, NULL)
+       PHP_FE(ncurses_noraw, NULL)
+       PHP_FE(ncurses_raw, NULL)
+       PHP_FE(ncurses_resetty, NULL)
+       PHP_FE(ncurses_savetty, NULL)
+       PHP_FE(ncurses_termattrs, NULL)
+       PHP_FE(ncurses_use_default_colors, NULL)
+       PHP_FE(ncurses_slk_attr, NULL)
+       PHP_FE(ncurses_slk_clear, NULL)
+       PHP_FE(ncurses_slk_noutrefresh, NULL)
+       PHP_FE(ncurses_slk_refresh, NULL)
+       PHP_FE(ncurses_slk_restore, NULL)
+       PHP_FE(ncurses_slk_touch, NULL)
+       PHP_FE(ncurses_attroff, NULL)
+       PHP_FE(ncurses_attron, NULL)
+       PHP_FE(ncurses_attrset, NULL)
+       PHP_FE(ncurses_bkgd, NULL)
+       PHP_FE(ncurses_curs_set, NULL)
+       PHP_FE(ncurses_delay_output, NULL)
+       PHP_FE(ncurses_echochar, NULL)
+       PHP_FE(ncurses_halfdelay, NULL)
+       PHP_FE(ncurses_has_key, NULL)
+       PHP_FE(ncurses_insch, NULL)
+       PHP_FE(ncurses_insdelln, NULL)
+       PHP_FE(ncurses_mouseinterval, NULL)
+       PHP_FE(ncurses_napms, NULL)
+       PHP_FE(ncurses_scrl, NULL)
+       PHP_FE(ncurses_slk_attroff, NULL)
+       PHP_FE(ncurses_slk_attron, NULL)
+       PHP_FE(ncurses_slk_attrset, NULL)
+       PHP_FE(ncurses_slk_color, NULL)
+       PHP_FE(ncurses_slk_init, NULL)
+       PHP_FE(ncurses_typeahead, NULL)
+       PHP_FE(ncurses_ungetch, NULL)
+       PHP_FE(ncurses_vidattr, NULL)
+       PHP_FE(ncurses_wrefresh, NULL)
+       PHP_FE(ncurses_use_extended_names, NULL)
+       PHP_FE(ncurses_bkgdset, NULL)
+       PHP_FE(ncurses_filter, NULL)
+       PHP_FE(ncurses_noqiflush, NULL)
+       PHP_FE(ncurses_qiflush, NULL)
+       PHP_FE(ncurses_timeout, NULL)
+       PHP_FE(ncurses_use_env, NULL)
+       PHP_FE(ncurses_addstr, NULL)
+       PHP_FE(ncurses_putp, NULL)
+       PHP_FE(ncurses_scr_dump, NULL)
+       PHP_FE(ncurses_scr_init, NULL)
+       PHP_FE(ncurses_scr_restore, NULL)
+       PHP_FE(ncurses_scr_set, NULL)
+       PHP_FE(ncurses_mvaddch, NULL)
+       PHP_FE(ncurses_mvaddchnstr, NULL)
+       PHP_FE(ncurses_addchnstr, NULL)
+       PHP_FE(ncurses_mvaddchstr, NULL)
+       PHP_FE(ncurses_addchstr, NULL)
+       PHP_FE(ncurses_mvaddnstr, NULL)
+       PHP_FE(ncurses_addnstr, NULL)
+       PHP_FE(ncurses_mvaddstr, NULL)
+       PHP_FE(ncurses_mvdelch, NULL)
+       PHP_FE(ncurses_mvgetch, NULL)
+       PHP_FE(ncurses_mvinch, NULL)
+       PHP_FE(ncurses_mvwaddstr, NULL)
+       PHP_FE(ncurses_insstr, NULL)
+       PHP_FE(ncurses_instr, NULL)
+       PHP_FE(ncurses_mvhline, NULL)
+       PHP_FE(ncurses_mvcur, NULL)
+       PHP_FE(ncurses_init_color, NULL)
+       PHP_FE(ncurses_border, NULL)
+       PHP_FE(ncurses_assume_default_colors, NULL)
+       PHP_FE(ncurses_define_key, NULL)
+       PHP_FE(ncurses_hline, NULL)
+       PHP_FE(ncurses_vline, NULL)
+       PHP_FE(ncurses_keyok, NULL)
        {NULL, NULL, NULL}      /* Must be the last line in ncurses_functions[] */
 };
index 99cfc81b719372d55f7b03f6980bc7ed7d9f3ebf..18380cb2f9f3e3c442baff5d40556bf41616d1f2 100644 (file)
 #include "php_ini.h"
 #include "php_ncurses.h"
 
+#define FETCH_WINRES(r, z)   ZEND_FETCH_RESOURCE(r, WINDOW *, z, -1, "ncurses_handle", le_ncurses); \
+                                    if(!r) RETURN_FALSE;
+
+
 /* {{{ proto int ncurses_addch(int ch)
     */
 PHP_FUNCTION(ncurses_addch)
@@ -51,7 +55,7 @@ PHP_FUNCTION(ncurses_color_set)
        }
        
        convert_to_long_ex(pair);
-
        RETURN_LONG(color_set(_INT(pair),NULL));
 #else
        php_error(E_WARNING,"%s not supported in this build");
@@ -60,20 +64,20 @@ PHP_FUNCTION(ncurses_color_set)
 }
 /* }}} */
 
-/* {{{ proto int ncurses_newwin(int ch)
+/* {{{ proto int ncurses_delwin(resource window)
     */
 PHP_FUNCTION(ncurses_delwin)
 {
        zval **handle;
+       WINDOW *w;
+
        if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &handle) == FAILURE){
                WRONG_PARAM_COUNT;
        }
 
-       convert_to_long_ex(handle);
-
-       /* TODO resource type check */
+       FETCH_WINRES(w,handle);
 
-       zend_list_delete((*handle)->value.lval);
+       zend_list_delete(_INT(handle));
 }
 /* }}} */
 
@@ -144,7 +148,7 @@ PHP_FUNCTION(ncurses_move)
 }
 /* }}} */
 
-/* {{{ proto int ncurses_newwin(int ch)
+/* {{{ proto int ncurses_newwin(int rows, int cols, int y, int x)
     */
 PHP_FUNCTION(ncurses_newwin)
 {
@@ -941,3 +945,537 @@ PHP_FUNCTION(ncurses_use_env)
        use_env(_INT(intarg));
 }
 /* }}} */
+
+/* {{{ proto int ncurses_addstr(string text)
+   */
+PHP_FUNCTION(ncurses_addstr)
+{
+       zval **data;
+
+       if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &data) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_string_ex(data);
+
+       RETURN_LONG(addstr(_STRING(data)));
+}
+/* }}} */
+
+
+
+
+/**********************  area of work *************************************/
+
+
+
+
+/* {{{ proto int ncurses_putp(string text)
+   */
+PHP_FUNCTION(ncurses_putp)
+{
+       zval **data;
+
+       if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &data) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_string_ex(data);
+
+       RETURN_LONG(putp(_STRING(data)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_scr_dump(string text)
+   */
+PHP_FUNCTION(ncurses_scr_dump)
+{
+       zval **data;
+
+       if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &data) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_string_ex(data);
+
+       RETURN_LONG(scr_dump(_STRING(data)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_scr_init(string text)
+   */
+PHP_FUNCTION(ncurses_scr_init)
+{
+       zval **data;
+
+       if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &data) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_string_ex(data);
+
+       RETURN_LONG(scr_init(_STRING(data)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_scr_restore(string text)
+   */
+PHP_FUNCTION(ncurses_scr_restore)
+{
+       zval **data;
+
+       if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &data) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_string_ex(data);
+
+       RETURN_LONG(scr_restore(_STRING(data)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_scr_set(string text)
+   */
+PHP_FUNCTION(ncurses_scr_set)
+{
+       zval **data;
+
+       if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &data) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_string_ex(data);
+
+       RETURN_LONG(scr_set(_STRING(data)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_mvaddch(int x, int y, int c)
+   */
+PHP_FUNCTION(ncurses_mvaddch)
+{
+       zval **x,**y,**c;
+
+       if(ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &x, &y, &c) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_long_ex(x);
+       convert_to_long_ex(y);
+       convert_to_long_ex(c);
+
+       RETURN_LONG(mvaddch(_INT(x),_INT(y),_INT(c)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_mvaddchnstr(int x, int y, string s, int n)
+   */
+PHP_FUNCTION(ncurses_mvaddchnstr)
+{
+       zval **x,**y,**s,**n;
+
+       if(ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &x, &y, &s, &n) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_long_ex(x);
+       convert_to_long_ex(y);
+       convert_to_string_ex(s);
+       convert_to_long_ex(n);
+
+       RETURN_LONG(mvaddchnstr(_INT(x),_INT(y),(chtype *)_STRING(s),_INT(n)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_addchnstr(string s, int n)
+   */
+PHP_FUNCTION(ncurses_addchnstr)
+{
+       zval **s,**n;
+
+       if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &s, &n) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_string_ex(s);
+       convert_to_long_ex(n);
+
+       RETURN_LONG(addchnstr((chtype *)_STRING(s),_INT(n)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_mvaddchstr(int x, int y, string s)
+   */
+PHP_FUNCTION(ncurses_mvaddchstr)
+{
+       zval **x,**y,**s;
+
+       if(ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &x, &y, &s) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_long_ex(x);
+       convert_to_long_ex(y);
+       convert_to_string_ex(s);
+
+       RETURN_LONG(mvaddchstr(_INT(x),_INT(y),(chtype *)_STRING(s)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_addchstr(string s)
+   */
+PHP_FUNCTION(ncurses_addchstr)
+{
+       zval **s;
+
+       if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &s) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_string_ex(s);
+
+       RETURN_LONG(addchstr((chtype *)_STRING(s)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_mvaddnstr(int x, int y, string s, int n)
+   */
+PHP_FUNCTION(ncurses_mvaddnstr)
+{
+       zval **x,**y,**s,**n;
+
+       if(ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &x, &y, &s, &n) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_long_ex(x);
+       convert_to_long_ex(y);
+       convert_to_string_ex(s);
+       convert_to_long_ex(n);
+
+       RETURN_LONG(mvaddnstr(_INT(x),_INT(y),_STRING(s),_INT(n)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_addnstr(int x, int y, string s, int n)
+   */
+PHP_FUNCTION(ncurses_addnstr)
+{
+       zval **s,**n;
+
+       if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &s, &n) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_string_ex(s);
+       convert_to_long_ex(n);
+
+       RETURN_LONG(addnstr(_STRING(s),_INT(n)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_mvaddstr(int x, int y, string s)
+   */
+PHP_FUNCTION(ncurses_mvaddstr)
+{
+       zval **x,**y,**s;
+
+       if(ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &x, &y, &s) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_long_ex(x);
+       convert_to_long_ex(y);
+       convert_to_string_ex(s);
+
+       RETURN_LONG(mvaddstr(_INT(x),_INT(y),_STRING(s)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_mvdelch(int x, int y)
+   */
+PHP_FUNCTION(ncurses_mvdelch)
+{
+       zval **x,**y,**c;
+
+       if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_long_ex(x);
+       convert_to_long_ex(y);
+
+       RETURN_LONG(mvdelch(_INT(x),_INT(y)));
+}
+/* }}} */
+
+
+/* {{{ proto int ncurses_mvgetch(int x, int y)
+   */
+PHP_FUNCTION(ncurses_mvgetch)
+{
+       zval **x,**y;
+
+       if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_long_ex(x);
+       convert_to_long_ex(y);
+
+       RETURN_LONG(mvgetch(_INT(x),_INT(y)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_mvinch(int x, int y)
+   */
+PHP_FUNCTION(ncurses_mvinch)
+{
+       zval **x,**y;
+
+       if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_long_ex(x);
+       convert_to_long_ex(y);
+
+       RETURN_LONG(mvinch(_INT(x),_INT(y)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_insstr(string)
+   */
+PHP_FUNCTION(ncurses_insstr)
+{
+       zval **str;
+
+       if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_string_ex(str);
+
+       RETURN_LONG(insstr(_STRING(str)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_instr(string)
+   */
+PHP_FUNCTION(ncurses_instr)
+{
+       zval **str;
+
+       if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_string_ex(str);
+
+       RETURN_LONG(instr(_STRING(str)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_mvhline(int,int,int,int)
+   */
+PHP_FUNCTION(ncurses_mvhline)
+{
+       zval **i1,**i2,**i3,**i4;
+
+       if(ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &i1, &i2, &i3, &i4) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_long_ex(i1);
+       convert_to_long_ex(i2);
+       convert_to_long_ex(i3);
+       convert_to_long_ex(i4);
+
+       RETURN_LONG(mvhline(_INT(i1),_INT(i2),_INT(i3),_INT(i4)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_mvcur(int,int,int,int)
+   */
+PHP_FUNCTION(ncurses_mvcur)
+{
+       zval **i1,**i2,**i3,**i4;
+
+       if(ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &i1, &i2, &i3, &i4) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_long_ex(i1);
+       convert_to_long_ex(i2);
+       convert_to_long_ex(i3);
+       convert_to_long_ex(i4);
+
+       RETURN_LONG(mvcur(_INT(i1),_INT(i2),_INT(i3),_INT(i4)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_init_color(int,int,int,int)
+   */
+PHP_FUNCTION(ncurses_init_color)
+{
+       zval **i1,**i2,**i3,**i4;
+
+       if(ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &i1, &i2, &i3, &i4) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_long_ex(i1);
+       convert_to_long_ex(i2);
+       convert_to_long_ex(i3);
+       convert_to_long_ex(i4);
+
+       RETURN_LONG(init_color(_INT(i1),_INT(i2),_INT(i3),_INT(i4)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_border(int,int,int,int,int,int,int,int)
+   */
+PHP_FUNCTION(ncurses_border)
+{
+       zval **i1,**i2,**i3,**i4,**i5,**i6,**i7,**i8;
+
+       if(ZEND_NUM_ARGS() != 8 || zend_get_parameters_ex(8, &i1, &i2, &i3, &i4, &i5, &i6, &i7, &i8) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_long_ex(i1);
+       convert_to_long_ex(i2);
+       convert_to_long_ex(i3);
+       convert_to_long_ex(i4);
+       convert_to_long_ex(i5);
+       convert_to_long_ex(i6);
+       convert_to_long_ex(i7);
+       convert_to_long_ex(i8);
+
+       RETURN_LONG(border(_INT(i1),_INT(i2),_INT(i3),_INT(i4),_INT(i5),_INT(i6),_INT(i7),_INT(i8)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_assume_default_colors(int,int)
+   */
+PHP_FUNCTION(ncurses_assume_default_colors)
+{
+       zval **i1,**i2;
+
+       if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &i1, &i2) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_long_ex(i1);
+       convert_to_long_ex(i2);
+
+       RETURN_LONG(assume_default_colors(_INT(i1),_INT(i2)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_define_key(string,int)
+   */
+PHP_FUNCTION(ncurses_define_key)
+{
+       zval **s1,**i2;
+
+       if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &s1, &i2) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_string_ex(s1);
+       convert_to_long_ex(i2);
+
+       RETURN_LONG(define_key(_STRING(s1),_INT(i2)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_hline(int,int)
+   */
+PHP_FUNCTION(ncurses_hline)
+{
+       zval **i1,**i2;
+
+       if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &i1, &i2) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_long_ex(i1);
+       convert_to_long_ex(i2);
+
+       RETURN_LONG(hline(_INT(i1),_INT(i2)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_vline(int,int)
+   */
+PHP_FUNCTION(ncurses_vline)
+{
+       zval **i1,**i2;
+
+       if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &i1, &i2) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_long_ex(i1);
+       convert_to_long_ex(i2);
+
+       RETURN_LONG(vline(_INT(i1),_INT(i2)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_keyok(int,bool)
+   */
+PHP_FUNCTION(ncurses_keyok)
+{
+       zval **i1,**b2;
+
+       if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &i1, &b2) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_long_ex(i1);
+       convert_to_long_ex(b2);
+
+       RETURN_LONG(hline(_INT(i1),_INT(b2)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_mvwaddstr(resource window, int y, int x, string text)
+    */
+PHP_FUNCTION(ncurses_mvwaddstr)
+{
+       zval **handle, **x, **y, **text;
+       WINDOW **w;
+
+       if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &handle, &y, &x, &text) == FAILURE){
+               WRONG_PARAM_COUNT;
+       }
+
+       FETCH_WINRES(w,handle);
+
+       convert_to_long_ex(y);
+       convert_to_long_ex(x);
+       convert_to_string_ex(text);
+
+       RETURN_LONG(mvwaddstr(*w,_INT(y),_INT(x),_STRING(text)));
+}
+/* }}} */
+
+/* {{{ proto int ncurses_wrefresh(resource window)
+    */
+PHP_FUNCTION(ncurses_wrefresh)
+{
+       zval **handle;
+       WINDOW **w;
+
+       if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &handle) == FAILURE){
+               WRONG_PARAM_COUNT;
+       }
+
+       FETCH_WINRES(w,handle);
+
+       RETURN_LONG(wrefresh(*w));
+}
+/* }}} */
+
index b31faa8414c8598458efafd2fb62cfefbd0a0f5d..f7e83383791e96b839529c456c0bcfb11bfdf9c6 100644 (file)
 #define PHP_NCURSES_FE_H
 
 PHP_FUNCTION(confirm_ncurses_compiled);        /* For testing, remove later. */
-PHP_FUNCTION(ncurses_init);
+PHP_FUNCTION(ncurses_addch);
+PHP_FUNCTION(ncurses_color_set);
+PHP_FUNCTION(ncurses_delwin);
 PHP_FUNCTION(ncurses_end);
 PHP_FUNCTION(ncurses_getch);
-PHP_FUNCTION(ncurses_move);
-PHP_FUNCTION(ncurses_addch);
-PHP_FUNCTION(ncurses_refresh);
 PHP_FUNCTION(ncurses_has_colors);
-PHP_FUNCTION(ncurses_start_color);
-PHP_FUNCTION(ncurses_color_set);
+PHP_FUNCTION(ncurses_init);
 PHP_FUNCTION(ncurses_init_pair);
+PHP_FUNCTION(ncurses_move);
 PHP_FUNCTION(ncurses_newwin);
-PHP_FUNCTION(ncurses_delwin);
+PHP_FUNCTION(ncurses_refresh);
+PHP_FUNCTION(ncurses_start_color);
 PHP_FUNCTION(ncurses_standout);
 PHP_FUNCTION(ncurses_standend);
 PHP_FUNCTION(ncurses_baudrate);
@@ -48,7 +48,6 @@ PHP_FUNCTION(ncurses_delch);
 PHP_FUNCTION(ncurses_deleteln);
 PHP_FUNCTION(ncurses_doupdate);
 PHP_FUNCTION(ncurses_echo);
-PHP_FUNCTION(ncurses_echochar);
 PHP_FUNCTION(ncurses_erase);
 PHP_FUNCTION(ncurses_erasechar);
 PHP_FUNCTION(ncurses_flash);
@@ -81,6 +80,7 @@ PHP_FUNCTION(ncurses_attrset);
 PHP_FUNCTION(ncurses_bkgd);
 PHP_FUNCTION(ncurses_curs_set);
 PHP_FUNCTION(ncurses_delay_output);
+PHP_FUNCTION(ncurses_echochar);
 PHP_FUNCTION(ncurses_halfdelay);
 PHP_FUNCTION(ncurses_has_key);
 PHP_FUNCTION(ncurses_insch);
@@ -96,6 +96,7 @@ PHP_FUNCTION(ncurses_slk_init);
 PHP_FUNCTION(ncurses_typeahead);
 PHP_FUNCTION(ncurses_ungetch);
 PHP_FUNCTION(ncurses_vidattr);
+PHP_FUNCTION(ncurses_wrefresh);
 PHP_FUNCTION(ncurses_use_extended_names);
 PHP_FUNCTION(ncurses_bkgdset);
 PHP_FUNCTION(ncurses_filter);
@@ -103,4 +104,33 @@ PHP_FUNCTION(ncurses_noqiflush);
 PHP_FUNCTION(ncurses_qiflush);
 PHP_FUNCTION(ncurses_timeout);
 PHP_FUNCTION(ncurses_use_env);
+PHP_FUNCTION(ncurses_addstr);
+PHP_FUNCTION(ncurses_putp);
+PHP_FUNCTION(ncurses_scr_dump);
+PHP_FUNCTION(ncurses_scr_init);
+PHP_FUNCTION(ncurses_scr_restore);
+PHP_FUNCTION(ncurses_scr_set);
+PHP_FUNCTION(ncurses_mvaddch);
+PHP_FUNCTION(ncurses_mvaddchnstr);
+PHP_FUNCTION(ncurses_addchnstr);
+PHP_FUNCTION(ncurses_mvaddchstr);
+PHP_FUNCTION(ncurses_addchstr);
+PHP_FUNCTION(ncurses_mvaddnstr);
+PHP_FUNCTION(ncurses_addnstr);
+PHP_FUNCTION(ncurses_mvaddstr);
+PHP_FUNCTION(ncurses_mvdelch);
+PHP_FUNCTION(ncurses_mvgetch);
+PHP_FUNCTION(ncurses_mvinch);
+PHP_FUNCTION(ncurses_mvwaddstr);
+PHP_FUNCTION(ncurses_insstr);
+PHP_FUNCTION(ncurses_instr);
+PHP_FUNCTION(ncurses_mvhline);
+PHP_FUNCTION(ncurses_mvcur);
+PHP_FUNCTION(ncurses_init_color);
+PHP_FUNCTION(ncurses_border);
+PHP_FUNCTION(ncurses_assume_default_colors);
+PHP_FUNCTION(ncurses_define_key);
+PHP_FUNCTION(ncurses_hline);
+PHP_FUNCTION(ncurses_vline);
+PHP_FUNCTION(ncurses_keyok);
 #endif