def get_includes(self):
return self._includes
+ def set_strip_suffix(self, strip_suffix):
+ self._strip_suffix = strip_suffix
+
def set_strip_prefix(self, strip_prefix):
self._strip_prefix = strip_prefix
# when --strip-prefix=g:
# GHashTable -> HashTable
# g_hash_table_new -> hash_table_new
+ stripped = False
prefix = self._strip_prefix.lower()
- if isfunction:
+
+ if isfunction and '_' in name:
prefix += '_'
if len(name) > len(prefix) and name.lower().startswith(prefix):
name = name[len(prefix):]
+ stripped = True
while name.startswith('_'):
name = name[1:]
+
+ if (stripped and self._strip_suffix and
+ len(name) > len(self._strip_suffix) and
+ name.endswith(self._strip_suffix)
+ name = name[:-1*len(self._strip_suffix)]
+
return name
def _traverse_one(self, symbol, stype=None):