updated scripts and generated detector.cpp

This commit is contained in:
Erik Frojdh
2022-03-16 18:29:33 +01:00
parent 7d91a15834
commit 401467c700
3 changed files with 23 additions and 22 deletions

View File

@ -11,9 +11,17 @@ manually
from clang import cindex
import subprocess
import argparse
import sys
from parse import system_include_paths, clang_format_version
required_version = 13
RED = '\033[91m'
ENDC = '\033[0m'
if (ver := clang_format_version()) != required_version:
print(f'{RED}Clang format version {required_version} required, detected: {ver}. Bye!{ENDC}')
sys.exit(1)
from parse import system_include_paths
default_build_path = "/home/l_frojdh/sls/build/"
fpath = "../../slsDetectorSoftware/src/Detector.cpp"
@ -66,7 +74,7 @@ def get_arguments_with_default(node):
args = []
for arg in node.get_arguments():
tokens = [t.spelling for t in arg.get_tokens()]
print(tokens)
# print(tokens)
if '=' in tokens:
if arg.type.spelling == "sls::Positions": #TODO! automate
args.append("py::arg() = Positions{}")
@ -111,19 +119,11 @@ def visit(node):
lines.append(
f'.def("{child.spelling}",{fs} &Detector::{child.spelling}{args})'
)
print(f'&Detector::{child.spelling}{args})')
cn.append(child)
for child in node.get_children():
visit(child)
# .def("setRxHostname",
# (void (Detector::*)(const std::string &, Positions)) &
# Detector::setRxHostname,
# py::arg(), py::arg() = Positions{})
# .def("setRxHostname",
# (void (Detector::*)(const std::vector<std::string> &)) &
# Detector::setRxHostname,
# py::arg())
visit(tu.cursor)