i += 1
target_ext = sys.argv[i]
+backport_ext = None
out_base = None
if target_ext.endswith(".glext"):
fn = target_ext
core_version = parts[2]
elif parts[0]=="secondary":
secondary.append(parts[1])
+ elif parts[0]=="backport":
+ backport_ext = parts[1]
if i+1<len(sys.argv):
out_base = os.path.splitext(sys.argv[i+1])[0]
else:
core_version = secondary.pop(0)
ext_type = target_ext.split('_')[0]
-backport_ext = None
if core_version:
core_version = map(int, core_version.split('.'))
def __init__(self, name):
self.name = name
self.supported_apis = []
- self.ext_type = name[0:name.find('_')]
+ underscore = name.find('_')
+ self.ext_type = name[0:underscore]
+ self.base_name = name[underscore+1:]
extensions = {}
things = {}
enums.sort(key=(lambda e: e.value))
# Some final preparations for creating the files
+backport_ext_candidates = []
for t in itertools.chain(funcs, enums):
if target_api in t.supported_apis and t.supported_apis[target_api]!="ext":
t.version = t.supported_apis[target_api]
# Things in backport extensions don't acquire an extension suffix
if t.extension and not t.name.endswith(ext_type) and target_api in t.supported_apis:
- backport_ext = t.extension
+ if t.extension not in backport_ext_candidates:
+ backport_ext_candidates.append(t.extension)
+
+if backport_ext:
+ if backport_ext=="none":
+ backport_ext = None
+ else:
+ backport_ext = extensions[backport_ext]
+
+ if backport_ext not in backport_ext_candidates:
+ print "Warning: explicitly specified backport extension %s does not look like a backport extension"
+elif backport_ext_candidates:
+ if len(backport_ext_candidates)>1:
+ print "Warning: multiple backport extension candidates: %s"%(" ".join(e.name for e in backport_ext_candidates))
+
+ for e in backport_ext_candidates:
+ if e.base_name==target_ext.base_name:
+ backport_ext = e
+
+ if not backport_ext and len(backport_ext_candidates)==1:
+ print "Warning: potential backport extension has mismatched name: %s"%backport_ext_candidates[0].name
for f in funcs:
f.typedef = "FPtr_%s"%f.name