cwFlowNet.cpp : Fix problem where literal suffix count was being ignored.

This commit is contained in:
kevin 2024-06-09 16:18:21 -04:00
parent ed194e826e
commit e469be6a01

View File

@ -490,7 +490,20 @@ namespace cw
goto errLabel; goto errLabel;
} }
if( proc_ele.sfx_id_count == kInvalidCnt )
cnt_ref = n; cnt_ref = n;
else
{
if( proc_ele.sfx_id_count > n )
{
rc = cwLogError(kSyntaxErrorRC,"The given literal sfx-id count %i execeeds the maximimum possible value of %i on %s-proc '%s:%i' .",proc_ele.sfx_id_count,n,in_or_src_label,cwStringNullGuard(proc_ele.label),sfx_id);
goto errLabel;
}
cnt_ref = proc_ele.sfx_id_count;
}
errLabel: errLabel:
return rc; return rc;
} }
@ -498,11 +511,12 @@ namespace cw
rc_t _io_stmt_calc_var_ele_count(network_t& net, const io_ele_t& proc_ele, const io_ele_t& var_ele, const char* in_or_src_label, unsigned& cnt_ref) rc_t _io_stmt_calc_var_ele_count(network_t& net, const io_ele_t& proc_ele, const io_ele_t& var_ele, const char* in_or_src_label, unsigned& cnt_ref)
{ {
rc_t rc = kOkRC; rc_t rc = kOkRC;
proc_t* proc = nullptr;
unsigned proc_sfx_id = proc_ele.base_sfx_id==kInvalidCnt ? kBaseSfxId : proc_ele.base_sfx_id;
cnt_ref = 0; cnt_ref = 0;
proc_t* proc = nullptr;
unsigned proc_sfx_id = proc_ele.base_sfx_id==kInvalidCnt ? kBaseSfxId : proc_ele.base_sfx_id;
// locate the proc which owns this var // locate the proc which owns this var
if((proc = proc_find(net,proc_ele.label,proc_sfx_id)) == nullptr ) if((proc = proc_find(net,proc_ele.label,proc_sfx_id)) == nullptr )
{ {
@ -524,7 +538,19 @@ namespace cw
goto errLabel; goto errLabel;
} }
if( var_ele.sfx_id_count == kInvalidCnt )
cnt_ref = n; cnt_ref = n;
else
{
if( var_ele.sfx_id_count > n )
{
rc = cwLogError(kSyntaxErrorRC,"The given literal sfx-id count %i execeeds the maximimum possible value of %i on %s-var '%s:%i-%s:%i' .",var_ele.sfx_id_count,n,in_or_src_label,cwStringNullGuard(proc_ele.label),proc_ele.sfx_id,cwStringNullGuard(var_ele.label),sfx_id);
goto errLabel;
}
cnt_ref = var_ele.sfx_id_count;
}
} }
@ -1218,12 +1244,12 @@ namespace cw
rc_t rc = kOkRC; rc_t rc = kOkRC;
unsigned max_vid = kInvalidId; unsigned max_vid = kInvalidId;
unsigned max_chIdx = 0; unsigned max_chIdx = 0;
variable_t* var = proc->varL; variable_t* var = nullptr;
//variable_t* v0 = nullptr;
// determine the max variable vid and max channel index value among all variables // determine the max variable vid and max channel index value among all variables
for(; var!=nullptr; var = var->var_link ) for(var=proc->varL; var!=nullptr; var = var->var_link )
{ {
if( var->vid != kInvalidId ) if( var->vid != kInvalidId )
{ {
if( max_vid == kInvalidId || var->vid > max_vid ) if( max_vid == kInvalidId || var->vid > max_vid )