mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-20 02:40:03 +02:00
updated scripts and generated detector.cpp
This commit is contained in:
parent
7d91a15834
commit
401467c700
@ -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)
|
||||
|
||||
|
@ -5,6 +5,12 @@ import subprocess
|
||||
from subprocess import PIPE
|
||||
import os
|
||||
|
||||
def clang_format_version():
|
||||
p = subprocess.run(['clang-format', '--version'], capture_output = True)
|
||||
ver = p.stdout.decode().split()[2]
|
||||
major = int(ver.split('.')[0])
|
||||
return major
|
||||
|
||||
|
||||
def remove_comments(text):
|
||||
def replacer(match):
|
||||
|
@ -1,8 +1,8 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
/* WARINING This file is auto generated any edits might be overwritten without
|
||||
* warning */
|
||||
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include <pybind11/chrono.h>
|
||||
#include <pybind11/operators.h>
|
||||
#include <pybind11/pybind11.h>
|
||||
@ -178,7 +178,7 @@ void init_det(py::module &m) {
|
||||
Detector::getMaster,
|
||||
py::arg() = Positions{})
|
||||
.def("setMaster", (void (Detector::*)(bool, int)) & Detector::setMaster,
|
||||
py::arg(), py::arg() = -1)
|
||||
py::arg(), py::arg())
|
||||
.def("isVirtualDetectorServer",
|
||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||
Detector::isVirtualDetectorServer,
|
||||
@ -772,7 +772,7 @@ void init_det(py::module &m) {
|
||||
Detector::getRxLastClientIP,
|
||||
py::arg() = Positions{})
|
||||
.def("getRxThreadIds",
|
||||
(Result<std::array<pid_t, 8>>(Detector::*)(sls::Positions) const) &
|
||||
(Result<std::array<pid_t, 9>>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getRxThreadIds,
|
||||
py::arg() = Positions{})
|
||||
.def("getRxArping",
|
||||
@ -1016,8 +1016,7 @@ void init_det(py::module &m) {
|
||||
Detector::getTop,
|
||||
py::arg() = Positions{})
|
||||
.def("setTop",
|
||||
(void (Detector::*)(bool, sls::Positions)) &
|
||||
Detector::setTop,
|
||||
(void (Detector::*)(bool, sls::Positions)) & Detector::setTop,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getChipVersion",
|
||||
(Result<double>(Detector::*)(sls::Positions) const) &
|
||||
@ -1277,10 +1276,6 @@ void init_det(py::module &m) {
|
||||
(Result<std::array<ns, 3>>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getGateDelayForAllGates,
|
||||
py::arg() = Positions{})
|
||||
.def("getMaster",
|
||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getMaster,
|
||||
py::arg() = Positions{})
|
||||
.def("getChipStatusRegister",
|
||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getChipStatusRegister,
|
||||
@ -1569,7 +1564,7 @@ void init_det(py::module &m) {
|
||||
Detector::getUpdateMode,
|
||||
py::arg() = Positions{})
|
||||
.def("setUpdateMode",
|
||||
(void (Detector::*)(bool, sls::Positions)) &
|
||||
(void (Detector::*)(const bool, sls::Positions)) &
|
||||
Detector::setUpdateMode,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("readRegister",
|
||||
|
Loading…
x
Reference in New Issue
Block a user