clang-format {Cache API} header files
diff --git a/SVIncCompil/API/PythonAPI.h b/SVIncCompil/API/PythonAPI.h
index 0005e16..74ac368 100644
--- a/SVIncCompil/API/PythonAPI.h
+++ b/SVIncCompil/API/PythonAPI.h
@@ -1,12 +1,12 @@
/*
Copyright 2019 Alain Dargelas
-
+
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
-
+
http://www.apache.org/licenses/LICENSE-2.0
-
+
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -14,7 +14,7 @@
limitations under the License.
*/
-/*
+/*
* File: PythonAPI.h
* Author: alain
*
@@ -27,47 +27,52 @@
namespace SURELOG {
-class SV3_1aPythonListener;
+class SV3_1aPythonListener;
class FileContent;
class Design;
class PythonAPI {
-public:
- PythonAPI();
- PythonAPI(const PythonAPI& orig);
- virtual ~PythonAPI();
- /* Main interpreter (in main thread) */
- static void init(const char ** argv);
- static void shutdown();
- static PyThreadState* getMainInterp() { return m_mainThreadState; }
-
- /* Per thread interpreters */
- static PyThreadState* initNewInterp();
- static void shutdown(PyThreadState* interp);
-
- static bool loadScript(std::string name, bool check = false);
- static std::string evalScript(std::string module, std::string function, std::vector<std::string> args, PyThreadState* interp);
- static void evalScript(std::string function, SV3_1aPythonListener* listener, ParserRuleContext* ctx);
- static std::string getInvalidScriptString() { return m_invalidScriptResult; }
- static bool isListenerLoaded() { return m_listenerLoaded; }
- static std::string getListenerScript() { return m_listenerScript; }
- static void setListenerScript(std::string script) { m_listenerScript = script; }
- static bool evalScriptPerFile(std::string script, ErrorContainer* errors, FileContent* fC, PyThreadState* interp);
- static bool evalScript(std::string script, Design* design);
- static void setStrictMode(bool mode) { m_strictMode = mode; }
-private:
- static void loadScriptsInInterp_();
- static bool loadScript_(std::string name, bool check = false);
- static std::string m_invalidScriptResult;
- static PyThreadState * m_mainThreadState;
- static std::string m_programPath;
- static bool m_listenerLoaded;
- static std::string m_listenerScript;
- static bool m_strictMode;
+ public:
+ PythonAPI();
+ PythonAPI(const PythonAPI& orig);
+ virtual ~PythonAPI();
+ /* Main interpreter (in main thread) */
+ static void init(const char** argv);
+ static void shutdown();
+ static PyThreadState* getMainInterp() { return m_mainThreadState; }
+
+ /* Per thread interpreters */
+ static PyThreadState* initNewInterp();
+ static void shutdown(PyThreadState* interp);
+
+ static bool loadScript(std::string name, bool check = false);
+ static std::string evalScript(std::string module, std::string function,
+ std::vector<std::string> args,
+ PyThreadState* interp);
+ static void evalScript(std::string function, SV3_1aPythonListener* listener,
+ ParserRuleContext* ctx);
+ static std::string getInvalidScriptString() { return m_invalidScriptResult; }
+ static bool isListenerLoaded() { return m_listenerLoaded; }
+ static std::string getListenerScript() { return m_listenerScript; }
+ static void setListenerScript(std::string script) {
+ m_listenerScript = script;
+ }
+ static bool evalScriptPerFile(std::string script, ErrorContainer* errors,
+ FileContent* fC, PyThreadState* interp);
+ static bool evalScript(std::string script, Design* design);
+ static void setStrictMode(bool mode) { m_strictMode = mode; }
+
+ private:
+ static void loadScriptsInInterp_();
+ static bool loadScript_(std::string name, bool check = false);
+ static std::string m_invalidScriptResult;
+ static PyThreadState* m_mainThreadState;
+ static std::string m_programPath;
+ static bool m_listenerLoaded;
+ static std::string m_listenerScript;
+ static bool m_strictMode;
};
-};
+}; // namespace SURELOG
#endif /* PYTHONAPI_H */
-
-
diff --git a/SVIncCompil/API/SLAPI.h b/SVIncCompil/API/SLAPI.h
index e85184f..8214a4b 100644
--- a/SVIncCompil/API/SLAPI.h
+++ b/SVIncCompil/API/SLAPI.h
@@ -1,12 +1,12 @@
/*
Copyright 2019 Alain Dargelas
-
+
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
-
+
http://www.apache.org/licenses/LICENSE-2.0
-
+
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -14,8 +14,7 @@
limitations under the License.
*/
-
-/*
+/*
* File: SLAPI.h
* Author: alain
*
@@ -27,7 +26,7 @@
typedef unsigned int NodeId;
namespace SURELOG {
-
+
class ModuleDefinition;
class FileContent;
class SV3_1aPythonListener;
@@ -43,20 +42,33 @@
typedef std::vector<unsigned int> UIntVector;
/* Error DB API */
-void SLsetWaiver(const char* messageId, const char* fileName = 0, unsigned int line = 0, const char* objectName = 0);
+void SLsetWaiver(const char* messageId, const char* fileName = 0,
+ unsigned int line = 0, const char* objectName = 0);
void SLoverrideSeverity(const char* messageId, const char* severity);
-void SLregisterNewErrorType(const char* messageId, const char* text, const char* secondLine);
+void SLregisterNewErrorType(const char* messageId, const char* text,
+ const char* secondLine);
-void SLaddError(ErrorContainer* container, const char* messageId, const char* fileName, unsigned int line, unsigned int col, const char* objectName);
+void SLaddError(ErrorContainer* container, const char* messageId,
+ const char* fileName, unsigned int line, unsigned int col,
+ const char* objectName);
-void SLaddErrorContext(SV3_1aPythonListener* prog, ParserRuleContext* context, const char* messageId, const char* objectName, bool printColumn = 0);
+void SLaddErrorContext(SV3_1aPythonListener* prog, ParserRuleContext* context,
+ const char* messageId, const char* objectName,
+ bool printColumn = 0);
-void SLaddMLErrorContext(SV3_1aPythonListener* prog, ParserRuleContext* context1, ParserRuleContext* context2, const char* messageId, const char* objectName1, const char* objectName2, bool printColumn = 0);
+void SLaddMLErrorContext(SV3_1aPythonListener* prog,
+ ParserRuleContext* context1,
+ ParserRuleContext* context2, const char* messageId,
+ const char* objectName1, const char* objectName2,
+ bool printColumn = 0);
-void SLaddMLError(ErrorContainer* container, const char* messageId, const char* fileName1, unsigned int line1, unsigned int col1, const char* objectName1,
- const char* fileName2, unsigned int line2, unsigned int col2, const char* objectName2);
+void SLaddMLError(ErrorContainer* container, const char* messageId,
+ const char* fileName1, unsigned int line1, unsigned int col1,
+ const char* objectName1, const char* fileName2,
+ unsigned int line2, unsigned int col2,
+ const char* objectName2);
/* File Listener API */
std::string SLgetFile(SV3_1aPythonListener* prog, ParserRuleContext* context);
@@ -67,11 +79,14 @@
std::string SLgetText(SV3_1aPythonListener* prog, ParserRuleContext* context);
-std::vector<std::string> SLgetTokens(SV3_1aPythonListener* prog, ParserRuleContext* context);
+std::vector<std::string> SLgetTokens(SV3_1aPythonListener* prog,
+ ParserRuleContext* context);
-ParserRuleContext* SLgetParentContext(SV3_1aPythonListener* prog, ParserRuleContext* context);
+ParserRuleContext* SLgetParentContext(SV3_1aPythonListener* prog,
+ ParserRuleContext* context);
-std::vector<ParserRuleContext*> SLgetChildrenContext(SV3_1aPythonListener* prog, ParserRuleContext* context);
+std::vector<ParserRuleContext*> SLgetChildrenContext(
+ SV3_1aPythonListener* prog, ParserRuleContext* context);
/* Parser API */
NodeId SLgetRootNode(FileContent* fC);
@@ -86,27 +101,38 @@
unsigned int SLgetLine(FileContent* fC, NodeId index);
-std::string SLgetName(FileContent* fC, NodeId index);
+std::string SLgetName(FileContent* fC, NodeId index);
unsigned int SLgetType(FileContent* fC, NodeId index);
-NodeId SLgetChild(FileContent* fC, NodeId parent, unsigned int type); // Get first child item of type
-
-NodeId SLgetParent(FileContent* fC, NodeId parent, unsigned int type); // Get first parent item of type
+NodeId SLgetChild(FileContent* fC, NodeId parent,
+ unsigned int type); // Get first child item of type
-UIntVector SLgetAll(FileContent* fC, NodeId parent, unsigned int type); // get all child items of type
-
-UIntVector SLgetAll(FileContent* fC, NodeId parent, UIntVector types); // get all child items of types
-
-NodeId SLcollect(FileContent* fC, NodeId parent, unsigned int type); // Recursively search for first item of type
-
-UIntVector SLcollectAll(FileContent* fC, NodeId parent, unsigned int type, bool first); // Recursively search for all items of type
-
-UIntVector SLcollectAll(FileContent* fC, NodeId parent, UIntVector types, bool first); // Recursively search for all items of types
-
-UIntVector SLcollectAll(FileContent* fC, NodeId parent, UIntVector types, UIntVector stopPoints, bool first);
- // Recursively search for all items of types
- // and stops at types stopPoints
+NodeId SLgetParent(FileContent* fC, NodeId parent,
+ unsigned int type); // Get first parent item of type
+
+UIntVector SLgetAll(FileContent* fC, NodeId parent,
+ unsigned int type); // get all child items of type
+
+UIntVector SLgetAll(FileContent* fC, NodeId parent,
+ UIntVector types); // get all child items of types
+
+NodeId SLcollect(
+ FileContent* fC, NodeId parent,
+ unsigned int type); // Recursively search for first item of type
+
+UIntVector SLcollectAll(
+ FileContent* fC, NodeId parent, unsigned int type,
+ bool first); // Recursively search for all items of type
+
+UIntVector SLcollectAll(
+ FileContent* fC, NodeId parent, UIntVector types,
+ bool first); // Recursively search for all items of types
+
+UIntVector SLcollectAll(FileContent* fC, NodeId parent, UIntVector types,
+ UIntVector stopPoints, bool first);
+// Recursively search for all items of types
+// and stops at types stopPoints
/* Design API */
unsigned int SLgetnModuleDefinition(Design* design);
@@ -176,33 +202,32 @@
NodeId SLgetProgramRootNode(Program* def);
-VObjectType SLgetInstanceType(ModuleInstance* instance);
+VObjectType SLgetInstanceType(ModuleInstance* instance);
-VObjectType SLgetInstanceModuleType(ModuleInstance* instance);
+VObjectType SLgetInstanceModuleType(ModuleInstance* instance);
-std::string SLgetInstanceName(ModuleInstance* instance);
+std::string SLgetInstanceName(ModuleInstance* instance);
-std::string SLgetInstanceFullPathName(ModuleInstance* instance);
+std::string SLgetInstanceFullPathName(ModuleInstance* instance);
-std::string SLgetInstanceModuleName(ModuleInstance* instance);
+std::string SLgetInstanceModuleName(ModuleInstance* instance);
DesignComponent* SLgetInstanceDefinition(ModuleInstance* instance);
-std::string SLgetInstanceFileName(ModuleInstance* instance);
+std::string SLgetInstanceFileName(ModuleInstance* instance);
-FileContent* SLgetInstanceFileContent(ModuleInstance* instance);
+FileContent* SLgetInstanceFileContent(ModuleInstance* instance);
-NodeId SLgetInstanceNodeId(ModuleInstance* instance);
+NodeId SLgetInstanceNodeId(ModuleInstance* instance);
-unsigned int SLgetInstanceLine(ModuleInstance* instance);
+unsigned int SLgetInstanceLine(ModuleInstance* instance);
-unsigned int SLgetnInstanceChildren(ModuleInstance* instance);
+unsigned int SLgetnInstanceChildren(ModuleInstance* instance);
-ModuleInstance* SLgetInstanceChildren(ModuleInstance* instance, unsigned int i);
+ModuleInstance* SLgetInstanceChildren(ModuleInstance* instance, unsigned int i);
-ModuleInstance* SLgetInstanceParent(ModuleInstance* instance);
+ModuleInstance* SLgetInstanceParent(ModuleInstance* instance);
-
-}
+} // namespace SURELOG
#endif
diff --git a/SVIncCompil/Cache/Cache.h b/SVIncCompil/Cache/Cache.h
index aa2947d..e8535b9 100644
--- a/SVIncCompil/Cache/Cache.h
+++ b/SVIncCompil/Cache/Cache.h
@@ -1,12 +1,12 @@
/*
Copyright 2019 Alain Dargelas
-
+
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
-
+
http://www.apache.org/licenses/LICENSE-2.0
-
+
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -14,7 +14,7 @@
limitations under the License.
*/
-/*
+/*
* File: Cache.h
* Author: alain
*
@@ -26,36 +26,42 @@
#include "flatbuffers/flatbuffers.h"
#include "header_generated.h"
-#include <cstdio> // For printing and file access.
+#include <cstdio> // For printing and file access.
namespace SURELOG {
class Cache {
-public:
- Cache();
- Cache(const Cache& orig);
- virtual ~Cache();
- time_t get_mtime(const char *path);
- std::string getExecutableTimeStamp();
- uint8_t* openFlatBuffers(std::string cacheFileName);
- bool saveFlatbuffers(flatbuffers::FlatBufferBuilder& builder, std::string cacheFileName);
- bool checkIfCacheIsValid(const SURELOG::CACHE::Header* header, std::string schemaVersion, std::string cacheFileName);
- const flatbuffers::Offset<SURELOG::CACHE::Header> createHeader(flatbuffers::FlatBufferBuilder& builder,
- std::string schemaVersion, std::string origFileName);
- std::pair<flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<SURELOG::CACHE::Error>>>,
- flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>>
- > cacheErrors(flatbuffers::FlatBufferBuilder& builder, SymbolTable& canonicalSymbols, ErrorContainer* errorContainer, SymbolTable* symbols, SymbolId subjectId);
- void restoreErrors(const flatbuffers::Vector<flatbuffers::Offset<SURELOG::CACHE::Error>>* errorsBuf,
- const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>* symbolBuf,
- SymbolTable& canonicalSymbols,
- ErrorContainer* errorContainer, SymbolTable* symbols);
+ public:
+ Cache();
+ Cache(const Cache& orig);
+ virtual ~Cache();
+ time_t get_mtime(const char* path);
+ std::string getExecutableTimeStamp();
+ uint8_t* openFlatBuffers(std::string cacheFileName);
+ bool saveFlatbuffers(flatbuffers::FlatBufferBuilder& builder,
+ std::string cacheFileName);
+ bool checkIfCacheIsValid(const SURELOG::CACHE::Header* header,
+ std::string schemaVersion,
+ std::string cacheFileName);
+ const flatbuffers::Offset<SURELOG::CACHE::Header> createHeader(
+ flatbuffers::FlatBufferBuilder& builder, std::string schemaVersion,
+ std::string origFileName);
+ std::pair<flatbuffers::Offset<flatbuffers::Vector<
+ flatbuffers::Offset<SURELOG::CACHE::Error>>>,
+ flatbuffers::Offset<
+ flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>>>
+ cacheErrors(flatbuffers::FlatBufferBuilder& builder,
+ SymbolTable& canonicalSymbols, ErrorContainer* errorContainer,
+ SymbolTable* symbols, SymbolId subjectId);
+ void restoreErrors(
+ const flatbuffers::Vector<flatbuffers::Offset<SURELOG::CACHE::Error>>*
+ errorsBuf,
+ const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>*
+ symbolBuf,
+ SymbolTable& canonicalSymbols, ErrorContainer* errorContainer,
+ SymbolTable* symbols);
};
-};
+}; // namespace SURELOG
#endif /* CACHE_H */
-
-
-
-
-
diff --git a/SVIncCompil/Cache/PPCache.h b/SVIncCompil/Cache/PPCache.h
index 018d062..491ea5e 100644
--- a/SVIncCompil/Cache/PPCache.h
+++ b/SVIncCompil/Cache/PPCache.h
@@ -1,12 +1,12 @@
/*
Copyright 2019 Alain Dargelas
-
+
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
-
+
http://www.apache.org/licenses/LICENSE-2.0
-
+
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -14,7 +14,7 @@
limitations under the License.
*/
-/*
+/*
* File: PPCache.h
* Author: alain
*
@@ -26,31 +26,27 @@
#include "flatbuffers/flatbuffers.h"
#include "preproc_generated.h"
-#include <cstdio> // For printing and file access.
+#include <cstdio> // For printing and file access.
#include "Cache.h"
namespace SURELOG {
class PPCache : Cache {
-public:
- PPCache(PreprocessFile* pp);
- PPCache(const PPCache& orig);
- bool restore();
- bool save();
- virtual ~PPCache();
-private:
- PreprocessFile* m_pp;
- std::string getCacheFileName_(std::string fileName = "");
- bool restore_(std::string cacheFileName);
- bool checkCacheIsValid_(std::string cacheFileName);
- bool m_isPrecompiled;
+ public:
+ PPCache(PreprocessFile* pp);
+ PPCache(const PPCache& orig);
+ bool restore();
+ bool save();
+ virtual ~PPCache();
+
+ private:
+ PreprocessFile* m_pp;
+ std::string getCacheFileName_(std::string fileName = "");
+ bool restore_(std::string cacheFileName);
+ bool checkCacheIsValid_(std::string cacheFileName);
+ bool m_isPrecompiled;
};
-};
+}; // namespace SURELOG
#endif /* PPCACHE_H */
-
-
-
-
-
diff --git a/SVIncCompil/Cache/ParseCache.h b/SVIncCompil/Cache/ParseCache.h
index bbbd343..6d8b714 100644
--- a/SVIncCompil/Cache/ParseCache.h
+++ b/SVIncCompil/Cache/ParseCache.h
@@ -1,12 +1,12 @@
/*
Copyright 2019 Alain Dargelas
-
+
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
-
+
http://www.apache.org/licenses/LICENSE-2.0
-
+
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -14,7 +14,7 @@
limitations under the License.
*/
-/*
+/*
* File: ParseCache.h
* Author: alain
*
@@ -24,36 +24,30 @@
#ifndef PARSECACHE_H
#define PARSECACHE_H
-
#include "flatbuffers/flatbuffers.h"
#include "parser_generated.h"
-#include <cstdio> // For printing and file access.
+#include <cstdio> // For printing and file access.
#include "Cache.h"
namespace SURELOG {
class ParseCache : Cache {
-public:
- ParseCache(ParseFile* pp);
- ParseCache(const ParseCache& orig);
- bool restore();
- bool save();
- bool isValid();
- virtual ~ParseCache();
-private:
- ParseFile* m_parse;
- std::string getCacheFileName_(std::string fileName = "");
- bool restore_(std::string cacheFileName);
- bool checkCacheIsValid_(std::string cacheFileName);
- bool m_isPrecompiled;
+ public:
+ ParseCache(ParseFile* pp);
+ ParseCache(const ParseCache& orig);
+ bool restore();
+ bool save();
+ bool isValid();
+ virtual ~ParseCache();
+
+ private:
+ ParseFile* m_parse;
+ std::string getCacheFileName_(std::string fileName = "");
+ bool restore_(std::string cacheFileName);
+ bool checkCacheIsValid_(std::string cacheFileName);
+ bool m_isPrecompiled;
};
-};
-
+}; // namespace SURELOG
#endif /* PARSECACHE_H */
-
-
-
-
-
diff --git a/SVIncCompil/Cache/PythonAPICache.h b/SVIncCompil/Cache/PythonAPICache.h
index b72cb7d..c377582 100644
--- a/SVIncCompil/Cache/PythonAPICache.h
+++ b/SVIncCompil/Cache/PythonAPICache.h
@@ -1,12 +1,12 @@
/*
Copyright 2019 Alain Dargelas
-
+
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
-
+
http://www.apache.org/licenses/LICENSE-2.0
-
+
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -14,7 +14,7 @@
limitations under the License.
*/
-/*
+/*
* File: PythonAPICache.h
* Author: alain
*
@@ -26,32 +26,27 @@
#include "flatbuffers/flatbuffers.h"
#include "python_api_generated.h"
-#include <cstdio>
+#include <cstdio>
#include "Cache.h"
namespace SURELOG {
class PythonAPICache : Cache {
-public:
- PythonAPICache(PythonListen* listener);
- PythonAPICache(const PythonAPICache& orig);
- bool restore();
- bool save();
- bool isValid();
- virtual ~PythonAPICache();
-private:
- PythonListen* m_listener;
- std::string getCacheFileName_(std::string fileName = "");
- bool restore_(std::string cacheFileName);
- bool checkCacheIsValid_(std::string cacheFileName);
+ public:
+ PythonAPICache(PythonListen* listener);
+ PythonAPICache(const PythonAPICache& orig);
+ bool restore();
+ bool save();
+ bool isValid();
+ virtual ~PythonAPICache();
+
+ private:
+ PythonListen* m_listener;
+ std::string getCacheFileName_(std::string fileName = "");
+ bool restore_(std::string cacheFileName);
+ bool checkCacheIsValid_(std::string cacheFileName);
};
-};
-
+}; // namespace SURELOG
#endif /* PYTHONAPICACHE_H */
-
-
-
-
-