Commit 4ca767f3 authored by rdubner's avatar rdubner
Browse files

Debug away missing base_symbol assignment problems for 00 FILE and REDEFINES

parent ad4cfe2c
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerCommandArguments>c:\Users\Bob\repos\samples-cbl-gdb\NC101A\NC101A</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>c:\Users\Bob\repos\samples-cbl-gdb\optfde01\optfde01</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerCommandArguments>c:\Users\Bob\repos\samples-cbl-gdb\NC101A\NC101A</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>c:\Users\Bob\repos\samples-cbl-gdb\optfde01\optfde01</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerCommandArguments>c:\Users\Bob\repos\samples-cbl-gdb\NC101A\NC101A</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>c:\Users\Bob\repos\samples-cbl-gdb\optfde01\optfde01</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerCommandArguments>c:\Users\Bob\repos\samples-cbl-gdb\NC101A\NC101A</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>c:\Users\Bob\repos\samples-cbl-gdb\optfde01\optfde01</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>
\ No newline at end of file
......@@ -152,6 +152,10 @@ ProcessDataStorage(ifstream &ifs,
string c_symbol = sm[1].str();
int size = stoi(sm[2].str());
string cbl_symbol = GetCommentText(input);
size_t nfound = cbl_symbol.find(" Record");
if( nfound != string::npos ) {
cbl_symbol = cbl_symbol.substr(0,nfound);
}
cob_data.Insert(c_symbol, size, program_id, storage, cbl_symbol);
......@@ -246,6 +250,11 @@ ProcessDataStorage(ifstream &ifs,
name_of_attr = sm[4].str();
cbl_name = GetCommentText(input);
size_t nfound = cbl_name.find(" Record");
if( nfound != string::npos ) {
cbl_name = cbl_name.substr(0,nfound);
}
cob_fields.Insert(c_symbol,
size,
name_of_data,
......
......@@ -1038,14 +1038,37 @@ DiveForVariable( VAR_NODE *node,
return retval;
}
void
VARIABLE_TREE::AdjustFlatList()
{
/* When there is, after an 00 FILE record, an 01 variable that isn't
referenced in the code, you end up with that 01 not being associated
with a b_ base symbol.
This code scans for that situation in the flat_list, and borrows the
b_ base_name from the 00 parent and assigns it to the 01 child. */
for( size_t i=1; i<flat_list.size(); i++ ) {
if( flat_list[i-1]->level EQ 0
AND flat_list[i]->base_symbol.empty()
AND flat_list[i-1]->program EQ flat_list[i]->program
AND flat_list[i]->level EQ 1 ) {
// This is the situation: 01 has no base_symbol, but its 00
// parent does.
flat_list[i]->base_symbol = flat_list[i-1]->base_symbol;
}
}
}
void
VARIABLE_TREE::Consolidive(VAR_NODE *node,const DATA_DESCRIPTIONS &data_description,string &base_symbol)
{
if( node ) {
VSTRING tokens = Split(node->GetCanonicalName(),"/");
if( tokens.size() >= 2) {
if( tokens.size() EQ 2) {
// We're starting work on a brand-new level-one variable. We need to
if( tokens.size() >= 2 ) {
if( node->level <= 1 OR node->level EQ 77 ) {
// We're starting work on a brand-new level-one(ish) variable. We need to
// clear out the base_symbol:
base_symbol = "" ;
}
......@@ -1175,6 +1198,8 @@ VARIABLE_TREE::Consolidate(const DATA_DESCRIPTIONS &data_description)
string base_symbol="";
Consolidive(root,data_description,base_symbol);
BuildFlatList(root,flat_list);
AdjustFlatList();
}
void
......
......@@ -230,6 +230,7 @@ private:
void ForceParent(VVAR_NODES &parents,const std::string &program_id);
void BuildCanonicalName(VAR_NODE *var_node);
void BuildFlatList(VAR_NODE *node,VVAR_NODES &flat);
void AdjustFlatList();
void Consolidive(VAR_NODE *node,
const DATA_DESCRIPTIONS &data_description,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment