update parser (#5)

This commit is contained in:
tompzf
2026-01-16 11:40:02 +01:00
committed by GitHub
parent 5039a37131
commit 234be8917f
115 changed files with 14038 additions and 5380 deletions

View File

@@ -1,4 +1,5 @@
#include <support/sdv_core.h>
#include <atomic>
#include "../../global/cmdlnparser/cmdlnparser.cpp"
#include "../../global/exec_dir_helper.h"
#include <support/app_control.h>
@@ -22,7 +23,7 @@ extern "C" int main(int iArgc, const char* rgszArgv[])
// See: https://stackoverflow.com/questions/51209268/using-stdthread-in-a-library-loaded-with-dlopen-leads-to-a-sigsev
// NOTE EVE 27.05.2025: in release builds, starting and ending the thread right after each other causes incorrect behavior and
// leads in some cases to create a deadlock in the join-function. The solution is to add delays in the thread processing.
bool bThreadStarted = false;
std::atomic_bool bThreadStarted = false;
std::thread thread = std::thread([&]()
{
std::this_thread::sleep_for(std::chrono::seconds(1));

View File

@@ -957,7 +957,7 @@ namespace sdv
static constexpr ::sdv::interface_id _id = 0xEE1AD4FC2B9217BB;
/**
* \brief Comment mask
* @brief Comment mask
*/
enum class ECommentMask : uint32_t
{
@@ -1024,7 +1024,7 @@ namespace sdv
static constexpr ::sdv::interface_id _id = 0xC7BB02340D82D7AE;
/**
* \brief Does the entity have an unnamed definition.
* @brief Does the entity have an unnamed definition.
* @return Returns 'true' when the entity has an unnamed definition; otherwise returns 'false'.
*/
virtual bool IsUnnamed() const = 0;

View File

@@ -110,7 +110,7 @@ public:
void CreateInheritanceValueChildNodes();
/**
* \brief Does the entity have an Unnamed definition. Overload of IDefinitionEntity::Unnamed.
* @brief Does the entity have an Unnamed definition. Overload of IDefinitionEntity::Unnamed.
* @return Returns 'true' when the definition supports unnamed definition; 'false' otherwise.
*/
virtual bool IsUnnamed() const override { return m_bAnonymousDefinition; };

View File

@@ -99,8 +99,10 @@ protected:
std::string ssName; ///< Parameter name
std::string ssDefaultValue; ///< Parameter default value (or empty for void return value)
std::string ssSize; ///< Parameter size
enum class EDirection { in, out, inout, ret, ignored } eDirection = EDirection::ignored; ///< Parameter direction or return value
enum class EAllocType { direct, indirect, ifc} eAllocType = EAllocType::direct; ///< Parameter allocation type
enum class EDirection ///< Parameter direction or return value
{ in, out, inout, ret, ignored } eDirection = EDirection::ignored; ///< Parameter direction or return value
enum class EAllocType ///< Parameter allocation type
{ direct, indirect, ifc} eAllocType = EAllocType::direct; ///< Parameter allocation type
};
/**

View File

@@ -107,7 +107,7 @@ private:
void PotentialSwapBuffer(TChar* szBuffer, size_t nSize, bool bIsSourceBigEndian);
/**
* \brief Convert a UTF16 string to UTF-8.
* @brief Convert a UTF16 string to UTF-8.
* @param[in] szBuffer The source string.
* @param[in] nSize The length of the string (or zero terminating string when supplied as 0).
* @return Returns the string as UTF8 std::string object.
@@ -115,7 +115,7 @@ private:
static std::string ConvertToUTF8(const char16_t* szBuffer, size_t nSize);
/**
* \brief Convert a UTF32 string to UTF-8.
* @brief Convert a UTF32 string to UTF-8.
* @param[in] szBuffer The source string.
* @param[in] nSize The length of the string (or zero terminating string when supplied as 0).
* @return Returns the string as UTF8 std::string object.

View File

@@ -1,3 +1,4 @@
#include <atomic>
#include <interfaces/ipc.h>
#include <support/sdv_core.h>
#include "../../global/cmdlnparser/cmdlnparser.cpp"
@@ -69,7 +70,7 @@ extern "C" int main(int iArgc, const char* rgszArgv[])
// See: https://stackoverflow.com/questions/51209268/using-stdthread-in-a-library-loaded-with-dlopen-leads-to-a-sigsev
// NOTE EVE 27.05.2025: in release builds, starting and ending the thread right after each other causes incorrect behavior and
// leads in some cases to create a deadlock in the join-function. The solution is to add delays in the thread processing.
bool bThreadStarted = false;
std::atomic_bool bThreadStarted = false;
std::thread thread = std::thread([&]()
{
std::this_thread::sleep_for(std::chrono::seconds(1));
@@ -223,12 +224,13 @@ extern "C" int main(int iArgc, const char* rgszArgv[])
return APP_CONTROL_INVALID_ISOLATION_CONFIG;
}
SConnectEventCallbackWrapper sConnectEventWrapper;
pConnect->RegisterStatusEventCallback(&sConnectEventWrapper);
uint64_t uiCookie = pConnect->RegisterStatusEventCallback(&sConnectEventWrapper);
// Connect to the core repository
sdv::com::IConnectionControl* pConnectionControl = sdv::core::GetObject<sdv::com::IConnectionControl>("CommunicationControl");
if (!pConnectionControl)
{
pConnect->UnregisterStatusEventCallback(uiCookie);
if (!bSilent)
std::cerr << "ERROR: " << COMMUNICATION_CONTROL_SERVICE_ACCESS_ERROR_MSG << std::endl;
return COMMUNICATION_CONTROL_SERVICE_ACCESS_ERROR;
@@ -237,6 +239,7 @@ extern "C" int main(int iArgc, const char* rgszArgv[])
sdv::com::TConnectionID tConnection = pConnectionControl->AssignClientEndpoint(ptrChannelEndpoint, 3000, pCoreRepo);
if (!tConnection.uiControl || !pCoreRepo)
{
pConnect->UnregisterStatusEventCallback(uiCookie);
if (!bSilent)
std::cerr << "ERROR: " << CONNECT_SDV_SERVER_ERROR_MSG << std::endl;
return CONNECT_SDV_SERVER_ERROR;
@@ -246,6 +249,7 @@ extern "C" int main(int iArgc, const char* rgszArgv[])
sdv::core::ILinkCoreRepository* pLinkCoreRepo = sdv::core::GetObject<sdv::core::ILinkCoreRepository>("RepositoryService");
if (!pLinkCoreRepo)
{
pConnect->UnregisterStatusEventCallback(uiCookie);
if (!bSilent)
std::cerr << "ERROR: " << LINK_REPO_SERVICE_ERROR_MSG << std::endl;
return LINK_REPO_SERVICE_ERROR;
@@ -264,6 +268,7 @@ extern "C" int main(int iArgc, const char* rgszArgv[])
sdv::core::IRepositoryUtilityCreate* pCreateUtility = sdv::core::GetObject<sdv::core::IRepositoryUtilityCreate>("RepositoryService");
if (!pRepositoryInfo || !pRepositoryControl || !pObjectAccess || !pCreateUtility)
{
pConnect->UnregisterStatusEventCallback(uiCookie);
if (!bSilent)
std::cerr << "ERROR: " << REPOSITORY_SERVICE_ACCESS_ERROR_MSG << std::endl;
return REPOSITORY_SERVICE_ACCESS_ERROR;
@@ -337,6 +342,7 @@ extern "C" int main(int iArgc, const char* rgszArgv[])
}
// Shutdwown
pConnect->UnregisterStatusEventCallback(uiCookie);
parser.Clear();
pLinkCoreRepo->UnlinkCoreRepository();
appcontrol.Shutdown();

View File

@@ -12,10 +12,13 @@ add_executable(sdv_packager
"../../sdv_services/core/toml_parser/parser_toml.cpp"
"../../sdv_services/core/toml_parser/lexer_toml.h"
"../../sdv_services/core/toml_parser/lexer_toml.cpp"
"../../sdv_services/core/toml_parser/lexer_toml_token.cpp"
"../../sdv_services/core/toml_parser/parser_node_toml.h"
"../../sdv_services/core/toml_parser/parser_node_toml.cpp"
"../../sdv_services/core/toml_parser/character_reader_utf_8.h"
"../../sdv_services/core/toml_parser/character_reader_utf_8.cpp"
"../../sdv_services/core/toml_parser/miscellaneous.h"
"../../sdv_services/core/toml_parser/miscellaneous.cpp"
"../../sdv_services/core/toml_parser/exception.h"
"environment.cpp"
"environment.h"

View File

@@ -929,7 +929,7 @@ bool CSdvPackagerEnvironment::ProcessCommandLine(const std::vector<std::string>&
}
else
{
// Check whether preceeded by at least one command
// Check whether preceded by at least one command
if (!(m_uiShowFlags & 0x00ff))
{
m_nError = CMDLN_MISSING_SHOW_COMMAND;

View File

@@ -33,6 +33,9 @@ inline bool iequals(const std::string& rssLeft, const std::string& rssRight)
return std::equal(rssLeft.begin(), rssLeft.end(), rssRight.begin(), rssRight.end(), ichar_equals);
}
/**
* @brief Environment access class.
*/
class CSdvPackagerEnvironment
{
public:

View File

@@ -1,3 +1,4 @@
#include <atomic>
#include <support/sdv_core.h>
#include <support/app_control.h>
#include "../../global/cmdlnparser/cmdlnparser.cpp"
@@ -73,7 +74,7 @@ extern "C" int main(int iArgc, const char* rgszArgv[])
// See: https://stackoverflow.com/questions/51209268/using-stdthread-in-a-library-loaded-with-dlopen-leads-to-a-sigsev
// NOTE EVE 27.05.2025: in release builds, starting and ending the thread right after each other causes incorrect behavior and
// leads in some cases to create a deadlock in the join-function. The solution is to add delays in the thread processing.
bool bThreadStarted = false;
std::atomic_bool bThreadStarted = false;
std::thread thread = std::thread([&]()
{
std::this_thread::sleep_for(std::chrono::seconds(1));

View File

@@ -344,7 +344,7 @@ protected:
/**
* @brief add to the type a cast, for example for 'std::string' it adds "const std::string&'
* @param[in]ssSignalType the string representing the type
* @param[in] ssSignalType the string representing the type
* @return Returns either original string or 'const' and '&' added.
*/
std::string CastValueType(const std::string& ssSignalType) const;