From 904e76f1769ea2a61c3a1d7e78e3dc404d0ef1b3 Mon Sep 17 00:00:00 2001 From: Larry Doolittle Date: Mon, 20 Oct 2008 10:06:04 -0700 Subject: [PATCH] Shadow reduction part 3 Continue cleaning up shadowed variables, flagged by turning on -Wshadow. No intended change in functionality. Patch looks right, and is tested to compile and run on my machine. No regressions in test suite. --- elab_expr.cc | 100 +++++++++++++++---------------- t-dll-expr.cc | 6 +- t-dll-proc.cc | 20 +++---- t-dll.cc | 160 +++++++++++++++++++++++++------------------------- 4 files changed, 143 insertions(+), 143 deletions(-) diff --git a/elab_expr.cc b/elab_expr.cc index 6107bee34..f7b527515 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -112,7 +112,7 @@ NetExpr* PExpr::elaborate_expr(Design*des, NetScope*, int, bool) const unsigned PEBinary::test_width(Design*des, NetScope*scope, unsigned min, unsigned lval, - ivl_variable_type_t&expr_type, + ivl_variable_type_t&expr_type__, bool&unsized_flag) { ivl_variable_type_t expr_type_left = IVL_VT_NO_TYPE; @@ -155,7 +155,7 @@ unsigned PEBinary::test_width(Design*des, NetScope*scope, break; case '*': - if (unsized_flag && type_is_vectorable(expr_type)) { + if (unsized_flag && type_is_vectorable(expr_type_)) { unsigned use_wid = wid_left + wid_right; if (use_wid > integer_width) use_wid = integer_width; @@ -191,7 +191,7 @@ unsigned PEBinary::test_width(Design*des, NetScope*scope, else expr_width_ = 1; - expr_type = expr_type_; + expr_type__ = expr_type_; return expr_width_; } @@ -502,7 +502,7 @@ NetExpr* PEBinary::elaborate_expr_base_lshift_(Design*des, } else if (NetEConst*rpc = dynamic_cast (rp)) { long shift = rpc->value().as_long(); - long use_wid = lp->expr_width(); + use_wid = lp->expr_width(); if (expr_wid > 0) use_wid = expr_wid; @@ -734,17 +734,17 @@ NetExpr* PEBinary::elaborate_expr_base_add_(Design*des, } unsigned PEBComp::test_width(Design*, NetScope*,unsigned, unsigned, - ivl_variable_type_t&expr_type, + ivl_variable_type_t&expr_type__, bool&) { expr_type_ = IVL_VT_LOGIC; - expr_type = expr_type_; + expr_type__ = expr_type_; expr_width_ = 1; return 1; } NetExpr* PEBComp::elaborate_expr(Design*des, NetScope*scope, - int expr_width, bool sys_task_arg) const + int expr_width_dummy, bool sys_task_arg) const { assert(left_); assert(right_); @@ -795,10 +795,10 @@ NetExpr* PEBComp::elaborate_expr(Design*des, NetScope*scope, unsigned PEBShift::test_width(Design*des, NetScope*scope, unsigned min, unsigned lval, - ivl_variable_type_t&expr_type, + ivl_variable_type_t&expr_type__, bool&unsized_flag) { - unsigned wid_left = left_->test_width(des,scope,min, 0, expr_type, unsized_flag); + unsigned wid_left = left_->test_width(des,scope,min, 0, expr_type__, unsized_flag); // The right expression is self-determined and has no impact // on the expression size that is generated. @@ -818,7 +818,7 @@ unsigned PEBShift::test_width(Design*des, NetScope*scope, << endl; } - expr_type_ = expr_type; + expr_type_ = expr_type__; expr_width_ = wid_left; // Run a test-width on the shift amount so that its types are @@ -856,7 +856,7 @@ NetExpr*PEBShift::elaborate_expr(Design*des, NetScope*scope, unsigned PECallFunction::test_width_sfunc_(Design*des, NetScope*scope, unsigned min, unsigned lval, - ivl_variable_type_t&expr_type, + ivl_variable_type_t&expr_type__, bool&unsized_flag) { perm_string name = peek_tail_name(path_); @@ -866,8 +866,8 @@ unsigned PECallFunction::test_width_sfunc_(Design*des, NetScope*scope, if (expr == 0) return 0; - expr_width_ = expr->test_width(des, scope, min, lval, expr_type, unsized_flag); - expr_type_ = expr_type; + expr_width_ = expr->test_width(des, scope, min, lval, expr_type__, unsized_flag); + expr_type_ = expr_type__; if (debug_elaborate) cerr << get_fileline() << ": debug: test_width" @@ -900,7 +900,7 @@ unsigned PECallFunction::test_width_sfunc_(Design*des, NetScope*scope, expr_type_ = IVL_VT_BOOL; expr_width_= integer_width; - expr_type = expr_type_; + expr_type__ = expr_type_; return expr_width_; } @@ -912,7 +912,7 @@ unsigned PECallFunction::test_width_sfunc_(Design*des, NetScope*scope, expr_type_ = IVL_VT_BOOL; expr_width_ = 1; - expr_type = expr_type_; + expr_type__ = expr_type_; return expr_width_; } @@ -924,7 +924,7 @@ unsigned PECallFunction::test_width_sfunc_(Design*des, NetScope*scope, expr_type_ = sfunc_info->type; expr_width_ = sfunc_info->wid; - expr_type = expr_type_; + expr_type__ = expr_type_; if (debug_elaborate) cerr << get_fileline() << ": debug: test_width " @@ -937,11 +937,11 @@ unsigned PECallFunction::test_width_sfunc_(Design*des, NetScope*scope, unsigned PECallFunction::test_width(Design*des, NetScope*scope, unsigned min, unsigned lval, - ivl_variable_type_t&expr_type, + ivl_variable_type_t&expr_type__, bool&unsized_flag) { if (peek_tail_name(path_)[0] == '$') - return test_width_sfunc_(des, scope, min, lval, expr_type, unsized_flag); + return test_width_sfunc_(des, scope, min, lval, expr_type__, unsized_flag); // The width of user defined functions depends only on the // width of the return value. The arguments are entirely @@ -963,14 +963,14 @@ unsigned PECallFunction::test_width(Design*des, NetScope*scope, if (debug_elaborate) cerr << get_fileline() << ": debug: test_width " << "of function returns width " << res->vector_width() - << ", type=" << expr_type + << ", type=" << expr_type_ << "." << endl; - if (! type_is_vectorable(expr_type)) + if (! type_is_vectorable(expr_type__)) unsized_flag = true; expr_width_ = res->vector_width(); - expr_type = expr_type_; + expr_type__ = expr_type_; return expr_width_; } @@ -1289,7 +1289,7 @@ NetExpr* PECallFunction::elaborate_expr(Design*des, NetScope*scope, unsigned PEConcat::test_width(Design*des, NetScope*scope, unsigned min, unsigned lval, - ivl_variable_type_t&expr_type, + ivl_variable_type_t&expr_type__, bool&unsized_flag) { expr_type_ = IVL_VT_LOGIC; @@ -1297,7 +1297,7 @@ unsigned PEConcat::test_width(Design*des, NetScope*scope, if (debug_elaborate) cerr << get_fileline() << ": debug: CONCAT MISSING TEST_WIDTH!" << endl; - expr_type = expr_type_; + expr_type__ = expr_type_; unsized_flag = false; return 0; } @@ -1416,14 +1416,14 @@ NetExpr* PEConcat::elaborate_expr(Design*des, NetScope*scope, */ unsigned PEFNumber::test_width(Design*des, NetScope*scope, unsigned min, unsigned lval, - ivl_variable_type_t&expr_type, + ivl_variable_type_t&expr_type__, bool&unsized_flag) { expr_type_ = IVL_VT_REAL; expr_width_ = 1; unsized_flag = true; - expr_type = expr_type_; + expr_type__ = expr_type_; return 1; } @@ -1577,7 +1577,7 @@ bool PEIdent::calculate_param_range_(Design*des, NetScope*scope, unsigned PEIdent::test_width(Design*des, NetScope*scope, unsigned min, unsigned lval, - ivl_variable_type_t&expr_type, + ivl_variable_type_t&expr_type__, bool&unsized_flag) { NetNet* net = 0; @@ -1626,7 +1626,7 @@ unsigned PEIdent::test_width(Design*des, NetScope*scope, if (use_width != UINT_MAX) { expr_type_ = IVL_VT_LOGIC; // Assume bit/parts selects are logic expr_width_ = max(use_width, min); - expr_type = expr_type_; + expr_type__ = expr_type_; return expr_width_; } @@ -1634,7 +1634,7 @@ unsigned PEIdent::test_width(Design*des, NetScope*scope, if (net != 0) { expr_type_ = net->data_type(); expr_width_= max(net->vector_width(), (unsigned long)min); - expr_type = expr_type_; + expr_type__ = expr_type_; return expr_width_; } @@ -1643,7 +1643,7 @@ unsigned PEIdent::test_width(Design*des, NetScope*scope, // width is undefined. if (par != 0) { expr_type_ = par->expr_type(); - expr_type = expr_type_; + expr_type__ = expr_type_; if (ex1) { ivl_assert(*this, ex2); const NetEConst*ex1_const = dynamic_cast (ex1); @@ -1673,7 +1673,7 @@ unsigned PEIdent::test_width(Design*des, NetScope*scope, expr_type_ = IVL_VT_NO_TYPE; expr_width_ = min; - expr_type = expr_type_; + expr_type__ = expr_type_; return min; } @@ -2111,10 +2111,10 @@ NetExpr* PEIdent::elaborate_expr_param_(Design*des, rb = verinum::V0; } - NetEConst*re = new NetEConst(verinum(rb, 1)); + NetEConst*re2 = new NetEConst(verinum(rb, 1)); delete tmp; delete mtmp; - tmp = re; + tmp = re2; } else { @@ -2528,7 +2528,7 @@ NetExpr* PEIdent::elaborate_expr_net(Design*des, NetScope*scope, unsigned PENumber::test_width(Design*, NetScope*, unsigned min, unsigned lval, - ivl_variable_type_t&expr_type, + ivl_variable_type_t&expr_type__, bool&unsized_flag) { expr_type_ = IVL_VT_LOGIC; @@ -2542,13 +2542,13 @@ unsigned PENumber::test_width(Design*, NetScope*, if (lval > 0 && lval < use_wid) use_wid = lval; - expr_type = expr_type_; + expr_type__ = expr_type_; expr_width_ = use_wid; return use_wid; } NetEConst* PENumber::elaborate_expr(Design*des, NetScope*, - int expr_width, bool) const + int expr_width__, bool) const { assert(value_); verinum tvalue = *value_; @@ -2557,10 +2557,10 @@ NetEConst* PENumber::elaborate_expr(Design*des, NetScope*, // specific size (for example this is part of the r-values of // an assignment) so we pad to the desired width and ignore // the self-determined size. - if (expr_width > 0) { - tvalue = pad_to_width(tvalue, expr_width); - if (tvalue.len() > (unsigned)expr_width) { - verinum tmp (tvalue, expr_width); + if (expr_width__ > 0) { + tvalue = pad_to_width(tvalue, expr_width__); + if (tvalue.len() > (unsigned)expr_width__) { + verinum tmp (tvalue, expr_width__); tmp.has_sign(tvalue.has_sign()); tvalue = tmp; } @@ -2573,7 +2573,7 @@ NetEConst* PENumber::elaborate_expr(Design*des, NetScope*, unsigned PEString::test_width(Design*des, NetScope*scope, unsigned min, unsigned lval, - ivl_variable_type_t&expr_type, + ivl_variable_type_t&expr_type__, bool&unsized_flag) { expr_type_ = IVL_VT_BOOL; @@ -2581,12 +2581,12 @@ unsigned PEString::test_width(Design*des, NetScope*scope, if (min > expr_width_) expr_width_ = min; - expr_type = expr_type_; + expr_type__ = expr_type_; return expr_width_; } NetEConst* PEString::elaborate_expr(Design*des, NetScope*, - int expr_width, bool) const + int expr_width_dummy, bool) const { NetEConst*tmp = new NetEConst(value()); tmp->set_line(*this); @@ -2595,7 +2595,7 @@ NetEConst* PEString::elaborate_expr(Design*des, NetScope*, unsigned PETernary::test_width(Design*des, NetScope*scope, unsigned min, unsigned lval, - ivl_variable_type_t&expr_type, + ivl_variable_type_t&expr_type__, bool&flag) { // The condition of the ternary is self-determined, but we @@ -2631,7 +2631,7 @@ unsigned PETernary::test_width(Design*des, NetScope*scope, expr_width_ = max(tru_wid,fal_wid); - expr_type = expr_type_; + expr_type__ = expr_type_; return expr_width_; } @@ -2761,7 +2761,7 @@ NetExpr*PETernary::elaborate_expr(Design*des, NetScope*scope, unsigned PEUnary::test_width(Design*des, NetScope*scope, unsigned min, unsigned lval, - ivl_variable_type_t&expr_type, + ivl_variable_type_t&expr_type__, bool&unsized_flag) { switch (op_) { @@ -2781,11 +2781,11 @@ unsigned PEUnary::test_width(Design*des, NetScope*scope, } expr_width_ = 1; - expr_type = expr_type_; + expr_type__ = expr_type_; return expr_width_; } - unsigned test_wid = expr_->test_width(des, scope, min, lval, expr_type, unsized_flag); + unsigned test_wid = expr_->test_width(des, scope, min, lval, expr_type__, unsized_flag); switch (op_) { // For these operators, the act of padding to the // minimum width can have an important impact on the @@ -2799,7 +2799,7 @@ unsigned PEUnary::test_width(Design*des, NetScope*scope, break; } - expr_type_ = expr_type; + expr_type_ = expr_type__; expr_width_ = test_wid; return test_wid; } @@ -2864,11 +2864,11 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope, tmp->set_line(*this); delete ip; - } else if (NetECReal*ipc = dynamic_cast(ip)) { + } else if (NetECReal*ipr = dynamic_cast(ip)) { /* When taking the - of a real, fold this into the constant value. */ - verireal val = - ipc->value(); + verireal val = - ipr->value(); tmp = new NetECReal(val); tmp->set_line( *ip ); delete ip; diff --git a/t-dll-expr.cc b/t-dll-expr.cc index 3dbb8d6c9..8e0f43bb7 100644 --- a/t-dll-expr.cc +++ b/t-dll-expr.cc @@ -257,13 +257,13 @@ void dll_target::expr_const(const NetEConst*net) void dll_target::expr_param(const NetEConstParam*net) { - ivl_scope_t scope = find_scope(des_, net->scope()); - ivl_parameter_t par = scope_find_param(scope, net->name()); + ivl_scope_t scop = find_scope(des_, net->scope()); + ivl_parameter_t par = scope_find_param(scop, net->name()); if (par == 0) { cerr << net->get_fileline() << ": internal error: " << "Parameter " << net->name() << " missing from " - << ivl_scope_name(scope) << endl; + << ivl_scope_name(scop) << endl; } assert(par); assert(par->value); diff --git a/t-dll-proc.cc b/t-dll-proc.cc index b3b96973f..f2031fb0b 100644 --- a/t-dll-proc.cc +++ b/t-dll-proc.cc @@ -85,7 +85,7 @@ bool dll_target::process(const NetProcTop*net) void dll_target::task_def(const NetScope*net) { - ivl_scope_t scope = lookup_scope_(net); + ivl_scope_t scop = lookup_scope_(net); const NetTaskDef*def = net->task_def(); assert(stmt_cur_ == 0); @@ -94,14 +94,14 @@ void dll_target::task_def(const NetScope*net) def->proc()->emit_proc(this); assert(stmt_cur_); - scope->def = stmt_cur_; + scop->def = stmt_cur_; stmt_cur_ = 0; } bool dll_target::func_def(const NetScope*net) { - ivl_scope_t scope = lookup_scope_(net); + ivl_scope_t scop = lookup_scope_(net); const NetFuncDef*def = net->func_def(); assert(stmt_cur_ == 0); @@ -110,14 +110,14 @@ bool dll_target::func_def(const NetScope*net) def->proc()->emit_proc(this); assert(stmt_cur_); - scope->def = stmt_cur_; + scop->def = stmt_cur_; stmt_cur_ = 0; - scope->ports = def->port_count() + 1; - if (scope->ports > 0) { - scope->port = new ivl_signal_t[scope->ports]; - for (unsigned idx = 1 ; idx < scope->ports ; idx += 1) - scope->port[idx] = find_signal(des_, def->port(idx-1)); + scop->ports = def->port_count() + 1; + if (scop->ports > 0) { + scop->port = new ivl_signal_t[scop->ports]; + for (unsigned idx = 1 ; idx < scop->ports ; idx += 1) + scop->port[idx] = find_signal(des_, def->port(idx-1)); } /* FIXME: the ivl_target API expects port-0 to be the output @@ -126,7 +126,7 @@ bool dll_target::func_def(const NetScope*net) this, but that will break code generators that use this result. */ if (const NetNet*ret_sig = def->return_sig()) { - scope->port[0] = find_signal(des_, ret_sig); + scop->port[0] = find_signal(des_, ret_sig); return true; } diff --git a/t-dll.cc b/t-dll.cc index d41359bbd..c452f4be0 100644 --- a/t-dll.cc +++ b/t-dll.cc @@ -469,15 +469,15 @@ ivl_parameter_t dll_target::scope_find_param(ivl_scope_t scope, * ivl_parameter_t objects. This involves saving the name and scanning * the expression value. */ -void dll_target::make_scope_parameters(ivl_scope_t scope, const NetScope*net) +void dll_target::make_scope_parameters(ivl_scope_t scop, const NetScope*net) { - scope->nparam_ = net->parameters.size() + net->localparams.size(); - if (scope->nparam_ == 0) { - scope->param_ = 0; + scop->nparam_ = net->parameters.size() + net->localparams.size(); + if (scop->nparam_ == 0) { + scop->param_ = 0; return; } - scope->param_ = new struct ivl_parameter_s [scope->nparam_]; + scop->param_ = new struct ivl_parameter_s [scop->nparam_]; unsigned idx = 0; typedef map::const_iterator pit_t; @@ -485,10 +485,10 @@ void dll_target::make_scope_parameters(ivl_scope_t scope, const NetScope*net) for (pit_t cur_pit = net->parameters.begin() ; cur_pit != net->parameters.end() ; cur_pit ++) { - assert(idx < scope->nparam_); - ivl_parameter_t cur_par = scope->param_ + idx; + assert(idx < scop->nparam_); + ivl_parameter_t cur_par = scop->param_ + idx; cur_par->basename = (*cur_pit).first; - cur_par->scope = scope; + cur_par->scope = scop; cur_par->file = (*cur_pit).second.get_file(); cur_par->lineno = (*cur_pit).second.get_lineno(); @@ -499,10 +499,10 @@ void dll_target::make_scope_parameters(ivl_scope_t scope, const NetScope*net) for (pit_t cur_pit = net->localparams.begin() ; cur_pit != net->localparams.end() ; cur_pit ++) { - assert(idx < scope->nparam_); - ivl_parameter_t cur_par = scope->param_ + idx; + assert(idx < scop->nparam_); + ivl_parameter_t cur_par = scop->param_ + idx; cur_par->basename = (*cur_pit).first; - cur_par->scope = scope; + cur_par->scope = scop; cur_par->file = (*cur_pit).second.get_file(); cur_par->lineno = (*cur_pit).second.get_lineno(); @@ -530,9 +530,9 @@ void dll_target::make_scope_param_expr(ivl_parameter_t cur_par, NetExpr*etmp) assert(0); } - } else if (const NetECReal*e = dynamic_cast(etmp)) { + } else if (const NetECReal*er = dynamic_cast(etmp)) { - expr_creal(e); + expr_creal(er); assert(expr_); assert(expr_->type_ == IVL_EX_REALNUM); expr_->u_.real_.parameter = cur_par; @@ -550,7 +550,7 @@ void dll_target::make_scope_param_expr(ivl_parameter_t cur_par, NetExpr*etmp) expr_ = 0; } -void dll_target::add_root(ivl_design_s &des_, const NetScope *s) +void dll_target::add_root(ivl_design_s &des__, const NetScope *s) { ivl_scope_t root_ = new struct ivl_scope_s; perm_string name = s->basename(); @@ -577,12 +577,12 @@ void dll_target::add_root(ivl_design_s &des_, const NetScope *s) root_->attr = fill_in_attributes(s); root_->is_auto = 0; - des_.nroots_++; - if (des_.roots_) - des_.roots_ = (ivl_scope_t *)realloc(des_.roots_, des_.nroots_ * sizeof(ivl_scope_t)); + des__.nroots_++; + if (des__.roots_) + des__.roots_ = (ivl_scope_t *)realloc(des__.roots_, des__.nroots_ * sizeof(ivl_scope_t)); else - des_.roots_ = (ivl_scope_t *)malloc(des_.nroots_ * sizeof(ivl_scope_t)); - des_.roots_[des_.nroots_ - 1] = root_; + des__.roots_ = (ivl_scope_t *)malloc(des__.nroots_ * sizeof(ivl_scope_t)); + des__.roots_[des__.nroots_ - 1] = root_; } bool dll_target::start_design(const Design*des) @@ -615,9 +615,9 @@ bool dll_target::start_design(const Design*des) des_.roots_ = NULL; root_scopes = des->find_root_scopes(); - for (list::const_iterator scope = root_scopes.begin(); - scope != root_scopes.end(); scope++) - add_root(des_, *scope); + for (list::const_iterator scop = root_scopes.begin(); + scop != root_scopes.end(); scop++) + add_root(des_, *scop); des_.consts = (ivl_net_const_t*) malloc(sizeof(ivl_net_const_t)); @@ -848,17 +848,17 @@ bool dll_target::bufz(const NetBUFZ*net) /* Attach the logic device to the scope that contains it. */ assert(net->scope()); - ivl_scope_t scope = find_scope(des_, net->scope()); - assert(scope); + ivl_scope_t scop = find_scope(des_, net->scope()); + assert(scop); - obj->scope_ = scope; + obj->scope_ = scop; obj->name_ = net->name(); logic_attributes(obj, net); make_logic_delays_(obj, net); - scope_add_logic(scope, obj); + scope_add_logic(scop, obj); return true; } @@ -867,10 +867,10 @@ void dll_target::event(const NetEvent*net) { struct ivl_event_s *obj = new struct ivl_event_s; - ivl_scope_t scope = find_scope(des_, net->scope()); + ivl_scope_t scop = find_scope(des_, net->scope()); obj->name = net->name(); - obj->scope = scope; - scope_add_event(scope, obj); + obj->scope = scop; + scope_add_event(scop, obj); obj->nany = 0; obj->nneg = 0; @@ -1029,17 +1029,17 @@ void dll_target::logic(const NetLogic*net) } assert(net->scope()); - ivl_scope_t scope = find_scope(des_, net->scope()); - assert(scope); + ivl_scope_t scop = find_scope(des_, net->scope()); + assert(scop); - obj->scope_= scope; + obj->scope_= scop; obj->name_ = net->name(); logic_attributes(obj, net); make_logic_delays_(obj, net); - scope_add_logic(scope, obj); + scope_add_logic(scop, obj); } bool dll_target::tran(const NetTran*net) @@ -1377,10 +1377,10 @@ void dll_target::udp(const NetUDP*net) } assert(net->scope()); - ivl_scope_t scope = find_scope(des_, net->scope()); - assert(scope); + ivl_scope_t scop = find_scope(des_, net->scope()); + assert(scop); - obj->scope_= scope; + obj->scope_= scop; obj->name_ = net->name(); make_logic_delays_(obj, net); @@ -1388,7 +1388,7 @@ void dll_target::udp(const NetUDP*net) obj->nattr = 0; obj->attr = 0; - scope_add_logic(scope, obj); + scope_add_logic(scop, obj); } void dll_target::lpm_abs(const NetAbs*net) @@ -2293,81 +2293,81 @@ void dll_target::net_probe(const NetEvProbe*net) void dll_target::scope(const NetScope*net) { - ivl_scope_t scope; + ivl_scope_t scop; if (net->parent() == 0) { unsigned i; - scope = NULL; - for (i = 0; i < des_.nroots_ && scope == NULL; i++) { + scop = NULL; + for (i = 0; i < des_.nroots_ && scop == NULL; i++) { if (strcmp(des_.roots_[i]->name_, net->basename()) == 0) - scope = des_.roots_[i]; + scop = des_.roots_[i]; } - assert(scope); + assert(scop); } else { perm_string sname = make_scope_name(net->fullname()); - scope = new struct ivl_scope_s; - scope->name_ = sname; - FILE_NAME(scope, net); - scope->child_ = 0; - scope->sibling_ = 0; - scope->parent = find_scope(des_, net->parent()); - assert(scope->parent); - scope->nsigs_ = 0; - scope->sigs_ = 0; - scope->nlog_ = 0; - scope->log_ = 0; - scope->nevent_ = 0; - scope->event_ = 0; - scope->nlpm_ = 0; - scope->lpm_ = 0; - scope->def = 0; - make_scope_parameters(scope, net); - scope->time_precision = net->time_precision(); - scope->time_units = net->time_unit(); - scope->nattr = net->attr_cnt(); - scope->attr = fill_in_attributes(net); - scope->is_auto = net->is_auto(); + scop = new struct ivl_scope_s; + scop->name_ = sname; + FILE_NAME(scop, net); + scop->child_ = 0; + scop->sibling_ = 0; + scop->parent = find_scope(des_, net->parent()); + assert(scop->parent); + scop->nsigs_ = 0; + scop->sigs_ = 0; + scop->nlog_ = 0; + scop->log_ = 0; + scop->nevent_ = 0; + scop->event_ = 0; + scop->nlpm_ = 0; + scop->lpm_ = 0; + scop->def = 0; + make_scope_parameters(scop, net); + scop->time_precision = net->time_precision(); + scop->time_units = net->time_unit(); + scop->nattr = net->attr_cnt(); + scop->attr = fill_in_attributes(net); + scop->is_auto = net->is_auto(); switch (net->type()) { case NetScope::MODULE: - scope->type_ = IVL_SCT_MODULE; - scope->tname_ = net->module_name(); + scop->type_ = IVL_SCT_MODULE; + scop->tname_ = net->module_name(); break; case NetScope::TASK: { const NetTaskDef*def = net->task_def(); if (def == 0) { cerr << "?:?" << ": internal error: " - << "task " << scope->name_ + << "task " << scop->name_ << " has no definition." << endl; } assert(def); - scope->type_ = IVL_SCT_TASK; - scope->tname_ = def->scope()->basename(); + scop->type_ = IVL_SCT_TASK; + scop->tname_ = def->scope()->basename(); break; } case NetScope::FUNC: - scope->type_ = IVL_SCT_FUNCTION; - scope->tname_ = net->func_def()->scope()->basename(); + scop->type_ = IVL_SCT_FUNCTION; + scop->tname_ = net->func_def()->scope()->basename(); break; case NetScope::BEGIN_END: - scope->type_ = IVL_SCT_BEGIN; - scope->tname_ = scope->name_; + scop->type_ = IVL_SCT_BEGIN; + scop->tname_ = scop->name_; break; case NetScope::FORK_JOIN: - scope->type_ = IVL_SCT_FORK; - scope->tname_ = scope->name_; + scop->type_ = IVL_SCT_FORK; + scop->tname_ = scop->name_; break; case NetScope::GENBLOCK: - scope->type_ = IVL_SCT_GENERATE; - scope->tname_ = scope->name_; + scop->type_ = IVL_SCT_GENERATE; + scop->tname_ = scop->name_; break; } - assert(scope->parent != 0); + assert(scop->parent != 0); - scope->sibling_= scope->parent->child_; - scope->parent->child_ = scope; + scop->sibling_= scop->parent->child_; + scop->parent->child_ = scop; } }