[interchange-cvs] interchange - jon modified 2 files

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Tue Mar 29 12:40:57 EST 2005


User:      jon
Date:      2005-03-29 17:40:56 GMT
Modified:  dist/test/products tests.asc
Modified:  lib/Vend Interpolate.pm
Log:
Add new "if" type, "control", with tests.

By Ethan Rowe <ethan at endpoint.com>.

Revision  Changes    Path
2.20      +45 -0     interchange/dist/test/products/tests.asc


rev 2.20, prev_rev 2.19
Index: tests.asc
===================================================================
RCS file: /var/cvs/interchange/dist/test/products/tests.asc,v
retrieving revision 2.19
retrieving revision 2.20
diff -u -u -r2.19 -r2.20
--- tests.asc	25 Jan 2005 03:54:19 -0000	2.19
+++ tests.asc	29 Mar 2005 17:40:56 -0000	2.20
@@ -2757,6 +2757,51 @@
 %%
 Verify operation of the $Row standard Perl object in [item-calc], [loop-calc], [sql-calc] subtags.
 %%%
+000158
+%%
+[if control dogs]ERROR[else]1[/else][/if]
+[if control cats]ERROR[else]1[/else][/if][control reset=1][control-set]
+			[dogs]Labradors Retrievers Poodles[/dogs]
+			[cats]Siamese[/cats]
+			[one]1[/one]
+			[zero]0[/zero]
+[/control-set][control reset=1]
+[if control one]1[else]ERROR[/else][/if]
+[if control zero]ERROR[else]1[/else][/if]
+[if control zero eq 0]1[else]ERROR[/else][/if]
+[if control zero == 0]1[else]ERROR[/else][/if]
+[if control one == 1]1[else]ERROR[/else][/if]
+[if control one >= 0]1[else]ERROR[/else][/if]
+[if control one <= 0]ERROR[else]1[/else][/if]
+[if control dogs =~ /shephard/i]ERROR[else]1[/else][/if]
+[if control dogs =~ /poodles/i]1[else]ERROR[/else][/if]
+[if control nonexistant]ERROR[else]1[/else][/if]
+[if type=control term=cats op=eq compare="[control cats]"]1[else]ERROR[/else][/if][control]
+[if control dogs]ERROR[else]1[/else][/if]
+[if control cats]ERROR[else]1[/else][/if]
+%%
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+%%
+
+%%
+
+%%
+Check the if 'control' conditional type.
+%%%
 999999
 %%
 [the test] [perl]



2.236     +13 -2     interchange/lib/Vend/Interpolate.pm


rev 2.236, prev_rev 2.235
Index: Interpolate.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Interpolate.pm,v
retrieving revision 2.235
retrieving revision 2.236
diff -u -u -r2.235 -r2.236
--- Interpolate.pm	16 Mar 2005 18:50:59 -0000	2.235
+++ Interpolate.pm	29 Mar 2005 17:40:56 -0000	2.236
@@ -1,6 +1,6 @@
 # Vend::Interpolate - Interpret Interchange tags
 # 
-# $Id: Interpolate.pm,v 2.235 2005/03/16 18:50:59 jon Exp $
+# $Id: Interpolate.pm,v 2.236 2005/03/29 17:40:56 jon Exp $
 #
 # Copyright (C) 2002-2005 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -28,7 +28,7 @@
 require Exporter;
 @ISA = qw(Exporter);
 
-$VERSION = substr(q$Revision: 2.235 $, 10);
+$VERSION = substr(q$Revision: 2.236 $, 10);
 
 @EXPORT = qw (
 
@@ -1127,6 +1127,17 @@
                 last;
             }
         }
+	}
+	elsif($base eq 'control') {
+		$op = 0;
+		if (defined $::Scratch->{control_index}
+			and defined $::Control->[$Scratch->{control_index}]) {
+			$op = qq%$::Control->[$::Scratch->{control_index}]{$term}%;
+			$op = "q{$op}"
+				unless defined $noop;
+			$op .= qq% $operator $comp%
+				if defined $comp;
+		}
 	}
 	else {
 		$op =	qq%$term%;








More information about the interchange-cvs mailing list