Fwd: CPAN Upload: JPRIT/Event-0.72.tar.gz

[email protected] (Joshua N Pritikin)
Newsgroups perl.loop
Message-ID <[email protected]>
----- Forwarded message from [email protected] -----

Subject: CPAN Upload: JPRIT/Event-0.72.tar.gz
From: [email protected]
To: [email protected],
    [email protected]

The uploaded file

    Event-0.72.tar.gz

has entered CPAN as

  file: $CPAN/authors/id/JPRIT/Event-0.72.tar.gz
  size: 146173 bytes
   md5: 497f3e26b8b0bb13fcede30ed3cd1cda

No action is required on your part
Request entered by: JPRIT (Joshua N. Pritikin)
Request entered on: Fri, 10 Mar 2000 23:19:16 GMT
Request completed:  Fri, 10 Mar 2000 23:20:42 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.71 to update it to Event-0.72
# 
# 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.
# STEP 2: Run the 'patch' program with this file as input.
#
#### End of Preamble ####

#### Patch data follows ####
gdiff -up '/usr/tmp/mp23177.d/old/Event-0.71/ChangeLog' '/usr/tmp/mp23177.d/new/Event-0.72/ChangeLog'
Index: ./ChangeLog
--- ./ChangeLog	Fri Mar  3 15:10:13 2000
+++ ./ChangeLog	Fri Mar 10 18:17:17 2000
@@ -1,3 +1,19 @@
+2000-03-10  Joshua Pritikin  <[email protected]>
+
+	* Release 0.72.
+
+2000-03-09  Joshua Pritikin  <[email protected]>
+
+	* Rename NetServer::ProcessTop -> NetServer::Portal.
+
+2000-03-08  Joshua Pritikin  <[email protected]>
+
+	* Removed unused QUEUED & RUNNING flags.
+
+2000-03-07  Joshua Pritikin  <[email protected]>
+
+	* Made pending() aware of context.  Added tests.
+
 2000-03-03  Joshua Pritikin  <[email protected]>
 
 	* Release 0.71.
gdiff -up '/usr/tmp/mp23177.d/old/Event-0.71/Event.h' '/usr/tmp/mp23177.d/new/Event-0.72/Event.h'
Index: ./Event.h
--- ./Event.h	Mon Feb  7 15:19:18 2000
+++ ./Event.h	Wed Mar  8 11:46:16 2000
@@ -92,13 +92,10 @@ struct pe_watcher_vtbl {
 #define PE_PERLCB	0x020
 #define PE_RUNNOW	0x040
 #define PE_TMPERLCB	0x080
-#define PE_QUEUED	0x100  /* virtual flag */
-#define PE_RUNNING	0x200  /* virtual flag */
 #define PE_CANCELLED	0x400
 #define PE_DESTROYED	0x800
 
-#define PE_VISIBLE_FLAGS \
-(PE_ACTIVE | PE_SUSPEND | PE_QUEUED | PE_RUNNING)
+#define PE_VISIBLE_FLAGS (PE_ACTIVE | PE_SUSPEND)
 
 #ifdef DEBUGGING
 #  define WaDEBUGx(ev) (SvIV(DebugLevel) + WaDEBUG(ev))
gdiff -up '/usr/tmp/mp23177.d/old/Event-0.71/Event.xs' '/usr/tmp/mp23177.d/new/Event-0.72/Event.xs'
Index: ./Event.xs
--- ./Event.xs	Fri Mar  3 13:32:45 2000
+++ ./Event.xs	Wed Mar  8 11:45:53 2000
@@ -574,19 +574,20 @@ DESTROY(ref)
 	}
 }
 
-int
+void
 pe_watcher::pending()
-	CODE:
+	PPCODE:
 {
-    pe_ring *lk = &THIS->events;
-    RETVAL = 0;
-    while (lk->next->self) {  /* should not be too wasteful */
-	++RETVAL;
-	lk = lk->next;
+    if (GIMME_V == G_ARRAY) {
+	pe_event *ev = (pe_event *) THIS->events.prev->self;
+	while (ev) {
+	    XPUSHs(event_2sv(ev));
+	    ev = (pe_event*) ev->peer.prev->self;
+	}
+    } else {
+	XPUSHs(THIS->events.next->self? &PL_sv_yes : &PL_sv_no);
     }
 }
-	OUTPUT:
-	RETVAL
 
 void
 pe_watcher::again()
@@ -640,19 +641,9 @@ pe_watcher::use_keys(...)
 	warn("use_keys is deprecated");
 
 void
-pe_watcher::running(...)
-	PPCODE:
-	PUTBACK;
-	warn("running renamed to is_running");
-	_watcher_running(THIS, items == 2? sv_mortalcopy(ST(1)) : 0);
-	SPAGAIN;
-
-void
 pe_watcher::is_running(...)
 	PPCODE:
-	PUTBACK;
-	_watcher_running(THIS, items == 2? sv_mortalcopy(ST(1)) : 0);
-	SPAGAIN;
+	XPUSHs(sv_2mortal(newSViv(THIS->running)));
 
 void
 pe_watcher::is_active(...)
@@ -665,12 +656,6 @@ pe_watcher::is_suspended(...)
 	PPCODE:
 	PUTBACK;
 	XPUSHs(boolSV(WaSUSPEND(THIS)));
-
-void
-pe_watcher::is_queued(...)
-	PPCODE:
-	PUTBACK;
-	XPUSHs(boolSV(WaFLAGS(THIS) & PE_QUEUED));
 
 void
 pe_watcher::is_cancelled(...)
gdiff -up '/usr/tmp/mp23177.d/old/Event-0.71/TODO' '/usr/tmp/mp23177.d/new/Event-0.72/TODO'
Index: ./TODO
--- ./TODO	Thu Feb 17 11:04:19 2000
+++ ./TODO	Wed Mar  8 11:50:37 2000
@@ -2,17 +2,12 @@ finish up lexical warnings
 
 omitting parked=>1 should be a warning, not an error?
 
-attribute set methods should return the new value
+attribute set methods should return the new value?
 
 add timeout for var watchers?
 
-remove PE_QUEUED (unused?)
-
 find owner for Win32 port
 
-I am planning to change $watcher->pending to return the T/F in a
-scalar context and the actual events in a list context.
-
 discontinue inactivity watchers
 
 documentation
@@ -53,8 +48,6 @@ loop
 -----------------------------------------------------------------------
 -----------------------------------------------------------------------
 
-Move process.pm to external module!
-
-export_fail hook to autoload?
+Move process.pm to external module?
 
 accept "%f minutes" & "%f hours" for all time specifications?
gdiff -up '/usr/tmp/mp23177.d/old/Event-0.71/c/tied.c' '/usr/tmp/mp23177.d/new/Event-0.72/c/tied.c'
Index: ./c/tied.c
--- ./c/tied.c	Tue Feb  1 12:30:59 2000
+++ ./c/tied.c	Wed Mar  8 11:46:43 2000
@@ -76,9 +76,7 @@ WKEYMETH(_tied_at) {
 WKEYMETH(_tied_flags) {
     if (!nval) {
 	dSP;
-	XPUSHs(sv_2mortal(newSViv((ev->flags & PE_VISIBLE_FLAGS) |
-				  (ev->running? PE_RUNNING : 0) |
-				  (PE_RING_EMPTY(&ev->events)? 0:PE_QUEUED))));
+	XPUSHs(sv_2mortal(newSViv(ev->flags & PE_VISIBLE_FLAGS)));
 	PUTBACK;
     } else {
 	IV nflags = SvIV(nval);
gdiff -up '/usr/tmp/mp23177.d/old/Event-0.71/c/watcher.c' '/usr/tmp/mp23177.d/new/Event-0.72/c/watcher.c'
Index: ./c/watcher.c
--- ./c/watcher.c	Fri Mar  3 12:03:29 2000
+++ ./c/watcher.c	Wed Mar  8 11:45:45 2000
@@ -207,15 +207,6 @@ WKEYMETH(_watcher_repeat) {
     }
 }
 
-WKEYMETH(_watcher_running) {
-    if (!nval) {
-	dSP;
-	XPUSHs(sv_2mortal(newSViv(ev->running)));
-	PUTBACK;
-    } else
-	croak("'e_running' is read-only");
-}
-
 WKEYMETH(_watcher_suspend) {
     if (!nval) {
 	dSP;
@@ -272,8 +263,6 @@ static void boot_pe_watcher() {
     vt->alarm = pe_watcher_alarm;
     newCONSTSUB(stash, "ACTIVE", newSViv(PE_ACTIVE));
     newCONSTSUB(stash, "SUSPEND", newSViv(PE_SUSPEND));
-    newCONSTSUB(stash, "QUEUED", newSViv(PE_QUEUED));
-    newCONSTSUB(stash, "RUNNING", newSViv(PE_RUNNING));
     newCONSTSUB(stash, "R", newSViv(PE_R));
     newCONSTSUB(stash, "W", newSViv(PE_W));
     newCONSTSUB(stash, "E", newSViv(PE_E));
gdiff -up '/usr/tmp/mp23177.d/old/Event-0.71/lib/Event.pm' '/usr/tmp/mp23177.d/new/Event-0.72/lib/Event.pm'
Index: ./lib/Event.pm
--- ./lib/Event.pm	Fri Mar  3 15:10:31 2000
+++ ./lib/Event.pm	Fri Mar 10 18:17:30 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.71';
+$VERSION = '0.72';
 
 # If we inherit DynaLoader then we inherit AutoLoader; Bletch!
 require DynaLoader;
gdiff -up '/usr/tmp/mp23177.d/old/Event-0.71/lib/Event.pod' '/usr/tmp/mp23177.d/new/Event-0.72/lib/Event.pod'
Index: ./lib/Event.pod
--- ./lib/Event.pod	Mon Feb 28 17:29:13 2000
+++ ./lib/Event.pod	Thu Mar  9 13:27:54 2000
@@ -131,7 +131,7 @@ customized by passing extra attributes t
 created, watcher objects are "started" and are waiting for events
 (see C<$event-E<gt>start> below).
 
-L<NetServer::ProcessTop> displays watchers in real-time, formatted
+L<NetServer::Portal> can display watchers in real-time, formatted
 similarly to the popular C<top> program.  You may find this a useful
 aide for debugging.
 
@@ -286,14 +286,6 @@ of the main callback.
 
 Extra attribute: signal => $str
 
-=item semaphore
-
-Not yet implemented.
-
-=item msg
-
-Not yet implemented.
-
 =back
     
 =head2 PRIORITY
@@ -695,7 +687,7 @@ descriptors.
 
 =head1 ALSO SEE
 
-L<Time::HiRes>, L<NetServer::ProcessTop>, L<IPC::LDT>, L<Event-tcp>,
+L<Time::HiRes>, L<NetServer::Portal>, L<IPC::LDT>, L<Event-tcp>,
 and L<Time::Warp>.
 
 While Tk does not yet support Event, L<PerlQt> does.
gdiff -up '/usr/tmp/mp23177.d/old/Event-0.71/lib/Event/Watcher.pm' '/usr/tmp/mp23177.d/new/Event-0.72/lib/Event/Watcher.pm'
Index: ./lib/Event/Watcher.pm
--- ./lib/Event/Watcher.pm	Thu Feb 10 10:04:02 2000
+++ ./lib/Event/Watcher.pm	Wed Mar  8 11:43:33 2000
@@ -3,7 +3,7 @@ package Event::Watcher;
 use base 'Exporter';
 use Carp;
 use vars qw(@EXPORT_OK @ATTRIBUTE);
-@EXPORT_OK = qw(ACTIVE SUSPEND QUEUED RUNNING R W E T);
+@EXPORT_OK = qw(ACTIVE SUSPEND R W E T);
 @ATTRIBUTE = qw(cb cbtime desc debug prio reentrant repeat max_cb_tm);
 
 sub register {
gdiff -up '/usr/tmp/mp23177.d/old/Event-0.71/t/now.t' '/usr/tmp/mp23177.d/new/Event-0.72/t/now.t'
Index: ./t/now.t
--- ./t/now.t	Fri Feb  4 08:16:58 2000
+++ ./t/now.t	Wed Mar  8 11:40:19 2000
@@ -1,6 +1,6 @@
 # -*-perl-*- ASAP
 
-use Test; plan tests => 3;
+use Test; plan tests => 13;
 use Event qw(loop unloop);
 
 # $Event::DebugLevel = 3;
@@ -11,10 +11,28 @@ Event->idle(repeat => 1, cb => sub { 
 		unloop if $c >= 2;
 	    })
     ->now;
-my $e = Event->timer(after => 10, cb => sub { ok 1 });
-$e->stop;
-$e->now;
+my $tm = Event->timer(after => 10, cb => sub { ok 1 });
+ok !$tm->pending;
+$tm->stop;
+$tm->now;
+
+ok $tm->pending;
+my @e = $tm->pending;
+ok @e, 1;
+ok ref $e[0], 'Event::Event';
+ok $e[0]->hits;
+ok $e[0]->w, $tm;
+
+$tm->prio($tm->prio + 1);
+$tm->now;
+$tm->prio($tm->prio - 1);
+$tm->now;
+$tm->now;
+
+@e = $tm->pending;   # in order of occurance (FIFO)
+ok join('', map { $_->prio } @e), join('', $tm->prio, $tm->prio+1,
+				       $tm->prio, $tm->prio);
 
 loop;
 ok $c, 2;
-ok $e->cbtime;
+ok $tm->cbtime;
#### End of Patch data ####

#### ApplyPatch data follows ####
# Data version        : 1.0
# Date generated      : Fri Mar 10 18:22:18 2000
# Generated by        : makepatch 2.00 (2.0BETA)
# Recurse directories : Yes
# p 'ChangeLog' 23921 952730237 0100444
# p 'Event.h' 4569 952533976 0100444
# p 'Event.xs' 18723 952533953 0100444
# p 'TODO' 1903 952534237 0100444
# p 'c/tied.c' 2764 952534003 0100444
# p 'c/watcher.c' 9673 952533945 0100444
# p 'lib/Event.pm' 4074 952730250 0100444
# p 'lib/Event.pod' 24058 952626474 0100444
# p 'lib/Event/Watcher.pm' 2384 952533813 0100444
# p 't/now.t' 302 952533619 0100444
#### End of ApplyPatch data ####

#### End of Patch kit [created: Fri Mar 10 18:22:18 2000] ####
#### Checksum: 334 9894 18284 ####

-- 
"May the best description of competition prevail."
          via, but not speaking for Deutsche Bank
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.