BOOT:
{
- reh_register("Devel::Regexp::Instrument", dri_comp_hook, dri_exec_hook);
+ reh_config cfg;
+ cfg.comp = dri_comp_hook;
+ cfg.exec = dri_exec_hook;
+ reh_register("Devel::Regexp::Instrument", &cfg);
}
In your Perl module file :
typedef void (*reh_exec_hook)(pTHX_ regexp *, regnode *, regmatch_info *, regmatch_state *);
+=head2 C<reh_config>
+
+A typedef'd struct that holds a set of all the different callbacks publicized by this module.
+It has the following members :
+
+=over 4
+
+=item *
+
+C<comp>
+
+A function pointer of type C<reh_comp_hook> that will be called each time a regnode is compiled.
+Allowed to be C<NULL> if you don't want to call anything for this phase.
+
+=item *
+
+C<exec>
+
+A function pointer of type C<reh_exec_hook> that will be called each time a regnode is executed.
+Allowed to be C<NULL> if you don't want to call anything for this phase.
+
+=back
+
=head2 C<reh_register>
- void reh_register(pTHX_ const char *key, reh_comp_hook comp, reh_exec_hook exec);
+ void reh_register(pTHX_ const char *key, reh_config *cfg);
-Registers under the given name C<key> a callback C<comp> that will run during the compilation phase and a callback C<exec> that will run during the execution phase.
-Null function pointers are allowed in case you don't want to hook one of the phases.
+Registers the callbacks specified by the C<reh_config *> object C<cfg> under the given name C<key>.
+C<cfg> can be a pointer to a static object of type C<reh_config>.
C<key> should match with the argument passed to L</enable> and L</disable> in Perl land.
An exception will be thrown if C<key> has already been used to register callbacks.