This distribution has been tested as part of the cpan-testers effort to test as many new uploads to CPAN as possible. See http://testers.cpan.org/ Please cc any replies to [EMAIL PROTECTED] to keep other test volunteers informed and to prevent any duplicate effort. -- This patch was needed: ====================== --- perl-5.6.1-orig/CYGWIN-PATCHES/Bundle.CPAN/TermReadKey-2.14/ReadKey.xs Mon Mar 29 15:57:56 1999 +++ perl-5.6.1-11599/CYGWIN-PATCHES/Bundle.CPAN/TermReadKey-2.14-patched/ReadKey.xs + Tue Aug 21 22:16:44 2001 @@ -5,6 +5,8 @@ #include "XSUB.h" #include "ppport.h" +#define InputStream PerlIO * + /******************************************************************* Copyright (C) 1994,1995,1996,1997 Kenneth Albanowski. Unlimited @@ -106,7 +108,7 @@ too. Added Sun TermSize support. (Hope I got it right.) Version 1.5, Fri Dec 9 16:07:49 EST 1994: - Added SetTermSize, GetSpeeds, Get/SetControlChars, FILE support. + Added SetTermSize, GetSpeeds, Get/SetControlChars, PerlIO support. Version 1.01, Thu Oct 20 23:32:39 EDT 1994: Added Select_fd_set_t casts to select() call. @@ -321,50 +323,50 @@ I think not for now. */ -#define STDIN IoIFP(GvIOp(PL_stdingv)) +#define STDIN PerlIO_stdin() #include "cchars.h" -int GetTermSizeVIO _((FILE * file, +int GetTermSizeVIO _((PerlIO * file, int * retwidth, int * retheight, int * xpix, int * ypix)); -int GetTermSizeGWINSZ _((FILE * file, +int GetTermSizeGWINSZ _((PerlIO * file, int * retwidth, int * retheight, int * xpix, int * ypix)); -int GetTermSizeGSIZE _((FILE * file, +int GetTermSizeGSIZE _((PerlIO * file, int * retwidth, int * retheight, int * xpix, int * ypix)); -int GetTermSizeWin32 _((FILE * file, +int GetTermSizeWin32 _((PerlIO * file, int * retwidth, int * retheight, int * xpix, int * ypix)); -int SetTerminalSize _((FILE * file, +int SetTerminalSize _((PerlIO * file, int width, int height, int xpix, int ypix)); -void ReadMode _((FILE * file,int mode)); +void ReadMode _((PerlIO * file,int mode)); -int pollfile _((FILE * file, double delay)); +int pollfile _((PerlIO * file, double delay)); -int setnodelay _((FILE * file, int mode)); +int setnodelay _((PerlIO * file, int mode)); -int selectfile _((FILE * file, double delay)); +int selectfile _((PerlIO * file, double delay)); -int Win32PeekChar _((FILE * file, double delay, char * key)); +int Win32PeekChar _((PerlIO * file, double delay, char * key)); -int getspeed _((FILE * file, I32 *in, I32 * out )); +int getspeed _((PerlIO * file, I32 *in, I32 * out )); #ifdef VIOMODE int GetTermSizeVIO(file,retwidth,retheight,xpix,ypix) -FILE * file; +PerlIO * file; int *retwidth, *retheight, *xpix, *ypix; { - /*int handle=fileno(file); + /*int handle=PerlIO_fileno(file); static VIOMODEINFO *modeinfo = NULL; @@ -385,7 +387,7 @@ } #else int GetTermSizeVIO(file,retwidth,retheight,xpix,ypix) -FILE * file; +PerlIO * file; int *retwidth, *retheight, *xpix, *ypix; { croak("TermSizeVIO is not implemented on this architecture"); @@ -395,10 +397,10 @@ #if defined(TIOCGWINSZ) && !defined(DONT_USE_GWINSZ) int GetTermSizeGWINSZ(file,retwidth,retheight,xpix,ypix) -FILE * file; +PerlIO * file; int *retwidth, *retheight, *xpix, *ypix; { - int handle=fileno(file); + int handle=PerlIO_fileno(file); struct winsize w; if (ioctl (handle, TIOCGWINSZ, &w) == 0) { @@ -412,7 +414,7 @@ } #else int GetTermSizeGWINSZ(file,retwidth,retheight,xpix,ypix) -FILE * file; +PerlIO * file; int *retwidth, *retheight, *xpix, *ypix; { croak("TermSizeGWINSZ is not implemented on this architecture"); @@ -421,10 +423,10 @@ #if (!defined(TIOCGWINSZ) || defined(DONT_USE_GWINSZ)) && (defined(TIOCGSIZE) && !defined(DONT_USE_GSIZE)) int GetTermSizeGSIZE(file,retwidth,retheight,xpix,ypix) -FILE * file; +PerlIO * file; int *retwidth, *retheight, *xpix, *ypix; { - int handle=fileno(file); + int handle=PerlIO_fileno(file); struct ttysize w; @@ -438,7 +440,7 @@ } #else int GetTermSizeGSIZE(file,retwidth,retheight,xpix,ypix) -FILE * file; +PerlIO * file; int *retwidth, *retheight, *xpix, *ypix; { croak("TermSizeGSIZE is not implemented on this architecture"); @@ -447,10 +449,10 @@ #ifdef USE_WIN32 int GetTermSizeWin32(file,retwidth,retheight,xpix,ypix) -FILE * file; +PerlIO * file; int *retwidth, *retheight, *xpix, *ypix; { - int handle=fileno(file); + int handle=PerlIO_fileno(file); HANDLE whnd = (HANDLE)_get_osfhandle(handle); CONSOLE_SCREEN_BUFFER_INFO info; @@ -472,7 +474,7 @@ } #else int GetTermSizeWin32(file,retwidth,retheight,xpix,ypix) -FILE * file; +PerlIO * file; int *retwidth, *retheight, *xpix, *ypix; { croak("TermSizeWin32 is not implemented on this architecture"); @@ -499,11 +501,11 @@ int SetTerminalSize(file, width, height, xpix, ypix) -FILE *file; +PerlIO *file; int width, height, xpix, ypix; { char buffer[10]; - int handle=fileno(file); + int handle=PerlIO_fileno(file); #ifdef VIOMODE return -1; @@ -624,10 +626,10 @@ }; int getspeed(file, in, out) -FILE * file; +PerlIO * file; I32 *in, *out; { - int handle=fileno(file); + int handle=PerlIO_fileno(file); int i; # ifdef I_TERMIOS /* Posixy stuff */ @@ -733,7 +735,7 @@ HV * modehash; /* Used to record the current terminal "mode" for each handle*/ void ReadMode(file,mode) -FILE * file; +PerlIO * file; int mode; { dTHR; @@ -744,7 +746,7 @@ struct tbuffer savebuf; - handle=fileno(file); + handle=PerlIO_fileno(file); firsttime=!hv_exists(filehash, (char*)&handle, sizeof(int)); @@ -1383,10 +1385,10 @@ /* Make use of a recent addition to Configure, if possible */ # ifdef USE_STDIO_PTR -# define FCOUNT(f) FILE_cnt(f) +# define FCOUNT(f) PerlIO_get_cnt(f) # else - /* This bit borrowed from pp_sys.c. Complain to Larry if it's broken. */ + /* If any of this works PerlIO_get_cnt() will too ... NI-S */ # if defined(USE_STD_STDIO) || defined(atarist) /* this will work with atariST */ # define FBASE(f) ((f)->_base) # define FSIZE(f) ((f)->_cnt + ((f)->_ptr - (f)->_base)) @@ -1419,20 +1421,18 @@ #ifdef Have_select int selectfile(file,delay) -FILE * file; +PerlIO * file; double delay; { struct timeval t; - int handle=fileno(file); + int handle=PerlIO_fileno(file); /*char buf[32]; Select_fd_set_t fd=(Select_fd_set_t)&buf[0];*/ fd_set fd; -# ifdef FCOUNT - if( FCOUNT(file)>0 ) + if (PerlIO_fast_gets(file) && PerlIO_get_cnt(file) > 0) return 1; -# endif /*t.tv_sec=t.tv_usec=0;*/ @@ -1452,7 +1452,7 @@ #else int selectfile(file, delay) -FILE * file; +PerlIO * file; double delay; { croak("select is not supported on this architecture"); @@ -1462,10 +1462,10 @@ #ifdef Have_nodelay int setnodelay(file, mode) -FILE * file; +PerlIO * file; int mode; { - int handle=fileno(file); + int handle=PerlIO_fileno(file); int flags; flags=fcntl(handle,F_GETFL,0); if(mode) @@ -1478,7 +1478,7 @@ #else int setnodelay(file, mode) -FILE * file; +PerlIO * file; int mode; { croak("setnodelay is not supported on this architecture"); @@ -1488,15 +1488,13 @@ #ifdef Have_poll int pollfile(file,delay) -FILE * file; +PerlIO * file; double delay; { - int handle=fileno(file); + int handle=PerlIO_fileno(file); struct pollfd fds; -# ifdef COUNT - if( FCOUNT(file)>0 ) + if (PerlIO_fast_gets(f) && PerlIO_get_cnt(f) > 0) return 1; -# endif if(delay<0.0) delay = 0.0; fds.fd=handle; fds.events=POLLIN; @@ -1505,7 +1503,7 @@ } #else int pollfile(file,delay) -FILE * file; +PerlIO * file; double delay; { croak("pollfile is not supported on this architecture"); @@ -1522,7 +1520,7 @@ */ int Win32PeekChar(file,delay,key) -FILE * file; +PerlIO * file; double delay; char * key; { @@ -1536,7 +1534,7 @@ file = stdin; - handle =fileno(file); + handle =PerlIO_fileno(file); whnd = /*GetStdHandle(STD_INPUT_HANDLE)*/(HANDLE)_get_osfhandle(handle); @@ -1602,7 +1600,7 @@ } #else int Win32PeekChar(file, delay, key) -FILE * file; +PerlIO * file; double delay; char * key; { @@ -1655,14 +1653,14 @@ int selectfile(file,delay) - FILE * file + InputStream file double delay # Clever, eh? void SetReadMode(mode,file=STDIN) int mode - FILE * file + InputStream file CODE: { ReadMode(file,mode); @@ -1670,17 +1668,17 @@ int setnodelay(file,mode) - FILE * file + InputStream file int mode int pollfile(file,delay) - FILE * file + InputStream file double delay SV * Win32PeekChar(file, delay) - FILE * file + InputStream file double delay CODE: { @@ -1704,7 +1702,7 @@ void GetTermSizeWin32(file=STDIN) - FILE * file + InputStream file PPCODE: { int x,y,xpix,ypix; @@ -1724,7 +1722,7 @@ void GetTermSizeVIO(file=STDIN) - FILE * file + InputStream file PPCODE: { int x,y,xpix,ypix; @@ -1744,7 +1742,7 @@ void GetTermSizeGWINSZ(file=STDIN) - FILE * file + InputStream file PPCODE: { int x,y,xpix,ypix; @@ -1764,7 +1762,7 @@ void GetTermSizeGSIZE(file=STDIN) - FILE * file + InputStream file PPCODE: { int x,y,xpix,ypix; @@ -1788,7 +1786,7 @@ int height int xpix int ypix - FILE * file + InputStream file CODE: { RETVAL=SetTerminalSize(file,width,height,xpix,ypix); @@ -1796,7 +1794,7 @@ void GetSpeed(file=STDIN) - FILE * file + InputStream file PPCODE: { I32 in,out; --- perl-5.6.1-orig/CYGWIN-PATCHES/Bundle.CPAN/TermReadKey-2.14/genchars.pl Fri Feb 26 04:05:28 1999 +++ perl-5.6.1-11599/CYGWIN-PATCHES/Bundle.CPAN/TermReadKey-2.14-patched/genchars.pl + Tue Aug 21 22:17:06 2001 @@ -8,7 +8,7 @@ use Configure; #sub report { -# my($prog)=join(" ",@_); +# my($prog)=join(" ",@_); # # my($ccflags, $ldflags, $cc, $rm) = @Config{'ccflags', 'ldflags', 'cc', 'rm'}; # my($command, $ret); @@ -30,58 +30,58 @@ open(CCHARS,">cchars.h") || die "Fatal error, Unable to write to cchars.h!"; #print "Checking for termio...\n"; -#$TERMIO = !report( "#include <termio.h>\n struct termios s; main(){}"); -#print " Termio ",($TERMIO?"":"NOT "),"found.\n"; +#$TERMIO = !report( "#include <termio.h>\n struct termios s; main(){}"); +#print " Termio ",($TERMIO?"":"NOT "),"found.\n"; #print "Checking for termios...\n"; -#$TERMIOS = !report( "#include <termios.h>\n struct termio s; main(){}"); -#print " Termios ",($TERMIOS?"":"NOT "),"found.\n"; +#$TERMIOS = !report( "#include <termios.h>\n struct termio s; main(){}"); +#print " Termios ",($TERMIOS?"":"NOT "),"found.\n"; #print "Checking for sgtty...\n"; -#$SGTTY = !report( "#include <sgtty.h>\n struct sgttyb s; main(){}"); -#print " Sgtty ",($SGTTY?"":"NOT "),"found.\n"; +#$SGTTY = !report( "#include <sgtty.h>\n struct sgttyb s; main(){}"); +#print " Sgtty ",($SGTTY?"":"NOT "),"found.\n"; #print "Termio=$TERMIO, Termios=$TERMIOS, Sgtty=$SGTTY\n"; # Control characters used for termio and termios -%possible = ( VINTR => "INTERRUPT", - VQUIT => "QUIT", - VERASE => "ERASE", - VKILL => "KILL", - VEOF => "EOF", - VTIME => "TIME", - VMIN => "MIN", - VSWTC => "SWITCH", - VSWTCH => "SWITCH", - VSTART => "START", - VSTOP => "STOP", - VSUSP => "SUSPEND", - VDSUSP => "DSUSPEND", - VEOL => "EOL", - VREPRINT => "REPRINT", - VDISCARD => "DISCARD", - VFLUSH => "DISCARD", - VWERASE => "ERASEWORD", - VLNEXT => "QUOTENEXT", - VQUOTE => "QUOTENEXT", - VEOL2 => "EOL2", - VSTATUS => "STATUS", +%possible = ( VINTR => "INTERRUPT", + VQUIT => "QUIT", + VERASE => "ERASE", + VKILL => "KILL", + VEOF => "EOF", + VTIME => "TIME", + VMIN => "MIN", + VSWTC => "SWITCH", + VSWTCH => "SWITCH", + VSTART => "START", + VSTOP => "STOP", + VSUSP => "SUSPEND", + VDSUSP => "DSUSPEND", + VEOL => "EOL", + VREPRINT => "REPRINT", + VDISCARD => "DISCARD", + VFLUSH => "DISCARD", + VWERASE => "ERASEWORD", + VLNEXT => "QUOTENEXT", + VQUOTE => "QUOTENEXT", + VEOL2 => "EOL2", + VSTATUS => "STATUS", ); # Control characters for sgtty -%possible2 = ( "intrc" => "INTERRUPT", - "quitc" => "QUIT", - "eofc" => "EOF", - "startc"=> "START", - "stopc" => "STOP", - "brkc" => "EOL", - "eolc" => "EOL", - "suspc" => "SUSPEND", - "dsuspc"=> "DSUSPEND", - "rprntc"=> "REPRINT", - "flushc"=> "DISCARD", - "lnextc"=> "QUOTENEXT", - "werasc"=> "ERASEWORD", +%possible2 = ( "intrc" => "INTERRUPT", + "quitc" => "QUIT", + "eofc" => "EOF", + "startc"=> "START", + "stopc" => "STOP", + "brkc" => "EOL", + "eolc" => "EOL", + "suspc" => "SUSPEND", + "dsuspc"=> "DSUSPEND", + "rprntc"=> "REPRINT", + "flushc"=> "DISCARD", + "lnextc"=> "QUOTENEXT", + "werasc"=> "ERASEWORD", ); print CCHARS " @@ -95,10 +95,10 @@ print "\n"; if(1) { - @values = sort { $possible{$a} cmp $possible{$b} } keys %possible; + @values = sort { $possible{$a} cmp $possible{$b} } keys %possible; - print "Writing termio/termios section of cchars.h... "; - print CCHARS " + print "Writing termio/termios section of cchars.h... "; + print CCHARS " #ifdef CC_TERMIOS # define TermStructure struct termios @@ -128,112 +128,112 @@ #if defined(CC_TERMIO) || defined(CC_TERMIOS) -char * cc_names[] = { ".join('',map(" +char * cc_names[] = { ".join('',map(" #if defined($_) && ($_ < LEGALMAXCC) - \"$possible{$_}\", "." -#else "." - \"\", "." -#endif ", @values ))." + \"$possible{$_}\", "." +#else "." + \"\", "." +#endif ", @values ))." }; -const int MAXCC = 0 ",join('',map(" +const int MAXCC = 0 ",join('',map(" #if defined($_) && ($_ < LEGALMAXCC) - +1 /* $possible{$_} */ -#endif ", @values ))." - ; + +1 /* $possible{$_} */ +#endif ", @values ))." + ; XS(XS_Term__ReadKey_GetControlChars) { - dXSARGS; - if (items < 0 || items > 1) { - croak(\"Usage: Term::ReadKey::GetControlChars()\"); - } - SP -= items; - { - FILE * file; - TermStructure s; - if (items < 1) - file = STDIN; - else { - file = IoIFP(sv_2io(ST(0))); - } + dXSARGS; + if (items < 0 || items > 1) { + croak(\"Usage: Term::ReadKey::GetControlChars()\"); + } + SP -= items; + { + PerlIO * file; + TermStructure s; + if (items < 1) + file = STDIN; + else { + file = IoIFP(sv_2io(ST(0))); + } #ifdef CC_TERMIOS - if(tcgetattr(fileno(file),&s)) + if(tcgetattr(PerlIO_fileno(file),&s)) #else # ifdef CC_TERMIO - if(ioctl(fileno(file),TCGETA,&s)) + if(ioctl(PerlIO_fileno(file),TCGETA,&s)) # endif #endif - croak(\"Unable to read terminal settings in GetControlChars\"); - else { - int i; - EXTEND(sp,MAXCC*2); ".join('',map(" -#if defined($values[$_]) && ($values[$_] < LEGALMAXCC) "." + croak(\"Unable to read terminal settings in +GetControlChars\"); + else { + int i; + EXTEND(sp,MAXCC*2); ".join('',map(" +#if defined($values[$_]) && ($values[$_] < LEGALMAXCC) "." PUSHs(sv_2mortal(newSVpv(cc_names[$_],strlen(cc_names[$_])))); /* $possible{$values[$_]} */ -PUSHs(sv_2mortal(newSVpv((char*)&s.c_cc[$values[$_]],1))); "." -#endif " ,0..$#values))." - - } - PUTBACK; - return; - } +PUSHs(sv_2mortal(newSVpv((char*)&s.c_cc[$values[$_]],1))); "." +#endif " ,0..$#values))." + + } + PUTBACK; + return; + } } XS(XS_Term__ReadKey_SetControlChars) { - dXSARGS; - /*if ((items % 2) != 0) { - croak(\"Usage: Term::ReadKey::SetControlChars(%charpairs,file=STDIN)\"); - }*/ - SP -= items; - { - TermStructure s; - FILE * file; - if ((items % 2) == 1) - file = IoIFP(sv_2io(ST(items-1))); - else { - file = STDIN; - } + dXSARGS; + /*if ((items % 2) != 0) { + croak(\"Usage: +Term::ReadKey::SetControlChars(%charpairs,file=STDIN)\"); + }*/ + SP -= items; + { + TermStructure s; + PerlIO * file; + if ((items % 2) == 1) + file = IoIFP(sv_2io(ST(items-1))); + else { + file = STDIN; + } #ifdef CC_TERMIOS - if(tcgetattr(fileno(file),&s)) + if(tcgetattr(PerlIO_fileno(file),&s)) #else # ifdef CC_TERMIO - if(ioctl(fileno(file),TCGETA,&s)) + if(ioctl(PerlIO_fileno(file),TCGETA,&s)) # endif #endif - croak(\"Unable to read terminal settings in SetControlChars\"); - else { - int i; - char * name, value; - for(i=0;i+1<items;i+=2) { - name = SvPV(ST(i),PL_na); - if( SvIOKp(ST(i+1)) || SvNOKp(ST(i+1)) )/* If Int or Float */ - value = (char)SvIV(ST(i+1)); /* Store int value */ - else /* Otherwise */ - value = SvPV(ST(i+1),PL_na)[0]; /* Use first char of PV */ - - if (0) ; ".join('',map(" -#if defined($values[$_]) && ($values[$_] < LEGALMAXCC) "." - else if(strcmp(name,cc_names[$_])==0) /* $possible{$values[$_]} */ - s.c_cc[$values[$_]] = value; "." -#endif ",0..$#values))." - else - croak(\"Invalid control character passed to SetControlChars\"); - - } + croak(\"Unable to read terminal settings in +SetControlChars\"); + else { + int i; + char * name, value; + for(i=0;i+1<items;i+=2) { + name = SvPV(ST(i),PL_na); + if( SvIOKp(ST(i+1)) || SvNOKp(ST(i+1)) )/* If Int or +Float */ + value = (char)SvIV(ST(i+1)); /* Store +int value */ + else /* Otherwise +*/ + value = SvPV(ST(i+1),PL_na)[0]; /* +Use first char of PV */ + + if (0) ; ".join('',map(" +#if defined($values[$_]) && ($values[$_] < LEGALMAXCC) "." + else if(strcmp(name,cc_names[$_])==0) /* $possible{$values[$_]} */ + s.c_cc[$values[$_]] = value; "." +#endif ",0..$#values))." + else + croak(\"Invalid control character passed to SetControlChars\"); + + } #ifdef CC_TERMIOS - if(tcsetattr(fileno(file),TCSANOW,&s)) + if(tcsetattr(PerlIO_fileno(file),TCSANOW,&s)) #else # ifdef CC_TERMIO - if(ioctl(fileno(file),TCSETA,&s)) + if(ioctl(PerlIO_fileno(file),TCSETA,&s)) # endif #endif - croak(\"Unable to write terminal settings in SetControlChars\"); - } - } - XSRETURN(1); + croak(\"Unable to write terminal settings in +SetControlChars\"); + } + } + XSRETURN(1); } @@ -241,19 +241,19 @@ "; - print "Done.\n"; + print "Done.\n"; } undef %billy; if(@ARGV) { # If any argument is supplied on the command-line don't check sgtty - $SGTTY=0; #skip tests + $SGTTY=0; #skip tests } else { - print "Checking for sgtty...\n"; + print "Checking for sgtty...\n"; - $SGTTY = CheckStructure "sgttyb","sgtty.h"; -# $SGTTY = !Compile(" + $SGTTY = CheckStructure "sgttyb","sgtty.h"; +# $SGTTY = !Compile(" ##include <sgtty.h> #struct sgttyb s; #main(){ @@ -262,14 +262,14 @@ #} -# $SGTTY = !report(" +# $SGTTY = !report(" ##include <sgtty.h> #struct sgttyb s; #main(){ #ioctl(0,TIOCGETP,&s); #}"); - print " Sgtty ",($SGTTY?"":"NOT "),"found.\n"; + print " Sgtty ",($SGTTY?"":"NOT "),"found.\n"; } $billy{"ERASE"} = "s1.sg_erase"; @@ -278,172 +278,172 @@ if($SGTTY) { - print "Checking sgtty...\n"; + print "Checking sgtty...\n"; - $tchars = CheckStructure "tchars","sgtty.h"; -# $tchars = !report( ' + $tchars = CheckStructure "tchars","sgtty.h"; +# $tchars = !report( ' ##include <sgtty.h> #struct tchars t; #main() { ioctl(0,TIOCGETC,&t); } #'); - print " tchars structure found.\n" if $tchars; + print " tchars structure found.\n" if $tchars; - $ltchars = CheckStructure "ltchars","sgtty.h"; -# $ltchars = !report( ' + $ltchars = CheckStructure "ltchars","sgtty.h"; +# $ltchars = !report( ' ##include <sgtty.h> #struct ltchars t; #main() { ioctl(0,TIOCGLTC,&t); } #'); - print " ltchars structure found.\n" if $ltchars; + print " ltchars structure found.\n" if $ltchars; - print "Checking symbols\n"; + print "Checking symbols\n"; - for $c (keys %possible2) { + for $c (keys %possible2) { -# if($tchars and !report(" +# if($tchars and !report(" ##include <sgtty.h> #struct tchars s2; #main () { char c = s2.t_$c; } #")) { - if($tchars and CheckField("tchars","t_$c","sgtty.h")) { + if($tchars and CheckField("tchars","t_$c","sgtty.h")) { - print " t_$c ($possible2{$c}) found in tchars\n"; - $billy{$possible2{$c}} = "s2.t_$c"; - } + print " t_$c ($possible2{$c}) found in tchars\n"; + $billy{$possible2{$c}} = "s2.t_$c"; + } -# elsif($ltchars and !report(" +# elsif($ltchars and !report(" ##include <sgtty.h> #struct ltchars s3; #main () { char c = s3.t_$c; } #")) { - elsif($ltchars and CheckField("ltchars","t_$c","sgtty.h")) { - print " t_$c ($possible2{$c}) found in ltchars\n"; - $billy{$possible2{$c}} = "s3.t_$c"; - } - - } - - - #undef @names; - #undef @values; - #for $v (sort keys %billy) { - # push(@names,$billy{$v}); - # push(@values,$v); - #} + elsif($ltchars and CheckField("ltchars","t_$c","sgtty.h")) { + print " t_$c ($possible2{$c}) found in ltchars\n"; + $billy{$possible2{$c}} = "s3.t_$c"; + } + + } + + + #undef @names; + #undef @values; + #for $v (sort keys %billy) { + # push(@names,$billy{$v}); + # push(@values,$v); + #} - #$numchars = keys %billy; + #$numchars = keys %billy; } @values = sort keys %billy; - $struct = " + $struct = " struct termstruct { - struct sgttyb s1; + struct sgttyb s1; "; - $struct .= " - struct tchars s2; -" if $tchars; - $struct .= " - struct ltchars s3; -" if $ltchars; - $struct .= " + $struct .= " + struct tchars s2; +" if $tchars; + $struct .= " + struct ltchars s3; +" if $ltchars; + $struct .= " };"; print "Writing sgtty section of cchars.h... "; - print CCHARS " + print CCHARS " #ifdef CC_SGTTY $struct #define TermStructure struct termstruct -char * cc_names[] = { ".join('',map(" - \"$_\", ", @values ))." +char * cc_names[] = { ".join('',map(" + \"$_\", ", @values ))." }; -#define MAXCC ". ($#values+1)." +#define MAXCC ". ($#values+1)." XS(XS_Term__ReadKey_GetControlChars) { - dXSARGS; - if (items < 0 || items > 1) { - croak(\"Usage: Term::ReadKey::GetControlChars()\"); - } - SP -= items; - { - FILE * file; - TermStructure s; - if (items < 1) - file = STDIN; - else { - file = IoIFP(sv_2io(ST(0))); - } - if(ioctl(fileno(file),TIOCGETP,&s.s1) ".($tchars?" - ||ioctl(fileno(file),TIOCGETC,&s.s2) ":'').($ltchars?" - ||ioctl(fileno(file),TIOCGLTC,&s.s3) ":'')." - ) - croak(\"Unable to read terminal settings in GetControlChars\"); - else { - int i; - EXTEND(sp,MAXCC*2); ".join('',map(" + dXSARGS; + if (items < 0 || items > 1) { + croak(\"Usage: Term::ReadKey::GetControlChars()\"); + } + SP -= items; + { + PerlIO * file; + TermStructure s; + if (items < 1) + file = STDIN; + else { + file = IoIFP(sv_2io(ST(0))); + } + if(ioctl(PerlIO_fileno(file),TIOCGETP,&s.s1) ".($tchars?" + ||ioctl(PerlIO_fileno(file),TIOCGETC,&s.s2) ":'').($ltchars?" + ||ioctl(PerlIO_fileno(file),TIOCGLTC,&s.s3) ":'')." + ) + croak(\"Unable to read terminal settings in +GetControlChars\"); + else { + int i; + EXTEND(sp,MAXCC*2); ".join('',map(" PUSHs(sv_2mortal(newSVpv(cc_names[$_],strlen(cc_names[$_])))); /* $values[$_] */ -PUSHs(sv_2mortal(newSVpv(&s.$billy{$values[$_]},1))); ",0..$#values))." - - } - PUTBACK; - return; - } +PUSHs(sv_2mortal(newSVpv(&s.$billy{$values[$_]},1))); ",0..$#values))." + + } + PUTBACK; + return; + } } XS(XS_Term__ReadKey_SetControlChars) { - dXSARGS; - /*if ((items % 2) != 0) { - croak(\"Usage: Term::ReadKey::SetControlChars(%charpairs,file=STDIN)\"); - }*/ - SP -= items; - { - FILE * file; - TermStructure s; - if ((items%2)==0) - file = STDIN; - else { - file = IoIFP(sv_2io(ST(items-1))); - } - - if(ioctl(fileno(file),TIOCGETP,&s.s1) ".($tchars?" - ||ioctl(fileno(file),TIOCGETC,&s.s2) ":'').($ltchars?" - ||ioctl(fileno(file),TIOCGLTC,&s.s3) ":'')." - ) - croak(\"Unable to read terminal settings in SetControlChars\"); - else { - int i; - char * name, value; - for(i=0;i+1<items;i+=2) { - name = SvPV(ST(i),PL_na); - if( SvIOKp(ST(i+1)) || SvNOKp(ST(i+1)) )/* If Int or Float */ - value = (char)SvIV(ST(i+1)); /* Store int value */ - else /* Otherwise */ - value = SvPV(ST(i+1),PL_na)[0]; /* Use first char of PV */ - - if (0) ; ".join('',map(" - else if(strcmp(name,cc_names[$_])==0) /* $values[$_] */ - s.$billy{$values[$_]} = value; ",0..$#values))." - else - croak(\"Invalid control character passed to SetControlChars\"); - - } - if(ioctl(fileno(file),TIOCSETN,&s.s1) ".($tchars?" - ||ioctl(fileno(file),TIOCSETC,&s.s2) ":'').($ltchars?" - ||ioctl(fileno(file),TIOCSLTC,&s.s3) ":'')." - ) croak(\"Unable to write terminal settings in SetControlChars\"); - } - } - XSRETURN(1); + dXSARGS; + /*if ((items % 2) != 0) { + croak(\"Usage: +Term::ReadKey::SetControlChars(%charpairs,file=STDIN)\"); + }*/ + SP -= items; + { + PerlIO * file; + TermStructure s; + if ((items%2)==0) + file = STDIN; + else { + file = IoIFP(sv_2io(ST(items-1))); + } + + if(ioctl(PerlIO_fileno(file),TIOCGETP,&s.s1) ".($tchars?" + ||ioctl(PerlIO_fileno(file),TIOCGETC,&s.s2) ":'').($ltchars?" + ||ioctl(PerlIO_fileno(file),TIOCGLTC,&s.s3) ":'')." + ) + croak(\"Unable to read terminal settings in +SetControlChars\"); + else { + int i; + char * name, value; + for(i=0;i+1<items;i+=2) { + name = SvPV(ST(i),PL_na); + if( SvIOKp(ST(i+1)) || SvNOKp(ST(i+1)) )/* If Int or +Float */ + value = (char)SvIV(ST(i+1)); /* Store +int value */ + else /* Otherwise +*/ + value = SvPV(ST(i+1),PL_na)[0]; /* +Use first char of PV */ + + if (0) ; ".join('',map(" + else if(strcmp(name,cc_names[$_])==0) /* $values[$_] */ + s.$billy{$values[$_]} = value; ",0..$#values))." + else + croak(\"Invalid control character passed to SetControlChars\"); + + } + if(ioctl(PerlIO_fileno(file),TIOCSETN,&s.s1) ".($tchars?" + ||ioctl(PerlIO_fileno(file),TIOCSETC,&s.s2) ":'').($ltchars?" + ||ioctl(PerlIO_fileno(file),TIOCSLTC,&s.s3) ":'')." + ) croak(\"Unable to write terminal settings in +SetControlChars\"); + } + } + XSRETURN(1); } #endif @@ -452,26 +452,26 @@ #define TermStructure int XS(XS_Term__ReadKey_GetControlChars) { - dXSARGS; - if (items <0 || items>1) { - croak(\"Usage: Term::ReadKey::GetControlChars([FileHandle])\"); - } - SP -= items; - { - ST(0) = sv_newmortal(); - PUTBACK; - return; - } + dXSARGS; + if (items <0 || items>1) { + croak(\"Usage: Term::ReadKey::GetControlChars([FileHandle])\"); + } + SP -= items; + { + ST(0) = sv_newmortal(); + PUTBACK; + return; + } } XS(XS_Term__ReadKey_SetControlChars) { - dXSARGS; - if (items < 0 || items > 1) { - croak(\"Invalid control character passed to SetControlChars\"); - } - SP -= items; - XSRETURN(1); + dXSARGS; + if (items < 0 || items > 1) { + croak(\"Invalid control character passed to SetControlChars\"); + } + SP -= items; + XSRETURN(1); } #endif @@ -480,7 +480,3 @@ print "Done.\n"; - - - - \ No newline at end of file ======================END OF PATCH -- Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration: Platform: osname=cygwin, osvers=1.3.2(0.3932), archname=cygwin-multi uname='cygwin_nt-4.0 loreley 1.3.2(0.3932) 2001-05-20 23:28 i686 unknown ' config_args='-de -Dusemultiplicity' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=define useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef Compiler: cc='gcc', ccflags ='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -I/usr/local/include', optimize='-O2', cppflags='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -I/usr/local/include' ccversion='', gccversion='2.95.3-5 (cygwin special)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4 alignbytes=8, usemymalloc=y, prototype=define Linker and Libraries: ld='ld2', ldflags =' -s -L/usr/local/lib' libpth=/usr/local/lib /usr/lib /lib libs=-lgdbm -ldb -lcrypt -liconv -lcygipc perllibs=-lcrypt -liconv -lcygipc libc=/usr/lib/libc.a, so=dll, useshrplib=true, libperl=libperl5_6_1.a Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' -s' cccdlflags=' ', lddlflags=' -s -L/usr/local/lib'
