Re: [NeoStats-Devel] Core CTCP event handling
Justin Hammond <justin-kLev/[email protected]> Mon, 12 Sep 2005 21:13:55 +0800
| Newsgroups | gmane.comp.neostats.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, On 06 Sep 2005, at 4:23 AM, M wrote: > Justin Hammond wrote: > >> On 03 Sep 2005, at 3:26 AM, M wrote: >> >>> Justin Hammond wrote: >>> I don't really follow what you mean and cannot see anything in a >>> recent commit that explains what the difference between a perl >>> extension and a perl module is from a coding point of view >>> >> or how one >> >>> is loaded and setup. >>> >>> >> >> Reason is that I havnt committed any code yet that makes any >> difference between them, >> > > I was going from your comment "Right now, Perl Modules can attach > to other > module (bots etc, like adding commands to SecureServ) after last > nights > commits" which I assume meant something had been committed. > > >> but if you follow that code path, >> you would see thats its impossible for a perl "interpreter" >> to live inside a real module (because of the IS_STD_MOD or >> IS_PERL_MOD >> macros etc. >> >> My post above was how I was thinking about tackling the problems. My >> question was do you see any problems, or a better way to do this? >> >> >> >>> If you just want to raise an event from NeoStats to both >>> >> modules and >> >>> perl, then it is a trivial change to the if contructs used to issue >>> the event in SendModuleEvent. >>> >>> >>> >> >> Well, in the current implementation, only one callback per >> event per module is possible (because we use the arrays of >> events). To support perl extensions, we would also have to >> iterate through a perl event structure to handle any perl >> callbacks that might be needed for the perl extension >> (otherwise the module coder would have to re-invent a mini >> event subsystem for each module he wants perl support for. >> > > Why not just change: > > if( IS_STANDARD_MOD( module_ptr ) ) > event call > else if( IS_PERL_MOD( module_ptr ) ) > perl call > > To: > > if( IS_STANDARD_MOD( module_ptr ) ) > event call > if( perl pointer ) > perl event call > > We already have a per array entry perl pointer so I assume the > following > would be the value to test: > > if( module_ptr->event_list[event]->pe ) > > Make a similar change to the main handler call and we end up with: > > if( module_ptr->event_list[event]->handler ) > event call > if( module_ptr->event_list[event]->pe ) > perl event call > > So, a trivial change to the if construct and both perl and normal > handlers > can be called whether they exist exclusively or together so will > work for > normal modules, perl modules and some combination of both. > > Does that achieve what you are aiming for? > Thats Perfect!!! BUT If only it was that simple. For the actual Event calls, that works like a dream, but I hit problems with all the Event Modification functions (enable, flags etc). Without adding a extra flag to those functions, its difficult to tell if you want to modify the C function or perl function, and you also hit problems if you have different flags for perl and C calls. I'm sure your not going to like what I done to the event subsystem, but I couldn't think of another way around it. :) > Mark. > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: devel-unsubscribe-wool9L35kifE9wlyV4mCnKxOck334EZe@public.gmane.org > For additional commands, e-mail: [email protected] > >