Skip to content

Commit

Permalink
Tools - Add HEMTT SQF support (#1630)
Browse files Browse the repository at this point in the history
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
Co-authored-by: jonpas <jonpas33@gmail.com>
  • Loading branch information
3 people authored Dec 7, 2023
1 parent 44325fe commit 9220304
Show file tree
Hide file tree
Showing 39 changed files with 34 additions and 43 deletions.
7 changes: 2 additions & 5 deletions .hemtt/project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,11 @@ include = [
[version]
git_hash = 0

# Unused in HEMTT v1.11 or higher, kept for backwards compatibility
[asc]
enabled = true
exclude = [
"/initsettings.sqf",
"/initkeybinds.sqf",
"/xeh_prep.sqf",
"/backwards_comp.sqf",
"settings/gui_createcategory.sqf",
".inc.sqf",
"diagnostic/fnc_isdebugconsoleallowed.sqf",
"xeh/fnc_initdisplay.sqf",
"xeh/fnc_startloadingscreen.sqf",
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion addons/accessory/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

if (!hasInterface) exitWith {};

#include "XEH_PREP.sqf"
#include "XEH_PREP.hpp"

GVAR(usageHash) = createHashMap;

Expand Down
2 changes: 1 addition & 1 deletion addons/accessory/XEH_preStart.sqf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#include "script_component.hpp"

#include "XEH_PREP.sqf"
#include "XEH_PREP.hpp"
2 changes: 1 addition & 1 deletion addons/common/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ GVAR(addons) = call (uiNamespace getVariable [QGVAR(addons), {[]}]);
activateAddons GVAR(addons);

// BWC
#include "backwards_comp.sqf"
#include "backwards_comp.inc.sqf"

// fix changing direction of remote units not working with zeus
["ModuleCurator_F", "init", {
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions addons/diagnostic/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ LOG(MSG_INIT);

ADDON = false;

#include "XEH_PREP.sqf"
#include "initSettings.sqf"
#include "XEH_PREP.hpp"
#include "initSettings.inc.sqf"

[QGVAR(debug), {_this call CBA_fnc_debug}] call CBA_fnc_addEventHandler;

Expand Down
2 changes: 1 addition & 1 deletion addons/diagnostic/XEH_preStart.sqf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "script_component.hpp"

#include "XEH_PREP.sqf"
#include "XEH_PREP.hpp"

PREP(initExtendedDebugConsole);
PREP(initTargetDebugConsole);
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions addons/disposable/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

ADDON = false;

#include "initSettings.sqf"
#include "initSettings.inc.sqf"

if (configProperties [configFile >> "CBA_DisposableLaunchers"] isEqualTo []) exitWith {};

#include "XEH_PREP.sqf"
#include "XEH_PREP.hpp"

["loadout", {
params ["_unit"];
Expand Down
2 changes: 1 addition & 1 deletion addons/disposable/XEH_preStart.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ PREP(initDisplayInventory);

if (configProperties [configFile >> "CBA_DisposableLaunchers"] isEqualTo []) exitWith {};

#include "XEH_PREP.sqf"
#include "XEH_PREP.hpp"
File renamed without changes.
4 changes: 2 additions & 2 deletions addons/events/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ if (isServer) then {
};
};

#include "backwards_comp.sqf"
#include "initSettings.sqf"
#include "backwards_comp.inc.sqf"
#include "initSettings.inc.sqf"

ADDON = true;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion addons/keybinding/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SCRIPT(XEH_preInit);

if (!hasInterface) exitWith {};

#include "XEH_PREP.sqf"
#include "XEH_PREP.hpp"

ADDON = false;

Expand Down
2 changes: 1 addition & 1 deletion addons/keybinding/XEH_preStart.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

if (!hasInterface) exitWith {};

#include "XEH_PREP.sqf"
#include "XEH_PREP.hpp"

private _supportedKeys = [
DIK_ESCAPE,
Expand Down
2 changes: 1 addition & 1 deletion addons/network/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

ADDON = false;

#include "initSettings.sqf"
#include "initSettings.inc.sqf"

// Restore loadouts lost by the naked unit bug
[QGVAR(validateLoadout), {
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions addons/optics/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

ADDON = false;

#include "initSettings.sqf"
#include "initSettings.inc.sqf"

if (configProperties [configFile >> "CBA_PIPItems"] isEqualTo [] && {
configProperties [configFile >> "CBA_CarryHandleTypes"] isEqualTo []
}) exitWith {};

#include "XEH_PREP.sqf"
#include "XEH_PREP.hpp"

if (!hasInterface) exitWith {};

#include "initKeybinds.sqf"
#include "initKeybinds.inc.sqf"

QGVAR(pauseOpticLayer) cutText ["", "PLAIN"];

Expand Down
2 changes: 1 addition & 1 deletion addons/optics/XEH_preStart.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ if (configProperties [configFile >> "CBA_PIPItems"] isEqualTo [] && {
configProperties [configFile >> "CBA_CarryHandleTypes"] isEqualTo []
}) exitWith {};

#include "XEH_PREP.sqf"
#include "XEH_PREP.hpp"
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions addons/settings/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ADDON = false;

// Don't prep functions if already prepped by CBA_fnc_addSetting to avoid log spam.
if (isNil QFUNC(init)) then {
#include "XEH_PREP.sqf"
#include "XEH_PREP.hpp"
};

//#define DEBUG_MODE_FULL
Expand Down Expand Up @@ -42,7 +42,7 @@ if (isNil QFUNC(init)) then {
#endif

// --- init settings namespaces
#include "initSettings.sqf"
#include "initSettings.inc.sqf"

// --- event to refresh missionNamespace value if setting has changed and call public event as well as execute setting script
[QGVAR(refreshSetting), {
Expand Down
2 changes: 1 addition & 1 deletion addons/settings/XEH_preStart.sqf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "script_component.hpp"

#include "XEH_PREP.sqf"
#include "XEH_PREP.hpp"

PREP(initDisplayMain);

Expand Down
2 changes: 1 addition & 1 deletion addons/settings/fnc_addSetting.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Author:

// Prep functions if not yet prepped to avoid race condition.
if (isNil QFUNC(init)) then {
#include "XEH_PREP.sqf"
#include "XEH_PREP.hpp"
};

call FUNC(init) == 0
2 changes: 1 addition & 1 deletion addons/settings/fnc_gui_addonChanged.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ uiNamespace setVariable [QGVAR(addonIndex), _index];
private _selectedSource = uiNamespace getVariable QGVAR(source);

if !(_display getVariable [_selectedAddon, false]) then {
#include "gui_createCategory.sqf"
#include "gui_createCategory.inc.sqf"
_display setVariable [_selectedAddon, true];
};

Expand Down
2 changes: 1 addition & 1 deletion addons/settings/fnc_init.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ if (canSuspend) exitWith {
};

// --- init settings system, makes this function useable in preInit without having to add "CBA_settings" to requiredAddons
#include "initSettings.sqf"
#include "initSettings.inc.sqf"

params [
["_setting", "", [""]],
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion addons/ui/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

ADDON = false;

#include "initSettings.sqf"
#include "initSettings.inc.sqf"

if (hasInterface) then {
call COMPILE_FILE(flexiMenu\init);
Expand Down
File renamed without changes.
6 changes: 1 addition & 5 deletions sqfc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
"P:/"
],
"excludeList": [
"\\initsettings.sqf",
"\\initkeybinds.sqf",
"\\xeh_prep.sqf",
"\\backwards_comp.sqf",
"settings\\gui_createcategory.sqf",
".inc.sqf",
"diagnostic\\fnc_isdebugconsoleallowed.sqf",
"xeh\\fnc_initdisplay.sqf",
"xeh\\fnc_startloadingscreen.sqf",
Expand Down
14 changes: 6 additions & 8 deletions tools/sqfvmChecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
addon_base_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))

files_to_ignore_lower = [
x.lower() for x in ["initSettings.sqf", "initKeybinds.sqf", "XEH_PREP.sqf", "backwards_comp.sqf", "gui_createCategory.sqf", "test_settings_comments.sqf", "test_settings_comments_eof.sqf", "test_settings_multiline.sqf", "test_settings_regular.sqf", "test_settings_unicode.sqf"]
x.lower() for x in ["test_settings_comments.sqf", "test_settings_comments_eof.sqf", "test_settings_multiline.sqf", "test_settings_regular.sqf", "test_settings_unicode.sqf"]
]
sqfvm_exe = os.path.join(addon_base_path, "sqfvm.exe")
virtual_paths = [
Expand All @@ -23,15 +23,15 @@ def get_files_to_process(basePath):
for root, _dirs, files in os.walk(os.path.join(addon_base_path, "addons")):
for file in files:
if file.endswith(".sqf") or file == "config.cpp":
if file.lower() in files_to_ignore_lower:
if file.endswith(".inc.sqf") or file.lower() in files_to_ignore_lower:
continue
skipPreprocessing = False
for addonTomlPath in [os.path.join(root, "addon.toml"), os.path.join(os.path.dirname(root), "addon.toml")]:
if os.path.isfile(addonTomlPath):
with open(addonTomlPath, "rb") as f:
tomlFile = tomllib.load(f)
try:
skipPreprocessing = not tomlFile.get('rapify')['enabled']
skipPreprocessing = tomlFile.get('tools')['sqfvm_skipConfigChecks']
except:
pass
if file == "config.cpp" and skipPreprocessing:
Expand All @@ -41,7 +41,7 @@ def get_files_to_process(basePath):
return arma_files


def process_file(filePath, skipA3Warnings=True):
def process_file(filePath, skipA3Warnings=True, skipPragmaHemtt=True):
with open(filePath, "r", encoding="utf-8", errors="ignore") as file:
content = file.read()
if content.startswith("//pragma SKIP_COMPILE"):
Expand Down Expand Up @@ -70,10 +70,8 @@ def process_file(filePath, skipA3Warnings=True):
if line.startswith("[ERR]"):
fileHasError = True
if not (
skipA3Warnings
and line.startswith("[WRN]")
and ("a3/" in line)
and (("Unexpected IFDEF" in line) or ("defined twice" in line))
(skipA3Warnings and line.startswith("[WRN]") and ("a3/" in line) and (("Unexpected IFDEF" in line) or ("defined twice" in line)))
or (skipPragmaHemtt and line.startswith("[WRN]") and ("Unknown pragma instruction 'hemtt'" in line))
):
print(" {}".format(line))
return fileHasError
Expand Down

0 comments on commit 9220304

Please sign in to comment.