----- Forwarded message from [EMAIL PROTECTED] -----

Date: Tue, 15 Feb 2000 21:59:57 +0100
Subject: CPAN Upload: JPRIT/Event-0.68.tar.gz
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED],
    [EMAIL PROTECTED]

The uploaded file

    Event-0.68.tar.gz

has entered CPAN as

  file: $CPAN/authors/id/JPRIT/Event-0.68.tar.gz
  size: 66194 bytes
   md5: cc5484a0759ac94ae0f83fecde182ba1

No action is required on your part
Request entered by: JPRIT (Joshua N. Pritikin)
Request entered on: Tue, 15 Feb 2000 20:58:33 GMT
Request completed:  Tue, 15 Feb 2000 20:59:57 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.67 to update it to Event-0.68
# 
# 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
# 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:
#
touch 'demo/stdin.t'
chmod 0444 'demo/stdin.t'
#
# This command terminates the shell and need not be executed manually.
exit
#
#### End of Preamble ####

#### Patch data follows ####
gdiff -up '/usr/tmp/mp29431.d/old/Event-0.67/ChangeLog' 
'/usr/tmp/mp29431.d/new/Event-0.68/ChangeLog'
Index: ./ChangeLog
--- ./ChangeLog Wed Feb  9 16:10:47 2000
+++ ./ChangeLog Tue Feb 15 15:19:11 2000
@@ -1,3 +1,19 @@
+2000-02-15  Joshua Pritikin  <[EMAIL PROTECTED]>
+
+       * Release 0.68.
+
+2000-02-14  Joshua Pritikin  <[EMAIL PROTECTED]>
+
+       * More careful checking of
+       intervals. (suggested by [EMAIL PROTECTED])
+
+2000-02-10  Joshua Pritikin  <[EMAIL PROTECTED]>
+
+       * Fix yet another typemap bug. ([EMAIL PROTECTED])
+
+       * Make io default to poll=r; more stringent start test;
+       fix demo/stdin.t (suggested by [EMAIL PROTECTED])
+
 2000-02-09  Joshua Pritikin  <[EMAIL PROTECTED]>
 
        * Release 0.67.  Hopefully this release will prove stable.
gdiff -up '/usr/tmp/mp29431.d/old/Event-0.67/Event.xs' 
'/usr/tmp/mp29431.d/new/Event-0.68/Event.xs'
Index: ./Event.xs
--- ./Event.xs  Mon Feb  7 15:16:44 2000
+++ ./Event.xs  Tue Feb 15 15:19:38 2000
@@ -23,6 +23,23 @@ extern "C" {
 #  define whichsig Perl_whichsig   /* ? */
 #endif
 
+/* lexical warnings -- waiting for appropriate magic from
+   [EMAIL PROTECTED] */
+#if 0
+static void Event_warn(const char* pat, ...) {
+    dTHX;
+    va_list args;
+    va_start(args, pat);
+    if (!ckWARN_d(WARN_ALL))
+       return;
+    Perl_vwarner(aTHX_ WARN_ALL, pat, &args);
+    va_end(args);
+}
+
+#  undef warn
+#  define warn Event_warn
+#endif
+
 #ifdef croak
 #  undef croak
 #endif
gdiff -up '/usr/tmp/mp29431.d/old/Event-0.67/MANIFEST' 
'/usr/tmp/mp29431.d/new/Event-0.68/MANIFEST'
Index: ./MANIFEST
--- ./MANIFEST  Wed Feb  9 08:51:53 2000
+++ ./MANIFEST  Thu Feb 10 09:00:52 2000
@@ -22,12 +22,13 @@ c/typemap.c
 c/unix_io.c
 c/var.c
 c/watcher.c
+demo/group.t
 demo/in.pl
 demo/inactivity.t
-demo/group.t
 demo/process.pm
 demo/readline.t
 demo/spin_io.t
+demo/stdin.t
 demo/variable_repeater.t
 lib/Event.pm
 lib/Event.pod
gdiff -up '/usr/tmp/mp29431.d/old/Event-0.67/TODO' 
'/usr/tmp/mp29431.d/new/Event-0.68/TODO'
Index: ./TODO
--- ./TODO      Tue Feb  8 16:57:12 2000
+++ ./TODO      Tue Feb 15 15:09:02 2000
@@ -1,10 +1,12 @@
+finish up lexical warnings
+
 deprecate inactivity completely?
 
-add timeout for var watchers?
+omitting parked=>1 should be a warning, not an error
 
-increase the number of priority levels?
-  ASYNC    0    1    2    3    4    5    6    7    8    9   IDLE
-                         HIGH           NORM
+attribute set methods should return the new value
+
+add timeout for var watchers?
 
 find owner for Win32 port
 
@@ -12,6 +14,14 @@ documentation
   how to design new event types (in perl)
   how to design new event types (in C)??
 
[EMAIL PROTECTED] signal discussion:
+  The API rsignal overrides the current signal handler.  If the signal
+  watcher is cancelled (or otherwise disabled) then rsignal is reset to
+  SIG_DFL.  Maybe the original handler
+  should be restored.  On the other hand, assignment to %SIG will mess
+  up Event watchers so maybe Event should refuse to watch a signal if a
+  handler is already installed.
+
 optimization
   update io event-mask without invalidating cache
   determine IntervalEpsilon dynamically & make available from perl
@@ -19,22 +29,18 @@ optimization
     queue events from both sides?
   try to hoist system calls from the inner loop
 
+there seems to be some sort of bug in the shutdown phase
+  Attempt to free unreferenced scalar during global destruction.
+  Use of uninitialized value during global destruction.
+  Explicit blessing to '' (assuming package main) during global
+  destruction.
+
 rethink
   pe_check_recovery & ENTER/LEAVE points
 
[EMAIL PROTECTED] signal discussion:
-  The API rsignal overrides the current signal handler.  If the signal
-  watcher is cancelled (or otherwise disabled) then rsignal is reset to
-  SIG_DFL.  Maybe the original handler
-  should be restored.  On the other hand, assignment to %SIG will mess
-  up Event watchers so maybe Event should refuse to watch a signal if a
-  handler is already installed.
-
-there seems to be some sort of bug in the shutdown phase
-> Attempt to free unreferenced scalar during global destruction.
-> Use of uninitialized value during global destruction.
-> Explicit blessing to '' (assuming package main) during global
-> destruction.
+increase the number of priority levels?
+  ASYNC    0    1    2    3    4    5    6    7    8    9   IDLE
+                         HIGH           NORM
 
 loop
   StarvePrio?
gdiff -up '/usr/tmp/mp29431.d/old/Event-0.67/c/group.c' 
'/usr/tmp/mp29431.d/new/Event-0.68/c/group.c'
Index: ./c/group.c
--- ./c/group.c Wed Feb  9 12:29:57 2000
+++ ./c/group.c Tue Feb 15 15:17:22 2000
@@ -35,7 +35,7 @@ static char *pe_group_start(pe_watcher *
 
     if (!ev->callback)
        return "without callback";
-    if (!sv_2interval(gp->timeout, &timeout))
+    if (!sv_2interval("group", gp->timeout, &timeout))
        return "repeating group has no timeout";
 
     gp->since = WaHARD(ev)? gp->tm.at : NVtime();
@@ -62,7 +62,7 @@ static void pe_group_alarm(pe_watcher *w
        }
     }
 
-    if (!sv_2interval(gp->timeout, &timeout))
+    if (!sv_2interval("group", gp->timeout, &timeout))
        croak("Event: can't extract timeout"); /* impossible */
 
     remaining = gp->since + timeout - now;
@@ -125,6 +125,7 @@ WKEYMETH(_group_timeout) {
        SV *old = gp->timeout;
        gp->timeout = SvREFCNT_inc(nval);
        SvREFCNT_dec(old);
+       VERIFYINTERVAL("group", gp->timeout);
        /* recalc expiration XXX */
     }
 }
