added REMOVE_SPF pass

This commit is contained in:
ALEXks
2025-03-18 09:37:20 +03:00
parent 43dfc2368a
commit d58227bd0c
10 changed files with 63 additions and 93 deletions

View File

@@ -273,11 +273,11 @@ void InitPassesDependencies(map<passes, vector<passes>> &passDepsIn, set<passes>
Pass(REVERT_SUBST_EXPR_RD) <= list({ PURE_SAVE_TO_PARAMS, PURE_MODULE_TO_PARAMS, PURE_COMMON_TO_PARAMS, PURE_INTENT_INSERT });
list({ CORRECT_VAR_DECL, REVERT_SUBST_EXPR_RD, VERIFY_INCLUDES }) <= list({ CONVERT_TO_ENDDO, CORRECT_CODE_STYLE, REMOVE_DVM_DIRS, REMOVE_DVM_DIRS_TO_COMMENTS, REMOVE_DVM_INTERVALS });
list({ CORRECT_VAR_DECL, REVERT_SUBST_EXPR_RD, VERIFY_INCLUDES }) <= list({ CONVERT_TO_ENDDO, CORRECT_CODE_STYLE, REMOVE_DVM_DIRS, REMOVE_DVM_DIRS_TO_COMMENTS, REMOVE_SPF_DIRS, REMOVE_DVM_INTERVALS });
list({ CALL_GRAPH2, CONVERT_LOOP_TO_ASSIGN, REVERT_SUBST_EXPR_RD, RESTORE_LOOP_FROM_ASSIGN }) <= Pass(INLINE_PROCEDURES);
list({ CONVERT_LOOP_TO_ASSIGN, CORRECT_FORMAT_PLACE }) <= list({ CONVERT_TO_ENDDO, CORRECT_CODE_STYLE, INSERT_INCLUDES, REMOVE_DVM_DIRS, REMOVE_DVM_DIRS_TO_COMMENTS, REMOVE_DVM_INTERVALS });
list({ CONVERT_LOOP_TO_ASSIGN, CORRECT_FORMAT_PLACE }) <= list({ CONVERT_TO_ENDDO, CORRECT_CODE_STYLE, INSERT_INCLUDES, REMOVE_DVM_DIRS, REMOVE_DVM_DIRS_TO_COMMENTS, REMOVE_SPF_DIRS, REMOVE_DVM_INTERVALS });
list({ CORRECT_VAR_DECL, REVERT_SUBST_EXPR_RD }) <= list({ INSERT_INCLUDES, UNPARSE_FILE, SET_TO_ALL_DECL_INIT_ZERO });

View File

@@ -556,7 +556,7 @@ string renameInclude(const string& inc)
void copyIncludes(const set<string> &allIncludeFiles, const map<string, map<int, set<string>>> &commentsToInclude,
const map<string, map<int, set<string>>>& newCopyDeclToIncl,
const char *folderName, bool keepSpfDirs, bool isFreeStyle, bool isRename,
int removeDvmDirs)
int removeDirs)
{
for (auto &include : allIncludeFiles)
{
@@ -601,18 +601,24 @@ void copyIncludes(const set<string> &allIncludeFiles, const map<string, map<int,
bufStr = "\n";
}
//remove DVM dirs or save DVM dirs as comment
if (removeDvmDirs == 1 || removeDvmDirs == 2)
if (removeDirs == 1 || removeDirs == 2)
{
if (bufStr[0] == '!' || bufStr[0] == 'c')
{
if (bufStr[1] == 'd' && bufStr[2] == 'v' && bufStr[3] == 'm' && bufStr[4] == '$')
{
if (removeDvmDirs == 1)
if (removeDirs == 1)
bufStr = "";
else if (removeDvmDirs == 2)
else if (removeDirs == 2)
bufStr.insert(1, " ");
}
}
} //remove SPF dirs
else if (removeDirs == 3)
{
if (bufStr[0] == '!' || bufStr[0] == 'c')
if (bufStr[1] == '$' && bufStr[2] == 's' && bufStr[3] == 'p' && bufStr[4] == 'f')
bufStr = "";
}
// save original include name

View File

@@ -34,7 +34,7 @@ std::wstring to_wstring(const std::string);
void convertBuffers(short*& resultM, int*& resultSizeM, short*& result, int*& resultSize);
void clearGlobalMessagesBuffer();
std::string renameInclude(const std::string& inc);
void copyIncludes(const std::set<std::string> &allIncludeFiles, const std::map<std::string, std::map<int, std::set<std::string>>> &commentsToInclude, const std::map<std::string, std::map<int, std::set<std::string>>>& newCopyDeclToIncl, const char *folderName, bool keepSpfDirs, bool isFreeStyle, bool isRename, int removeDvmDirs = 0);
void copyIncludes(const std::set<std::string> &allIncludeFiles, const std::map<std::string, std::map<int, std::set<std::string>>> &commentsToInclude, const std::map<std::string, std::map<int, std::set<std::string>>>& newCopyDeclToIncl, const char *folderName, bool keepSpfDirs, bool isFreeStyle, bool isRename, int removeDirs = 0);
std::string splitDirective(const std::string &in);
std::string splitDirectiveFull(const std::string &in_);

View File

@@ -1,3 +1,3 @@
#pragma once
#define VERSION_SPF "2397"
#define VERSION_SPF "2398"