r21081 - in /trunk/libhtml-template-pro-perl: Changes MANIFEST META.yml Pro.xs debian/changelog lib/HTML/Template/Pro.pm perl-HTML-Template-Pro.spec procore.c procore.h proscope.c proscope.h prostate.h t/HTML-Template-Pro.t templates-Pro/include/

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Sat Jun 14 20:17:00 UTC 2008


Author: gregoa
Date: Sat Jun 14 20:17:00 2008
New Revision: 21081

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=21081
Log:
New upstream release.

Added:
    trunk/libhtml-template-pro-perl/templates-Pro/include/
      - copied from r21080, branches/upstream/libhtml-template-pro-perl/current/templates-Pro/include/
Modified:
    trunk/libhtml-template-pro-perl/Changes
    trunk/libhtml-template-pro-perl/MANIFEST
    trunk/libhtml-template-pro-perl/META.yml
    trunk/libhtml-template-pro-perl/Pro.xs
    trunk/libhtml-template-pro-perl/debian/changelog
    trunk/libhtml-template-pro-perl/lib/HTML/Template/Pro.pm
    trunk/libhtml-template-pro-perl/perl-HTML-Template-Pro.spec
    trunk/libhtml-template-pro-perl/procore.c
    trunk/libhtml-template-pro-perl/procore.h
    trunk/libhtml-template-pro-perl/proscope.c
    trunk/libhtml-template-pro-perl/proscope.h
    trunk/libhtml-template-pro-perl/prostate.h
    trunk/libhtml-template-pro-perl/t/HTML-Template-Pro.t

Modified: trunk/libhtml-template-pro-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-template-pro-perl/Changes?rev=21081&op=diff
==============================================================================
--- trunk/libhtml-template-pro-perl/Changes (original)
+++ trunk/libhtml-template-pro-perl/Changes Sat Jun 14 20:17:00 2008
@@ -145,4 +145,7 @@
 	- fixed Windows compilation thanks to Vyacheslav Shevelyov
 
 0.69  Thu Feb 28 06:46:17 EET 2008
-	- added elsif tag (requested by koha.org project)
+	- added elsif tag (requested by koha.org project)
+	
+0.70 Thu Apr  3 22:12:33 EEST 2008
+	- fixed regression in include scope (reported by Naxim Babych)

Modified: trunk/libhtml-template-pro-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-template-pro-perl/MANIFEST?rev=21081&op=diff
==============================================================================
--- trunk/libhtml-template-pro-perl/MANIFEST (original)
+++ trunk/libhtml-template-pro-perl/MANIFEST Sat Jun 14 20:17:00 2008
@@ -57,6 +57,10 @@
 tagstack.h
 tagstack.inc
 templates-Pro/empty.incl
+templates-Pro/include/2.out
+templates-Pro/include/2.tmpl
+templates-Pro/include/3.tmpl
+templates-Pro/include/4.tmpl
 templates-Pro/test_broken.tmpl
 templates-Pro/test_broken1.out
 templates-Pro/test_broken1.tmpl

Modified: trunk/libhtml-template-pro-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-template-pro-perl/META.yml?rev=21081&op=diff
==============================================================================
--- trunk/libhtml-template-pro-perl/META.yml (original)
+++ trunk/libhtml-template-pro-perl/META.yml Sat Jun 14 20:17:00 2008
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:                HTML-Template-Pro
-version:             0.69
+version:             0.70
 abstract:            Perl/XS module to use HTML Templates from CGI scripts
 license:             ~
 generated_by:        ExtUtils::MakeMaker version 6.32

Modified: trunk/libhtml-template-pro-perl/Pro.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-template-pro-perl/Pro.xs?rev=21081&op=diff
==============================================================================
--- trunk/libhtml-template-pro-perl/Pro.xs (original)
+++ trunk/libhtml-template-pro-perl/Pro.xs Sat Jun 14 20:17:00 2008
@@ -374,7 +374,6 @@
   if (!hashvalptr || !SvROK(*hashvalptr) || (SvTYPE(SvRV(*hashvalptr)) != SVt_PVHV))
     die("FATAL:output:param_map not found");
 
-  //setRootScope((HV *)SvRV(*hashvalptr));
   param->rootHV = (HV *)SvRV(*hashvalptr);
 
   /* end setting param_map */

