Fwd: CPAN Upload: JPRIT/Event-0.70.tar.gz
[email protected] (Joshua N Pritikin)
| Newsgroups | perl.loop |
|---|---|
| Message-ID | <[email protected]> |
----- Forwarded message from [email protected] ----- Date: Fri, 25 Feb 2000 23:34:13 +0100 Subject: CPAN Upload: JPRIT/Event-0.70.tar.gz From: [email protected] To: [email protected], [email protected] The uploaded file Event-0.70.tar.gz has entered CPAN as file: $CPAN/authors/id/JPRIT/Event-0.70.tar.gz size: 67283 bytes md5: b30afd8e35a94018216ef877f2f4b9de No action is required on your part Request entered by: JPRIT (Joshua N. Pritikin) Request entered on: Fri, 25 Feb 2000 22:33:50 GMT Request completed: Fri, 25 Feb 2000 22:34:13 GMT Virtually Yours, Id: paused,v 1.68 1999/10/22 14:39:12 k Exp k ----- End forwarded message ----- # This is a patch for Event-0.69 to update it to Event-0.70 # # To apply this patch: # STEP 1: Chdir to the source directory. # STEP 2: Run the 'applypatch' program with this patch file as input. # # If you do not have 'applypatch', it is part of the 'makepatch' package # that you can fetch from the Comprehensive Perl Archive Network: # http://www.perl.com/CPAN/authors/Johan_Vromans/makepatch-x.y.tar.gz # In the above URL, 'x' should be 2 or higher. # # To apply this patch without the use of 'applypatch': # STEP 1: Chdir to the source directory. # If you have a decent Bourne-type shell: # STEP 2: Run the shell with this file as input. # If you don't have such a shell, you may need to manually create/delete # the files as shown below. # STEP 3: Run the 'patch' program with this file as input. # # These are the commands needed to create/delete files/directories: # rm -f 'demo/variable_repeater.t' rm -f 'demo/stdin.t' rm -f 'demo/spin_io.t' rm -f 'demo/inactivity.t' rm -f 'demo/in.pl' touch 'demo/echo.t' chmod 0444 'demo/echo.t' touch 'demo/perlqt.t' chmod 0444 'demo/perlqt.t' touch 'demo/rand_interval.t' chmod 0444 'demo/rand_interval.t' touch 'demo/repeat.t' chmod 0444 'demo/repeat.t' # # This command terminates the shell and need not be executed manually. exit # #### End of Preamble #### #### Patch data follows #### gdiff -up '/usr/tmp/mp2046.d/old/Event-0.69/ChangeLog' '/usr/tmp/mp2046.d/new/Event-0.70/ChangeLog' Index: ./ChangeLog --- ./ChangeLog Fri Feb 18 15:30:29 2000 +++ ./ChangeLog Fri Feb 25 12:09:13 2000 @@ -1,4 +1,20 @@ +2000-02-25 Joshua Pritikin <[email protected]> + + * Release 0.70. + +2000-02-24 Joshua Pritikin <[email protected]> + + * Fix bug in select() engine spotted by [email protected] + +2000-02-22 Joshua Pritikin <[email protected]> + + * Prune demo directory. + + * Add repeat.t demo. ([email protected]) + 2000-02-18 Joshua Pritikin <[email protected]> + + * Add perlqt.t demo. * Release 0.69. gdiff -up '/usr/tmp/mp2046.d/old/Event-0.69/MANIFEST' '/usr/tmp/mp2046.d/new/Event-0.70/MANIFEST' Index: ./MANIFEST --- ./MANIFEST Thu Feb 10 09:00:52 2000 +++ ./MANIFEST Tue Feb 22 17:56:01 2000 @@ -22,14 +22,13 @@ c/typemap.c c/unix_io.c c/var.c c/watcher.c +demo/echo.t demo/group.t -demo/in.pl -demo/inactivity.t +demo/perlqt.t demo/process.pm +demo/rand_interval.t demo/readline.t -demo/spin_io.t -demo/stdin.t -demo/variable_repeater.t +demo/repeat.t lib/Event.pm lib/Event.pod lib/Event/EventAPI.h gdiff -up '/usr/tmp/mp2046.d/old/Event-0.69/c/unix_io.c' '/usr/tmp/mp2046.d/new/Event-0.70/c/unix_io.c' Index: ./c/unix_io.c --- ./c/unix_io.c Tue Feb 8 16:51:45 2000 +++ ./c/unix_io.c Thu Feb 24 08:43:46 2000 @@ -45,8 +45,8 @@ static void _queue_io(pe_io *wa, int got } /************************************************* POLL */ -#if defined(HAS_POLL) && !PE_IO_WAIT -#define PE_IO_WAIT 1 +#if defined(HAS_POLL) && !PE_SYS_IO +#define PE_SYS_IO 1 static struct pollfd *Pollfd=0; static int pollMax=0; @@ -125,9 +125,9 @@ static void pe_sys_multiplex(double time } ev = (pe_io*) IOWatch.next->self; while (ev) { + pe_io *next_ev = (pe_io*) ev->ioring.next->self; STRLEN n_a; int xref = ev->xref; - pe_io *next_ev = (pe_io*) ev->ioring.next->self; if (xref >= 0) { int got = 0; int mask = Pollfd[xref].revents; @@ -152,8 +152,8 @@ static void pe_sys_multiplex(double time /************************************************* SELECT */ -#if defined(HAS_SELECT) && !PE_IO_WAIT -#define PE_IO_WAIT 1 +#if defined(HAS_SELECT) && !PE_SYS_IO +#define PE_SYS_IO 1 static int Nfds; static fd_set Rfds, Wfds, Efds; @@ -246,6 +246,7 @@ static void pe_sys_multiplex(double time } ev = IOWatch.next->self; while (ev) { + pe_io *next_ev = (pe_io*) ev->ioring.next->self; int fd = ev->fd; if (fd >= 0) { int got = 0; @@ -259,7 +260,7 @@ static void pe_sys_multiplex(double time if (--ret == 0) { ev=0; continue; } */ } - ev = ev->ioring.next->self; + ev = next_ev; } } #endif /*HAS_SELECT*/ gdiff -up /dev/null '/usr/tmp/mp2046.d/new/Event-0.70/demo/echo.t' Index: ./demo/echo.t --- ./demo/echo.t Wed Dec 31 19:00:00 1969 +++ ./demo/echo.t Tue Feb 22 17:55:44 2000 @@ -0,0 +1,34 @@ +#!./perl -w + +$| = 1; +use Event qw(time); +require Event::io; + +print "This demo echoes whatever you type. If you don't type anything +for as long as 2.5 seconds then it will complain. Enter an empty line +to exit. + +"; + +my $recent = time; +Event->io(fd => \*STDIN, + timeout => 2.5, + poll => "r", + repeat => 1, + cb => sub { + my $e = shift; + my $got = $e->got; + #print scalar(localtime), " "; + if ($got eq "r") { + sysread(STDIN, $buf, 80); + chop $buf; + my $len = length($buf); + Event::unloop if !$len; + print "read[$len]:$buf:\n"; + $recent = time; + } else { + print "nothing for ".(time - $recent)." seconds\n"; + } + }); + +Event::loop(); gdiff -up /dev/null '/usr/tmp/mp2046.d/new/Event-0.70/demo/perlqt.t' Index: ./demo/perlqt.t --- ./demo/perlqt.t Wed Dec 31 19:00:00 1969 +++ ./demo/perlqt.t Fri Feb 18 16:04:59 2000 @@ -0,0 +1,45 @@ +#!./perl -w + +use Qt 2.0; +use Event; +use NetServer::ProcessTop; + +package MyMainWindow; +use base 'Qt::MainWindow'; + +use Qt::slots 'quit()'; +sub quit { + Event::unloop(0); +} + +package main; +import Qt::app; + +Event->io(desc => 'Qt', fd => Qt::xfd(), timeout => .25, + cb => sub { + $app->processEvents(3000); #read + $app->flushX(); #write + }); + +my $w = MyMainWindow->new; + +my $file = Qt::PopupMenu->new; +$file->insertItem("Quit", $w, 'quit()'); +my $mb = $w->menuBar; +$mb->insertItem("File", $file); + +my $at = 1000; +my $label = Qt::Label->new("$at", $w); +$w->setCentralWidget($label); + +Event->timer(interval => .25, cb => sub { + --$at; + $label->setText($at); + }); + +$w->resize(200, 200); +$w->show; + +$app->setMainWidget($w); +exit Event::loop(); + gdiff -up /dev/null '/usr/tmp/mp2046.d/new/Event-0.70/demo/rand_interval.t' Index: ./demo/rand_interval.t --- ./demo/rand_interval.t Wed Dec 31 19:00:00 1969 +++ ./demo/rand_interval.t Tue Feb 22 17:53:18 2000 @@ -0,0 +1,16 @@ +#!./perl -w +# contributed by [email protected] + +use Event qw(loop); +require Event::timer; + +$w = Event->timer(interval => 1, parked=>1); +$w->cb(sub { + my $next = rand(10); + print(scalar localtime(Event::time()), ": waiting ", + $next, " sec\n"); + $w->interval($next); + }); +$w->start; + +loop(); gdiff -up /dev/null '/usr/tmp/mp2046.d/new/Event-0.70/demo/repeat.t' Index: ./demo/repeat.t --- ./demo/repeat.t Wed Dec 31 19:00:00 1969 +++ ./demo/repeat.t Thu Feb 24 08:38:42 2000 @@ -0,0 +1,45 @@ +#!./perl -w + +use strict; +use Event; + +# $Event::DebugLevel = 4; + +my $w=Event->io(fd=>\*STDIN, repeat=>0, cb=>\&callback); + +Event->timer(interval=>4, cb=>sub { + $w->repeat(!$w->repeat); + warn "repeat=".$w->repeat."\n"; + state($w); + }); + +sub callback { + my $w = $_[0]->w; + my $h = $w->fd; + my $in=<$h>; + print "You entered: $in"; + if ($in =~ /start|again/) { + $w->again; + } + state($w); +} + +sub state { + my ($w)=@_; + warn 'Is: '.join(' ', $w->is_active?'ACTIVE':'INACTIVE', + $w->is_suspended?'SUSP':'', + $w->is_cancelled?'CANCELLED':'')."\n"; +} + +print " +This demo shows the function of the repeat flag. If you press return +while repeat=1 then the watcher will remain active. If you press +return while repeat=0 then the watcher will become inactive. If you +type 'again' while the watcher is inactive then again() will be called +in the callback and the watcher should continue to be active. + +Granted, this is not very exciting. :-) + +"; + +Event::loop; gdiff -up '/usr/tmp/mp2046.d/old/Event-0.69/lib/Event.pm' '/usr/tmp/mp2046.d/new/Event-0.70/lib/Event.pm' Index: ./lib/Event.pm --- ./lib/Event.pm Fri Feb 18 15:30:19 2000 +++ ./lib/Event.pm Fri Feb 25 12:08:42 2000 @@ -13,7 +13,7 @@ use Carp; eval { require Carp::Heavy; }; # work around perl_call_pv bug XXX use vars qw($VERSION @EXPORT_OK $API $DebugLevel $Eval $DIED $Now); -$VERSION = '0.69'; +$VERSION = '0.70'; # If we inherit DynaLoader then we inherit AutoLoader; Bletch! require DynaLoader; gdiff -up '/usr/tmp/mp2046.d/old/Event-0.69/lib/Event.pod' '/usr/tmp/mp2046.d/new/Event-0.70/lib/Event.pod' Index: ./lib/Event.pod --- ./lib/Event.pod Thu Feb 17 11:46:13 2000 +++ ./lib/Event.pod Thu Feb 24 17:20:12 2000 @@ -716,9 +716,13 @@ This list is archived at Thanks! -=head1 AUTHORS +=head1 AUTHOR Joshua N. Pritikin E<lt>F<[email protected]>E<gt> + +For my motivation, see http://why-compete.org + +=head1 ACKNOWLEDGMENT Initial 0.01 implementation by Graham Barr E<lt>F<[email protected]>E<gt>. Other contributors include at least #### End of Patch data #### #### ApplyPatch data follows #### # Data version : 1.0 # Date generated : Fri Feb 25 17:46:59 2000 # Generated by : makepatch 2.00 (2.0BETA) # Recurse directories : Yes # r 'demo/variable_repeater.t' 294 0 # r 'demo/stdin.t' 146 0 # r 'demo/spin_io.t' 330 0 # r 'demo/inactivity.t' 603 0 # r 'demo/in.pl' 546 0 # p 'ChangeLog' 23139 951498553 0100444 # p 'MANIFEST' 919 951260161 0100444 # p 'c/unix_io.c' 6447 951399826 0100444 # c 'demo/echo.t' 0 951260144 0100444 # c 'demo/perlqt.t' 0 950907899 0100444 # c 'demo/rand_interval.t' 0 951259998 0100444 # c 'demo/repeat.t' 0 951399522 0100444 # p 'lib/Event.pm' 4254 951498522 0100444 # p 'lib/Event.pod' 23962 951430812 0100444 #### End of ApplyPatch data #### #### End of Patch kit [created: Fri Feb 25 17:46:59 2000] #### #### Checksum: 359 9773 15032 #### -- "Never ascribe to malice that which can be explained by stupidity." via, but not speaking for Deutsche Bank