2020-02-19 12:26:55 +01:00
|
|
|
#!/usr/bin/env python3
|
2018-01-18 22:42:31 +01:00
|
|
|
|
2020-05-28 12:31:15 +02:00
|
|
|
"usage: gen-def.py harfbuzz.def hb.h [hb-blob.h hb-buffer.h ...]"
|
|
|
|
|
2020-05-28 21:41:19 +02:00
|
|
|
import os, re, sys
|
2018-01-18 22:42:31 +01:00
|
|
|
|
2018-07-09 19:11:29 +02:00
|
|
|
if len (sys.argv) < 3:
|
2020-05-28 12:31:15 +02:00
|
|
|
sys.exit(__doc__)
|
2018-07-09 19:11:29 +02:00
|
|
|
|
|
|
|
output_file = sys.argv[1]
|
|
|
|
header_paths = sys.argv[2:]
|
|
|
|
|
2018-01-18 22:42:31 +01:00
|
|
|
headers_content = []
|
2018-07-09 19:11:29 +02:00
|
|
|
for h in header_paths:
|
2018-01-18 22:42:31 +01:00
|
|
|
if h.endswith (".h"):
|
2020-05-28 21:41:19 +02:00
|
|
|
with open (h, encoding='utf-8') as f: headers_content.append (f.read ())
|
2018-01-18 22:42:31 +01:00
|
|
|
|
2020-01-29 19:56:04 +01:00
|
|
|
symbols = sorted (re.findall (r"^hb_\w+(?= \()", "\n".join (headers_content), re.M))
|
2020-04-20 22:43:13 +02:00
|
|
|
if '--experimental-api' not in sys.argv:
|
2020-01-29 19:56:04 +01:00
|
|
|
# Move these to harfbuzz-sections.txt when got stable
|
|
|
|
experimental_symbols = \
|
|
|
|
"""hb_font_draw_glyph
|
|
|
|
hb_draw_funcs_t
|
|
|
|
hb_draw_close_path_func_t
|
|
|
|
hb_draw_cubic_to_func_t
|
|
|
|
hb_draw_line_to_func_t
|
|
|
|
hb_draw_move_to_func_t
|
|
|
|
hb_draw_quadratic_to_func_t
|
|
|
|
hb_draw_funcs_create
|
|
|
|
hb_draw_funcs_destroy
|
|
|
|
hb_draw_funcs_is_immutable
|
|
|
|
hb_draw_funcs_make_immutable
|
|
|
|
hb_draw_funcs_reference
|
|
|
|
hb_draw_funcs_set_close_path_func
|
|
|
|
hb_draw_funcs_set_cubic_to_func
|
|
|
|
hb_draw_funcs_set_line_to_func
|
|
|
|
hb_draw_funcs_set_move_to_func
|
2020-04-17 17:42:24 +02:00
|
|
|
hb_draw_funcs_set_quadratic_to_func
|
2020-06-04 13:19:54 +02:00
|
|
|
hb_style_get_value
|
2020-04-17 19:41:40 +02:00
|
|
|
hb_font_get_var_coords_design
|
|
|
|
hb_ot_layout_closure_lookups
|
|
|
|
hb_ot_layout_closure_features""".splitlines ()
|
2020-01-29 19:56:04 +01:00
|
|
|
symbols = [x for x in symbols if x not in experimental_symbols]
|
|
|
|
symbols = "\n".join (symbols)
|
2018-10-29 10:41:01 +01:00
|
|
|
|
|
|
|
result = symbols if os.environ.get('PLAIN_LIST', '') else """EXPORTS
|
2018-02-12 12:40:13 +01:00
|
|
|
%s
|
2018-11-12 20:41:39 +01:00
|
|
|
LIBRARY lib%s-0.dll""" % (symbols, output_file.replace ('src/', '').replace ('.def', ''))
|
2018-01-18 22:42:31 +01:00
|
|
|
|
2018-07-09 19:11:29 +02:00
|
|
|
with open (output_file, "w") as f: f.write (result)
|