Send commitlog mailing list submissions to
commitlog@lists.openmoko.org
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
commitlog-requ...@lists.openmoko.org
You can reach the person managing the list at
commitlog-ow...@lists.openmoko.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:
1. r5814 - trunk/gta02-core/bom/fic (wer...@docs.openmoko.org)
2. r5815 - in trunk/gta02-core/bom: . fic (wer...@docs.openmoko.org)
--- Begin Message ---
Author: werner
Date: 2010-02-02 17:58:35 +0100 (Tue, 02 Feb 2010)
New Revision: 5814
Added:
trunk/gta02-core/bom/fic/fic2dsc
Log:
- bom/fic/fic2dsc: extract the textual description keyed by the reference
number
Added: trunk/gta02-core/bom/fic/fic2dsc
===================================================================
--- trunk/gta02-core/bom/fic/fic2dsc (rev 0)
+++ trunk/gta02-core/bom/fic/fic2dsc 2010-02-02 16:58:35 UTC (rev 5814)
@@ -0,0 +1,8 @@
+#!/usr/bin/perl
+
+print "#DSC\n";
+while (<>) {
+ chop;
+ next unless /^\d*,"(\S+)\s*","([^"]*?)\s*"/;
+ print "FIC $1 $2\n";
+}
Property changes on: trunk/gta02-core/bom/fic/fic2dsc
___________________________________________________________________
Name: svn:executable
+ *
--- End Message ---
--- Begin Message ---
Author: werner
Date: 2010-02-02 23:22:38 +0100 (Tue, 02 Feb 2010)
New Revision: 5815
Added:
trunk/gta02-core/bom/prettyord
Modified:
trunk/gta02-core/bom/README
trunk/gta02-core/bom/fic/Makefile
trunk/gta02-core/bom/gta02-core.sub
trunk/gta02-core/bom/parser.pl
trunk/gta02-core/bom/part2order
Log:
Added pretty-printing of orders, for documentation purposes.
- bom/fic/Makefile: added fic.dsc target
- bom/fic/Makefile: fixed typo in fic.inv dependency
- bom/part2order: forgot to output the #ORD
- bom/parser.pl: added parsing of .ord and .dsc file
- bom/README: documented the .dsc file format
- bom/prettyord: pretty-print an order
Modified: trunk/gta02-core/bom/README
===================================================================
--- trunk/gta02-core/bom/README 2010-02-02 16:58:35 UTC (rev 5814)
+++ trunk/gta02-core/bom/README 2010-02-02 22:22:38 UTC (rev 5815)
@@ -210,3 +210,17 @@
least 100 units. So a 170 units order would cost USD 34.
Blank lines and comments (#) are ignored.
+
+
+Description (.dsc)
+------------------
+
+A description file contains plain text descriptions of parts. The file
+begins with a like containing only
+#DSC
+
+Each line contains the name space, a space, the part number, another
+space, and the description. The description can contain any printable
+character and ends with a newline.
+
+Blank lines and comments (#) are ignored.
Modified: trunk/gta02-core/bom/fic/Makefile
===================================================================
--- trunk/gta02-core/bom/fic/Makefile 2010-02-02 16:58:35 UTC (rev 5814)
+++ trunk/gta02-core/bom/fic/Makefile 2010-02-02 22:22:38 UTC (rev 5815)
@@ -7,8 +7,11 @@
fic.equ: fic2vendor $(INV)
perl fic2vendor $(INV) >$@ || { rm -f $@; exit 1; }
-fic.inv: fic2inv $(INC)
+fic.inv: fic2inv $(INV)
perl fic2inv $(INV) >$@ || { rm -f $@; exit 1; }
+fic.dsc: fic2dsc $(INV)
+ perl fic2dsc $(INV) >$@ || { rm -f $@; exit 1; }
+
spotless:
- rm -f fic.equ fic.inv
+ rm -f fic.equ fic.inv fic.dsc
Modified: trunk/gta02-core/bom/gta02-core.sub
===================================================================
--- trunk/gta02-core/bom/gta02-core.sub 2010-02-02 16:58:35 UTC (rev 5814)
+++ trunk/gta02-core/bom/gta02-core.sub 2010-02-02 22:22:38 UTC (rev 5815)
@@ -5,6 +5,7 @@
R[0-9P]* { # also handle RP...
-> T=R
VAL=$R -> R=$VAL
+ -> TOL=5%
F1=$% -> TOL=$F1
}
Modified: trunk/gta02-core/bom/parser.pl
===================================================================
--- trunk/gta02-core/bom/parser.pl 2010-02-02 16:58:35 UTC (rev 5814)
+++ trunk/gta02-core/bom/parser.pl 2010-02-02 22:22:38 UTC (rev 5815)
@@ -272,6 +272,38 @@
}
+#
+# "ord" populates the following global variables:
+#
+# $order{"namespace item-number"}[0] = quantity to order
+# $order{"namespace item-number"}[1] = currency
+# $order{"namespace item-number"}[2] = total cost in above currency
+# $order{"namespace item-number"}[3] = component reference
+# ...
+#
+
+sub ord
+{
+ my @f = split(/\s+/);
+ my @id = splice(@f, 0, 2);
+ @{ $order{"$id[0] $id[1]"} } = @f;
+}
+
+
+#
+# "dsc" populates the following global variable:
+#
+# $dsc{"namespace item-number"} = description
+#
+
+sub dsc
+{
+ my @f = split(/ /);
+ my @id = splice(@f, 0, 2);
+ $dsc{"$id[0] $id[1]"} = join(" ", @f);
+}
+
+
sub parse
{
$mode = *skip;
@@ -313,6 +345,14 @@
undef $may_cont;
next;
}
+ if (/^#ORD\b/) {
+ $mode = *ord;
+ next;
+ }
+ if (/^#DSC\b/) {
+ $mode = *dsc;
+ next;
+ }
s/#.*//;
next if /^\s*$/;
&$mode($_);
Modified: trunk/gta02-core/bom/part2order
===================================================================
--- trunk/gta02-core/bom/part2order 2010-02-02 16:58:35 UTC (rev 5814)
+++ trunk/gta02-core/bom/part2order 2010-02-02 22:22:38 UTC (rev 5815)
@@ -53,6 +53,7 @@
$parts++;
}
+print "#ORD\n";
for (sort { &rank($b, $a) } keys %want) {
my $n = &number($_);
$n -= $n % $mult;
Added: trunk/gta02-core/bom/prettyord
===================================================================
--- trunk/gta02-core/bom/prettyord (rev 0)
+++ trunk/gta02-core/bom/prettyord 2010-02-02 22:22:38 UTC (rev 5815)
@@ -0,0 +1,40 @@
+#!/usr/bin/perl
+
+require "parser.pl";
+
+&parse;
+
+$out[0][0] = "Pos";
+$out[1][0] = "Qty";
+$out[2][0] = "P/N";
+$out[3][0] = "Description";
+$out[4][0] = "Value";
+$out[5][0] = "";
+
+for (sort keys %order) {
+ push(@{ $out[0] }, ++$n);
+ push(@{ $out[1] }, $order{$_}[0]);
+ @f = split(/\s+/, $_);
+ push(@{ $out[2] }, $f[1]);
+ push(@{ $out[3] }, $dsc{$_});
+ push(@{ $out[4] }, $order{$_}[1]);
+ push(@{ $out[5] }, sprintf("%.2f", $order{$_}[2]));
+}
+
+for (@out) {
+ push(@max, 0);
+ for (@{ $_ }) {
+ $max[$#max] = length $_ if length $_ > $max[$#max];
+ }
+}
+
+for ($i = 0; $i < $#{ $out[0] }; $i++) {
+ for ($j = 0; $j != 6; $j++) {
+ my $s = $out[$j][$i];;
+ print $s if $j == 2 || $j == 3 || $j == 4;
+ print " " x ($max[$j]-length $s);
+ print $s if $j == 0 || $j == 1 || $j == 5;
+ print " " unless $j == 5;
+ }
+ print "\n";
+}
Property changes on: trunk/gta02-core/bom/prettyord
___________________________________________________________________
Name: svn:executable
+ *
--- End Message ---
_______________________________________________
commitlog mailing list
commitlog@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/commitlog