mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-18 05:42:49 +00:00
too/btstack_rtos_generator: update to Python 3 and evolving repo structure
This commit is contained in:
parent
6857b998dd
commit
c3d71bb2b9
@ -144,7 +144,7 @@ num_functions = 0
|
|||||||
|
|
||||||
# [file_name, api_title, api_label]
|
# [file_name, api_title, api_label]
|
||||||
apis = [
|
apis = [
|
||||||
["src/ble/ancs_client.h", "BLE ANCS Client", "ancsClient", True],
|
["src/ble/gatt-service/ancs_client.h", "BLE ANCS Client", "ancsClient", True],
|
||||||
["src/ble/att_db_util.h", "BLE ATT Database", "attDb", True],
|
["src/ble/att_db_util.h", "BLE ATT Database", "attDb", True],
|
||||||
["src/ble/att_server.h", "BLE ATT Server", "attServer", True],
|
["src/ble/att_server.h", "BLE ATT Server", "attServer", True],
|
||||||
["src/ble/gatt_client.h", "BLE GATT Client", "gattClient", True],
|
["src/ble/gatt_client.h", "BLE GATT Client", "gattClient", True],
|
||||||
@ -198,7 +198,7 @@ def split_arguments(args_string):
|
|||||||
return args
|
return args
|
||||||
|
|
||||||
def argument_name(parameter):
|
def argument_name(parameter):
|
||||||
function_pointer = re.match('[\w\s\*]*\(\s*\*(\w*)\s*\)\(.*\)', parameter)
|
function_pointer = re.match(r'[\w\s\*]*\(\s*\*(\w*)\s*\)\(.*\)', parameter)
|
||||||
if function_pointer:
|
if function_pointer:
|
||||||
return function_pointer.group(1)
|
return function_pointer.group(1)
|
||||||
parts = parameter.split(' ')
|
parts = parameter.split(' ')
|
||||||
@ -274,29 +274,29 @@ def write_wrappers_for_file(fout, file, header_name, need_lock):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if state == State.SearchStartAPI:
|
if state == State.SearchStartAPI:
|
||||||
parts = re.match('.*API_START.*',line)
|
parts = re.match(r'.*API_START.*',line)
|
||||||
if parts:
|
if parts:
|
||||||
state = State.SearchEndAPI
|
state = State.SearchEndAPI
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if state == State.SearchEndAPI:
|
if state == State.SearchEndAPI:
|
||||||
parts = re.match('.*API_END.*',line)
|
parts = re.match(r'.*API_END.*',line)
|
||||||
if parts:
|
if parts:
|
||||||
state = State.DoneAPI
|
state = State.DoneAPI
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if inline_function:
|
if inline_function:
|
||||||
function_end = re.match('.*}.*', line)
|
function_end = re.match(r'.*}.*', line)
|
||||||
if function_end:
|
if function_end:
|
||||||
inline_function = 0
|
inline_function = 0
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if multiline_function_def:
|
if multiline_function_def:
|
||||||
multiline += line
|
multiline += line
|
||||||
function_end = re.match('.*\)', line)
|
function_end = re.match(r'.*\)', line)
|
||||||
if function_end:
|
if function_end:
|
||||||
multiline_function_def = 0
|
multiline_function_def = 0
|
||||||
function = re.match('([\w\s\*]*)\(([\w\s,\*]*)\).*', multiline)
|
function = re.match(r'([\w\s\*]*)\(([\w\s,\*]*)\).*', multiline)
|
||||||
if function:
|
if function:
|
||||||
type_and_name = function.group(1)
|
type_and_name = function.group(1)
|
||||||
arg_string = function.group(2)
|
arg_string = function.group(2)
|
||||||
@ -304,7 +304,7 @@ def write_wrappers_for_file(fout, file, header_name, need_lock):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if multiline_comment:
|
if multiline_comment:
|
||||||
comment_end = re.match('.*\*/.*', line)
|
comment_end = re.match(r'.*\*/.*', line)
|
||||||
if comment_end:
|
if comment_end:
|
||||||
multiline_comment = 0
|
multiline_comment = 0
|
||||||
fout.write(line)
|
fout.write(line)
|
||||||
@ -312,36 +312,36 @@ def write_wrappers_for_file(fout, file, header_name, need_lock):
|
|||||||
|
|
||||||
# search typedef struct end
|
# search typedef struct end
|
||||||
if typedefFound:
|
if typedefFound:
|
||||||
typedef = re.match('}\s*(.*);\n', line)
|
typedef = re.match(r'}\s*(.*);\n', line)
|
||||||
if typedef:
|
if typedef:
|
||||||
typedefFound = 0
|
typedefFound = 0
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# search comment line
|
# search comment line
|
||||||
comment = re.match(".*/\*.*\*/.*", line)
|
comment = re.match(r'.*/\*.*\*/.*', line)
|
||||||
if comment:
|
if comment:
|
||||||
fout.write(line)
|
fout.write(line)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# search start of multi line comment
|
# search start of multi line comment
|
||||||
comment = re.match(".*/\*", line)
|
comment = re.match(r'.*/\*', line)
|
||||||
if comment:
|
if comment:
|
||||||
fout.write(line)
|
fout.write(line)
|
||||||
multiline_comment = 1
|
multiline_comment = 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# ignore __attribute__ for hci_dump_log in src/hci_dump.h
|
# ignore __attribute__ for hci_dump_log in src/hci_dump.h
|
||||||
param = re.match(".*__attribute__", line)
|
param = re.match(r'.*__attribute__', line)
|
||||||
if param:
|
if param:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# search typedef struct begin
|
# search typedef struct begin
|
||||||
typedef = re.match('.*typedef\s+struct.*', line)
|
typedef = re.match(r'.*typedef\s+struct.*', line)
|
||||||
if typedef:
|
if typedef:
|
||||||
typedefFound = 1
|
typedefFound = 1
|
||||||
|
|
||||||
# complete function declaration
|
# complete function declaration
|
||||||
function = re.match('([\w\s\*]*)\((.*)\).*', line)
|
function = re.match(r'([\w\s\*]*)\((.*)\).*', line)
|
||||||
if function:
|
if function:
|
||||||
if "return" in line:
|
if "return" in line:
|
||||||
continue
|
continue
|
||||||
@ -352,7 +352,7 @@ def write_wrappers_for_file(fout, file, header_name, need_lock):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# multi-line function declaration
|
# multi-line function declaration
|
||||||
function = re.match('([\w\s\*]*)\((.*).*', line)
|
function = re.match(r'([\w\s\*]*)\((.*).*', line)
|
||||||
if function:
|
if function:
|
||||||
multiline = line
|
multiline = line
|
||||||
multiline_function_def = 1
|
multiline_function_def = 1
|
||||||
@ -410,6 +410,7 @@ def main(argv):
|
|||||||
rtos_folder = btstack_root + '/platform/rtos'
|
rtos_folder = btstack_root + '/platform/rtos'
|
||||||
assert_dir_exists(rtos_folder)
|
assert_dir_exists(rtos_folder)
|
||||||
assert_dir_exists(rtos_folder+'/ble')
|
assert_dir_exists(rtos_folder+'/ble')
|
||||||
|
assert_dir_exists(rtos_folder+'/ble/gatt-service')
|
||||||
assert_dir_exists(rtos_folder+'/classic')
|
assert_dir_exists(rtos_folder+'/classic')
|
||||||
create_wrapper_files(btstack_root, rtos_folder, apis)
|
create_wrapper_files(btstack_root, rtos_folder, apis)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user