From:             garrote at dm dot com dot br
Operating system: linux 2.4.20
PHP version:      4CVS-2003-06-09 (stable)
PHP Bug Type:     Unknown/Other Function
Bug description:  ncurses panel

Good morning,

there is a problem with ncurses_panel_window. if you create more than one
panel it doesnīt sets the recurse correctly and return segment fault. i
have to use array to storage the information of window and panel.
one think...we use function to retrieve the information...but i donīt
think that itīs the problem.

function nova_janela($nr_linhas, $nr_colunas, $linha, $coluna, $cor)
{
        global $WINDOW;

        $win = ncurses_newwin($nr_linhas, $nr_colunas, $linha, $coluna);
        if(!$win) // temos uma window
                return false;

        $janela = ncurses_new_panel($win);
        if(!$janela) // temos uma janela
                return false;

        $WINDOW["$janela"] = $win; // coloca na memoria o recurso

        if(ncurses_has_colors() and $cor) { // temos cor no terminal
                $fg = ($cor == NCURSES_COLOR_BLUE) ? NCURSES_COLOR_WHITE :
NCURSES_COLOR_BLACK;
                $bg = $cor;
                ncurses_init_pair($cor, $fg, $bg);
                ncurses_wattron($win, (color_pair($cor) | ' '));
        } else
                ncurses_wbkgdsett($win, NCURSES_A_BOLD | ' ');

        ncurses_wborder($win, 0,0,0,0,0,0,0,0);
        $l = 1;
        while($l < $nr_linhas - 1) {
                $c = 1;
                ncurses_wmove($win, $l, 1);
                while($c++ < $nr_colunas - 1) {
                        ncurses_waddch($win, 32);
                        //ncurses_update_panels(); //oops
                        ncurses_wrefresh($win); //oops
                }
                $l++;
        }
        ncurses_update_panels();
        ncurses_doupdate();
        return $janela;
}

function remove_janela($janela)
{
        global $WINDOW;

        if(!$janela) // temos uma janela
                return false;

        //$win = ncurses_panel_window($janela); // error Segment fault
        $win = $WINDOW["$janela"]; // recupera recurso

        if(!$win) // temos uma window
                return false;

        ncurses_del_panel($janela); // libera janela
        ncurses_delwin($win); // libera window
        ncurses_update_panels();
        ncurses_doupdate();
        return true;
}

$WINDOW=ARRAY();
ncurses_init();
if(ncurses_has_colors())
        ncurses_start_color();
$i=0;
while($i < 5) {
        $a[$i] = nova_janela(10 + ($i * 2), 20 + ($i * 5), 10 + $i, 10 +
$i,$i + 1);
        $i++;
}
$i=0;
while($i < 5) {
        remove_janela($a[$i]);
        $i++;
}
ncurses_end();
exit;





PHP 4.3.3-dev (cgi) (built: Jun  6 2003 19:30:49)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies
[PHP Modules]
ctype
mysql
ncurses
overload
pcre
posix
session
standard
tokenizer
xml
[Zend Modules]

-- 
Edit bug report at http://bugs.php.net/?id=24092&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=24092&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=24092&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=24092&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=24092&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=24092&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=24092&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=24092&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=24092&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=24092&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=24092&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24092&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=24092&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=24092&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=24092&r=gnused

Reply via email to