BUU has asked for the wisdom of the Perl Monks concerning the following question:
my $o = IO::File->new("/dev/tty", "w"); my $i = IO::File->new("/dev/tty", "r"); newterm(undef, $o, $i); endwin()
I'll reproduce the XS code for newterm for your viewing pleasure:#include <curses.h> #include <stdlib.h> int main() { FILE *i, *o; i = fopen( "/dev/tty", "r" ); o = fopen( "/dev/tty", "w" ); SCREEN *s = newterm(0, o, i); addch('a'); addch('b'); addch('c'); refresh(); endwin(); }
XS(XS_Curses_newterm) { dXSARGS; #ifdef C_NEWTERM c_exactargs("newterm", items, 3); { char * type = ST(0) != &PL_sv_undef ? (char *)SvPV(ST(0),PL_na) : +NULL; FILE * outfd = IoIFP(sv_2io(ST(1))); FILE * infd = IoIFP(sv_2io(ST(2))); SCREEN * ret = newterm(type, outfd, infd); ST(0) = sv_newmortal(); c_screen2sv(ST(0), ret); } XSRETURN(1); #else c_fun_not_there("newterm"); XSRETURN(0); #endif }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Curses.pm and newterm
by BrowserUk (Patriarch) on Dec 12, 2005 at 09:42 UTC | |
by BUU (Prior) on Dec 12, 2005 at 19:28 UTC | |
by BrowserUk (Patriarch) on Dec 12, 2005 at 23:25 UTC | |
by BUU (Prior) on Dec 13, 2005 at 01:31 UTC |