check.py : Add iOS support. Fix header import.
This commit is contained in:
parent
0e60d8a11c
commit
e6d55d2426
1 changed files with 11 additions and 2 deletions
13
check.py
13
check.py
|
@ -22,6 +22,7 @@ mappings_dict = OrderedDict([
|
||||||
("Mac OS X", {}),
|
("Mac OS X", {}),
|
||||||
("Linux", {}),
|
("Linux", {}),
|
||||||
("Android", {}),
|
("Android", {}),
|
||||||
|
("iOS", {}),
|
||||||
])
|
])
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
@ -243,8 +244,10 @@ def import_header(filepath):
|
||||||
OSX = 2
|
OSX = 2
|
||||||
LINUX = 3
|
LINUX = 3
|
||||||
ANDROID = 4
|
ANDROID = 4
|
||||||
NONE = 5
|
IOS = 5
|
||||||
|
NONE = 6
|
||||||
|
|
||||||
|
global mappings_dict # { "platform": { "guid": Mapping }}
|
||||||
current_platform = Platform.NONE
|
current_platform = Platform.NONE
|
||||||
|
|
||||||
input_file = open(filepath, mode="r")
|
input_file = open(filepath, mode="r")
|
||||||
|
@ -264,6 +267,9 @@ def import_header(filepath):
|
||||||
elif "#if defined(__ANDROID__)" in line:
|
elif "#if defined(__ANDROID__)" in line:
|
||||||
current_platform = Platform.ANDROID
|
current_platform = Platform.ANDROID
|
||||||
continue
|
continue
|
||||||
|
elif "#if defined(SDL_JOYSTICK_MFI)" in line:
|
||||||
|
current_platform = Platform.IOS
|
||||||
|
continue
|
||||||
elif "#endif" in line:
|
elif "#endif" in line:
|
||||||
current_platform = Platform.NONE
|
current_platform = Platform.NONE
|
||||||
continue
|
continue
|
||||||
|
@ -284,8 +290,10 @@ def import_header(filepath):
|
||||||
mapping_string += "platform:Linux,"
|
mapping_string += "platform:Linux,"
|
||||||
if current_platform == Platform.ANDROID:
|
if current_platform == Platform.ANDROID:
|
||||||
mapping_string += "platform:Android,"
|
mapping_string += "platform:Android,"
|
||||||
|
if current_platform == Platform.IOS:
|
||||||
|
mapping_string += "platform:iOS,"
|
||||||
|
|
||||||
# print(mapping_string)
|
print(mapping_string)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
mapping = Mapping(mapping_string, lineno + 1)
|
mapping = Mapping(mapping_string, lineno + 1)
|
||||||
|
@ -295,6 +303,7 @@ def import_header(filepath):
|
||||||
print("Ignoring mapping")
|
print("Ignoring mapping")
|
||||||
print(line)
|
print(line)
|
||||||
continue
|
continue
|
||||||
|
mappings_dict[mapping.platform][mapping.guid] = mapping
|
||||||
input_file.close()
|
input_file.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue