require '_h2ph_pre.ph';

unless(defined(&_EVENT_H_)) {
    eval 'sub _EVENT_H_ () {1;}' unless defined(&_EVENT_H_);
    if(defined(&__cplusplus)) {
    }
    eval 'sub EVLIST_TIMEOUT () {0x1;}' unless defined(&EVLIST_TIMEOUT);
    eval 'sub EVLIST_INSERTED () {0x2;}' unless defined(&EVLIST_INSERTED);
    eval 'sub EVLIST_SIGNAL () {0x4;}' unless defined(&EVLIST_SIGNAL);
    eval 'sub EVLIST_ACTIVE () {0x8;}' unless defined(&EVLIST_ACTIVE);
    eval 'sub EVLIST_INIT () {0x80;}' unless defined(&EVLIST_INIT);
    eval 'sub EVLIST_ALL () {(0xf000 | 0x8f);}' unless defined(&EVLIST_ALL);
    eval 'sub EV_TIMEOUT () {0x1;}' unless defined(&EV_TIMEOUT);
    eval 'sub EV_READ () {0x2;}' unless defined(&EV_READ);
    eval 'sub EV_WRITE () {0x4;}' unless defined(&EV_WRITE);
    eval 'sub EV_SIGNAL () {0x8;}' unless defined(&EV_SIGNAL);
    eval 'sub EV_PERSIST () {0x10;}' unless defined(&EV_PERSIST);
    unless(defined(&TAILQ_ENTRY)) {
	eval 'sub _EVENT_DEFINED_TQENTRY () {1;}' unless defined(&_EVENT_DEFINED_TQENTRY);
	eval 'sub TAILQ_ENTRY {
	    local($type) = @_;
    	    eval q(\'struct struct\' { \'struct type\' * &tqe_next; \'struct type\' ** &tqe_prev; });
	}' unless defined(&TAILQ_ENTRY);
    }
    unless(defined(&RB_ENTRY)) {
	eval 'sub _EVENT_DEFINED_RBENTRY () {1;}' unless defined(&_EVENT_DEFINED_RBENTRY);
	eval 'sub RB_ENTRY {
	    local($type) = @_;
    	    eval q(\'struct struct\' { \'struct type\' * &rbe_left; \'struct type\' * &rbe_right; \'struct type\' * &rbe_parent; \'int\'  &rbe_color; });
	}' unless defined(&RB_ENTRY);
    }
    eval 'sub EVENT_SIGNAL {
        local($ev) = @_;
	    eval q( ($ev->{ev_fd}));
    }' unless defined(&EVENT_SIGNAL);
    eval 'sub EVENT_FD {
        local($ev) = @_;
	    eval q( ($ev->{ev_fd}));
    }' unless defined(&EVENT_FD);
    if(defined(&_EVENT_DEFINED_TQENTRY)) {
	undef(&TAILQ_ENTRY) if defined(&TAILQ_ENTRY);
	undef(&_EVENT_DEFINED_TQENTRY) if defined(&_EVENT_DEFINED_TQENTRY);
    } else {
    }
    if(defined(&_EVENT_DEFINED_RBENTRY)) {
	undef(&RB_ENTRY) if defined(&RB_ENTRY);
	undef(&_EVENT_DEFINED_RBENTRY) if defined(&_EVENT_DEFINED_RBENTRY);
    }
    eval 'sub TIMEOUT_DEFAULT () {{5, 0};}' unless defined(&TIMEOUT_DEFAULT);
    eval 'sub EVLOOP_ONCE () {0x1;}' unless defined(&EVLOOP_ONCE);
    eval 'sub EVLOOP_NONBLOCK () {0x2;}' unless defined(&EVLOOP_NONBLOCK);
    eval 'sub evtimer_add {
        local($ev, $tv) = @_;
	    eval q( &event_add($ev, $tv));
    }' unless defined(&evtimer_add);
    eval 'sub evtimer_set {
        local($ev, $cb, $arg) = @_;
	    eval q( &event_set($ev, -1, 0, $cb, $arg));
    }' unless defined(&evtimer_set);
    eval 'sub evtimer_del {
        local($ev) = @_;
	    eval q( &event_del($ev));
    }' unless defined(&evtimer_del);
    eval 'sub evtimer_pending {
        local($ev, $tv) = @_;
	    eval q( &event_pending($ev,  &EV_TIMEOUT, $tv));
    }' unless defined(&evtimer_pending);
    eval 'sub evtimer_initialized {
        local($ev) = @_;
	    eval q((($ev)-> &ev_flags &  &EVLIST_INIT));
    }' unless defined(&evtimer_initialized);
    eval 'sub signal_add {
        local($ev, $tv) = @_;
	    eval q( &event_add($ev, $tv));
    }' unless defined(&signal_add);
    eval 'sub signal_set {
        local($ev, $x, $cb, $arg) = @_;
	    eval q( &event_set($ev, $x,  &EV_SIGNAL| &EV_PERSIST, $cb, $arg));
    }' unless defined(&signal_set);
    eval 'sub signal_del {
        local($ev) = @_;
	    eval q( &event_del($ev));
    }' unless defined(&signal_del);
    eval 'sub signal_pending {
        local($ev, $tv) = @_;
	    eval q( &event_pending($ev,  &EV_SIGNAL, $tv));
    }' unless defined(&signal_pending);
    eval 'sub signal_initialized {
        local($ev) = @_;
	    eval q((($ev)-> &ev_flags &  &EVLIST_INIT));
    }' unless defined(&signal_initialized);
    eval 'sub event_initialized {
        local($ev) = @_;
	    eval q((($ev)-> &ev_flags &  &EVLIST_INIT));
    }' unless defined(&event_initialized);
    if(defined(&__cplusplus)) {
    }
}
1;
