Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add macros 'PATHTO_FNC ' and 'RECOMPILE' #475

Merged
merged 7 commits into from
Aug 31, 2016
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion addons/main/script_macros_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ Macro: MAP()
/* -------------------------------------------
Macro: FILTER()
Description:
Filters an array based on given code, then assigns the resulting array
Filters an array based on given code, then assigns the resulting array
to the original
Parameters:
ARRAY - Array to be filtered
Expand Down Expand Up @@ -796,6 +796,17 @@ Macro: GVARMAIN()
#define PREPMAIN(var1) ['PATHTO_SYS(PREFIX,COMPONENT_F,DOUBLES(fnc,var1))', 'TRIPLES(PREFIX,fnc,var1)'] call SLX_XEH_COMPILE_NEW
#endif

#ifdef RECOMPILE
#define RECOMPILE recompile = 1
Copy link
Contributor

@commy2 commy2 Aug 21, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this work with Mikero's Tools? I think they error out now when trying to redefine a macro in config space.
At least when using make.py (binarizing)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add #undef to keep the macro parsers happy

#else
#define RECOMPILE recompile = 0
#endif

#define F_FILEPATH(func) class func {\
file = QUOTE(PATHTOF(DOUBLES(fnc,func).sqf));\ // \MAINPREFIX\PREFIX\SUBPREFIX\COMPONENT\fnc_func.sqf
Copy link
Contributor

@commy2 commy2 Aug 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should use a function (macro) header for explaining the usage instead of having in code comments:

/* -------------------------------------------
Macro: PATHTO_FNC()

Description:
    Defines a function inside CfgFunctions.

    Full file path in addons:
        '\MAINPREFIX\PREFIX\SUBPREFIX\COMPONENT\fnc_<FNC>.sqf'
    Define 'RECOMPILE' to enable recompiling.

Parameters:
    FUNCTION NAME - Name of the function, unquoted <STRING>

Examples:
    (begin example)
        // file name: fnc_addPerFrameHandler.sqf
        class CfgFunctions {
            class CBA {
                class Misc {
                    PATHTO_FNC(addPerFrameHandler);
                };
            };
        };
        // -> CBA_fnc_addPerFrameHandler
    (end)

Author:
    dixon13, commy2
 ------------------------------------------- */

Or something like that.

RECOMPILE;\
}

#define FUNC(var1) TRIPLES(ADDON,fnc,var1)
#define FUNCMAIN(var1) TRIPLES(PREFIX,fnc,var1)
#define FUNC_INNER(var1,var2) TRIPLES(DOUBLES(PREFIX,var1),fnc,var2)
Expand Down
6 changes: 3 additions & 3 deletions tools/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ def main():
failed = 0
skipped = 0
removed = 0

for file in os.listdir(addonspath):
if os.path.isfile(file):
if check_for_obsolete_pbos(addonspath, file):
removed += 1
print(" Removing obsolete file => " + file)
os.remove(file)
print("")
print("")

for p in os.listdir(addonspath):
path = os.path.join(addonspath, p)
if not os.path.isdir(path):
Expand Down