diff --git a/scripts/generate_oxr_ext_support.py b/scripts/generate_oxr_ext_support.py index 40137f795..752fea21e 100755 --- a/scripts/generate_oxr_ext_support.py +++ b/scripts/generate_oxr_ext_support.py @@ -5,6 +5,28 @@ from pathlib import Path +def _add_defined(s): + if "defined" in s: + return s + return "defined({})".format(s) + +def or_(*args): + """ + Create an "OR" in the definition condition list. + + Takes any number of strings directly or through e.g. "not_". + """ + return "({})".format(" || ".join(_add_defined(s) for s in args)) + + +def not_(s): + """ + Create a "NOT" in the condition list. + + Takes a single string, directly or through e.g. "or_". + """ + return "(!{})".format(_add_defined(s)) + # Each extension that we implement gets an entry in this tuple. # Each entry should be a list of defines that are checked for an extension: # the first one must be the name of the extension itself. @@ -42,30 +64,6 @@ EXTENSIONS = ( ) -def or_(*args): - """ - Create an "OR" in the definition condition list. - - Takes any number of strings directly or through e.g. "not_". - """ - return "({})".format(" || ".join(_add_defined(s) for s in args)) - - -def not_(s): - """ - Create a "NOT" in the condition list. - - Takes a single string, directly or through e.g. "or_". - """ - return "(!{})".format(_add_defined(s)) - - -def _add_defined(s): - if "defined" in s: - return s - return "defined({})".format(s) - - ROOT = Path(__file__).resolve().parent.parent FN = ROOT / 'src' / 'xrt'/'state_trackers' / 'oxr' / 'oxr_extension_support.h'