gdiff -up '/usr/tmp/mp29431.d/old/Event-0.67/c/idle.c' 
'/usr/tmp/mp29431.d/new/Event-0.68/c/idle.c'
Index: ./c/idle.c
--- ./c/idle.c  Mon Feb  7 10:15:08 2000
+++ ./c/idle.c  Tue Feb 15 15:17:55 2000
@@ -36,7 +36,7 @@ static char *pe_idle_start(pe_watcher *e
        WaCBTIME_off(ev);
     if (!repeating) ev->cbtime = NVtime();
     now = WaHARD(ev)? ev->cbtime : NVtime();
-    if (sv_2interval(ip->min_interval, &min)) {
+    if (sv_2interval("min", ip->min_interval, &min)) {
        ip->tm.at = min + now;
        pe_timeable_start(&ip->tm);
        D_IDLE(warn("min %.2f setup '%s'\n", min, SvPV(ev->desc,na)));
@@ -44,7 +44,7 @@ static char *pe_idle_start(pe_watcher *e
     else {
        PE_RING_UNSHIFT(&ip->iring, &Idle);
        D_IDLE(warn("idle '%s'\n", SvPV(ev->desc,na)));
-       if (sv_2interval(ip->max_interval, &max)) {
+       if (sv_2interval("max", ip->max_interval, &max)) {
            D_IDLE(warn("max %.2f setup '%s'\n", max, SvPV(ev->desc,na)));
            ip->tm.at = max + now;
            pe_timeable_start(&ip->tm);
@@ -58,7 +58,7 @@ static void pe_idle_alarm(pe_watcher *wa
     double min,max,left;
     pe_idle *ip = (pe_idle*) wa;
     pe_timeable_stop(&ip->tm);
-    if (sv_2interval(ip->min_interval, &min)) {
+    if (sv_2interval("min", ip->min_interval, &min)) {
        left = wa->cbtime + min - now;
        if (left > IntervalEpsilon) {
            ++TimeoutTooEarly;
@@ -72,7 +72,7 @@ static void pe_idle_alarm(pe_watcher *wa
        PE_RING_UNSHIFT(&ip->iring, &Idle);
        D_IDLE(warn("idle '%s'\n", SvPV(wa->desc,na)));
     }
-    if (sv_2interval(ip->max_interval, &max)) {
+    if (sv_2interval("max", ip->max_interval, &max)) {
        left = wa->cbtime + max - now;
        if (left < IntervalEpsilon) {
            pe_event *ev;
@@ -108,6 +108,7 @@ WKEYMETH(_idle_max_interval) {
        SV *old = ip->max_interval;
        ip->max_interval = SvREFCNT_inc(nval);
        if (old) SvREFCNT_dec(old);
+       VERIFYINTERVAL("max", ip->max_interval);
     }
 }
 
@@ -121,6 +122,7 @@ WKEYMETH(_idle_min_interval) {
        SV *old = ip->min_interval;
        ip->min_interval = SvREFCNT_inc(nval);
        if (old) SvREFCNT_dec(old);
+       VERIFYINTERVAL("min", ip->min_interval);
     }
 }
 
gdiff -up '/usr/tmp/mp29431.d/old/Event-0.67/c/io.c' 
'/usr/tmp/mp29431.d/new/Event-0.68/c/io.c'
Index: ./c/io.c
--- ./c/io.c    Tue Feb  8 17:20:49 2000
+++ ./c/io.c    Thu Feb 10 08:27:22 2000
@@ -14,7 +14,7 @@ static pe_watcher *pe_io_allocate(HV *st
     ev->fd = -1;
     ev->timeout = 0;
     ev->handle = &PL_sv_undef;
-    ev->poll = 0;
+    ev->poll = PE_R;
     ev->tm_callback = 0;
     ev->tm_ext_data = 0;
     WaINVOKE1_off(ev);
@@ -43,7 +43,7 @@ static char *pe_io_start(pe_watcher *_ev
        assigning anything to the 'handle'.  This should be more
        officially supported but maybe it is too unix specific. */
 
-    if (ev->fd >= 0) {
+    if (ev->fd >= 0 && (ev->poll & ~PE_T)) {
        if (!ev->base.callback)
            return "without io callback";
        PE_RING_UNSHIFT(&ev->ioring, &IOWatch);
@@ -132,7 +132,7 @@ WKEYMETH(_io_poll) {
        XPUSHs(sv_2mortal(events_mask_2sv(io->poll)));
        PUTBACK;
     } else {
-       int nev = sv_2events_mask(nval, PE_R|PE_W|PE_E|PE_T);
+       int nev = sv_2events_mask(nval, PE_R|PE_W|PE_E);
        if (io->timeout) nev |=  PE_T;
        else             nev &= ~PE_T;
        if (io->poll != nev) {
gdiff -up '/usr/tmp/mp29431.d/old/Event-0.67/c/timer.c' 
'/usr/tmp/mp29431.d/new/Event-0.68/c/timer.c'
Index: ./c/timer.c
--- ./c/timer.c Tue Feb  8 17:22:15 2000
+++ ./c/timer.c Tue Feb 15 15:16:56 2000
@@ -29,7 +29,7 @@ static char *pe_timer_start(pe_watcher *
           the appropriate time increment. */
        double interval;
 
-       if (!sv_2interval(tm->interval, &interval))
+       if (!sv_2interval("timer", tm->interval, &interval))
            return "repeating timer has no interval";
 
        tm->tm.at = interval + (WaHARD(ev)? tm->tm.at : NVtime());
@@ -74,6 +74,7 @@ WKEYMETH(_timer_interval) {
        SV *old = tp->interval;
        tp->interval = SvREFCNT_inc(nval);
        SvREFCNT_dec(old);
+       VERIFYINTERVAL("timer", tp->interval);
        /* recalc expiration XXX */
     }
 }
gdiff -up '/usr/tmp/mp29431.d/old/Event-0.67/c/typemap.c' 
'/usr/tmp/mp29431.d/new/Event-0.68/c/typemap.c'
Index: ./c/typemap.c
--- ./c/typemap.c       Wed Feb  9 08:47:22 2000
+++ ./c/typemap.c       Tue Feb 15 15:18:40 2000
@@ -55,6 +55,8 @@ static void* sv_2watcher(SV *sv) {
     sv = SvRV(sv);
     if (SvTYPE(sv) < SVt_PVMG)
        croak("sv_2watcher: not a watcher");
+    if (!SvOBJECT(sv))
+       croak("sv_2watcher: not an object");
     mg = mg_find(sv, '~');
     if (mg) {
        if (mg->mg_private != MG_PRIVATE_CODE) {
@@ -62,8 +64,7 @@ static void* sv_2watcher(SV *sv) {
        }
        return (void*) mg->mg_obj;
     }
-    croak("Attempt to use destroyed object (RV=0x%x %s=0x%x)",
-         origsv, HvNAME(SvSTASH(sv)), sv);
+    croak("sv_2watcher: can't decode SV=0x%x", origsv);
     return 0;
 }
 
@@ -102,7 +103,10 @@ static void *sv_2event(SV *sv) {
 
 /***************************************************************/
 
-static int sv_2interval(SV *in, double *out) {
+#define VERIFYINTERVAL(name, f) \
+ STMT_START { double ign; sv_2interval(name, f, &ign); } STMT_END
+
+static int sv_2interval(char *label, SV *in, double *out) {
     SV *sv = in;
     if (!sv) return 0;
     if (SvGMAGICAL(sv))
@@ -110,7 +114,10 @@ static int sv_2interval(SV *in, double *
     if (!SvOK(sv)) return 0;
     if (SvROK(sv))
        sv = SvRV(sv);
-    if (SvNOK(sv)) {
+    if (!SvOK(sv)) {
+       warn("Event: %s interval undef", label);
+       *out = 0;
+    } else if (SvNOK(sv)) {
        *out = SvNVX(sv);
     } else if (SvIOK(sv)) {
        *out = SvIVX(sv);
@@ -118,11 +125,13 @@ static int sv_2interval(SV *in, double *
        *out = SvNV(sv);
     } else {
        sv_dump(in);
-       croak("Interval must be a number of reference to a number");
+       croak("Event: %s interval must be a number or reference to a number",
+             label);
        return 0;
     }
     if (*out < 0) {
-       warn("Event: negative timeout (%.2f) clipped to zero", *out);
+       warn("Event: %s has negative timeout %.2f (clipped to zero)",
+            label, *out);
        *out = 0;
     }
     return 1;
gdiff -up /dev/null '/usr/tmp/mp29431.d/new/Event-0.68/demo/stdin.t'
Index: ./demo/stdin.t
--- ./demo/stdin.t      Wed Dec 31 19:00:00 1969
+++ ./demo/stdin.t      Thu Feb 10 08:08:00 2000
@@ -0,0 +1,7 @@
+use Event;
+
+$w=Event->io(fd=>\*STDIN, cb=>sub {<STDIN>; warn "CALLED!\n";});
+
+print "io default poll attribute:", $w->poll, "\n";
+
+Event::loop();
gdiff -up '/usr/tmp/mp29431.d/old/Event-0.67/lib/Event.pm' 
'/usr/tmp/mp29431.d/new/Event-0.68/lib/Event.pm'
Index: ./lib/Event.pm
--- ./lib/Event.pm      Wed Feb  9 16:11:04 2000
+++ ./lib/Event.pm      Tue Feb 15 15:09:11 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.67';
+$VERSION = '0.68';
 
 # If we inherit DynaLoader then we inherit AutoLoader; Bletch!
 require DynaLoader;
gdiff -up '/usr/tmp/mp29431.d/old/Event-0.67/ppport.h' 
'/usr/tmp/mp29431.d/new/Event-0.68/ppport.h'
Index: ./ppport.h
--- ./ppport.h  Wed Dec 22 17:00:07 1999
+++ ./ppport.h  Mon Feb 14 09:02:47 2000
@@ -187,6 +187,7 @@ __DATA__
 #ifndef dTHX
 #  define dTHX dTHR
 #  define pTHX_
+#  define aTHX_
 #endif
 
 #ifndef boolSV
gdiff -up '/usr/tmp/mp29431.d/old/Event-0.67/t/callback.t' 
'/usr/tmp/mp29431.d/new/Event-0.68/t/callback.t'
Index: ./t/callback.t
--- ./t/callback.t      Tue Feb  8 17:46:38 2000
+++ ./t/callback.t      Tue Feb 15 15:49:26 2000
@@ -1,7 +1,7 @@
 #!./perl -w
 
 use strict;
-use Test; plan tests => 3;
+use Test; plan tests => 5;
 use Event 0.65;
 
 my $invoked_method=0;
@@ -17,11 +17,19 @@ Event->timer(after => 0, cb => [$main, '
     local $SIG{__WARN__} = sub {
        ok $_[0], '/nomethod/';
     };
-    Event->timer(after => 0, cb => [$main, 'nomethod'])->cancel;
+    Event->timer(desc => 'nomethod', after => 0, cb => [$main, 'nomethod']);
 }
 
 eval { Event->timer(after => 0, cb => ['main']); };
 ok $@, '/Callback/';
 
-Event::loop();
+{
+    local $Event::DIED = sub {
+       my ($run,$err) = @_;
+       ok $run->w->desc, 'nomethod';
+       ok $err, '/object method/';
+    };
+    Event::loop();
+}
+
 ok $invoked_method, 3;
gdiff -up '/usr/tmp/mp29431.d/old/Event-0.67/t/io.t' 
'/usr/tmp/mp29431.d/new/Event-0.68/t/io.t'
Index: ./t/io.t
--- ./t/io.t    Fri Feb  4 08:15:51 2000
+++ ./t/io.t    Thu Feb 10 08:38:04 2000
@@ -8,12 +8,18 @@ BEGIN {
     }
 }
 
-use Test; plan tests => 6;
+use Test; plan tests => 8;
 use Event qw(loop unloop);
 use Event::Watcher qw(R W);
 use Symbol;
 
 #$Event::DebugLevel = 3;
+
+eval { Event->io };
+ok $@, "/nothing to watch/";
+
+eval { Event->io(fd => \*STDIN, cb => \&die, poll => 0) };
+ok $@, "/nothing to watch/";
 
 my $noticed_bogus_fd=0;
 my $bogus_timeout=0;
#### End of Patch data ####

#### ApplyPatch data follows ####
# Data version        : 1.0
# Date generated      : Tue Feb 15 15:57:49 2000
# Generated by        : makepatch 2.00 (2.0BETA)
# Recurse directories : Yes
# p 'ChangeLog' 22650 950645951 0100444
# p 'Event.xs' 18104 950645978 0100444
# p 'MANIFEST' 906 950191252 0100444
# p 'TODO' 1620 950645342 0100444
# p 'c/group.c' 3709 950645842 0100444
# p 'c/idle.c' 3573 950645875 0100444
# p 'c/io.c' 5369 950189242 0100444
# p 'c/timer.c' 2173 950645816 0100444
# p 'c/typemap.c' 4161 950645920 0100444
# c 'demo/stdin.t' 0 950188080 0100444
# p 'lib/Event.pm' 4254 950645351 0100444
# p 'ppport.h' 7852 950536967 0100444
# p 't/callback.t' 543 950647766 0100444
# p 't/io.t' 1650 950189884 0100444
#### End of ApplyPatch data ####

#### End of Patch kit [created: Tue Feb 15 15:57:49 2000] ####
#### Checksum: 490 16017 42654 ####

-- 
"Never ascribe to malice that which can be explained by stupidity."
                            via, but not speaking for Deutsche Bank

Reply via email to