diff options
| author | Mike Jones <mjjones@us.ibm.com> | 2011-07-05 13:10:01 -0500 |
|---|---|---|
| committer | MIKE J. JONES <mjjones@us.ibm.com> | 2011-07-12 11:19:33 -0500 |
| commit | e3fc77c59a071c009e13acdf4c4b2ce6a718a570 (patch) | |
| tree | b6797ecc6735caf1d21866d10f51bd57aee9f68c /src/usr/hwpf/fapi | |
| parent | 0849df559aaa0fb758dfa92148f9e7a2c3d10105 (diff) | |
| download | blackbird-hostboot-e3fc77c59a071c009e13acdf4c4b2ce6a718a570.tar.gz blackbird-hostboot-e3fc77c59a071c009e13acdf4c4b2ce6a718a570.zip | |
HWPF const fixes and perl script updates
Change-Id: Icb0393cac0e9143638b8d6811cc528404d29977c
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/186
Tested-by: Jenkins Server
Reviewed-by: MIKE J. JONES <mjjones@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf/fapi')
| -rwxr-xr-x | src/usr/hwpf/fapi/fapiParseAttributeInfo.pl | 21 | ||||
| -rwxr-xr-x | src/usr/hwpf/fapi/fapiParseErrorInfo.pl | 94 | ||||
| -rw-r--r-- | src/usr/hwpf/fapi/fapiReturnCode.C | 20 | ||||
| -rw-r--r-- | src/usr/hwpf/fapi/fapiReturnCodeDataRef.C | 10 | ||||
| -rw-r--r-- | src/usr/hwpf/fapi/fapiTarget.C | 14 |
5 files changed, 109 insertions, 50 deletions
diff --git a/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl b/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl index 0153bfb2f..4f50e56ca 100755 --- a/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl +++ b/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl @@ -17,12 +17,13 @@ # mjjones 06/06/11 Minor updates for integration # mjjones 06/10/11 Added "use strict;" # mjjones 06/23/11 Parse more info +# mjjones 07/05/11 Take output dir as parameter # # End Change Log ****************************************************** # # Usage: -# fapiParseAttributeInfo.pl <filename1> <filename2> .... <filenameN> +# fapiParseAttributeInfo.pl <output dir> <filename1> <filename2> ... use strict; @@ -30,9 +31,9 @@ use strict; # Print Command Line Help #------------------------------------------------------------------------------ my $numArgs = $#ARGV + 1; -if ($numArgs < 1) +if ($numArgs < 2) { - print ("Usage: fapiParseAttributeInfo.pl <filename1> <filename2> .... <filenameN>\n"); + print ("Usage: fapiParseAttributeInfo.pl <output dir> <filename1> <filename2> ...\n"); print (" This perl script will parse attribute XML files and add\n"); print (" attribute information to a file called fapiAttributeIds.H\n"); exit(1); @@ -50,7 +51,10 @@ my $xml = new XML::Simple (KeyAttr=>[]); #------------------------------------------------------------------------------ # Open output file for writing #------------------------------------------------------------------------------ -open(OUTFILE, ">fapiAttributeIds.H"); +my $outputFile = $ARGV[0]; +$outputFile .= "/"; +$outputFile .= "fapiAttributeIds.H"; +open(OUTFILE, ">", $outputFile); #------------------------------------------------------------------------------ # Print Start of file information @@ -73,9 +77,10 @@ print OUTFILE "enum AttributeId\n{\n"; #------------------------------------------------------------------------------ # For each XML file #------------------------------------------------------------------------------ -my $infile; -foreach $infile(@ARGV) +foreach my $argnum (1 .. $#ARGV) { + my $infile = $ARGV[$argnum]; + # read XML file my $attributes = $xml->XMLin($infile); @@ -115,8 +120,10 @@ print OUTFILE " *\/\n"; #------------------------------------------------------------------------------ # For each XML file #------------------------------------------------------------------------------ -foreach $infile(@ARGV) +foreach my $argnum (1 .. $#ARGV) { + my $infile = $ARGV[$argnum]; + # read XML file my $attributes = $xml->XMLin($infile); diff --git a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl index e0dc8b652..858059567 100755 --- a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl +++ b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl @@ -1,31 +1,64 @@ #!/usr/bin/perl # +# Purpose: This perl script will parse HWP Error XML files, +# pull out the error Return Codes and create a header file fapiHwpReturnCodes.H +# containing an enumeration of them. +# +# Author: CamVan Nguyen +# Last Updated: 06/03/2011 +# +# Version: 1.0 +# +# Change Log ********************************************************** +# +# Flag Track# Userid Date Description +# ---- -------- -------- -------- ----------- +# camvanng 06/03/11 Created +# mjjones 06/06/11 Minor updates for integration +# mjjones 06/10/11 Added "use strict;" +# mjjones 07/05/11 Take output dir as parameter +# +# End Change Log ****************************************************** + +# # Usage: -# fapiParseErrorInfo.pl <filename1> <filename2> .... <filenameN> +# fapiParseErrorInfo.pl <output dir> <filename1> <filename2> ... use strict; +#------------------------------------------------------------------------------ +# Print Command Line Help +#------------------------------------------------------------------------------ my $numArgs = $#ARGV + 1; -#print $numArgs, "\n"; - -if ($numArgs < 1) +if ($numArgs < 2) { - print ("Usage: fapiParseErrorInfo.pl <filename1> <filename2> .... <filenameN>\n"); - print (" This perl script will parse HWP Error XML files,\n"); - print (" pull out the error Return Codes and create a header file\n"); - print (" hwp/fapiHwpReturnCodes.H containing an enumeration of them.\n"); + print ("Usage: fapiParseErrorInfo.pl <output dir> <filename1> <filename2> ...\n"); + print (" This perl script will parse HWP Error XML files and add an\n"); + print (" enumeration of return codes to a file called fapiHwpReturnCodes.H\n"); exit(1); } - - -# use module +#------------------------------------------------------------------------------ +# Specify perl modules to use +#------------------------------------------------------------------------------ use XML::Simple; +my $xml = new XML::Simple (KeyAttr=>[]); + +# Uncomment to enable debug output #use Data::Dumper; -#open output file for writing -open(OUTFILE, ">fapiHwpReturnCodes.H"); +#------------------------------------------------------------------------------ +# Open output file for writing +#------------------------------------------------------------------------------ +my $outputFile = $ARGV[0]; +$outputFile .= "/"; +$outputFile .= "fapiHwpReturnCodes.H"; +open(OUTFILE, ">", $outputFile); + +#------------------------------------------------------------------------------ +# Print Start of file information +#------------------------------------------------------------------------------ print OUTFILE "// fapiHwpReturnCodes.H\n"; print OUTFILE "// This file is generated by perl script fapiParseErrorInfo.pl\n\n"; print OUTFILE "#ifndef FAPIHWPRETURNCODES_H_\n"; @@ -38,27 +71,27 @@ print OUTFILE " *\/\n"; print OUTFILE "enum HwpReturnCode\n"; print OUTFILE "{\n"; -# create object -my $xml = new XML::Simple (KeyAttr=>[]); -my $infile; - -#for each Hwp Attribute XML file -foreach $infile(@ARGV) +#------------------------------------------------------------------------------ +# For each XML file +#------------------------------------------------------------------------------ +foreach my $argnum (1 .. $#ARGV) { - #print filename - #print $ifile, "\n\n"; + my $infile = $ARGV[$argnum]; # read XML file my $errors = $xml->XMLin($infile); - # print output - #print Dumper($errors); - #print "\n"; + # Uncomment to get debug output of all attributes + #print "\nFile: ", $infile, "\n", Dumper($errors), "\n"; - # print return code to file - my $err; - foreach $err (@{$errors->{hwpError}}) + #-------------------------------------------------------------------------- + # For each Attribute + #-------------------------------------------------------------------------- + foreach my $err (@{$errors->{hwpError}}) { + #-------------------------------------------------------------------------- + # Print the return code + #-------------------------------------------------------------------------- if ($err->{id}) { print OUTFILE " ", $err->{id}, ",\n"; @@ -71,9 +104,14 @@ foreach $infile(@ARGV) }; } +#------------------------------------------------------------------------------ +# Print End of file information +#------------------------------------------------------------------------------ print OUTFILE "};\n\n"; print OUTFILE "}\n\n"; print OUTFILE "#endif\n"; -#close output file +#------------------------------------------------------------------------------ +# Close output file +#------------------------------------------------------------------------------ close(OUTFILE); diff --git a/src/usr/hwpf/fapi/fapiReturnCode.C b/src/usr/hwpf/fapi/fapiReturnCode.C index b32ae0f2f..1720f31c4 100644 --- a/src/usr/hwpf/fapi/fapiReturnCode.C +++ b/src/usr/hwpf/fapi/fapiReturnCode.C @@ -4,6 +4,14 @@ * @brief Implements the ReturnCode class. */ +/* + * Change Log ****************************************************************** + * Flag Defect/Feature User Date Description + * ------ -------------- ---------- ----------- ---------------------------- + * mjjones 04/13/2011 Created. + * mjjones 07/05/2011. Removed const from data + */ + #include <fapiReturnCode.H> #include <fapiReturnCodeDataRef.H> @@ -108,7 +116,7 @@ ReturnCode::operator uint32_t() const //****************************************************************************** void * ReturnCode::getData() const { - const void * l_pData = NULL; + void * l_pData = NULL; if (iv_pDataRef) { @@ -116,8 +124,7 @@ void * ReturnCode::getData() const l_pData = iv_pDataRef->getData(); } - // Remove the constness and return - return const_cast<void *>(l_pData); + return l_pData; } //****************************************************************************** @@ -125,7 +132,7 @@ void * ReturnCode::getData() const //****************************************************************************** void * ReturnCode::releaseData() { - const void * l_pData = NULL; + void * l_pData = NULL; if (iv_pDataRef) { @@ -136,14 +143,13 @@ void * ReturnCode::releaseData() (void) removeData(); } - // Remove the constness and return - return const_cast<void *>(l_pData); + return l_pData; } //****************************************************************************** // setData function //****************************************************************************** -void ReturnCode::setData(const void * i_pData) +void ReturnCode::setData(void * i_pData) { // Remove interest in pointed to ReturnCodeDataRef (void) removeData(); diff --git a/src/usr/hwpf/fapi/fapiReturnCodeDataRef.C b/src/usr/hwpf/fapi/fapiReturnCodeDataRef.C index 9aaa16381..0682388ac 100644 --- a/src/usr/hwpf/fapi/fapiReturnCodeDataRef.C +++ b/src/usr/hwpf/fapi/fapiReturnCodeDataRef.C @@ -11,7 +11,7 @@ * mjjones 04/13/2011 Created. * camvanng 05/31/2011 Added debug traces * mjjones 06/30/2011 Added #include - * + * mjjones 07/05/2011 Removed const from data */ #include <fapiReturnCodeDataRef.H> @@ -24,7 +24,7 @@ namespace fapi //****************************************************************************** // Constructor //****************************************************************************** -ReturnCodeDataRef::ReturnCodeDataRef(const void * i_pData) : +ReturnCodeDataRef::ReturnCodeDataRef(void * i_pData) : iv_refCount(1), iv_pData(i_pData) { @@ -78,7 +78,7 @@ bool ReturnCodeDataRef::decRefCountCheckZero() //****************************************************************************** // getData function //****************************************************************************** -const void * ReturnCodeDataRef::getData() const +void * ReturnCodeDataRef::getData() const { return iv_pData; } @@ -86,9 +86,9 @@ const void * ReturnCodeDataRef::getData() const //****************************************************************************** // releaseData function //****************************************************************************** -const void * ReturnCodeDataRef::releaseData() +void * ReturnCodeDataRef::releaseData() { - const void * l_pData = iv_pData; + void * l_pData = iv_pData; iv_pData = NULL; return l_pData; } diff --git a/src/usr/hwpf/fapi/fapiTarget.C b/src/usr/hwpf/fapi/fapiTarget.C index 463a13ed3..ae6869f46 100644 --- a/src/usr/hwpf/fapi/fapiTarget.C +++ b/src/usr/hwpf/fapi/fapiTarget.C @@ -4,6 +4,14 @@ * @brief Implements the FAPI part of the Target class. */ +/* + * Change Log ****************************************************************** + * Flag Defect/Feature User Date Description + * ------ -------------- ---------- ----------- ---------------------------- + * mjjones 04/13/2011 Created. Based on Hlava prototype + * mjjones 07/05/2011. Removed const from handle + */ + #include <fapiTarget.H> namespace fapi @@ -22,7 +30,7 @@ Target::Target() : // Constructor. //****************************************************************************** Target::Target(const TargetType i_type, - const void * i_pHandle) : + void * i_pHandle) : iv_type(i_type), iv_pHandle(i_pHandle) { @@ -88,13 +96,13 @@ bool Target::operator!=(const Target & i_right) const //****************************************************************************** void * Target::get() const { - return const_cast<void *>(iv_pHandle); + return iv_pHandle; } //****************************************************************************** // Set the handle. //****************************************************************************** -void Target::set(const void * i_pHandle) +void Target::set(void * i_pHandle) { iv_pHandle = i_pHandle; } |

