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. r5977 - trunk/eda/boom (wer...@docs.openmoko.org)
--- Begin Message ---
Author: werner
Date: 2010-09-12 21:41:14 +0200 (Sun, 12 Sep 2010)
New Revision: 5977

Modified:
   trunk/eda/boom/parser.pl
Log:
Added recursive includes to BOM parser. Syntax: include filename

- boom/parser.pl (parse, parse_one): explicitly switch from file to file and 
  call parse_one for only one file at a time
- boom/parser.pl (parse_one): added recursive includes



Modified: trunk/eda/boom/parser.pl
===================================================================
--- trunk/eda/boom/parser.pl    2010-09-12 02:52:04 UTC (rev 5976)
+++ trunk/eda/boom/parser.pl    2010-09-12 19:41:14 UTC (rev 5977)
@@ -1,6 +1,7 @@
 #!/usr/bin/perl
 
 use re 'eval';
+use IO::File;
 
 
 #
@@ -362,10 +363,24 @@
 }
 
 
-sub parse
+sub parse_one
 {
-    $mode = *skip;
-    while (<>) {
+    local ($name) = @_;
+
+    my $file = new IO::File->new($name) || die "$name: $!";
+    while (1) {
+       $_ = <$file>;
+       if (!defined $_) {
+           $file->close();
+           return unless @inc;
+           $file = pop @inc;
+           next;
+       }
+       if (/^\s*include\s+(.*?)\s*$/) {
+           push(@inc, $file);
+           $file = new IO::File->new($1) || die "$1: $!";
+           next;
+       }
        chop;
 
 # ----- KiCad BOM parsing. Alas, the BOM is localized, so there are almost no
@@ -442,4 +457,14 @@
     }
 }
 
+
+sub parse
+{
+    $mode = *skip;
+    for (@ARGV) {
+       &parse_one($_);
+    }
+}
+
+
 return 1;




--- End Message ---
_______________________________________________
commitlog mailing list
commitlog@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/commitlog

Reply via email to