Modified: trunk/libhtml-template-pro-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-template-pro-perl/debian/changelog?rev=21081&op=diff
==============================================================================
--- trunk/libhtml-template-pro-perl/debian/changelog (original)
+++ trunk/libhtml-template-pro-perl/debian/changelog Sat Jun 14 20:17:00 2008
@@ -1,3 +1,9 @@
+libhtml-template-pro-perl (0.70-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- gregor herrmann <gregoa at debian.org>  Sat, 14 Jun 2008 22:16:08 +0200
+
 libhtml-template-pro-perl (0.69-1) unstable; urgency=low
 
   * New upstream release.

Modified: trunk/libhtml-template-pro-perl/lib/HTML/Template/Pro.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-template-pro-perl/lib/HTML/Template/Pro.pm?rev=21081&op=diff
==============================================================================
--- trunk/libhtml-template-pro-perl/lib/HTML/Template/Pro.pm (original)
+++ trunk/libhtml-template-pro-perl/lib/HTML/Template/Pro.pm Sat Jun 14 20:17:00 2008
@@ -9,7 +9,7 @@
 use vars qw($VERSION @ISA);
 @ISA = qw(DynaLoader);
 
-$VERSION = '0.69';
+$VERSION = '0.70';
 
 bootstrap HTML::Template::Pro $VERSION;
 

Modified: trunk/libhtml-template-pro-perl/perl-HTML-Template-Pro.spec
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-template-pro-perl/perl-HTML-Template-Pro.spec?rev=21081&op=diff
==============================================================================
--- trunk/libhtml-template-pro-perl/perl-HTML-Template-Pro.spec (original)
+++ trunk/libhtml-template-pro-perl/perl-HTML-Template-Pro.spec Sat Jun 14 20:17:00 2008
@@ -6,7 +6,7 @@
 %define module HTML-Template-Pro
 
 Name: perl-%module
-Version: 0.69
+Version: 0.70
 Release: alt1
 
 Packager: Igor Yu. Vlasenko <viy at altlinux.org>
@@ -54,6 +54,9 @@
 %perl_vendor_man3dir/*
 
 %changelog
+* Thu Apr 03 2008 Igor Vlasenko <viy at altlinux.ru> 0.70-alt1
+- new version; see Changes
+
 * Thu Feb 28 2008 Igor Vlasenko <viy at altlinux.ru> 0.69-alt1
 - new version; see Changes
 

Modified: trunk/libhtml-template-pro-perl/procore.c
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-template-pro-perl/procore.c?rev=21081&op=diff
==============================================================================
--- trunk/libhtml-template-pro-perl/procore.c (original)
+++ trunk/libhtml-template-pro-perl/procore.c Sat Jun 14 20:17:00 2008
@@ -103,7 +103,7 @@
   static char buffer[20]; /* for snprintf %d */
   int loop;
   PSTRING retval={NULL,NULL};
-  if (curScopeLevel(&state->var_scope_stack)>0 
+  if (curScopeLevel(&state->param->var_scope_stack)>0 
       && name.endnext-name.begin>4
       && '_'==*(name.begin)
       && '_'==*(name.begin+1)
@@ -111,7 +111,7 @@
     /* we can meet loop variables here -- try it first */
     /* length of its name >4 */
     /* __first__ __last__ __inner__ __odd__ __counter__ */
-    struct ProLoopState* currentScope = getCurrentScope(&state->var_scope_stack);
+    struct ProLoopState* currentScope = getCurrentScope(&state->param->var_scope_stack);
     PSTRING shiftedname; /* (PSTRING) {name.begin+2,name.endnext} */
     shiftedname.begin=name.begin+2;
     shiftedname.endnext=name.endnext;
@@ -278,12 +278,12 @@
 static
 ABSTRACT_VALUE* walk_through_nested_loops (struct tmplpro_state *state, PSTRING name) {
   int PrevHash;
-  struct ProLoopState* currentScope = getCurrentScope(&state->var_scope_stack);
+  struct ProLoopState* currentScope = getCurrentScope(&state->param->var_scope_stack);
   ABSTRACT_VALUE* valptr= state->param->getAbstractValFuncPtr(currentScope->param_HV, name);
   if ((0==state->param->global_vars) || (valptr)) return valptr;
-  PrevHash=curScopeLevel(&state->var_scope_stack)-1;
+  PrevHash=curScopeLevel(&state->param->var_scope_stack)-1;
   while (PrevHash>=0) {
-    valptr=state->param->getAbstractValFuncPtr(getScope(&state->var_scope_stack, PrevHash)->param_HV,name);
+    valptr=state->param->getAbstractValFuncPtr(getScope(&state->param->var_scope_stack, PrevHash)->param_HV,name);
     if (valptr!=NULL) return valptr;
     PrevHash--;
   }
@@ -538,9 +538,9 @@
 #ifdef DEBUG
   tmpl_log(state,TMPL_LOG_DEBUG2,"next_loop:before NextLoopFuncPtr\n");
 #endif
-  struct ProLoopState* currentScope = getCurrentScope(&state->var_scope_stack);
+  struct ProLoopState* currentScope = getCurrentScope(&state->param->var_scope_stack);
   if (++currentScope->loop >currentScope->maxloop || !(state->param->NextLoopFuncPtr)(currentScope)) {
-    popScope(&state->var_scope_stack);
+    popScope(&state->param->var_scope_stack);
     return 0;
   } else return 1;
 }
@@ -557,7 +557,7 @@
 #ifdef DEBUG
   tmpl_log(state,TMPL_LOG_DEBUG2,"tag_handler_loop:before InitLoopFuncPtr\n");
 #endif
-  if (state->is_visible && (*state->param->InitLoopFuncPtr)(&state->var_scope_stack,name) && next_loop(state)) {
+  if (state->is_visible && (*state->param->InitLoopFuncPtr)(&state->param->var_scope_stack,name) && next_loop(state)) {
     iftag.value=1; /* the loop is non - empty */
   } else {
     /* empty loop is equal to <if false> ... </if> */
@@ -848,12 +848,11 @@
   flag is_tag_closed;
   flag is_tag_commented;
   char* last_safe_pos=state->next_to_end-TAG_WIDTH_OFFSET;
+  if (debuglevel) tmpl_log(NULL,TMPL_LOG_DEBUG,"process_state:initiated\n");
   tagstack_init(&(state->tag_stack));
   pbuffer_init(&(state->str_buffer));
   pbuffer_init(&(state->expr_pusharg_buffer));
-  Scope_init(&state->var_scope_stack);
-  // hack (until param and state will merge ???)
-  setRootScope(&state->var_scope_stack,state->param->rootHV);
+  Scope_init_root(&state->param->var_scope_stack,state->param->rootHV);
 
 
   while (state->cur_pos < last_safe_pos) {
@@ -881,7 +880,7 @@
   }
   (state->param->WriterFuncPtr)(state->last_processed_pos,state->next_to_end);
 
-  Scope_free(&state->var_scope_stack);
+  Scope_free(&state->param->var_scope_stack);
   pbuffer_free(&(state->expr_pusharg_buffer));
   pbuffer_free(&(state->str_buffer));
   tagstack_free(&(state->tag_stack));

Modified: trunk/libhtml-template-pro-perl/procore.h
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-template-pro-perl/procore.h?rev=21081&op=diff
==============================================================================
--- trunk/libhtml-template-pro-perl/procore.h (original)
+++ trunk/libhtml-template-pro-perl/procore.h Sat Jun 14 20:17:00 2008
@@ -124,8 +124,9 @@
   const char* selfpath; /* file that has included this file, or empty string */
   /* hack until param and state will be merged */
   ABSTRACT_MAP* rootHV;
-
-
+  /* moved from state; are passed to include */
+  /* variable scope (nested loops) */
+  struct scope_stack var_scope_stack;
 };
 
 int tmplpro_exec_tmpl (const char* filename, struct tmplpro_param* ProParams);

Modified: trunk/libhtml-template-pro-perl/proscope.c
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-template-pro-perl/proscope.c?rev=21081&op=diff
==============================================================================
--- trunk/libhtml-template-pro-perl/proscope.c (original)
+++ trunk/libhtml-template-pro-perl/proscope.c Sat Jun 14 20:17:00 2008
@@ -12,20 +12,23 @@
 
 #define START_NUMBER_OF_NESTED_LOOPS 64
 
-
+static
 void 
 Scope_init(struct scope_stack* scopestack) {
-  scopestack->max=START_NUMBER_OF_NESTED_LOOPS;
-  scopestack->root=(struct ProLoopState*) malloc ((scopestack->max) * sizeof(struct ProLoopState));
-  if (NULL==scopestack->root) tmpl_log(NULL,TMPL_LOG_ERROR, "DIE:Scope_init:internal error:not enough memory\n");
-  scopestack->level=-1;
+    scopestack->max=START_NUMBER_OF_NESTED_LOOPS;
+    scopestack->root=(struct ProLoopState*) malloc ((scopestack->max) * sizeof(struct ProLoopState));
+    if (NULL==scopestack->root) tmpl_log(NULL,TMPL_LOG_ERROR, "DIE:Scope_init:internal error:not enough memory\n");
+    scopestack->level=-1;
 }
 
 void 
 Scope_free(struct scope_stack* scopestack) {
-  free(scopestack->root);
-  scopestack->max=-1;
-  scopestack->level=-1;
+  if (scopestack->_init_count--<=0) {
+    free(scopestack->root);
+    scopestack->max=-1;
+    scopestack->level=-1;
+    scopestack->_init_count=0;
+  }
 }
 
 int curScopeLevel(struct scope_stack* scopestack) {
@@ -70,11 +73,10 @@
 }
 
 void 
-setRootScope(struct scope_stack* scopestack, void* param_HV) {
-  if (scopestack->max<0) {
-    tmpl_log(NULL,TMPL_LOG_ERROR, "WARN:SetRootScope:internal warning:why scope is empty?\n");
+Scope_init_root(struct scope_stack* scopestack, void* param_HV) {
+  if (scopestack->_init_count++==0) {
     Scope_init(scopestack);
+    scopestack->level=0;
+    scopestack->root->param_HV=param_HV;
   }
-  scopestack->level=0;
-  scopestack->root->param_HV=param_HV;
 }

Modified: trunk/libhtml-template-pro-perl/proscope.h
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-template-pro-perl/proscope.h?rev=21081&op=diff
==============================================================================
--- trunk/libhtml-template-pro-perl/proscope.h (original)
+++ trunk/libhtml-template-pro-perl/proscope.h Sat Jun 14 20:17:00 2008
@@ -16,6 +16,7 @@
 struct scope_stack {
   int level;
   int max;
+  int _init_count;
   struct ProLoopState* root;
 };
 
@@ -30,11 +31,10 @@
 int curScopeLevel(struct scope_stack*);
 struct ProLoopState* getCurrentScope(struct scope_stack*);
 struct ProLoopState* getScope(struct scope_stack*, int depth);
-void popScope();
+void popScope(struct scope_stack* scopestack);
 /* maxloop = number of loops - 1 in * loops_AV */
 void pushScope2(struct scope_stack*, int maxloop, void *loops_AV);
-void setRootScope(struct scope_stack*, void* param_HV);
-void Scope_init(struct scope_stack* scopestack);
+void Scope_init_root(struct scope_stack*, void* param_HV);
 void Scope_free(struct scope_stack* scopestack);
 
 #endif /* _PROSCOPE_H */

Modified: trunk/libhtml-template-pro-perl/prostate.h
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-template-pro-perl/prostate.h?rev=21081&op=diff
==============================================================================
--- trunk/libhtml-template-pro-perl/prostate.h (original)
+++ trunk/libhtml-template-pro-perl/prostate.h Sat Jun 14 20:17:00 2008
@@ -27,11 +27,13 @@
   pbuffer str_buffer;
   /* tag stack */
   struct tagstack tag_stack;
+
+  /* moved from state; are passed to include */
   /* variable scope (nested loops) */
-  struct scope_stack var_scope_stack;
-
+  /* struct scope_stack var_scope_stack;*/
   /* expr state variables */
   /* expr string buffer; used to unescape pstring arg */
+  /* TODO: test and move it too (otherwise it will cause bugs in included exprs?) */
   pbuffer expr_pusharg_buffer;
 
   char* expr_curpos;

Modified: trunk/libhtml-template-pro-perl/t/HTML-Template-Pro.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-template-pro-perl/t/HTML-Template-Pro.t?rev=21081&op=diff
==============================================================================
--- trunk/libhtml-template-pro-perl/t/HTML-Template-Pro.t (original)
+++ trunk/libhtml-template-pro-perl/t/HTML-Template-Pro.t Sat Jun 14 20:17:00 2008
@@ -6,7 +6,7 @@
 # change 'tests => 1' to 'tests => last_test_to_print';
 
 use Test;
-BEGIN {plan tests => 1+2*(18+4) };
+BEGIN {plan tests => 1+2*(18+4+1) };
 use File::Spec;
 #use HTML::Template;
 use HTML::Template::Pro;
@@ -64,6 +64,10 @@
 # if IMITATE==1 (-DCOMPAT_ALLOW_NAME_IN_CLOSING_TAG)
 #test_tmpl('test_if6',  @varset1);
 #
+
+
+test_tmpl('include/2', 'list', [{test => 1}, {test=>2}]);
+
 
 my $devnull=File::Spec->devnull();
 if (defined $devnull) {




More information about the Pkg-perl-cvs-commits mailing list