Revision: 61130 http://sourceforge.net/p/brlcad/code/61130 Author: tbrowder2 Date: 2014-06-05 01:39:45 +0000 (Thu, 05 Jun 2014) Log Message: ----------- update data flow; put parse tree actions in an if block for action only if parse is successful
Modified Paths: -------------- brlcad/branches/d-binding/misc/d-bindings/D.pm brlcad/branches/d-binding/misc/d-bindings/HACKING brlcad/branches/d-binding/misc/d-bindings/ParsePPCHeader.pm Modified: brlcad/branches/d-binding/misc/d-bindings/D.pm =================================================================== --- brlcad/branches/d-binding/misc/d-bindings/D.pm 2014-06-04 21:47:08 UTC (rev 61129) +++ brlcad/branches/d-binding/misc/d-bindings/D.pm 2014-06-05 01:39:45 UTC (rev 61130) @@ -456,17 +456,25 @@ }); if (defined $ptree) { + my $fp; # dump it my $efil = "${ifil}.dump.txt"; - open my $fp, '>', $efil + open $fp, '>', $efil or die "$efil: $!"; push @{$tfils_aref}, $efil; push @{$ofils_aref}, $efil if $G::debug; ParsePPCHeader::dump_parse_tree($fp, $ptree); + close $fp; - # inspect it (print to stdout) - ParsePPCHeader::print_parse_tree($ptree); + # inspect it (print it) + my $pfil = "${ifil}.myprint.txt"; + open $fp, '>', $pfil + or die "$pfil: $!"; + push @{$tfils_aref}, $pfil; + push @{$ofils_aref}, $pfil + if $G::debug; + ParsePPCHeader::print_parse_tree($fp, $ptree); } # now process @olines and write them out Modified: brlcad/branches/d-binding/misc/d-bindings/HACKING =================================================================== --- brlcad/branches/d-binding/misc/d-bindings/HACKING 2014-06-04 21:47:08 UTC (rev 61129) +++ brlcad/branches/d-binding/misc/d-bindings/HACKING 2014-06-05 01:39:45 UTC (rev 61130) @@ -31,17 +31,19 @@ foreach line in the X.i file next if blank line extract the object into an Hobj instance - push the Hobj->line onto the @lines array - push the Hobj instance onto the @obj array + push the Hobj->line onto the @olines array + push the Hobj instance onto the @objs array last line if desired number of objects has neen extracted end foreach line use P::RD on the @lines array to yield the parse tree - dump the parse tree to a file X.h.dump.txt + use Data::Dumper to dump the parse tree to a file X.i.dump.txt + interpret (print) the parse to a file X.i.myprint.txt + analyze the parse tree - # the objects array is for debugging more if needed + # the objects array is available for debugging more if needed convert the parse tree to the output X.d module Modified: brlcad/branches/d-binding/misc/d-bindings/ParsePPCHeader.pm =================================================================== --- brlcad/branches/d-binding/misc/d-bindings/ParsePPCHeader.pm 2014-06-04 21:47:08 UTC (rev 61129) +++ brlcad/branches/d-binding/misc/d-bindings/ParsePPCHeader.pm 2014-06-05 01:39:45 UTC (rev 61130) @@ -123,15 +123,17 @@ } # get_spaces sub print_parse_tree { - my $obj = shift @_; + my $fp = shift @_; + my $ptree = shift @_; - print "DEBUG: syntax tree:\n"; + print $fp "syntax tree:\n"; - print_object($obj, 1); + print_object($fp, $ptree, 1); } # print_parse_tree sub print_object { + my $fp = shift @_; my $obj = shift @_; my $level = shift @_; # use for number of leading spaces @@ -142,27 +144,27 @@ my $r = ref $obj; if (!$r) { - print "${s}scalar value: '$obj'\n"; + print $fp "${s}scalar value: '$obj'\n"; } elsif ($r eq 'ARRAY') { - print "${s}array ref: '$obj'\n"; + print $fp "${s}array ref: '$obj'\n"; foreach my $val (@{$obj}) { if (!defined $val) { - print "${s}value: 'undef'\n"; + print $fp "${s}value: 'undef'\n"; next; } - print_object($val, $level + 1); + print_object($fp, $val, $level + 1); } } elsif ($r eq 'HASH') { - print "${s}hash ref: '$obj'\n"; + print $fp "${s}hash ref: '$obj'\n"; while (my ($key, $val) = each %{$obj}) { - print "${s}hash key: '$key'\n"; + print $fp "${s}hash key: '$key'\n"; if (!defined $val) { - print "${s}value: 'undef'\n"; + print $fp "${s}value: 'undef'\n"; next; } - print_object($val, $level + 1); + print_object($fp, $val, $level + 1); } } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/NeoTech _______________________________________________ BRL-CAD Source Commits mailing list brlcad-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-commits