change split.py to output extern vars/functions into generate CPP (#98)

* change split.py to output extern vars/functions into generate CPP
also change demangling to use short type names

* don't take files for extern funcs/vars anymore

Co-authored-by: Pheenoh <pheenoh@gmail.com>
This commit is contained in:
lepelog
2021-01-25 20:09:55 +01:00
committed by GitHub
parent ec9b03241d
commit d301beca77
2 changed files with 25 additions and 52 deletions
+16 -5
View File
@@ -10,14 +10,21 @@ types = {
'l': 'long',
's': 'short',
'c': 'char',
'f': 'float',
'd': 'double',
'f': 'f32',
'd': 'f64',
'v': 'void',
'x': 'long long',
'b': 'bool',
'e': 'varargs...',
}
short_type_names = {
'char': '8',
'short': '16',
'long' : '32',
'long long': '64',
}
# {'defctor', 'ops',}
special_funcs = {
@@ -55,9 +62,13 @@ class Param:
ret = ''
if self.is_const:
ret += 'const '
if self.is_unsigned:
ret += 'unsigned '
ret += self.name
if self.name in short_type_names:
ret += 'u' if self.is_unsigned else 's'
ret += short_type_names[self.name]
else:
if self.is_unsigned:
ret += 'unsigned '
ret += self.name
for _ in range(self.pointer_lvl):
ret += '*'
if self.is_ref: