Home  |  Linux  | Mysql  | PHP  | XML
From:jhorwitz@cvs.perl.org Date:Sun Sep 21 11:42:09 2008
Subject:[svn:mod_parrot] r447 - in mod_parrot/branches/hll-modules: languages/perl6/lib lib/ModParrot/HLL src
Author: jhorwitz
Date: Sun Sep 21 10:42:04 2008
New Revision: 447

Modified:
   mod_parrot/branches/hll-modules/languages/perl6/lib/mod_perl6.pm
   mod_parrot/branches/hll-modules/lib/ModParrot/HLL/pir.pir
   mod_parrot/branches/hll-modules/src/module.c

Log:
make user-visible hook array a list of hooks instead of a bitmap


Modified: mod_parrot/branches/hll-modules/languages/perl6/lib/mod_perl6.pm
==============================================================================
--- mod_parrot/branches/hll-modules/languages/perl6/lib/mod_perl6.pm	(original)
+++ mod_parrot/branches/hll-modules/languages/perl6/lib/mod_perl6.pm	Sun Sep 21 10:42:04 2008
@@ -108,7 +108,7 @@
 
 # register hooks
 # XXX would be nice to use the enum strings here
-my @hooks = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0);
+my @hooks = (13);
 
 Apache::Module::add(
     'modparrot_perl6_module',

Modified: mod_parrot/branches/hll-modules/lib/ModParrot/HLL/pir.pir
==============================================================================
--- mod_parrot/branches/hll-modules/lib/ModParrot/HLL/pir.pir	(original)
+++ mod_parrot/branches/hll-modules/lib/ModParrot/HLL/pir.pir	Sun Sep 21 10:42:04 2008
@@ -66,7 +66,7 @@
     $I0 = 0
   loop_start:
     $P0 = new 'Integer'
-    $P0 = 1
+    $P0 = $I0
     hooks[$I0] = $P0
     inc $I0
     if $I0 < 19 goto loop_start

Modified: mod_parrot/branches/hll-modules/src/module.c
==============================================================================
--- mod_parrot/branches/hll-modules/src/module.c	(original)
+++ mod_parrot/branches/hll-modules/src/module.c	Sun Sep 21 10:42:04 2008
@@ -409,15 +409,18 @@
     minfo->namespace = (char *)apr_pstrdup(p, namespace);
 
     /* populate hook array for use by register_meta_hooks */
-    i = Parrot_PMC_get_intval(interp, hook_array);
-    if (i != MP_HOOK_LAST) {
-        /* XXX how do we output an error here? */
-        return(NULL);
-    }
-    for (i = 0; i < MP_HOOK_LAST; i++) {
-        Parrot_PMC flag;
-        flag = Parrot_PMC_get_pmc_keyed_int(interp, hook_array, i);
-        minfo->hooks[i] = Parrot_PMC_get_intval(interp, flag);
+    num = Parrot_PMC_get_intval(interp, hook_array);
+    for (i = 0; i < num; i++) {
+        int hook_index;
+        Parrot_PMC hpmc;
+        hpmc = Parrot_PMC_get_pmc_keyed_int(interp, hook_array, i);
+        hook_index = Parrot_PMC_get_intval(interp, hpmc);
+        if (hook_index < 0 || hook_index >= MP_HOOK_LAST) {
+            MPLOG_ERRORF(s, "invalid hook value in module '%s'", name);
+	    /* XXX is exit() the right thing to do here? */
+            exit(1);
+        }
+        minfo->hooks[hook_index] = 1;
     }
     modp->dynamic_load_handle = minfo;
 
Navigate in group perl.cvs.mod_parrot at sever nntp.perl.org
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants