php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24092 ncurses panel
Submitted: 2003-06-09 07:33 UTC Modified: 2003-06-09 22:05 UTC
From: garrote at dm dot com dot br Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4CVS-2003-06-09 (stable) OS: linux 2.4.20
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: garrote at dm dot com dot br
New email:
PHP Version: OS:

 

 [2003-06-09 07:33 UTC] garrote at dm dot com dot br
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]

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-09 08:41 UTC] sniper@php.net
Fatal error: Call to undefined function:  ncurses_wbkgdset() 

Try provide a script that has even remote possibility on
working..or at least a GDB backtrace.

 [2003-06-09 09:15 UTC] garrote at dm dot com dot br
i?m sory.... i don?t send this function in example...plese add the coment in those line
// } else
//    ncurses_wbkgdsett($win, NCURSES_A_BOLD | ' ');
but the problem persist whithout this function.
 [2003-06-09 22:05 UTC] sniper@php.net
Does not crash here.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Oct 05 04:01:29 2024 UTC