mapi: Allow blocks to be disabled from the output.
For example, a printer may ask not to output noop dispatch table.
This commit is contained in:
+55
-44
@@ -236,6 +236,11 @@ class ABIPrinter(object):
|
||||
self.api_entry = 'KHRONOS_APIENTRY'
|
||||
self.api_attrs = 'KHRONOS_APIATTRIBUTES'
|
||||
|
||||
self.lib_need_table_size = True
|
||||
self.lib_need_noop_array = True
|
||||
self.lib_need_stubs = True
|
||||
self.lib_need_entries = True
|
||||
|
||||
def c_notice(self):
|
||||
return '/* This file is automatically generated by mapi_abi.py. Do not modify. */'
|
||||
|
||||
@@ -475,54 +480,60 @@ class ABIPrinter(object):
|
||||
print self.c_public_declarations(self.prefix_lib)
|
||||
print '#undef MAPI_TMP_DEFINES'
|
||||
print '#endif /* MAPI_TMP_DEFINES */'
|
||||
print
|
||||
print '#ifdef MAPI_TMP_TABLE'
|
||||
print self.c_mapi_table()
|
||||
print '#undef MAPI_TMP_TABLE'
|
||||
print '#endif /* MAPI_TMP_TABLE */'
|
||||
print
|
||||
|
||||
pool, pool_offsets = self.c_stub_string_pool()
|
||||
print '#ifdef MAPI_TMP_PUBLIC_STUBS'
|
||||
print 'static const char public_string_pool[] ='
|
||||
print pool
|
||||
print
|
||||
print 'static const struct mapi_stub public_stubs[] = {'
|
||||
print self.c_stub_initializer(self.prefix_lib, pool_offsets)
|
||||
print '};'
|
||||
print '#undef MAPI_TMP_PUBLIC_STUBS'
|
||||
print '#endif /* MAPI_TMP_PUBLIC_STUBS */'
|
||||
print
|
||||
if self.lib_need_table_size:
|
||||
print
|
||||
print '#ifdef MAPI_TMP_TABLE'
|
||||
print self.c_mapi_table()
|
||||
print '#undef MAPI_TMP_TABLE'
|
||||
print '#endif /* MAPI_TMP_TABLE */'
|
||||
|
||||
print '#ifdef MAPI_TMP_PUBLIC_ENTRIES'
|
||||
print self.c_public_dispatches(self.prefix_lib)
|
||||
print '#undef MAPI_TMP_PUBLIC_ENTRIES'
|
||||
print '#endif /* MAPI_TMP_PUBLIC_ENTRIES */'
|
||||
print
|
||||
if self.lib_need_noop_array:
|
||||
print
|
||||
print '#ifdef MAPI_TMP_NOOP_ARRAY'
|
||||
print '#ifdef DEBUG'
|
||||
print
|
||||
print self.c_noop_functions(self.prefix_noop, self.prefix_lib)
|
||||
print
|
||||
print 'const mapi_func table_%s_array[] = {' % (self.prefix_noop)
|
||||
print self.c_noop_initializer(self.prefix_noop, False)
|
||||
print '};'
|
||||
print
|
||||
print '#else /* DEBUG */'
|
||||
print
|
||||
print 'const mapi_func table_%s_array[] = {' % (self.prefix_noop)
|
||||
print self.c_noop_initializer(self.prefix_noop, True)
|
||||
print '};'
|
||||
print
|
||||
print '#endif /* DEBUG */'
|
||||
print '#undef MAPI_TMP_NOOP_ARRAY'
|
||||
print '#endif /* MAPI_TMP_NOOP_ARRAY */'
|
||||
|
||||
print '#ifdef MAPI_TMP_NOOP_ARRAY'
|
||||
print '#ifdef DEBUG'
|
||||
print
|
||||
print self.c_noop_functions(self.prefix_noop, self.prefix_lib)
|
||||
print
|
||||
print 'const mapi_func table_%s_array[] = {' % (self.prefix_noop)
|
||||
print self.c_noop_initializer(self.prefix_noop, False)
|
||||
print '};'
|
||||
print
|
||||
print '#else /* DEBUG */'
|
||||
print
|
||||
print 'const mapi_func table_%s_array[] = {' % (self.prefix_noop)
|
||||
print self.c_noop_initializer(self.prefix_noop, True)
|
||||
print '};'
|
||||
print '#endif /* DEBUG */'
|
||||
print '#undef MAPI_TMP_NOOP_ARRAY'
|
||||
print '#endif /* MAPI_TMP_NOOP_ARRAY */'
|
||||
print
|
||||
if self.lib_need_stubs:
|
||||
pool, pool_offsets = self.c_stub_string_pool()
|
||||
print
|
||||
print '#ifdef MAPI_TMP_PUBLIC_STUBS'
|
||||
print 'static const char public_string_pool[] ='
|
||||
print pool
|
||||
print
|
||||
print 'static const struct mapi_stub public_stubs[] = {'
|
||||
print self.c_stub_initializer(self.prefix_lib, pool_offsets)
|
||||
print '};'
|
||||
print '#undef MAPI_TMP_PUBLIC_STUBS'
|
||||
print '#endif /* MAPI_TMP_PUBLIC_STUBS */'
|
||||
|
||||
print '#ifdef MAPI_TMP_STUB_ASM_GCC'
|
||||
print self.c_asm_gcc(self.prefix_lib)
|
||||
print '#undef MAPI_TMP_STUB_ASM_GCC'
|
||||
print '#endif /* MAPI_TMP_STUB_ASM_GCC */'
|
||||
if self.lib_need_entries:
|
||||
print
|
||||
print '#ifdef MAPI_TMP_PUBLIC_ENTRIES'
|
||||
print self.c_public_dispatches(self.prefix_lib)
|
||||
print '#undef MAPI_TMP_PUBLIC_ENTRIES'
|
||||
print '#endif /* MAPI_TMP_PUBLIC_ENTRIES */'
|
||||
|
||||
print
|
||||
print '#ifdef MAPI_TMP_STUB_ASM_GCC'
|
||||
print self.c_asm_gcc(self.prefix_lib)
|
||||
print '#undef MAPI_TMP_STUB_ASM_GCC'
|
||||
print '#endif /* MAPI_TMP_STUB_ASM_GCC */'
|
||||
|
||||
def output_for_app(self):
|
||||
print self.c_notice()
|
||||
|
||||
Reference in New Issue
Block a user