diff --git a/TestLibDlg/TestLibDlg/A2LFileData.cpp b/TestLibDlg/TestLibDlg/A2LFileData.cpp new file mode 100644 index 0000000..3583a55 --- /dev/null +++ b/TestLibDlg/TestLibDlg/A2LFileData.cpp @@ -0,0 +1,21 @@ + +#include "pch.h" +#include "A2LFileData.h" + +CA2LFileData::CA2LFileData() +{ + +} + +CA2LFileData::~CA2LFileData() +{ + +} + +bool CA2LFileData::LoadA2lFile(std::string strPath) +{ + bool bRet = false; + + + return bRet; +} \ No newline at end of file diff --git a/TestLibDlg/TestLibDlg/A2LFileData.h b/TestLibDlg/TestLibDlg/A2LFileData.h new file mode 100644 index 0000000..71898b0 --- /dev/null +++ b/TestLibDlg/TestLibDlg/A2LFileData.h @@ -0,0 +1,14 @@ +#pragma once + +#include +#include + +class CA2LFileData +{ +public: + CA2LFileData(); + ~CA2LFileData(); + + bool LoadA2lFile(std::string strPath); + +}; diff --git a/TestLibDlg/TestLibDlg/TestLibDlg.aps b/TestLibDlg/TestLibDlg/TestLibDlg.aps index c57b48e..1edc7b1 100644 Binary files a/TestLibDlg/TestLibDlg/TestLibDlg.aps and b/TestLibDlg/TestLibDlg/TestLibDlg.aps differ diff --git a/TestLibDlg/TestLibDlg/TestLibDlg.rc b/TestLibDlg/TestLibDlg/TestLibDlg.rc index c147727..78c86ab 100644 Binary files a/TestLibDlg/TestLibDlg/TestLibDlg.rc and b/TestLibDlg/TestLibDlg/TestLibDlg.rc differ diff --git a/TestLibDlg/TestLibDlg/TestLibDlg.vcxproj b/TestLibDlg/TestLibDlg/TestLibDlg.vcxproj index a60be9b..bfef79d 100644 --- a/TestLibDlg/TestLibDlg/TestLibDlg.vcxproj +++ b/TestLibDlg/TestLibDlg/TestLibDlg.vcxproj @@ -202,6 +202,7 @@ + @@ -211,6 +212,7 @@ + Create diff --git a/TestLibDlg/TestLibDlg/TestLibDlg.vcxproj.filters b/TestLibDlg/TestLibDlg/TestLibDlg.vcxproj.filters index 58d9b90..14392b8 100644 --- a/TestLibDlg/TestLibDlg/TestLibDlg.vcxproj.filters +++ b/TestLibDlg/TestLibDlg/TestLibDlg.vcxproj.filters @@ -36,6 +36,9 @@ 헤더 파일 + + 헤더 파일 + @@ -50,6 +53,9 @@ 소스 파일 + + 소스 파일 + diff --git a/TestLibDlg/TestLibDlg/TestLibDlgDlg.cpp b/TestLibDlg/TestLibDlg/TestLibDlgDlg.cpp index 407c8fb..efd7318 100644 --- a/TestLibDlg/TestLibDlg/TestLibDlgDlg.cpp +++ b/TestLibDlg/TestLibDlg/TestLibDlgDlg.cpp @@ -94,7 +94,7 @@ BEGIN_MESSAGE_MAP(CTestLibDlgDlg, CDialogEx) ON_WM_CLOSE() ON_WM_PAINT() ON_WM_QUERYDRAGICON() - ON_BN_CLICKED(IDC_BUTTON1, &CTestLibDlgDlg::OnBnClickedButton1) + ON_BN_CLICKED(IDC_BUTTON_OPEN, &CTestLibDlgDlg::OnBnClickedButtonOpen) END_MESSAGE_MAP() @@ -222,13 +222,6 @@ BOOL CTestLibDlgDlg::CanExit() } - -void CTestLibDlgDlg::OnBnClickedButton1() -{ - // TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다. - loadA2lFile("C:\\Users\\oilvirus\\Downloads\\example-a2l-file.a2l"); -} - void CTestLibDlgDlg::loadA2lFile(std::string strFilePath) { std::string strLogData; @@ -280,233 +273,292 @@ void CTestLibDlgDlg::loadA2lFile(std::string strFilePath) std::cout << module_list.size() << " : " << module_list.size(); AddLogString(string_format("module_list.size() : %d", module_list.size())); + if (module_list.size() > 0) { - const auto& module = module_list.cbegin()->second; - //ASSERT_TRUE(module); + const auto& module = module_list.cbegin()->second; + //ASSERT_TRUE(module); - //EXPECT_STREQ(module->Name().c_str(), "Example"); - //EXPECT_FALSE(module->A2ml().empty()); - AddLogString(string_format("module->Name() : %s", module->Name().c_str())); - AddLogString(string_format("module->A2ml() : %s", module->A2ml().c_str())); + //EXPECT_STREQ(module->Name().c_str(), "Example"); + //EXPECT_FALSE(module->A2ml().empty()); + AddLogString(string_format("module->Name() : %s", module->Name().c_str())); + AddLogString(string_format("module->A2ml() : %s", module->A2ml().c_str())); - AddLogString(""); + AddLogString(""); - for (const auto& [protocol, if_data] : module->IfDatas()) { - a2l::IfDataBlock block(if_data); - //EXPECT_TRUE(block.IsOk()) << block.LastError(); - std::cout << block.AsString() << std::endl; + const auto& modPar = module->ModPar(); + AddLogString(string_format("modPar.Comment() : %s", modPar.Comment.c_str())); + AddLogString(string_format("modPar.epk : %s", modPar.Epk.c_str())); + AddLogString(string_format("modPar.addr_epk size : %d", modPar.AddressEpkList.size())); + for (int i = 0; i < modPar.AddressEpkList.size(); i++) { + AddLogString(string_format("modPar.addr_epk (%d) addr (0x%X)",i, modPar.AddressEpkList.at(i))); + } + AddLogString(string_format("modPar.memory layout size : %d", modPar.MemoryLayoutList.size())); + /* + for (int i = 0; i < modPar.MemoryLayoutList.size(); i++) { + AddLogString(string_format("modPar.MemoryLayoutList (%d) addr (0x%X)", i, modPar.MemoryLayoutList.at(i))); + } + */ - AddLogString(string_format("IF_DATA : %s", block.Protocol().c_str())); - AddLogString(string_format("block.ItemList().size() : %d", block.ItemList().size())); + AddLogString(string_format("modPar.memory segment size : %d", modPar.MemorySegmentList.size())); - for (int i = 0; i < block.ItemList().size(); i++) { - AddLogString(string_format("%d block.ItemList() : %s", i, block.ItemList()[i].BlockName.c_str())); - AddLogString(string_format("block.ItemList()[i].ItemList.size() : %d", block.ItemList()[i].ItemList.size())); - - for (int j = 0; j < block.ItemList()[i].ItemList.size(); j++) { - // check digit - bool bIsDigit = true; - if (j > 0) - TRACE("asdf"); - for (int cnt = 0; cnt < block.ItemList()[i].ItemList[j].Value.size(); cnt++) { - //int value = std::isdigit(block.ItemList()[i].ItemList[j].Value.at(cnt)); - //int alpha = std::isalpha(block.ItemList()[i].ItemList[j].Value.at(cnt)); - //TRACE("[%c][%d][%d]\n", block.ItemList()[i].ItemList[j].Value.at(cnt), value, alpha); - if (std::isdigit(block.ItemList()[i].ItemList[j].Value.at(cnt)) == 0) - bIsDigit = false; - } - - if (bIsDigit) - AddLogString(string_format("%d : Address 0x%X (%d) : ", j, atoi(block.ItemList()[i].ItemList[j].Value.c_str()), atoi(block.ItemList()[i].ItemList[j].Value.c_str()))); - else - AddLogString(string_format("%d : %s", j, block.ItemList()[i].ItemList[j].Value.c_str())); - + for (int i = 0; i < modPar.MemorySegmentList.size(); i++) { + AddLogString(string_format("(%d) modPar.Memory sement description=[%s] segment_type=[%d] memory_type=[%d] attribution=[%d] addr (0x%X) size(0x%X) offset_list=[%d] ifDataList=[%d]", + i, modPar.MemorySegmentList.at(i).Description.c_str(), modPar.MemorySegmentList.at(i).SegmentType, modPar.MemorySegmentList.at(i).MemoryType, + modPar.MemorySegmentList.at(i).Attribute, modPar.MemorySegmentList.at(i).Address, modPar.MemorySegmentList.at(i).Size, + modPar.MemorySegmentList.at(i).OffsetList.size(), modPar.MemorySegmentList.at(i).IfDataList.size())); - for (int k = 0; k < (block.ItemList()[i].ItemList[j].ItemList.size()); k++) { + } + + AddLogString(""); + + const auto& modComm = module->ModCommon(); + AddLogString(string_format("modComm.Comment() : %s", modComm.Comment.c_str())); + AddLogString(string_format("modComm.Deposit : %d", modComm.Deposit)); + AddLogString(string_format("modComm.ByteOrder : %d", modComm.ByteOrder)); + AddLogString(string_format("modComm.AlignmentByte : %d", modComm.AlignmentByte)); + AddLogString(string_format("modComm.AlignmentFloat16 : %d", modComm.AlignmentFloat16)); + AddLogString(string_format("modComm.AlignmentFloat32 : %d", modComm.AlignmentFloat32)); + AddLogString(string_format("modComm.AlignmentFloat64 : %d", modComm.AlignmentFloat64)); + AddLogString(string_format("modComm.AlignmentInt64 : %d", modComm.AlignmentInt64)); + AddLogString(string_format("modComm.AlignmentLong : %d", modComm.AlignmentLong)); + AddLogString(string_format("modComm.AlignmentWord : %d", modComm.AlignmentWord)); + + AddLogString(""); + for (const auto& [protocol, if_data] : module->IfDatas()) { + a2l::IfDataBlock block(if_data); + //EXPECT_TRUE(block.IsOk()) << block.LastError(); + std::cout << block.AsString() << std::endl; + + AddLogString(string_format("IF_DATA : %s", block.Protocol().c_str())); + AddLogString(string_format("block.ItemList().size() : %d", block.ItemList().size())); + + for (int i = 0; i < block.ItemList().size(); i++) { + AddLogString(string_format("%d block.ItemList() : %s", i, block.ItemList()[i].BlockName.c_str())); + AddLogString(string_format("block.ItemList()[i].ItemList.size() : %d", block.ItemList()[i].ItemList.size())); + + for (int j = 0; j < block.ItemList()[i].ItemList.size(); j++) { + // check digit + bool bIsDigit = true; + if (j > 0) + TRACE("asdf"); + for (int cnt = 0; cnt < block.ItemList()[i].ItemList[j].Value.size(); cnt++) { + //int value = std::isdigit(block.ItemList()[i].ItemList[j].Value.at(cnt)); + //int alpha = std::isalpha(block.ItemList()[i].ItemList[j].Value.at(cnt)); + //TRACE("[%c][%d][%d]\n", block.ItemList()[i].ItemList[j].Value.at(cnt), value, alpha); + if (std::isdigit(block.ItemList()[i].ItemList[j].Value.at(cnt)) == 0) + bIsDigit = false; + } + + if (bIsDigit) + AddLogString(string_format("%d : Address 0x%X (%d) : %s itemlist=%d", j, atoi(block.ItemList()[i].ItemList[j].Value.c_str()), atoi(block.ItemList()[i].ItemList[j].Value.c_str()), block.ItemList()[i].ItemList[j].BlockName.c_str(), block.ItemList()[i].ItemList[j].ItemList.size())); + else + AddLogString(string_format("%d : %s : %s itemlist=%d", j, block.ItemList()[i].ItemList[j].Value.c_str(), block.ItemList()[i].ItemList[j].BlockName.c_str(), block.ItemList()[i].ItemList[j].ItemList.size())); + + + for (int k = 0; k < (block.ItemList()[i].ItemList[j].ItemList.size()); k++) { + AddLogString(string_format(" %d : %s : %s", k, block.ItemList()[i].ItemList[j].ItemList[k].Value.c_str(), block.ItemList()[i].ItemList[j].ItemList[k].BlockName.c_str())); + } } + + AddLogString(""); } + //AddLogString(string_format("block.AsString() : %s", block.AsString().c_str())); AddLogString(""); } - //AddLogString(string_format("block.AsString() : %s", block.AsString().c_str())); AddLogString(""); - } + const auto& axis_list = module->AxisPtss(); + //EXPECT_GT(axis_list.size(), 1); + std::cout << "\t\tAXIS PTS" << std::endl; + for (const auto& [pts_name, pts] : axis_list) { + std::cout << pts_name << std::endl; + } + std::cout << std::endl; - AddLogString(""); - const auto& axis_list = module->AxisPtss(); - //EXPECT_GT(axis_list.size(), 1); - std::cout << "\t\tAXIS PTS" << std::endl; - for (const auto& [pts_name, pts] : axis_list) { - std::cout << pts_name << std::endl; - } - std::cout << std::endl; + const auto& blob_list = module->Blobs(); + //EXPECT_GT(blob_list.size(), 0); + std::cout << "\t\tBLOB" << std::endl; + for (const auto& [blob_name, blob] : blob_list) { + std::cout << blob_name << " " << blob->Address() << std::endl; + } + std::cout << std::endl; - const auto& blob_list = module->Blobs(); - //EXPECT_GT(blob_list.size(), 0); - std::cout << "\t\tBLOB" << std::endl; - for (const auto& [blob_name, blob] : blob_list) { - std::cout << blob_name << " " << blob->Address() << std::endl; - } - std::cout << std::endl; + AddLogString(""); - const auto& characteristic_list = module->Characteristics(); - //EXPECT_GT(characteristic_list.size(), 0); - std::cout << "\t\tCHARACTERISTIC" << std::endl; - for (const auto& [char_name, characteristic] : characteristic_list) { - std::cout << char_name << " " << characteristic->Description() << std::endl; - } - std::cout << std::endl; + const auto& characteristic_list = module->Characteristics(); + //EXPECT_GT(characteristic_list.size(), 0); + std::cout << "\t\tCHARACTERISTIC" << std::endl; - const auto& compu_method_list = module->CompuMethods(); - //EXPECT_GT(compu_method_list.size(), 0); - std::cout << "\t\tCOMPU METHOD" << std::endl; - for (const auto& [method_name, method] : compu_method_list) { - std::cout << method_name << " " << method->Description() << std::endl; - } - std::cout << std::endl; + AddLogString(string_format("chracteristics : %d", characteristic_list.size())); + int i = 0; + for (const auto& [char_name, characteristic] : characteristic_list) { + std::cout << char_name << " " << characteristic->Description() << std::endl; + AddLogString(string_format(" %d : %s", i, characteristic->Description().c_str())); + } + std::cout << std::endl; - const auto& compu_tab_list = module->CompuTabs(); - //EXPECT_GT(compu_tab_list.size(), 0); - std::cout << "\t\tCOMPU TAB" << std::endl; - for (const auto& [tab_name, tab] : compu_tab_list) { - std::cout << tab_name << " " << tab->Description() << std::endl; - } - std::cout << std::endl; + AddLogString(""); - const auto& compu_vtab_list = module->CompuVtabs(); - //EXPECT_GT(compu_vtab_list.size(), 0); - std::cout << "\t\tCOMPU VTAB" << std::endl; - for (const auto& [vtab_name, vtab] : compu_vtab_list) { - std::cout << vtab_name << " " << vtab->Description() << std::endl; - } - std::cout << std::endl; + const auto& compu_method_list = module->CompuMethods(); + //EXPECT_GT(compu_method_list.size(), 0); + std::cout << "\t\tCOMPU METHOD" << std::endl; + for (const auto& [method_name, method] : compu_method_list) { + std::cout << method_name << " " << method->Description() << std::endl; + } + std::cout << std::endl; - const auto& compu_vtab_range_list = module->CompuVtabRanges(); - //EXPECT_GT(compu_vtab_range_list.size(), 0); - std::cout << "\t\tCOMPU VTAB RANGE" << std::endl; - for (const auto& [range_name, range] : compu_vtab_range_list) { - std::cout << range_name << " " << range->Description() << std::endl; - } - std::cout << std::endl; + const auto& compu_tab_list = module->CompuTabs(); + //EXPECT_GT(compu_tab_list.size(), 0); + std::cout << "\t\tCOMPU TAB" << std::endl; + for (const auto& [tab_name, tab] : compu_tab_list) { + std::cout << tab_name << " " << tab->Description() << std::endl; + } + std::cout << std::endl; - const auto& frame_list = module->Frames(); - // EXPECT_GT(frame_list.size(), 0); No frames in file - std::cout << "\t\tFRAME" << std::endl; - for (const auto& [frame_name, frame] : frame_list) { - std::cout << frame_name << " " << frame->Description() << std::endl; - } - std::cout << std::endl; + const auto& compu_vtab_list = module->CompuVtabs(); + //EXPECT_GT(compu_vtab_list.size(), 0); + std::cout << "\t\tCOMPU VTAB" << std::endl; + for (const auto& [vtab_name, vtab] : compu_vtab_list) { + std::cout << vtab_name << " " << vtab->Description() << std::endl; + } + std::cout << std::endl; - const auto& func_list = module->Functions(); - //EXPECT_GT(func_list.size(), 0); - std::cout << "\t\tFUNCTION" << std::endl; - for (const auto& [func_name, func] : func_list) { - std::cout << func_name << " " << func->Description() << std::endl; - } - std::cout << std::endl; + const auto& compu_vtab_range_list = module->CompuVtabRanges(); + //EXPECT_GT(compu_vtab_range_list.size(), 0); + std::cout << "\t\tCOMPU VTAB RANGE" << std::endl; + for (const auto& [range_name, range] : compu_vtab_range_list) { + std::cout << range_name << " " << range->Description() << std::endl; + } + std::cout << std::endl; - const auto& group_list = module->Groups(); - //EXPECT_GT(group_list.size(), 0); - std::cout << "\t\tGROUP" << std::endl; - for (const auto& [group_name, group] : group_list) { - std::cout << group_name << " " << group->Description() << std::endl; - } - std::cout << std::endl; + const auto& frame_list = module->Frames(); + // EXPECT_GT(frame_list.size(), 0); No frames in file + std::cout << "\t\tFRAME" << std::endl; + for (const auto& [frame_name, frame] : frame_list) { + std::cout << frame_name << " " << frame->Description() << std::endl; + } + std::cout << std::endl; - const auto& instance_list = module->Instances(); - //EXPECT_GT(instance_list.size(), 0); - std::cout << "\t\tINSTANCE" << std::endl; - for (const auto& [instance_name, instance] : instance_list) { - std::cout << instance_name << " " << instance->Description() << std::endl; - } - std::cout << std::endl; + const auto& func_list = module->Functions(); + //EXPECT_GT(func_list.size(), 0); + std::cout << "\t\tFUNCTION" << std::endl; + for (const auto& [func_name, func] : func_list) { + std::cout << func_name << " " << func->Description() << std::endl; + } + std::cout << std::endl; - const auto& meas_list = module->Measurements(); - //EXPECT_GT(meas_list.size(), 0); - std::cout << "\t\tMEASUREMENT" << std::endl; - for (const auto& [meas_name, meas] : meas_list) { - std::cout << meas_name << " " << meas->Description() << std::endl; - } - std::cout << std::endl; + const auto& group_list = module->Groups(); + //EXPECT_GT(group_list.size(), 0); + std::cout << "\t\tGROUP" << std::endl; + for (const auto& [group_name, group] : group_list) { + std::cout << group_name << " " << group->Description() << std::endl; + } + std::cout << std::endl; - const auto& rec_list = module->RecordLayouts(); - //EXPECT_GT(rec_list.size(), 0); - std::cout << "\t\tRECORD LAYOUT" << std::endl; - for (const auto& [rec_name, rec] : rec_list) { - std::cout << rec_name << std::endl; - } - std::cout << std::endl; + const auto& instance_list = module->Instances(); + //EXPECT_GT(instance_list.size(), 0); + std::cout << "\t\tINSTANCE" << std::endl; + for (const auto& [instance_name, instance] : instance_list) { + std::cout << instance_name << " " << instance->Description() << std::endl; + } + std::cout << std::endl; - const auto& trans_list = module->Transformers(); - //EXPECT_GT(trans_list.size(), 0); - std::cout << "\t\tTRANSFORMER" << std::endl; - for (const auto& [trans_name, trans] : trans_list) { - std::cout << trans_name << std::endl; - } - std::cout << std::endl; + AddLogString(""); - const auto& taxis_list = module->TypedefAxiss(); - //EXPECT_GT(taxis_list.size(), 0); - std::cout << "\t\tTYPEDEF AXIS" << std::endl; - for (const auto& [taxis_name, taxis] : taxis_list) { - std::cout << taxis_name << std::endl; - } - std::cout << std::endl; + const auto& meas_list = module->Measurements(); + //EXPECT_GT(meas_list.size(), 0); + std::cout << "\t\tMEASUREMENT" << std::endl; - const auto& tblob_list = module->TypedefBlobs(); - //EXPECT_GT(tblob_list.size(), 0); - std::cout << "\t\tTYPEDEF BLOB" << std::endl; - for (const auto& [tblob_name, tblob] : tblob_list) { - std::cout << tblob_name << std::endl; - } - std::cout << std::endl; + AddLogString(string_format("measurement : %d", meas_list.size())); - const auto& tchar_list = module->TypedefCharacteristics(); - //EXPECT_GT(tchar_list.size(), 0); - std::cout << "\t\tTYPEDEF CHARACTERISTIC" << std::endl; - for (const auto& [tchar_name, tchar] : tchar_list) { - std::cout << tchar_name << std::endl; - } - std::cout << std::endl; + i = 0; + for (const auto& [meas_name, meas] : meas_list) { + std::cout << meas_name << " " << meas->Description() << std::endl; + AddLogString(string_format(" %d : %s", i, meas->Description().c_str())); + } + std::cout << std::endl; - const auto& tmeas_list = module->TypedefMeasurements(); - //EXPECT_GT(tmeas_list.size(), 0); - std::cout << "\t\tTYPEDEF MEASUREMENT" << std::endl; - for (const auto& [tmeas_name, tmeas] : tmeas_list) { - std::cout << tmeas_name << std::endl; - } + AddLogString(""); - std::cout << std::endl; - const auto& tstruct_list = module->TypedefStructures(); - //EXPECT_GT(tstruct_list.size(), 0); - std::cout << "\t\tTYPEDEF STRUCTURE" << std::endl; - for (const auto& [tstruct_name, tstruct] : tstruct_list) { - std::cout << tstruct_name << std::endl; - } - std::cout << std::endl; - - std::cout << std::endl; - const auto& unit_list = module->Units(); - //EXPECT_GT(unit_list.size(), 0); - std::cout << "\t\tUNIT" << std::endl; - for (const auto& [unit_name, unit] : unit_list) { - std::cout << unit_name << std::endl; + const auto& rec_list = module->RecordLayouts(); + //EXPECT_GT(rec_list.size(), 0); + std::cout << "\t\tRECORD LAYOUT" << std::endl; + for (const auto& [rec_name, rec] : rec_list) { + std::cout << rec_name << std::endl; + } + std::cout << std::endl; + + const auto& trans_list = module->Transformers(); + //EXPECT_GT(trans_list.size(), 0); + std::cout << "\t\tTRANSFORMER" << std::endl; + for (const auto& [trans_name, trans] : trans_list) { + std::cout << trans_name << std::endl; + } + std::cout << std::endl; + + const auto& taxis_list = module->TypedefAxiss(); + //EXPECT_GT(taxis_list.size(), 0); + std::cout << "\t\tTYPEDEF AXIS" << std::endl; + for (const auto& [taxis_name, taxis] : taxis_list) { + std::cout << taxis_name << std::endl; + } + std::cout << std::endl; + + const auto& tblob_list = module->TypedefBlobs(); + //EXPECT_GT(tblob_list.size(), 0); + std::cout << "\t\tTYPEDEF BLOB" << std::endl; + for (const auto& [tblob_name, tblob] : tblob_list) { + std::cout << tblob_name << std::endl; + } + std::cout << std::endl; + + const auto& tchar_list = module->TypedefCharacteristics(); + //EXPECT_GT(tchar_list.size(), 0); + std::cout << "\t\tTYPEDEF CHARACTERISTIC" << std::endl; + for (const auto& [tchar_name, tchar] : tchar_list) { + std::cout << tchar_name << std::endl; + } + std::cout << std::endl; + + const auto& tmeas_list = module->TypedefMeasurements(); + //EXPECT_GT(tmeas_list.size(), 0); + std::cout << "\t\tTYPEDEF MEASUREMENT" << std::endl; + for (const auto& [tmeas_name, tmeas] : tmeas_list) { + std::cout << tmeas_name << std::endl; + } + + std::cout << std::endl; + const auto& tstruct_list = module->TypedefStructures(); + //EXPECT_GT(tstruct_list.size(), 0); + std::cout << "\t\tTYPEDEF STRUCTURE" << std::endl; + for (const auto& [tstruct_name, tstruct] : tstruct_list) { + std::cout << tstruct_name << std::endl; + } + std::cout << std::endl; + + std::cout << std::endl; + const auto& unit_list = module->Units(); + //EXPECT_GT(unit_list.size(), 0); + std::cout << "\t\tUNIT" << std::endl; + for (const auto& [unit_name, unit] : unit_list) { + std::cout << unit_name << std::endl; + } + std::cout << std::endl; + + a2l::A2mlBlock a2ml_block(module->A2ml()); + const auto& a2ml = module->A2ml(); + const auto a2ml_parse = a2ml_block.IsOk(); + + //EXPECT_TRUE(a2ml_parse) << a2ml_block.LastError(); + /* + const auto& block_list = a2ml_scanner.BlockList(); + for (const auto& block : block_list) { + std::cout << block.AsString() << std::endl; + } + */ } - std::cout << std::endl; - - a2l::A2mlBlock a2ml_block(module->A2ml()); - const auto& a2ml = module->A2ml(); - const auto a2ml_parse = a2ml_block.IsOk(); - - //EXPECT_TRUE(a2ml_parse) << a2ml_block.LastError(); - /* - const auto& block_list = a2ml_scanner.BlockList(); - for (const auto& block : block_list) { - std::cout << block.AsString() << std::endl; - } - */ } void CTestLibDlgDlg::AddLogString(std::string strMessage) @@ -516,4 +568,20 @@ void CTestLibDlgDlg::AddLogString(std::string strMessage) message_w.assign(strMessage.begin(), strMessage.end()); pListBox->AddString(message_w.c_str()); -} \ No newline at end of file +} +void CTestLibDlgDlg::OnBnClickedButtonOpen() +{ + // TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다. + TCHAR a2lExt[] = _T("*.a2l"); + TCHAR a2lBaseFilter[] = _T("A2L file(*.A2L) | *.a2l;*.A2L | 모든파일(*.*) | *.* ||"); + CFileDialog dlg(TRUE, a2lExt, NULL, OFN_HIDEREADONLY, a2lBaseFilter); + + if (dlg.DoModal() == IDOK) { + std::wstring strPath = dlg.GetPathName().GetBuffer(); + + std::string strA2lPath; + strA2lPath.assign(strPath.begin(), strPath.end()); + + loadA2lFile(strA2lPath.c_str()); + } +} diff --git a/TestLibDlg/TestLibDlg/TestLibDlgDlg.h b/TestLibDlg/TestLibDlg/TestLibDlgDlg.h index 6997723..de099b1 100644 --- a/TestLibDlg/TestLibDlg/TestLibDlgDlg.h +++ b/TestLibDlg/TestLibDlg/TestLibDlgDlg.h @@ -55,10 +55,11 @@ protected: virtual void OnOK(); virtual void OnCancel(); DECLARE_MESSAGE_MAP() -public: - afx_msg void OnBnClickedButton1(); + private: void loadA2lFile(std::string strFilePath); void AddLogString(std::string strMessage); +public: + afx_msg void OnBnClickedButtonOpen(); }; diff --git a/TestLibDlg/TestLibDlg/resource.h b/TestLibDlg/TestLibDlg/resource.h index 20d9dc1..b6c76d6 100644 --- a/TestLibDlg/TestLibDlg/resource.h +++ b/TestLibDlg/TestLibDlg/resource.h @@ -10,6 +10,7 @@ #define IDR_MAINFRAME 128 #define IDC_LIST_DATA 1001 #define IDC_BUTTON1 1002 +#define IDC_BUTTON_OPEN 1002 // Next default values for new objects //