8 Star 16 Fork 2

openvela/frameworks_bluetooth

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
test.py 1.06 KB
一键复制 编辑 原始数据 按行查看 历史
chao an 提交于 2023-10-10 19:49 +08:00 . service/socket: add lightweight socket ipc layer
import clang.cindex
index = clang.cindex.Index.create()
tu = index.parse("framework/include/bt_device.h", args=['-std=c99'])
for node in tu.cursor.walk_preorder():
if node.kind == clang.cindex.CursorKind.FUNCTION_DECL:
print('struct ' + node.spelling + '_s')
print('{')
if node.result_type.spelling == 'void *':
print(' ' + node.result_type.spelling + ' __ret;')
elif node.result_type.spelling != 'void':
print(' ' + node.result_type.spelling.replace("*","") + ' __ret;')
for arg in node.get_arguments():
print(' ' + arg.type.spelling.replace("*","") + ' ' + arg.spelling + ';')
print('};\n')
print(arg.type.spelling + ' ' + node.spelling + '(', end="")
first = True
for arg in node.get_arguments():
if first != True:
print(', ', end="")
first = False
print(arg.type.spelling + ' ' + arg.spelling, end="")
print(')')
print('{')
print('}\n')
for node in tu.cursor.walk_preorder():
if node.kind == clang.cindex.CursorKind.FUNCTION_DECL:
print(node.spelling.upper() + ',')
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/open-vela/frameworks_bluetooth.git
git@gitee.com:open-vela/frameworks_bluetooth.git
open-vela
frameworks_bluetooth
frameworks_bluetooth
dev

搜索帮助