1 Star 0 Fork 1

craftsky/wiringOP-Python

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
generate-bindings.py 1.17 KB
一键复制 编辑 原始数据 按行查看 历史
HEADERS = []
src = open("wiringpi.i").read().split('\n')
for line in src:
line = line.strip()
if line.startswith('#include') and line.endswith('.h"'):
HEADERS.append(line.replace('#include','').replace('"','').strip())
def is_c_decl(line):
for fn in ['wiringPiISR','wiringPiSetupPiFace','wiringPiSetupPiFaceForGpioProg']:
if fn in line:
return False
for prefix in ['extern','void','int','uint8_t']:
if line.startswith(prefix):
return True
print("// Generated by generate-bindings.py - do not edit manually!")
for file in HEADERS:
print("\n// Header file {}".format(file))
if file == "wiringOP/devLib/font.h":
continue # continue here
h = open(file).read().split('\n')
extern = False
cont = False
if 'extern "C" {' not in h:
extern = True
for line in h:
line = line.strip()
if cont:
print("\t{}".format(line))
cont = ";" not in line
continue
if line.startswith('extern "C"'):
extern = True
continue
if is_c_decl(line) and extern:
print(line)
cont = ";" not in line
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/caaaa_admin/wiringOP-Python.git
[email protected]:caaaa_admin/wiringOP-Python.git
caaaa_admin
wiringOP-Python
wiringOP-Python
master

搜索帮助