[interchange-cvs] interchange - docelic modified eg/pcode

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Tue Oct 19 05:53:32 EDT 2004


User:      docelic
Date:      2004-10-19 09:53:32 GMT
Modified:  eg       pcode
Log:
* pcode: The script now checks for element names in the file matching file name.

  Say, "CodeDef currency" in a file named ..../currency.filter is OK, but
  "CodeDef text2html" issues a warning.

Revision  Changes    Path
1.2       +15 -0     interchange/eg/pcode


rev 1.2, prev_rev 1.1
Index: pcode
===================================================================
RCS file: /var/cvs/interchange/eg/pcode,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- pcode	18 Oct 2004 21:21:52 -0000	1.1
+++ pcode	19 Oct 2004 09:53:32 -0000	1.2
@@ -6,11 +6,26 @@
 # Simple script to extract Perl code out of combined files like 
 # UserTags or Filters.
 #
+# Script also takes out the item name and sees if it's the same as file.
+# Say, "CodeDef currency" is ok in file .../currency.filter, "CodeDef xy"
+# is not.
+#
 # Example use:
 # for p in *.filter; do pcode $p | perl -c; done
 # 
 
+ at ARGV==1 and do {
+	$file = $ARGV[0];
+	$item = $file;
+	$item =~ s#.*/##;
+	$item =~ s/\..+$//;
+	$item or warn "No item name out of '$file'?\n";
+};
+
 while (<>) {
+	if ( $item and /^CodeDef\s+(\S+)\s+/  and  $item ne $1) {
+		warn "File '$file', item '$item' != '$1' from script content.\n";
+	}
 	next if /Routine\s+<<(\S+)/ and $run=$1  or  /^$run$/ and $run=0;
 	print if $run;
 }








More information about the interchange-cvs mailing list