r5992 - trunk/eda/boom

werner at docs.openmoko.org werner at docs.openmoko.org
Mon Oct 25 03:10:13 CEST 2010


Author: werner
Date: 2010-10-25 03:10:12 +0200 (Mon, 25 Oct 2010)
New Revision: 5992

Added:
   trunk/eda/boom/testsub
Modified:
   trunk/eda/boom/parser.pl
Log:
New tool "boom testsub" to process .sub rules on a set of parameters.

Example:
boom testsub atrf.sub VR3 5V6 0402

- parser.pl: reset $mode globally so that we can call &parse_one directly
- testsub: new tool to debug .sub rules. Option -d to print rules processing.



Modified: trunk/eda/boom/parser.pl
===================================================================
--- trunk/eda/boom/parser.pl	2010-10-24 11:39:46 UTC (rev 5991)
+++ trunk/eda/boom/parser.pl	2010-10-25 01:10:12 UTC (rev 5992)
@@ -488,5 +488,9 @@
     }
 }
 
+#
+# in case user calls directly &parse_one and not &parse
+#
+$mode = *skip;
 
 return 1;

Added: trunk/eda/boom/testsub
===================================================================
--- trunk/eda/boom/testsub	                        (rev 0)
+++ trunk/eda/boom/testsub	2010-10-25 01:10:12 UTC (rev 5992)
@@ -0,0 +1,45 @@
+#!/usr/bin/perl
+
+require "parser.pl";
+require "match.pl";
+
+
+sub usage
+{
+	print STDERR "usage: $0 [-d] file.sub|field ...\n\n";
+	print STDERR "  fields: ref value [footprint user-field ...]\n";
+}
+
+
+for (@ARGV) {
+	if ($_ eq "-d") {
+		$debug = 1;
+		next;
+	}
+	&usage if /^-/;
+	if (/\.sub$/) {
+		&parse_one($_);
+	} else {
+		push(@f, $_);
+	}
+}
+
+&usage unless @f >= 2;
+
+$field{"REF"} = shift @f;
+$field{"VAL"} = shift @f;
+$field{"FP"} = shift @f;
+
+for (my $i = 1; $i != 10; $i++) {
+	$field{"F$i"} = $f[$i-1];
+}
+
+&apply_rules;
+
+for (sort keys %field) {
+	if ($field{$_} =~ / /) {
+		print "$_ = \"$field{$_}\"\n";
+	} else {
+		print "$_ = $field{$_}\n";
+	}
+}


Property changes on: trunk/eda/boom/testsub
___________________________________________________________________
Name: svn:executable
   + *




More information about the commitlog mailing list