ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/EV/EV.xs
(Generate patch)

Comparing EV/EV.xs (file contents):
Revision 1.3 by root, Fri Oct 26 17:24:18 2007 UTC vs.
Revision 1.7 by root, Sat Oct 27 14:54:21 2007 UTC

7 7
8#include <sys/time.h> 8#include <sys/time.h>
9#include <time.h> 9#include <time.h>
10#include <event.h> 10#include <event.h>
11#include <evdns.h> 11#include <evdns.h>
12/*include <evhttp.h>*/ /* does not compile */ 12
13/* workaround for evhttp.h requiring obscure bsd headers */
14#ifndef TAILQ_ENTRY
15#define TAILQ_ENTRY(type) \
16struct { \
17 struct type *tqe_next; /* next element */ \
18 struct type **tqe_prev; /* address of previous next element */ \
19}
20#endif /* !TAILQ_ENTRY */
21#include <evhttp.h>
13 22
14#define EV_NONE 0 23#define EV_NONE 0
15#define EV_UNDEF -1 24#define EV_UNDEF -1
16 25
17#define TIMEOUT_NONE HUGE_VAL 26#define TIMEOUT_NONE HUGE_VAL
107 116
108 if (ev->abstime) 117 if (ev->abstime)
109 { 118 {
110 double now = e_now (); 119 double now = e_now ();
111 120
112 if (now > to && ev->interval) 121 if (ev->interval)
113 ev->timeout = (to += ceil ((now - to) / ev->interval) * ev->interval); 122 ev->timeout = (to += ceil ((now - to) / ev->interval) * ev->interval);
114 123
115 to -= now; 124 to -= now;
116 } 125 }
117 else if (to < 0.) 126 else if (to < 0.)
160 dSP; 169 dSP;
161 170
162 ENTER; 171 ENTER;
163 SAVETMPS; 172 SAVETMPS;
164 173
165 if (!(ev->ev.ev_events & EV_PERSIST)) 174 if (!(ev->ev.ev_events & EV_PERSIST) || (events & EV_TIMEOUT))
166 ev->active = 0; 175 ev->active = 0;
167 176
168 PUSHMARK (SP); 177 PUSHMARK (SP);
169 EXTEND (SP, 2); 178 EXTEND (SP, 2);
170 PUSHs (sv_2mortal (e_self (ev))); 179 PUSHs (sv_2mortal (e_self (ev)));
471 static const struct { 480 static const struct {
472 const char *name; 481 const char *name;
473 IV iv; 482 IV iv;
474 } *civ, const_iv[] = { 483 } *civ, const_iv[] = {
475# define const_iv(pfx, name) { # name, (IV) pfx ## name }, 484# define const_iv(pfx, name) { # name, (IV) pfx ## name },
476
477 const_iv (DNS_, ERR_NONE) 485 const_iv (DNS_, ERR_NONE)
478 const_iv (DNS_, ERR_FORMAT) 486 const_iv (DNS_, ERR_FORMAT)
479 const_iv (DNS_, ERR_SERVERFAILED) 487 const_iv (DNS_, ERR_SERVERFAILED)
480 const_iv (DNS_, ERR_NOTEXIST) 488 const_iv (DNS_, ERR_NOTEXIST)
481 const_iv (DNS_, ERR_NOTIMPL) 489 const_iv (DNS_, ERR_NOTIMPL)
552 560
553void evdns_search_add (char *domain) 561void evdns_search_add (char *domain)
554 562
555void evdns_search_ndots_set (int ndots) 563void evdns_search_ndots_set (int ndots)
556 564
565
566MODULE = EV PACKAGE = EV::HTTP PREFIX = evhttp_
567
568BOOT:
569{
570 HV *stash = gv_stashpv ("EV::HTTP", 1);
571
572 static const struct {
573 const char *name;
574 IV iv;
575 } *civ, const_iv[] = {
576# define const_iv(pfx, name) { # name, (IV) pfx ## name },
577 const_iv (HTTP_, OK)
578 const_iv (HTTP_, NOCONTENT)
579 const_iv (HTTP_, MOVEPERM)
580 const_iv (HTTP_, MOVETEMP)
581 const_iv (HTTP_, NOTMODIFIED)
582 const_iv (HTTP_, BADREQUEST)
583 const_iv (HTTP_, NOTFOUND)
584 const_iv (HTTP_, SERVUNAVAIL)
585 const_iv (EVHTTP_, REQ_OWN_CONNECTION)
586 const_iv (EVHTTP_, PROXY_REQUEST)
587 const_iv (EVHTTP_, REQ_GET)
588 const_iv (EVHTTP_, REQ_POST)
589 const_iv (EVHTTP_, REQ_HEAD)
590 const_iv (EVHTTP_, REQUEST)
591 const_iv (EVHTTP_, RESPONSE)
592 };
593
594 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
595 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
596}
597
598MODULE = EV PACKAGE = EV::HTTP::Request PREFIX = evhttp_request_
599
600#HttpRequest new (SV *klass, SV *cb)
601
602#void DESTROY (struct evhttp_request *req);
603
604
605
606
607
608
609
610

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines