Curses
view release on metacpan or search on metacpan
sv_setref_pv(svP, "Curses::Item", (void*)valP);
}
static MENU *
c_sv2menu(sv, argnum)
SV *sv;
int argnum;
{
if (sv_derived_from(sv, "Curses::Menu"))
return (MENU *)SvIV((SV*)SvRV(sv));
if (argnum >= 0)
croak("argument %d to Curses function '%s' is not a Curses menu",
argnum, c_function);
else
croak("argument is not a Curses menu");
}
static void
c_menu2sv(sv, val)
SV *sv;
MENU *val;
{
sv_setref_pv(sv, "Curses::Menu", (void*)val);
}
static PANEL *
c_sv2panel(sv, argnum)
SV *sv;
int argnum;
{
if (sv_derived_from(sv, "Curses::Panel"))
return (PANEL *)SvIV((SV*)SvRV(sv));
if (argnum >= 0)
@ISA = qw(Curses);
sub new { newterm(@_) }
sub DESTROY { }
package Curses::Panel;
@ISA = qw(Curses);
sub new { new_panel(@_) }
sub DESTROY { }
package Curses::Menu;
@ISA = qw(Curses);
sub new { new_menu(@_) }
sub DESTROY { }
package Curses::Item;
@ISA = qw(Curses);
sub new { new_item(@_) }
sub DESTROY { }
CursesFun.c view on Meta::CPAN
sv_setiv(ST(0), (IV)ret);
}
XSRETURN(1);
#else
c_fun_not_there("del_panel");
XSRETURN(0);
#endif
}
/* Menu functions */
/* menu_attributes */
XS(XS_Curses_set_menu_fore)
{
dXSARGS;
#ifdef C_SET_MENU_FORE
c_exactargs("set_menu_fore", items, 2);
{
MENU * menu = c_sv2menu(ST(0), 0);
Makefile.PL view on Meta::CPAN
exit 1;
} else {
system($sys);
}
}
}
sub guessPanelMenuFormLibs($$$$$) {
my ($ncursesLibSearch, $libType, $panelLibsR, $menuLibsR, $formLibsR) = @_;
my ($panelLibGuess, $menuLibGuess, $formLibGuess);
if (defined($libType) && $libType eq "ncursesw") {
$panelLibGuess = -lpanelw;
$menuLibGuess = -lmenuw;
$formLibGuess = -lformw;
} else {
Makefile.PL view on Meta::CPAN
#
my $ncursesLibSearch;
$ncursesLibSearch = ''; # initial value
while ($libs =~ m{(-L\S+)}g) {
$ncursesLibSearch .= $1 . ' ';
}
guessPanelMenuFormLibs($ncursesLibSearch, $libType,
\my $panelGuess, \my $menuGuess, \my $formGuess);
if ($panels and not $panel_libs) {
$panel_libs = $panelGuess;
}
if ($menus and not $menu_libs) {
$menu_libs = $menuGuess;
}
push(@cFieldList, 0);
my $fieldListFormArg = pack('L!*', @cFieldList);
my $formR = new_form($fieldListFormArg);
if (${$formR} eq '') {
fatal("new_form failed");
}
# Don't under any circumstance destroy $itemListMenuArg while the menu
# object still exists, since the C menu object actually points to the
# memory that backs $itemListMenuArg.
# And don't destroy @cItemList or @cItemRList either while the menu object
# still exists, because they are backed by memory that the C menu object
# references as well.
my $rows;
my $cols;
scale_form($formR, $rows, $cols);
# try to understand it; just copy this magic pack code.
my @cItemList;
foreach my $cItemR (@cItemRList) {
push(@cItemList, ${$cItemR});
}
push @cItemList, 0;
my $itemListMenuArg = pack('L!*', @cItemList);
my $menuR = new_menu($itemListMenuArg);
if (${$menuR} eq '') {
fatal("new_menu failed")
}
# Don't under any circumstance destroy $itemListMenuArg while the menu object
# still exists, since the C menu object actually points to the memory that
# backs $itemListMenuArg.
# And don't destroy @cItemList or @cItemRList either while the menu object
# still exists, because they are backed by memory that the C menu object
# references as well.
my $rows;
my $cols;
set_menu_mark($menuR, '->');
set_menu_format($menuR, 3, 1);
( run in 1.212 second using v1.01-cache-2.11-cpan-49f99fa48dc )