diff options
Diffstat (limited to 'src/usr/hwpf/fapi/fapiParseAttributeInfo.pl')
-rwxr-xr-x | src/usr/hwpf/fapi/fapiParseAttributeInfo.pl | 93 |
1 files changed, 85 insertions, 8 deletions
diff --git a/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl b/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl index e493255ec..110057794 100755 --- a/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl +++ b/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl @@ -49,6 +49,8 @@ # enums # mjjones 11/15/11 Move gen of fapiAttributeService.C # to a different file +# mjjones 12/16/11 Generate fapiAttributePlatCheck.H +# Generate fapiAttributesSupported.html # # End Change Log ****************************************************** @@ -61,8 +63,11 @@ my $numArgs = $#ARGV + 1; if ($numArgs < 2) { print ("Usage: fapiParseAttributeInfo.pl <output dir> <attr-xml-file1> [<attr-xml-file2> ...]\n"); - print (" This perl script will parse attribute XML files and add\n"); - print (" attribute information to a file called fapiAttributeIds.H\n"); + print (" This perl script will parse attribute XML files and create the following files:\n"); + print (" - fapiAttributeIds.H. Contains IDs, type, value enums and other information\n"); + print (" - fapiAttributePlatCheck.H. Contains compile time checks that all attributes are\n"); + print (" handled by the platform\n"); + print (" - fapiAttributesSupported.html Contains the HWPF attributes supported\n"); exit(1); } @@ -76,13 +81,23 @@ my $xml = new XML::Simple (KeyAttr=>[]); #use Data::Dumper; #------------------------------------------------------------------------------ -# Open output file for writing +# Open output files for writing #------------------------------------------------------------------------------ my $aiFile = $ARGV[0]; $aiFile .= "/"; $aiFile .= "fapiAttributeIds.H"; open(AIFILE, ">", $aiFile); +my $acFile = $ARGV[0]; +$acFile .= "/"; +$acFile .= "fapiAttributePlatCheck.H"; +open(ACFILE, ">", $acFile); + +my $asFile = $ARGV[0]; +$asFile .= "/"; +$asFile .= "fapiAttributesSupported.html"; +open(ASFILE, ">", $asFile); + #------------------------------------------------------------------------------ # Print Start of file information to fapiAttributeIds.H #------------------------------------------------------------------------------ @@ -98,6 +113,28 @@ print AIFILE " *\/\n"; print AIFILE "enum AttributeId\n{\n"; #------------------------------------------------------------------------------ +# Print Start of file information to fapiAttributePlatCheck.H +#------------------------------------------------------------------------------ +print ACFILE "// fapiAttributePlatCheck.H\n"; +print ACFILE "// This file is generated by perl script fapiParseAttributeInfo.pl\n"; +print ACFILE "// A platform can include it to ensure that it handles all HWPF\n"; +print ACFILE "// attributes\n\n"; +print ACFILE "#ifndef FAPIATTRIBUTEPLATCHECK_H_\n"; +print ACFILE "#define FAPIATTRIBUTEPLATCHECK_H_\n\n"; + +#------------------------------------------------------------------------------ +# Print Start of file information to fapiAttributesSupported.html +#------------------------------------------------------------------------------ +print ASFILE "<html>\n"; +print ASFILE "<body>\n\n"; +print ASFILE "<!-- fapiAttributesSupported.html -->\n"; +print ASFILE "<!-- This file is generated by perl script fapiParseAttributeInfo.pl -->\n"; +print ASFILE "<!-- It lists all HWPF attributes supported -->\n\n"; +print ASFILE "<h4>HWPF Attributes supported by this build.</h4>\n"; +print ASFILE "<table border=\"4\">\n"; +print ASFILE "<tr><th>Attribute ID</th><th>Attribute Description</th></tr>"; + +#------------------------------------------------------------------------------ # For each XML file #------------------------------------------------------------------------------ foreach my $argnum (1 .. $#ARGV) @@ -124,7 +161,7 @@ foreach my $argnum (1 .. $#ARGV) exit(1); } - print AIFILE " ", $attr->{id}, ",\n"; + print AIFILE " $attr->{id},\n"; }; } @@ -158,13 +195,24 @@ foreach my $argnum (1 .. $#ARGV) foreach my $attr (@{$attributes->{attribute}}) { #---------------------------------------------------------------------- - # Print a comment with the attribute description to fapiAttributeIds.H + # Print a comment with the attribute ID fapiAttributeIds.H + #---------------------------------------------------------------------- + print AIFILE "/* $attr->{id} */\n"; + + #---------------------------------------------------------------------- + # Print the AttributeId and description to fapiAttributesSupported.html #---------------------------------------------------------------------- - if ($attr->{description}) + if (! exists $attr->{description}) { - print AIFILE "/* $attr->{id}: $attr->{description} */\n"; + print ("fapiParseAttributeInfo.pl ERROR. Att 'description' missing\n"); + exit(1); } + print ASFILE "<tr>\n"; + print ASFILE " <td>$attr->{id}</td>\n"; + print ASFILE " <td>$attr->{description}</td>\n"; + print ASFILE "</tr>\n"; + #---------------------------------------------------------------------- # Figure out the attribute array dimensions (if array) #---------------------------------------------------------------------- @@ -259,6 +307,20 @@ foreach my $argnum (1 .. $#ARGV) } #---------------------------------------------------------------------- + # Print the platform attribute checks to fapiAttributePlatCheck.H + #---------------------------------------------------------------------- + if (exists $attr->{writeable}) + { + print ACFILE "#ifndef $attr->{id}_SETMACRO\n"; + print ACFILE "#error Platform does not support set of HWPF attr $attr->{id}\n"; + print ACFILE "#endif\n"; + } + + print ACFILE "#ifndef $attr->{id}_GETMACRO\n"; + print ACFILE "#error Platform does not support get of HWPF attr $attr->{id}\n"; + print ACFILE "#endif\n\n"; + + #---------------------------------------------------------------------- # Print newline between each attribute's info to fapiAttributeIds.H #---------------------------------------------------------------------- print AIFILE "\n"; @@ -272,6 +334,21 @@ print AIFILE "}\n\n"; print AIFILE "#endif\n"; #------------------------------------------------------------------------------ -# Close output file +# Print End of file information to fapiAttributePlatCheck.H +#------------------------------------------------------------------------------ +print ACFILE "#endif\n"; + +#------------------------------------------------------------------------------ +# Print End of file information to fapiAttributesSupported.html +#------------------------------------------------------------------------------ +print ASFILE "</table>\n\n"; +print ASFILE "</body>\n"; +print ASFILE "</html>\n"; + +#------------------------------------------------------------------------------ +# Close output files #------------------------------------------------------------------------------ close(AIFILE); +close(ACFILE); +close(ASFILE); + |