From 2a0d33608f0bc1cf571f1cc87cd00ed8d0d96f49 Mon Sep 17 00:00:00 2001 From: Cary R Date: Wed, 2 Mar 2011 20:23:02 -0800 Subject: [PATCH] Fix spacing problems. This patch fixes spacing problems in the source code, space/tab at the end of line and space before tab. --- PExpr.h | 2 +- elab_expr.cc | 6 ++-- elab_scope.cc | 10 +++--- elab_sig.cc | 2 +- elaborate.cc | 6 ++-- net_design.cc | 4 +-- tgt-vhdl/cast.cc | 2 +- tgt-vhdl/process.cc | 2 +- tgt-vhdl/scope.cc | 2 +- tgt-vhdl/state.cc | 8 ++--- tgt-vhdl/stmt.cc | 42 +++++++++++----------- tgt-vhdl/vhdl_syntax.cc | 16 ++++----- tgt-vvp/draw_vpi.c | 2 +- vhdlpp/lexor.lex | 80 ++++++++++++++++++++--------------------- vhdlpp/parse.y | 8 ++--- vhdlpp/vhdlint.cc | 8 ++--- vhdlpp/vhdlint.h | 4 +-- vhdlpp/vhdlreal.cc | 4 +-- vhdlpp/vhdlreal.h | 2 +- vvp/file_line.cc | 4 +-- 20 files changed, 107 insertions(+), 107 deletions(-) diff --git a/PExpr.h b/PExpr.h index 15794e6a4..ffcbf6422 100644 --- a/PExpr.h +++ b/PExpr.h @@ -101,7 +101,7 @@ class PExpr : public LineInfo { // this method is the calculated lossless width, but the width // returned by a subsequent call to the expr_width method will be // the final expression width. - virtual unsigned test_width(Design*des, NetScope*scope, + virtual unsigned test_width(Design*des, NetScope*scope, width_mode_t&mode); // After the test_width method is complete, these methods diff --git a/elab_expr.cc b/elab_expr.cc index c8404859a..f40e46159 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -850,7 +850,7 @@ unsigned PEBLeftWidth::test_width(Design*des, NetScope*scope, width_mode_t&mode) case 'R': // >>> // A logical shift will effectively coerce a signed // operand to unsigned. We have to assume an arithmetic - // shift may do the same, as we don't yet know the final + // shift may do the same, as we don't yet know the final // expression type. if ((mode == LOSSLESS) && signed_flag_) mode = UNSIZED; @@ -2634,7 +2634,7 @@ NetExpr* PEIdent::elaborate_expr_param_(Design*des, tmp = pad_to_width(tmp, expr_wid, *this); } else { - + /* No bit or part select. Make the constant into a NetEConstParam or NetECRealParam as appropriate. */ NetEConst*ctmp = dynamic_cast(tmp); @@ -3381,7 +3381,7 @@ NetExpr*PETernary::elaborate_expr(Design*des, NetScope*scope, cerr << get_fileline() << ": debug: Short-circuit " "elaborate TRUE clause of ternary." << endl; - + return elab_and_eval_alternative_(des, scope, tru_, expr_wid); } diff --git a/elab_scope.cc b/elab_scope.cc index b15b5a429..4bf184661 100644 --- a/elab_scope.cc +++ b/elab_scope.cc @@ -50,7 +50,7 @@ typedef map::const_iterator mparm_it_t; -static void collect_parm_item_(Design*des, NetScope*scope, perm_string name, +static void collect_parm_item_(Design*des, NetScope*scope, perm_string name, const LexicalScope::param_expr_t&cur) { NetScope::range_t*range_list = 0; @@ -424,7 +424,7 @@ bool Module::elaborate_scope(Design*des, NetScope*scope, // Run through the defparams for this module and save the result // in a table for later final override. - + typedef list::const_iterator defparms_iter_t; for (defparms_iter_t cur = defparms.begin() ; cur != defparms.end() ; ++ cur ) { @@ -1375,7 +1375,7 @@ void PFunction::elaborate_scope(Design*des, NetScope*scope) const assert(scope->type() == NetScope::FUNC); // Scan the parameters in the function, and store the information - // needed to evaluate the parameter expressions. + // needed to evaluate the parameter expressions. collect_scope_parameters_(des, scope, parameters); @@ -1393,7 +1393,7 @@ void PTask::elaborate_scope(Design*des, NetScope*scope) const assert(scope->type() == NetScope::TASK); // Scan the parameters in the task, and store the information - // needed to evaluate the parameter expressions. + // needed to evaluate the parameter expressions. collect_scope_parameters_(des, scope, parameters); @@ -1470,7 +1470,7 @@ void PBlock::elaborate_scope(Design*des, NetScope*scope) const my_scope->is_auto(scope->is_auto()); // Scan the parameters in the scope, and store the information - // needed to evaluate the parameter expressions. + // needed to evaluate the parameter expressions. collect_scope_parameters_(des, my_scope, parameters); diff --git a/elab_sig.cc b/elab_sig.cc index 6aaaca577..35312e442 100644 --- a/elab_sig.cc +++ b/elab_sig.cc @@ -1042,7 +1042,7 @@ NetNet* PWire::elaborate_sig(Design*des, NetScope*scope) const cerr << get_fileline() << ": error: real "; if (wtype == NetNet::REG) cerr << "variable"; else cerr << "net"; - cerr << " '" << name_ + cerr << " '" << name_ << "' cannot be declared as a vector, found a range [" << msb << ":" << lsb << "]." << endl; des->errors += 1; diff --git a/elaborate.cc b/elaborate.cc index d671827ac..e21740b73 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -2262,7 +2262,7 @@ NetProc* PAssign::elaborate(Design*des, NetScope*scope) const << "Enumeration type mismatch in assignment." << endl; des->errors += 1; } - + NetAssign*cur = new NetAssign(lv, rv); cur->set_line(*this); @@ -3584,7 +3584,7 @@ NetProc* PForStatement::elaborate(Design*des, NetScope*scope) const /* Make the r-value of the initial assignment, and size it properly. Then use it to build the assignment statement. */ - etmp = elaborate_rval_expr(des, scope, lv->expr_type(), lv->lwidth(), + etmp = elaborate_rval_expr(des, scope, lv->expr_type(), lv->lwidth(), expr1_); if (debug_elaborate) { @@ -3625,7 +3625,7 @@ NetProc* PForStatement::elaborate(Design*des, NetScope*scope) const /* Make the r-value of the increment assignment, and size it properly. Then use it to build the assignment statement. */ - etmp = elaborate_rval_expr(des, scope, lv->expr_type(), lv->lwidth(), + etmp = elaborate_rval_expr(des, scope, lv->expr_type(), lv->lwidth(), expr2_); if (debug_elaborate) { diff --git a/net_design.cc b/net_design.cc index 9bd4d1a69..30f85791c 100644 --- a/net_design.cc +++ b/net_design.cc @@ -370,7 +370,7 @@ void NetScope::evaluate_parameter_logic_(Design*des, param_ref_t cur) lv_width = (msb >= lsb) ? 1 + msb - lsb : 1 + lsb - msb; NetExpr*expr = elab_and_eval(des, val_scope, val_expr, lv_width); - if (! expr) + if (! expr) return; switch (expr->expr_type()) { @@ -489,7 +489,7 @@ void NetScope::evaluate_parameter_real_(Design*des, param_ref_t cur) NetScope*val_scope = (*cur).second.val_scope; NetExpr*expr = elab_and_eval(des, val_scope, val_expr, -1); - if (! expr) + if (! expr) return; NetECReal*res = 0; diff --git a/tgt-vhdl/cast.cc b/tgt-vhdl/cast.cc index 8e34673a3..f54dacf94 100644 --- a/tgt-vhdl/cast.cc +++ b/tgt-vhdl/cast.cc @@ -122,7 +122,7 @@ vhdl_expr *vhdl_expr::to_string() { bool numeric = type_->get_name() == VHDL_TYPE_UNSIGNED || type_->get_name() == VHDL_TYPE_SIGNED; - + if (numeric) { vhdl_fcall *image = new vhdl_fcall("integer'image", vhdl_type::string()); image->add_expr(this->cast(vhdl_type::integer())); diff --git a/tgt-vhdl/process.cc b/tgt-vhdl/process.cc index d19eac572..8ed03e0ca 100644 --- a/tgt-vhdl/process.cc +++ b/tgt-vhdl/process.cc @@ -59,7 +59,7 @@ static int generate_vhdl_process(vhdl_entity *ent, ivl_process_t proc) // will optimise the process out of the output bool is_initial = ivl_process_type(proc) == IVL_PR_INITIAL; bool is_empty = vhdl_proc->get_container()->empty(); - + if (is_initial && !is_empty) { vhdl_wait_stmt *wait = new vhdl_wait_stmt(); vhdl_proc->get_container()->add_stmt(wait); diff --git a/tgt-vhdl/scope.cc b/tgt-vhdl/scope.cc index ff82c4e42..56d313933 100644 --- a/tgt-vhdl/scope.cc +++ b/tgt-vhdl/scope.cc @@ -945,7 +945,7 @@ static void create_skeleton_entity_for(ivl_scope_t scope, int depth) assert(false); } } - + arch->set_comment(ss.str()); ent->set_comment(ss.str()); diff --git a/tgt-vhdl/state.cc b/tgt-vhdl/state.cc index 01262ab62..43e448828 100644 --- a/tgt-vhdl/state.cc +++ b/tgt-vhdl/state.cc @@ -187,8 +187,8 @@ vhdl_entity* find_entity(ivl_scope_t scope) return NULL; } else { - const char *tname = ivl_scope_tname(scope); - + const char *tname = ivl_scope_tname(scope); + for (scope_name_map_t::iterator it = g_scope_names.begin(); it != g_scope_names.end(); ++it) { if (strcmp(tname, ivl_scope_tname((*it).first)) == 0) @@ -248,8 +248,8 @@ void set_active_entity(vhdl_entity *ent) static bool same_scope_type_name(ivl_scope_t a, ivl_scope_t b) { if (strcmp(ivl_scope_tname(a), ivl_scope_tname(b)) != 0) - return false; - + return false; + unsigned nparams_a = ivl_scope_params(a); unsigned nparams_b = ivl_scope_params(b); diff --git a/tgt-vhdl/stmt.cc b/tgt-vhdl/stmt.cc index 57c1b055b..4f6392b78 100644 --- a/tgt-vhdl/stmt.cc +++ b/tgt-vhdl/stmt.cc @@ -32,7 +32,7 @@ static void emit_wait_for_0(vhdl_procedural *proc, stmt_container *container, ivl_statement_t stmt, vhdl_expr *expr); - + /* * VHDL has no real equivalent of Verilog's $finish task. The * current solution is to use `assert false ...' to terminate @@ -79,7 +79,7 @@ static int draw_stask_display(vhdl_procedural *proc, { vhdl_binop_expr *text = new vhdl_binop_expr(VHDL_BINOP_CONCAT, vhdl_type::string()); - + const int count = ivl_stmt_parm_count(stmt); int i = 0; while (i < count) { @@ -91,7 +91,7 @@ static int draw_stask_display(vhdl_procedural *proc, text->add_expr(new vhdl_const_string(" ")); continue; } - + if (ivl_expr_type(net) == IVL_EX_STRING) { ostringstream ss; for (const char *p = ivl_expr_string(net); *p; p++) { @@ -110,7 +110,7 @@ static int draw_stask_display(vhdl_procedural *proc, // Flush the output string up to this point text->add_expr(new vhdl_const_string(ss.str())); ss.str(""); - + // Skip over width for now while (isdigit(*p)) ++p; @@ -125,13 +125,13 @@ static int draw_stask_display(vhdl_procedural *proc, assert(i < count); ivl_expr_t netp = ivl_stmt_parm(stmt, i++); assert(netp); - + vhdl_expr *base = translate_expr(netp); if (NULL == base) return 1; emit_wait_for_0(proc, container, stmt, base); - + text->add_expr(base->cast(text->get_type())); } } @@ -141,16 +141,16 @@ static int draw_stask_display(vhdl_procedural *proc, } // Emit any non-empty string data left in the buffer - if (!ss.str().empty()) + if (!ss.str().empty()) text->add_expr(new vhdl_const_string(ss.str())); } else { vhdl_expr *base = translate_expr(net); - if (NULL == base) + if (NULL == base) return 1; emit_wait_for_0(proc, container, stmt, base); - + text->add_expr(base->cast(text->get_type())); } } @@ -158,7 +158,7 @@ static int draw_stask_display(vhdl_procedural *proc, if (count == 0) text->add_expr(new vhdl_const_string("")); - container->add_stmt(new vhdl_report_stmt(text)); + container->add_stmt(new vhdl_report_stmt(text)); return 0; } @@ -397,7 +397,7 @@ static void emit_wait_for_0(vhdl_procedural *proc, << ivl_stmt_file(stmt) << ":" << ivl_stmt_lineno(stmt) << ")"; wait->set_comment(ss.str()); - + container->add_stmt(wait); proc->added_wait_stmt(); } @@ -451,7 +451,7 @@ void make_assignment(vhdl_procedural *proc, stmt_container *container, assign_type = decl->assignment_type(); if (assign_type == vhdl_decl::ASSIGN_NONBLOCK && emul_blocking) - proc->add_blocking_target(lhs); + proc->add_blocking_target(lhs); // A small optimisation is to expand ternary RHSs into an // if statement (eliminates a function call and produces @@ -589,7 +589,7 @@ void make_assignment(vhdl_procedural *proc, stmt_container *container, width_so_far += lval_width; if (assign_type == vhdl_decl::ASSIGN_NONBLOCK && emul_blocking) - proc->add_blocking_target(*it); + proc->add_blocking_target(*it); } } } @@ -615,9 +615,9 @@ static int draw_assign(vhdl_procedural *proc, stmt_container *container, { vhdl_decl::assign_type_t assign_type = vhdl_decl::ASSIGN_NONBLOCK; bool emulate_blocking = proc->get_scope()->allow_signal_assignment(); - + make_assignment(proc, container, stmt, emulate_blocking, assign_type); - + return 0; } @@ -645,7 +645,7 @@ static int draw_delay(vhdl_procedural *proc, stmt_container *container, if (NULL == time) return 1; } - + ivl_statement_t sub_stmt = ivl_stmt_sub_stmt(stmt); vhdl_wait_stmt *wait = new vhdl_wait_stmt(VHDL_WAIT_FOR, time); @@ -665,8 +665,8 @@ static int draw_delay(vhdl_procedural *proc, stmt_container *container, // Any further assignments occur after simulation time 0 // so they cannot be used to initialise signal declarations // (if this scope is an initial process) - proc->get_scope()->set_initializing(false); - + proc->get_scope()->set_initializing(false); + return 0; } @@ -1022,10 +1022,10 @@ static int draw_if(vhdl_procedural *proc, stmt_container *container, return 1; emit_wait_for_0(proc, container, stmt, test); - + vhdl_if_stmt *vhdif = new vhdl_if_stmt(test); container->add_stmt(vhdif); - + ivl_statement_t cond_true_stmt = ivl_stmt_cond_true(stmt); if (cond_true_stmt) draw_stmt(proc, vhdif->get_then_container(), cond_true_stmt, is_last); @@ -1555,7 +1555,7 @@ int draw_while(vhdl_procedural *proc, stmt_container *container, draw_stmt(proc, loop->get_container(), ivl_stmt_sub_stmt(stmt)); emit_wait_for_0(proc, loop->get_container(), stmt, test); - + container->add_stmt(loop); return 0; } diff --git a/tgt-vhdl/vhdl_syntax.cc b/tgt-vhdl/vhdl_syntax.cc index c485776e0..f74256eeb 100644 --- a/tgt-vhdl/vhdl_syntax.cc +++ b/tgt-vhdl/vhdl_syntax.cc @@ -212,7 +212,7 @@ bool vhdl_procedural::is_blocking_target(vhdl_var_ref* ref) const { return blocking_targets_.find(ref->get_name()) != blocking_targets_.end(); } - + void vhdl_process::add_sensitivity(const std::string &name) { sens_.push_back(name); @@ -283,7 +283,7 @@ void stmt_container::find_vars(vhdl_var_set_t& read, for (stmt_list_t::const_iterator it = stmts_.begin(); it != stmts_.end(); ++it) - (*it)->find_vars(read, write); + (*it)->find_vars(read, write); } void stmt_container::emit(std::ostream &of, int level, bool newline) const @@ -800,7 +800,7 @@ void vhdl_report_stmt::emit(ostream& of, int level) const const char *levels[] = { "note", "warning", "error", "failure" }; of << " severity " << levels[severity_]; } - + of << ";"; } @@ -812,7 +812,7 @@ void vhdl_report_stmt::find_vars(vhdl_var_set_t& read, vhdl_var_set_t& write) vhdl_assert_stmt::vhdl_assert_stmt(const char *reason) : vhdl_report_stmt(new vhdl_const_string(reason), SEVERITY_FAILURE) { - + } void vhdl_assert_stmt::emit(std::ostream &of, int level) const @@ -876,7 +876,7 @@ void vhdl_if_stmt::find_vars(vhdl_var_set_t& read, it != elsif_parts_.end(); ++it) { (*it).test->find_vars(read); (*it).container->find_vars(read, write); - } + } } int vhdl_expr::paren_levels(0); @@ -890,7 +890,7 @@ void vhdl_expr::open_parens(std::ostream& of) void vhdl_expr::close_parens(std::ostream& of) { assert(paren_levels > 0); - + if (--paren_levels > 0) of << ")"; } @@ -908,7 +908,7 @@ void vhdl_unaryop_expr::find_vars(vhdl_var_set_t& read) void vhdl_unaryop_expr::emit(std::ostream &of, int level) const { open_parens(of); - + switch (op_) { case VHDL_UNARYOP_NOT: of << "not "; @@ -944,7 +944,7 @@ void vhdl_binop_expr::find_vars(vhdl_var_set_t& read) { for (list::const_iterator it = operands_.begin(); it != operands_.end(); ++it) - (*it)->find_vars(read); + (*it)->find_vars(read); } void vhdl_binop_expr::emit(std::ostream &of, int level) const diff --git a/tgt-vvp/draw_vpi.c b/tgt-vvp/draw_vpi.c index 86279578d..b23a2723e 100644 --- a/tgt-vvp/draw_vpi.c +++ b/tgt-vvp/draw_vpi.c @@ -287,7 +287,7 @@ static void draw_vpi_taskfunc_args(const char*call_string, assert((unsigned)(dp - buffer) <= sizeof buffer); } args[idx].text = strdup(buffer); - continue; + continue; } case IVL_EX_STRING: diff --git a/vhdlpp/lexor.lex b/vhdlpp/lexor.lex index f00addcb9..24d1b7c55 100644 --- a/vhdlpp/lexor.lex +++ b/vhdlpp/lexor.lex @@ -99,7 +99,7 @@ based_integer [0-9a-fA-F](_?[0-9a-fA-F])* \n { yylloc.first_line += 1; } "*/" { BEGIN(comment_enter); } -\'.\' { +\'.\' { yylval.text = escape_apostrophe_and_dup(yytext); return CHARACTER_LITERAL; } @@ -119,7 +119,7 @@ based_integer [0-9a-fA-F](_?[0-9a-fA-F])* if(!are_underscores_correct(yytext)) std::cerr << "An invalid underscore in the identifier:" << yytext << std::endl; - //yywarn(yylloc, "An invalid underscore in the identifier"); + //yywarn(yylloc, "An invalid underscore in the identifier"); yylval.text = strdupnew(yytext); break; default: @@ -127,32 +127,32 @@ based_integer [0-9a-fA-F](_?[0-9a-fA-F])* } return rc; } - + \\([^\\]|\\\\)*\\ { /* extended identifiers */ yylval.text = strdupnew(yytext); - return IDENTIFIER; + return IDENTIFIER; } - + {decimal_literal} { if(!are_underscores_correct(yytext)) - std::cerr << "An invalid underscore in the decimal literal:" + std::cerr << "An invalid underscore in the decimal literal:" << yytext << std::endl; - + if(strchr(yytext, '.')) { yylval.real = new vhdlreal(yytext); return REAL_LITERAL; } else { - yylval.integer = new vhdlint(yytext); + yylval.integer = new vhdlint(yytext); return INT_LITERAL; } } {based_literal} { if(!are_underscores_correct(yytext) || !is_based_correct(yytext)) - std::cerr << "An invalid form of based literal:" + std::cerr << "An invalid form of based literal:" << yytext << std::endl; - + if(strchr(yytext, '.')) { double val = make_double_from_based(yytext); @@ -167,7 +167,7 @@ based_integer [0-9a-fA-F](_?[0-9a-fA-F])* } } - + /* Compound symbols */ "<=" { return LEQ; } ">=" { return GEQ; } @@ -178,10 +178,10 @@ based_integer [0-9a-fA-F](_?[0-9a-fA-F])* "=>" { return ARROW; } "<<" { return DLT; } ">>" { return DGT; } - /* + /* Here comes a list of symbols that are more then strange, at least for the time being. - + "??" { return K_CC; } "?=" {} "?/=" {} @@ -204,7 +204,7 @@ extern void yyparse_set_filepath(const char*path); * \return true is returned if underscores are placed * correctly according to specification */ -static bool are_underscores_correct(char* text) +static bool are_underscores_correct(char* text) { unsigned char underscore_allowed = 0; const char* cp; @@ -248,12 +248,12 @@ static bool is_based_correct(char* text) ++clean_base_ptr; } unsigned length = clean_base_ptr - clean_base; - unsigned base; + unsigned base; if(length > 2 || length == 0) return 0; //the base is too big or too small if(length == 2) { - base = 10*(clean_base[0] - '0') + (clean_base[1] - '0'); + base = 10*(clean_base[0] - '0') + (clean_base[1] - '0'); //the base exceeds 16 or equals 0 if(base > 16 || base == 0) return 0; @@ -266,7 +266,7 @@ static bool is_based_correct(char* text) } bool point = 0; set allowed_chars; - + unsigned c; if(base <= 10) { for(c = 0; c < base; ++c) @@ -282,7 +282,7 @@ static bool is_based_correct(char* text) //MANTISSA examination for(ptr = strchr(text, '#') + 1, length = 0; ptr != strrchr(text, '#'); ++ptr) { - if(*ptr == '.') + if(*ptr == '.') { //we found a dot and another one was already found if(point == 1) @@ -301,7 +301,7 @@ static bool is_based_correct(char* text) } if(length == 0) return 0; - + //EXPONENT examination if(strchr(text, '\0') - strrchr(text, '#') > 1) { //the number contains an exponent if(*(strrchr(text, '#') + 2) == '-') @@ -313,7 +313,7 @@ static bool is_based_correct(char* text) if(!((*ptr >= '0' && *ptr <= '9') || (*ptr >= 'a' && *ptr <= 'f'))) return 0; } - } + } return 1; } @@ -327,13 +327,13 @@ static bool is_based_correct(char* text) static char* escape_quot_and_dup(char* text) { char* newstr = new char[strlen(text)+1]; - + unsigned old_idx, new_idx; - for(new_idx = 0, old_idx = 0; old_idx < strlen(text); ) + for(new_idx = 0, old_idx = 0; old_idx < strlen(text); ) { - if(text[old_idx] == '"' && old_idx == 0) + if(text[old_idx] == '"' && old_idx == 0) { //the beginning of the literal - ++old_idx; + ++old_idx; continue; } else @@ -343,12 +343,12 @@ static char* escape_quot_and_dup(char* text) return newstr; } else - if(text[old_idx] == '"' && text[old_idx+1] == '"') + if(text[old_idx] == '"' && text[old_idx+1] == '"') { newstr[new_idx++] = '"'; old_idx += 2; //jump across two chars } - else + else { newstr[new_idx] = text[old_idx]; ++old_idx; @@ -374,7 +374,7 @@ static char* escape_apostrophe_and_dup(char* text) } /** -* This function takes a floating point based number +* This function takes a floating point based number * in form of a C-strings and converts it to a double. * * \return new double is returned @@ -387,10 +387,10 @@ static double make_double_from_based(char* text) //put null byte in lieu of hashes *first_hash_ptr = '\0'; *second_hash_ptr = '\0'; - + //now lets deduce the base unsigned base = (unsigned)strtol(text, 0, 10) ; - + double mantissa = 0.0; char*ptr = first_hash_ptr + 1; for( ; ptr != second_hash_ptr ; ++ptr) @@ -416,12 +416,12 @@ static double make_double_from_based(char* text) { return mantissa + fraction; } - + //now calculate the value of the exponent double exponent = 0.0; //leave 'e'/'E' and '+' - ptr = *(second_hash_ptr + 2) == '+' ? second_hash_ptr + 3 : second_hash_ptr + 2; - + ptr = *(second_hash_ptr + 2) == '+' ? second_hash_ptr + 3 : second_hash_ptr + 2; + for( ; *ptr != '\0'; ++ptr) { if(*ptr != '_') @@ -430,13 +430,13 @@ static double make_double_from_based(char* text) } } return pow(mantissa + fraction, exponent); -} +} -/** +/** * This function takes a hexadecimal digit in form of * a char and returns its litteral value as short */ -static unsigned short short_from_hex_char(char ch) +static unsigned short short_from_hex_char(char ch) { if(ch >= '0' && ch <= '9') return ch - '0'; @@ -455,9 +455,9 @@ static int64_t make_long_from_based(char* text) { char* second_hash_ptr = strrchr(text, '#'); char* end_ptr = strrchr(text, '\0'); //now lets deduce the base - *first_hash_ptr = '\0'; + *first_hash_ptr = '\0'; unsigned base = (unsigned)strtol(text, 0, 10) ; - + char *ptr = first_hash_ptr + 1; int64_t mantissa = 0; for( ; ptr != second_hash_ptr ; ++ptr) @@ -470,9 +470,9 @@ static int64_t make_long_from_based(char* text) { //if there is an exponent if(end_ptr - second_hash_ptr > 1) { - int64_t exponent = 0L; - - ptr = *(second_hash_ptr + 2) == '+' ? second_hash_ptr + 3 : second_hash_ptr + 2; + int64_t exponent = 0L; + + ptr = *(second_hash_ptr + 2) == '+' ? second_hash_ptr + 3 : second_hash_ptr + 2; for( ; *ptr != '\0'; ++ptr) { if(*ptr != '_') diff --git a/vhdlpp/parse.y b/vhdlpp/parse.y index d5f8de0e9..0b2e6ab75 100644 --- a/vhdlpp/parse.y +++ b/vhdlpp/parse.y @@ -47,7 +47,7 @@ int parse_errors = 0; char*text; vhdlint* integer; vhdlreal* real; - + InterfacePort*interface_element; std::list* interface_list; }; @@ -79,7 +79,7 @@ int parse_errors = 0; %token K_xnor K_xor /* Identifiers that are not keywords are identifiers. */ %token IDENTIFIER -%token INT_LITERAL +%token INT_LITERAL %token REAL_LITERAL %token STRING_LITERAL CHARACTER_LITERAL /* compound symbols */ @@ -143,7 +143,7 @@ design_unit ; design_units - : design_units design_unit + : design_units design_unit | design_unit ; @@ -173,7 +173,7 @@ entity_declaration if(strcmp($2, $7) != 0) { errormsg(@1, "Syntax error in entity clause. \n"); yyerrok; } - + delete[]$2; delete[]$7; // Transfer the ports diff --git a/vhdlpp/vhdlint.cc b/vhdlpp/vhdlint.cc index e86baa8aa..70ca8a23f 100644 --- a/vhdlpp/vhdlint.cc +++ b/vhdlpp/vhdlint.cc @@ -46,9 +46,9 @@ vhdlint::vhdlint(const char* text) value_ = 0L; return; } - + char* new_text = new char[text_length + 1]; - + const char* ptr; char* new_ptr; for(ptr = text, new_ptr = new_text; *ptr != '\0'; ++ptr) @@ -63,10 +63,10 @@ vhdlint::vhdlint(const char* text) } } *new_ptr = '\0'; - + istringstream str(new_text); delete[] new_text; - + //TODO: check if numbers greater than MAX_INT are handled correctly str >> value_; } diff --git a/vhdlpp/vhdlint.h b/vhdlpp/vhdlint.h index a01afa18c..3a4b841dd 100644 --- a/vhdlpp/vhdlint.h +++ b/vhdlpp/vhdlint.h @@ -29,11 +29,11 @@ class vhdlint explicit vhdlint(const char* text); explicit vhdlint(const int64_t& val); explicit vhdlint(const vhdlint& val); - + bool is_negative() const; bool is_positive() const; bool is_zero() const; - + int64_t as_long() const; //vhdlv get(const unsigned index) const; //void set(const unsigned index, const unsigned val); diff --git a/vhdlpp/vhdlreal.cc b/vhdlpp/vhdlreal.cc index 52d7f81b0..6651b2d14 100644 --- a/vhdlpp/vhdlreal.cc +++ b/vhdlpp/vhdlreal.cc @@ -39,7 +39,7 @@ vhdlreal::vhdlreal(const vhdlreal& val) { vhdlreal::vhdlreal(const char* text) { assert(strlen(text) != 0); char* buffer = new char[strlen(text)+1]; - + char* buf_ptr; for(buf_ptr = buffer; *text != 0; ++buf_ptr, ++text) { if(*text == '_') @@ -47,7 +47,7 @@ vhdlreal::vhdlreal(const char* text) { *buf_ptr = *text; } *buf_ptr = '\0'; - + value_ = strtod(buffer, NULL); delete[] buffer; } diff --git a/vhdlpp/vhdlreal.h b/vhdlpp/vhdlreal.h index bc891672e..25b0616e1 100644 --- a/vhdlpp/vhdlreal.h +++ b/vhdlpp/vhdlreal.h @@ -29,7 +29,7 @@ */ class vhdlreal { - public: + public: friend std::ostream& operator<< (std::ostream&, const vhdlreal&); friend vhdlreal operator+ (const vhdlreal&, const vhdlreal&); friend vhdlreal operator- (const vhdlreal&, const vhdlreal&); diff --git a/vvp/file_line.cc b/vvp/file_line.cc index b2c07ed50..6f8198be5 100644 --- a/vvp/file_line.cc +++ b/vvp/file_line.cc @@ -61,7 +61,7 @@ static char *file_line_get_str(int type, vpiHandle ref) } static const struct __vpirt vpip_file_line_rt = { - _vpiFileLine, + _vpiFileLine, file_line_get, file_line_get_str, 0, @@ -71,7 +71,7 @@ static const struct __vpirt vpip_file_line_rt = { 0, 0, 0, - 0 + 0 }; vpiHandle vpip_build_file_line(char*description, long file_idx, long lineno)