From 2a3fe621a0177dac456a366c54ac85e51ba3c7b8 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 28 Oct 2023 15:35:33 -0500 Subject: [PATCH 1/3] Configs - Cleanup for hemtt macro padding check --- addons/common/Cfg3DEN.hpp | 6 ++---- addons/diagnostic/gui.hpp | 4 ++-- addons/optics/RscInGameUI.hpp | 2 +- addons/settings/gui.hpp | 3 +-- addons/ui/RscTitles.hpp | 18 +++++++++--------- addons/ui/flexiMenu/data/menu_arma2.hpp | 1 + addons/ui/flexiMenu/data/menu_buttonList.hpp | 1 + addons/ui/flexiMenu/data/menu_iconRow.hpp | 1 + addons/ui/flexiMenu/data/menu_popup.hpp | 1 + addons/ui/flexiMenu/data/menu_rose.hpp | 1 + include/a3/ui_f/hpp/defineDIKCodes.inc | 3 +++ tools/make.py | 20 ++++++++++++++++++++ 12 files changed, 43 insertions(+), 18 deletions(-) diff --git a/addons/common/Cfg3DEN.hpp b/addons/common/Cfg3DEN.hpp index e82a7b55b3..883508cb33 100644 --- a/addons/common/Cfg3DEN.hpp +++ b/addons/common/Cfg3DEN.hpp @@ -15,8 +15,7 @@ class Cfg3DEN { for '_y' from 1900 to 2050 do {\ _ctrlYear lbSetValue [ARR_2(_ctrlYear lbAdd str _y,_y)];\ };\ - _ctrlYear lbSetCurSel 53;\ - ); + _ctrlYear lbSetCurSel 53;); }; }; }; @@ -32,8 +31,7 @@ class Cfg3DEN { _this setGroupID [ARR_1(_value)];\ } else {\ [ARR_2(_this,_value)] call CBA_fnc_setCallsign;\ - };\ - ); + };); }; }; }; diff --git a/addons/diagnostic/gui.hpp b/addons/diagnostic/gui.hpp index ff7f0d8fc6..c72bfa8e47 100644 --- a/addons/diagnostic/gui.hpp +++ b/addons/diagnostic/gui.hpp @@ -14,8 +14,8 @@ class RscTitles { idc = -1; font = "RobotoCondensedBold"; sizeEx = QUOTE(0.55 * GUI_GRID_CENTER_H); - x = QUOTE( 0 * GUI_GRID_CENTER_W + GUI_GRID_CENTER_X); - y = QUOTE( 5 * GUI_GRID_CENTER_H + GUI_GRID_CENTER_Y); + x = QUOTE(0 * GUI_GRID_CENTER_W + GUI_GRID_CENTER_X); + y = QUOTE(5 * GUI_GRID_CENTER_H + GUI_GRID_CENTER_Y); w = QUOTE(40 * GUI_GRID_CENTER_W); h = QUOTE(10 * GUI_GRID_CENTER_H); colorBackground[] = {1,0.2,0,0.8}; diff --git a/addons/optics/RscInGameUI.hpp b/addons/optics/RscInGameUI.hpp index 71d02eb0d2..c5fbd29efe 100644 --- a/addons/optics/RscInGameUI.hpp +++ b/addons/optics/RscInGameUI.hpp @@ -10,7 +10,7 @@ class RscInGameUI { }; class CBA_ScriptedOptic: RscWeaponZeroing { - onLoad = QUOTE([ARR_2(_this select 0, true)] call FUNC(loadScriptedOptic)); + onLoad = QUOTE([ARR_2(_this select 0,true)] call FUNC(loadScriptedOptic)); controls[] = {"CA_FOVMode","ScopeBlack","Reticle","BodyNight","BodyDay","TrippleHeadLeft","TrippleHeadRight","CA_Zeroing","Magnification","ActiveDisplayHelper"}; // Idea by Taosenai. This control can be used to determine whether the scope or the collimator is used. diff --git a/addons/settings/gui.hpp b/addons/settings/gui.hpp index a5eb4aef7c..39f34fce62 100644 --- a/addons/settings/gui.hpp +++ b/addons/settings/gui.hpp @@ -653,8 +653,7 @@ class RscDisplayEmpty; class GVAR(MainMenuHelper): RscDisplayEmpty { onLoad = QUOTE(\ (_this select 0) call FUNC(openSettingsMenu);\ - (_this select 0) closeDisplay 0;\ - ); + (_this select 0) closeDisplay 0;); }; class GVAR(export) { diff --git a/addons/ui/RscTitles.hpp b/addons/ui/RscTitles.hpp index 9811952828..5074d10b1b 100644 --- a/addons/ui/RscTitles.hpp +++ b/addons/ui/RscTitles.hpp @@ -1,6 +1,6 @@ class RscTitles { class GVAR(ProgressBar) { - onLoad = QUOTE(with uiNameSpace do { GVAR(ProgressBar) = _this select 0 }; ); + onLoad = QUOTE(with uiNameSpace do { GVAR(ProgressBar) = _this select 0 };); idd = -1; duration = 1e+11; fadeIn = 0; @@ -21,10 +21,10 @@ class RscTitles { style = ST_CENTER; sizeEx = QUOTE(1 * GUI_GRID_CENTER_H); colorBackground[] = {0,0,0,0.5}; - x = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),X))), 0)]); - y = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),Y))), 0)]); - w = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),W))), 0)]); - h = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),H))), 0)]); + x = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),X))),0)]); + y = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),Y))),0)]); + w = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),W))),0)]); + h = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),H))),0)]); }; class TitleText: TitleBackground { @@ -38,10 +38,10 @@ class RscTitles { colorFrame[] = {0,0,0,0.5}; colorBar[] = GUI_BCG_COLOR; texture = "#(argb,8,8,3)color(1,1,1,0.7)"; - x = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),X))), 0)]); - y = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),Y))), 0)]); - w = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),W))), 0)]); - h = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),H))), 0)]); + x = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),X))),0)]); + y = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),Y))),0)]); + w = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),W))),0)]); + h = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),H))),0)]); }; class Script: RscMapControl { diff --git a/addons/ui/flexiMenu/data/menu_arma2.hpp b/addons/ui/flexiMenu/data/menu_arma2.hpp index 289b768b76..e3229b2282 100644 --- a/addons/ui/flexiMenu/data/menu_arma2.hpp +++ b/addons/ui/flexiMenu/data/menu_arma2.hpp @@ -1,4 +1,5 @@ //#include "..\..\script_component.hpp" +#pragma hemtt suppress pw3_padded_arg file #define _DefaultAspectRatio 3 / 4 #define _SX (safeZoneX+safeZoneW / 2) // screen centre x diff --git a/addons/ui/flexiMenu/data/menu_buttonList.hpp b/addons/ui/flexiMenu/data/menu_buttonList.hpp index edaa635925..2f1beb1c22 100644 --- a/addons/ui/flexiMenu/data/menu_buttonList.hpp +++ b/addons/ui/flexiMenu/data/menu_buttonList.hpp @@ -1,4 +1,5 @@ //#include "..\..\script_component.hpp" +#pragma hemtt suppress pw3_padded_arg file #define _imagePath(TOKEN) QUOTE(PATHTOF(flexiMenu)\data\buttonList\TOKEN.paa) #define _SX (safeZoneX + safeZoneW / 2) // screen centre x diff --git a/addons/ui/flexiMenu/data/menu_iconRow.hpp b/addons/ui/flexiMenu/data/menu_iconRow.hpp index 85b12be226..f377e00752 100644 --- a/addons/ui/flexiMenu/data/menu_iconRow.hpp +++ b/addons/ui/flexiMenu/data/menu_iconRow.hpp @@ -1,4 +1,5 @@ //#include "..\..\script_component.hpp" +#pragma hemtt suppress pw3_padded_arg file #define _imagePath(TOKEN) QUOTE(PATHTOF(flexiMenu)\data\arma2\TOKEN.paa) #define _SX (safeZoneX + safeZoneW / 2) // screen centre x diff --git a/addons/ui/flexiMenu/data/menu_popup.hpp b/addons/ui/flexiMenu/data/menu_popup.hpp index b1295ffbc5..2369f9b1c9 100644 --- a/addons/ui/flexiMenu/data/menu_popup.hpp +++ b/addons/ui/flexiMenu/data/menu_popup.hpp @@ -1,4 +1,5 @@ // #include "..\..\script_component.hpp" +#pragma hemtt suppress pw3_padded_arg file #define _imagePath(TOKEN) QUOTE(PATHTOF(flexiMenu)\data\popup\TOKEN.paa) #define _SX (safeZoneX + safeZoneW / 2) //screen centre x diff --git a/addons/ui/flexiMenu/data/menu_rose.hpp b/addons/ui/flexiMenu/data/menu_rose.hpp index 7cd947d626..8a8558c44d 100644 --- a/addons/ui/flexiMenu/data/menu_rose.hpp +++ b/addons/ui/flexiMenu/data/menu_rose.hpp @@ -1,5 +1,6 @@ //#define DEBUG_MODE_FULL //#include "..\..\script_component.hpp" +#pragma hemtt suppress pw3_padded_arg file #define _DefaultAspectRatio 3 / 4 #define _SX (safeZoneX + safeZoneW / 2) //screen centre x diff --git a/include/a3/ui_f/hpp/defineDIKCodes.inc b/include/a3/ui_f/hpp/defineDIKCodes.inc index c641d60132..6b95ebc056 100644 --- a/include/a3/ui_f/hpp/defineDIKCodes.inc +++ b/include/a3/ui_f/hpp/defineDIKCodes.inc @@ -1,3 +1,6 @@ +#pragma hemtt suppress pw3_padded_arg file +#pragma hemtt suppress pw3_padded_arg config + #ifndef DIK_ESCAPE /**************************************************************************** diff --git a/tools/make.py b/tools/make.py index e373247a04..fc0e81fe50 100644 --- a/tools/make.py +++ b/tools/make.py @@ -473,6 +473,21 @@ def cleanup_optionals(mod): print_error("Cleaning Optionals Failed") raise +# mikro tools (before 2023?) don't understand #pragma +def toggle_config_pragmas(do_restore=False): + token_from = "//#pragma-backup-make.py " if do_restore else "#pragma " + token_to = "#pragma " if do_restore else "//#pragma-backup-make.py " + print_green(f"Checking configs for {token_from}") + for root, _dirs, files in os.walk(module_root): + for file in files: + if file.endswith(".cpp") or file.endswith(".hpp"): + with open(os.path.join(root, file), "r", encoding="utf-8") as f: + content = f.read() + if (not token_from in content): continue + print(f"- Replacing {token_from} in {os.path.join(root, file)}") + content = re.sub(token_from, token_to, content) + with open(os.path.join(root, file), "w", encoding="utf-8") as f: + f.write(content) def purge(dir, pattern, friendlyPattern="files"): print_green("Deleting {} files from directory: {}".format(friendlyPattern,dir)) @@ -1105,6 +1120,9 @@ def main(argv): optional_files = [] copy_optionals_for_building(optionals_modules,optional_files) + # hide #pragma from pboProject's sensitive eyes + toggle_config_pragmas(False) + # Get list of subdirs in make root. dirs = next(os.walk(module_root))[1] @@ -1446,6 +1464,8 @@ def main(argv): copy_important_files(module_root_parent,os.path.join(release_dir, project)) if (os.path.isdir(optionals_root)): cleanup_optionals(optionals_modules) + #restore #pragma + toggle_config_pragmas(True) if not version_update: restore_version_files() From 6f2a13b6ec678957bfa6cfb2bafbe15804417f77 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 28 Oct 2023 19:08:28 -0500 Subject: [PATCH 2/3] put suppression on use instead of on define --- addons/events/config.cpp | 1 + include/a3/ui_f/hpp/defineDIKCodes.inc | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/addons/events/config.cpp b/addons/events/config.cpp index 7feefddd8e..61c9ffa9c2 100644 --- a/addons/events/config.cpp +++ b/addons/events/config.cpp @@ -1,4 +1,5 @@ #include "script_component.hpp" +#pragma hemtt suppress pw3_padded_arg config class CfgPatches { class ADDON { diff --git a/include/a3/ui_f/hpp/defineDIKCodes.inc b/include/a3/ui_f/hpp/defineDIKCodes.inc index 6b95ebc056..c641d60132 100644 --- a/include/a3/ui_f/hpp/defineDIKCodes.inc +++ b/include/a3/ui_f/hpp/defineDIKCodes.inc @@ -1,6 +1,3 @@ -#pragma hemtt suppress pw3_padded_arg file -#pragma hemtt suppress pw3_padded_arg config - #ifndef DIK_ESCAPE /**************************************************************************** From b031ff3c58314918ac550fded178feaaba83c33f Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 28 Oct 2023 19:10:37 -0500 Subject: [PATCH 3/3] suppress line supports multi-line macros --- addons/events/config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/events/config.cpp b/addons/events/config.cpp index 61c9ffa9c2..f1c36854a8 100644 --- a/addons/events/config.cpp +++ b/addons/events/config.cpp @@ -1,5 +1,4 @@ #include "script_component.hpp" -#pragma hemtt suppress pw3_padded_arg config class CfgPatches { class ADDON { @@ -19,6 +18,7 @@ class CfgPatches { #include "CfgFunctions.hpp" class RscDisplayChat { +#pragma hemtt suppress pw3_padded_arg line onKeyDown = QUOTE(\ if ((_this select 1) in [ARR_2(DIK_RETURN,DIK_NUMPADENTER)]) then {\ [ARR_2('GVAR(chatMessageSent)',[ARR_2(ctrlText ((_this select 0) displayctrl 101),_this select 0)])] call CBA_fnc_localEvent;\