From: Vincent Pit Date: Sat, 31 Mar 2012 15:48:48 +0000 (+0200) Subject: This is 0.02 X-Git-Tag: v0.02^0 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Fre-engine-Hooks.git;a=commitdiff_plain;h=619dd7df9609f6910fd3724e1d88e8a9697752e1 This is 0.02 --- diff --git a/Changes b/Changes index ffac2bf..99668af 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,14 @@ Revision history for re-engine-Hooks +0.02 2012-02-31 15:50 UTC + + Chg : INCOMPATIBLE CHANGE : Arguments are now passed to + reh_register() through a configuration structure. + + Chg : The node compilation hook is now called when a branch is + converted into a trie. + + Fix : The module now builds correctly on perl 5.15.5 and greater. + + Fix : Duplicated symbols on Windows should have been pruned. + + Fix : The module is now be thread-safe. + 0.01 2012-03-29 22:00 UTC First version, released on an unsuspecting world. diff --git a/META.json b/META.json index 97d8a4e..962b407 100644 --- a/META.json +++ b/META.json @@ -60,5 +60,5 @@ "url" : "http://git.profvince.com/?p=perl%2Fmodules%2Fre-engine-Hooks.git" } }, - "version" : "0.01" + "version" : "0.02" } diff --git a/META.yml b/META.yml index e3747ae..1b256aa 100644 --- a/META.yml +++ b/META.yml @@ -35,4 +35,4 @@ resources: homepage: http://search.cpan.org/dist/re-engine-Hooks/ license: http://dev.perl.org/licenses/ repository: http://git.profvince.com/?p=perl%2Fmodules%2Fre-engine-Hooks.git -version: 0.01 +version: 0.02 diff --git a/README b/README index 24d8b59..812b41d 100644 --- a/README +++ b/README @@ -3,14 +3,14 @@ NAME engine. VERSION - Version 0.01 + Version 0.02 SYNOPSIS In your XS file : #include "re_engine_hooks.h" - STATIC void dri_comp_hook(pTHX_ regexp *rx, regnode *node) { + STATIC void dri_comp_node_hook(pTHX_ regexp *rx, regnode *node) { ... } @@ -23,7 +23,10 @@ SYNOPSIS BOOT: { - reh_register("Devel::Regexp::Instrument", dri_comp_hook, dri_exec_hook); + reh_config cfg; + cfg.comp_node = dri_comp_node_hook; + cfg.exec_node = dri_exec_node_hook; + reh_register("Devel::Regexp::Instrument", &cfg); } In your Perl module file : @@ -38,7 +41,7 @@ SYNOPSIS use re::engine::Hooks; # Before loading our own shared library BEGIN { - $VERSION = '0.01'; + $VERSION = '0.02'; require DynaLoader; push @ISA, 'DynaLoader'; __PACKAGE__->bootstrap($VERSION); @@ -71,42 +74,58 @@ DESCRIPTION C API The C API is made available through the re_engine_hooks.h header file. - "reh_comp_hook" - The typedef for the regexp compilation phase hook. Currently evaluates - to : + "reh_comp_node_hook" + The typedef for the regexp node compilation phase hook. Currently + evaluates to : - typedef void (*reh_comp_hook)(pTHX_ regexp *, regnode *); + typedef void (*reh_comp_node_hook)(pTHX_ regexp *, regnode *); "reh_exec_hook" - The typedef for the regexp execution phase hook. Currently evaluates to - : + The typedef for the regexp node_execution phase hook. Currently + evaluates to : - typedef void (*reh_exec_hook)(pTHX_ regexp *, regnode *, regmatch_info *, regmatch_state *); + typedef void (*reh_exec_node_hook)(pTHX_ regexp *, regnode *, regmatch_info *, regmatch_state *); + + "reh_config" + A typedef'd struct that holds a set of all the different callbacks + publicized by this module. It has the following members : + + * "comp_node" + + A function pointer of type "reh_comp_node_hook" that will be called + each time a regnode is compiled. Allowed to be "NULL" if you don't + want to call anything for this phase. + + * "exec_node" + + A function pointer of type "reh_exec_node_hook" that will be called + each time a regnode is executed. Allowed to be "NULL" if you don't + want to call anything for this phase. "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 "key" a callback "comp" that will run - during the compilation phase and a callback "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. "key" should match with the - argument passed to "enable" and "disable" in Perl land. An exception - will be thrown if "key" has already been used to register callbacks. + Registers the callbacks specified by the "reh_config *" object "cfg" + under the given name "key". "cfg" can be a pointer to a static object of + type "reh_config". "key" is expected to be a nul-terminated string and + should match the argument passed to "enable" and "disable" in Perl land. + An exception will be thrown if "key" has already been used to register + callbacks. PERL API "enable" enable $key; - Lexically enables the hooks associated with the key $key + Lexically enables the hooks associated with the key $key. "disable" disable $key; - Lexically disables the hooks associated with the key $key + Lexically disables the hooks associated with the key $key. EXAMPLES - See the t/re-engine-Hooks-TestDist/ directory in the distribution. It - implements a couple of simple examples. + Please refer to the t/re-engine-Hooks-TestDist/ directory in the + distribution. It implements a couple of simple examples. DEPENDENCIES perl 5.10.1. diff --git a/lib/re/engine/Hooks.pm b/lib/re/engine/Hooks.pm index 97da688..2777002 100644 --- a/lib/re/engine/Hooks.pm +++ b/lib/re/engine/Hooks.pm @@ -11,7 +11,7 @@ re::engine::Hooks - Hookable variant of the Perl core regular expression engine. =head1 VERSION -Version 0.01 +Version 0.02 =cut @@ -20,7 +20,7 @@ our ($VERSION, @ISA); sub dl_load_flags { 0x01 } BEGIN { - $VERSION = '0.01'; + $VERSION = '0.02'; require DynaLoader; push @ISA, qw; __PACKAGE__->bootstrap($VERSION); @@ -63,7 +63,7 @@ In your Perl module file : use re::engine::Hooks; # Before loading our own shared library BEGIN { - $VERSION = '0.01'; + $VERSION = '0.02'; require DynaLoader; push @ISA, 'DynaLoader'; __PACKAGE__->bootstrap($VERSION); diff --git a/t/re-engine-Hooks-TestDist/lib/re/engine/Hooks/TestDist.pm b/t/re-engine-Hooks-TestDist/lib/re/engine/Hooks/TestDist.pm index c155f36..05747ff 100644 --- a/t/re-engine-Hooks-TestDist/lib/re/engine/Hooks/TestDist.pm +++ b/t/re-engine-Hooks-TestDist/lib/re/engine/Hooks/TestDist.pm @@ -10,7 +10,7 @@ our ($VERSION, @ISA); use re::engine::Hooks; BEGIN { - $VERSION = '0.01'; + $VERSION = '0.02'; require DynaLoader; push @ISA, 'DynaLoader'; __PACKAGE__->bootstrap($VERSION);