diff options
author | CamVan Nguyen <ctnguyen@us.ibm.com> | 2012-04-16 16:49:12 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-04-19 17:11:31 -0500 |
commit | 4a47221cbf1a556c71e4a66b9742205e85b1c0a5 (patch) | |
tree | 781fd04735be8bb8a3c2306d1c2d300aa3daddc5 /src/usr/hwpf/ifcompiler | |
parent | 3f89cb472a8fb434b27fb0a9be39f053c3efe48e (diff) | |
download | blackbird-hostboot-4a47221cbf1a556c71e4a66b9742205e85b1c0a5.tar.gz blackbird-hostboot-4a47221cbf1a556c71e4a66b9742205e85b1c0a5.zip |
Right justify SCOM data
Ability to specify search paths for include files
Change-Id: I0179b0bb81bf645b91fe2a3c25e763a71c3b1121
RTC: 40443
RTC: 40447
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/906
Tested-by: Jenkins Server
Reviewed-by: Douglas R. Gilbert <dgilbert@us.ibm.com>
Reviewed-by: MIKE J. JONES <mjjones@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf/ifcompiler')
-rwxr-xr-x | src/usr/hwpf/ifcompiler/initCompiler.C | 13 | ||||
-rwxr-xr-x | src/usr/hwpf/ifcompiler/initCompiler.H | 2 | ||||
-rwxr-xr-x | src/usr/hwpf/ifcompiler/initCompiler.lex | 23 |
3 files changed, 32 insertions, 6 deletions
diff --git a/src/usr/hwpf/ifcompiler/initCompiler.C b/src/usr/hwpf/ifcompiler/initCompiler.C index de8553e6c..36222c0e9 100755 --- a/src/usr/hwpf/ifcompiler/initCompiler.C +++ b/src/usr/hwpf/ifcompiler/initCompiler.C @@ -22,6 +22,7 @@ // andrewg 05/24/11 Port over for VPL/PgP // andrewg 09/19/11 Updates based on review // mjjones 11/17/11 Output attribute listing +// camvanng 04/12/12 Ability to specify search paths for include files // End Change Log ********************************************************************************* /** @@ -50,6 +51,7 @@ using namespace std; int yyline = 1; init::ScomList * yyscomlist = NULL; +vector<string> yyincludepath; //path to search for include files ostringstream init::dbg; ostringstream init::erros; @@ -204,6 +206,7 @@ Parser::Parser(int narg, char ** argv) else if (arg.compare(0,2,"-o") == 0) iv_outfile = argv[++i]; //dg003a else if (arg.compare(0,3,"-if") == 0) iv_source_path = argv[++i]; else if (arg.compare(0,3,"-ec") == 0) iv_ec = strtoul(argv[++i],NULL,16); //dg002a + else if (arg.compare(0,2, "-I") == 0) yyincludepath.push_back(argv[++i]); else if (arg.compare(0,9,"--compare") == 0) { compare.first = argv[++i]; @@ -253,6 +256,16 @@ Parser::Parser(int narg, char ** argv) stats << "* attr: " << attr_listing_fn() << endl; stats << "* binary: " << binseq_fn() << endl; + if (yyincludepath.size()) + { + stats << "* search paths for include files:" << endl; + for (size_t i = 0; i < yyincludepath.size(); i++) + { + stats << "* " << yyincludepath.at(i) << endl; + } + stats << "*" << endl; + } + iv_scomlist = new ScomList(iv_source_path, header_files, stats, iv_ec); //dg002c if(compare.second.size()) { diff --git a/src/usr/hwpf/ifcompiler/initCompiler.H b/src/usr/hwpf/ifcompiler/initCompiler.H index d49c8e136..afd804d01 100755 --- a/src/usr/hwpf/ifcompiler/initCompiler.H +++ b/src/usr/hwpf/ifcompiler/initCompiler.H @@ -25,6 +25,7 @@ // andrewg 05/24/11 Port over for VPL/PgP // andrewg 09/19/11 Updates based on review // mjjones 11/17/11 Output attribute listing +// camvanng 04/12/12 Ability to specify search paths for include files // End Change Log ********************************************************************************* /** @@ -48,6 +49,7 @@ extern FILE * yyin; extern int yyparse(); void yyerror(const char * s); extern init::ScomList * yyscomlist; +extern vector<string> yyincludepath; namespace init { diff --git a/src/usr/hwpf/ifcompiler/initCompiler.lex b/src/usr/hwpf/ifcompiler/initCompiler.lex index 39fec30bb..612f29601 100755 --- a/src/usr/hwpf/ifcompiler/initCompiler.lex +++ b/src/usr/hwpf/ifcompiler/initCompiler.lex @@ -30,6 +30,8 @@ // camvanng 02/07/12 Ability to #include common scom initfile defines // camvanng 02/14/12 Support binary and hex scom addresses // Support for array at beginning of scom address +// camvanng 04/12/12 Right justify SCOM data +// Ability to specify search paths for include files // End Change Log *********************************************************************************/ /** * @file initCompiler.lex @@ -71,6 +73,7 @@ bool g_equation = false; // equation inside scomv col std::string g_scomname; // dg02 extern int yyline; +extern std::vector<std::string> yyincludepath; #define MAX_INCLUDE_DEPTH 10 YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; @@ -133,6 +136,7 @@ MULTI_DIGIT [0-9]+ else { yy_delete_buffer(YY_CURRENT_BUFFER); + fclose(yyin); yy_switch_to_buffer(include_stack[include_stack_num]); } } @@ -168,7 +172,13 @@ include { BEGIN(incl); } YY_CURRENT_BUFFER; /* Switch input buffer */ - yyin = fopen( yytext, "r" ); + std::string filename = yytext; + yyin = fopen( filename.c_str(), "r" ); + for (size_t i = 0; (i < yyincludepath.size()) && (NULL == yyin); i++) + { + filename = yyincludepath.at(i) + "/" + yytext; + yyin = fopen( filename.c_str(), "r" ); + } if (NULL == yyin) { oss.str(""); @@ -176,6 +186,7 @@ include { BEGIN(incl); } lex_err(oss.str().c_str()); exit(1); } + printf("Include file %s\n", filename.c_str()); yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); BEGIN(INITIAL); @@ -375,11 +386,11 @@ void lex_err(const char *s ) std::cerr << "\nERROR: " << s << " -line " << yyline << std::endl; } -// Convert left justified bitstring to 64 bit integer +// Convert left justified bitstring to right-justified 64 bit integer uint64_t bits2int( const char * bitString) { uint32_t idx = 0; - uint64_t mask = 0x8000000000000000ull; + uint64_t mask = 0x0000000000000001ull; uint64_t val = 0; do { @@ -393,6 +404,7 @@ uint64_t bits2int( const char * bitString) while( bitString[idx] != 0 ) { + val <<= 1; char c = bitString[idx]; if( c == '1') val |= mask; else if(c != '0') @@ -401,7 +413,6 @@ uint64_t bits2int( const char * bitString) break; } ++idx; - mask >>= 1; } if(idx > 66) //dg01a 64bits + "0B" prefix lex_err("Bit string greater than 64 bits!"); @@ -410,7 +421,7 @@ uint64_t bits2int( const char * bitString) return val; } -// Convert left justified hex string to 64 bit integer +// Convert left justified hex string to 64 right-justified bit integer uint64_t hexs2int(const char * hexString, int32_t size) { uint64_t val = 0; @@ -420,7 +431,7 @@ uint64_t hexs2int(const char * hexString, int32_t size) lex_err("HEX literal greater than 64 bits"); size = 18; } - s.append(18-size,'0'); // 0x + 16 digits + s.insert(2, 18-size,'0'); // 0x + 16 digits val = strtoull(s.c_str(),NULL,16); return val; } |