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

Comparing deliantra/server/server/cfperl.xs (file contents):
Revision 1.79 by root, Thu Dec 14 05:09:32 2006 UTC vs.
Revision 1.80 by root, Thu Dec 14 20:39:54 2006 UTC

834 PL_exit_flags |= PERL_EXIT_DESTRUCT_END; 834 PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
835 835
836 char *argv[] = { 836 char *argv[] = {
837 "", 837 "",
838 "-e" 838 "-e"
839 "cf->bootstrap;" 839 "use Event;" // required for bootstrap
840 "cf->bootstrap;" // requiored for datadir :*>
840 "unshift @INC, cf::datadir ();" 841 "unshift @INC, cf::datadir ();"
841 "require cf;" 842 "require cf;"
842 }; 843 };
843 844
844 if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) || perl_run (perl)) 845 if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) || perl_run (perl))
1055cfperl_result_DOUBLE (int idx) 1056cfperl_result_DOUBLE (int idx)
1056{ 1057{
1057 return SvNV (cfperl_result (idx)); 1058 return SvNV (cfperl_result (idx));
1058} 1059}
1059 1060
1061/////////////////////////////////////////////////////////////////////////////
1062
1063struct EventAPI *watcher_base::GEventAPI;
1064
1065static void iow_dispatch (pe_event *ev)
1066{
1067 iow *w = (iow *)ev->ext_data;
1068 w->call (*w, ((pe_ioevent *)ev)->got);
1069}
1070
1071void
1072iow::alloc ()
1073{
1074 pe = GEventAPI->new_io (0, 0);
1075
1076 pe->base.callback = (void *)iow_dispatch;
1077 pe->base.ext_data = (void *)this;
1078
1079 pe->fd = -1;
1080 pe->poll = 0;
1081}
1082
1083iow &
1084iow::fd (int fd)
1085{
1086 pe->fd = fd;
1087
1088 return *this;
1089}
1090
1091int
1092iow::poll ()
1093{
1094 return pe->poll;
1095}
1096
1097iow &
1098iow::poll (int events)
1099{
1100 pe->poll = events;
1101
1102 return *this;
1103}
1104
1060MODULE = cf PACKAGE = cf PREFIX = cf_ 1105MODULE = cf PACKAGE = cf PREFIX = cf_
1061 1106
1062BOOT: 1107BOOT:
1063{ 1108{
1064 HV *stash = gv_stashpv ("cf", 1); 1109 HV *stash = gv_stashpv ("cf", 1);
1110
1111 I_EVENT_API (PACKAGE);
1112 watcher_base::GEventAPI = GEventAPI;
1065 1113
1066 newCONSTSUB (stash, "VERSION", newSVpv (VERSION, sizeof (VERSION) - 1)); 1114 newCONSTSUB (stash, "VERSION", newSVpv (VERSION, sizeof (VERSION) - 1));
1067 1115
1068 static const struct { 1116 static const struct {
1069 const char *name; 1117 const char *name;
1580 av_push (event, newSVpv ((char *)eiv->name + eiv->skip, 0)); 1628 av_push (event, newSVpv ((char *)eiv->name + eiv->skip, 0));
1581 av_push (event, newSViv (eiv->klass)); 1629 av_push (event, newSViv (eiv->klass));
1582 av_store (av, eiv->iv, newRV_noinc ((SV *)event)); 1630 av_store (av, eiv->iv, newRV_noinc ((SV *)event));
1583 newCONSTSUB (stash, (char *)eiv->name, newSViv (eiv->iv)); 1631 newCONSTSUB (stash, (char *)eiv->name, newSViv (eiv->iv));
1584 } 1632 }
1585
1586 //I_EVENT_API (PACKAGE);
1587} 1633}
1588 1634
1589void _init_vars () 1635void _init_vars ()
1590 CODE: 1636 CODE:
1591 cb_global = get_av ("cf::CB_GLOBAL", 1); 1637 cb_global = get_av ("cf::CB_GLOBAL", 1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines