From 4f4125a3b2728d3e4adb3d2326d1399be153127a Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Wed, 13 Dec 2023 17:01:10 +0100 Subject: [PATCH] Generate commands/fix detp detg command rename (#882) * replacing detp with sls_Detector_put and detg with sls_detector_get * sls_detector_not implemented, but extended message to ask user to use sls_detector_get or sls_detector_put * autocompletion also for sls_detector or det --- slsDetectorSoftware/CMakeLists.txt | 2 +- .../generator/autocomplete/autocomplete.py | 8 +- .../autocomplete/bash_autocomplete.in.sh | 3 + .../autocomplete/bash_autocomplete.sh | 45 +-- .../autocomplete/slsdet-completion.bash | 8 +- .../autocomplete/zsh_autocomplete.in.sh | 5 +- .../autocomplete/zsh_autocomplete.sh | 47 +-- .../generator/cpp_codegen/codegen.py | 4 +- .../generator/inferAction.in.cpp | 5 +- slsDetectorSoftware/src/inferAction.cpp | 274 ++++++++++-------- 10 files changed, 223 insertions(+), 178 deletions(-) diff --git a/slsDetectorSoftware/CMakeLists.txt b/slsDetectorSoftware/CMakeLists.txt index 905952154..e97f31bb9 100755 --- a/slsDetectorSoftware/CMakeLists.txt +++ b/slsDetectorSoftware/CMakeLists.txt @@ -111,7 +111,7 @@ if(SLS_USE_TEXTCLIENT) set_property(TARGET ${val1} PROPERTY INTERPROCEDURAL_OPTIMIZATION True) endif() endforeach() - install(TARGETS ${det_bin_names} DESTINATION bin) # was not there for detp. Include? FIXME + install(TARGETS ${det_bin_names} DESTINATION bin) endif(SLS_USE_TEXTCLIENT) diff --git a/slsDetectorSoftware/generator/autocomplete/autocomplete.py b/slsDetectorSoftware/generator/autocomplete/autocomplete.py index afcfe93d7..008531a05 100644 --- a/slsDetectorSoftware/generator/autocomplete/autocomplete.py +++ b/slsDetectorSoftware/generator/autocomplete/autocomplete.py @@ -38,13 +38,13 @@ def get_types(arg_types): #Intercept the options and in case detector specific options appear replace the #list of options with a command line call that fetches them - #TODO! Rename detg + #TODO! Rename sls_detector_get if "defs::dacIndex" in arg_types: - return "`detg daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" + return "`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" elif "defs::detectorSettings" in arg_types: - return "`detg settingslist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" + return "`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" elif "defs::timingMode" in arg_types: - return "`detg timinglist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" + return "`sls_detector_get timinglist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" return ret diff --git a/slsDetectorSoftware/generator/autocomplete/bash_autocomplete.in.sh b/slsDetectorSoftware/generator/autocomplete/bash_autocomplete.in.sh index c622a809d..d55b10c07 100644 --- a/slsDetectorSoftware/generator/autocomplete/bash_autocomplete.in.sh +++ b/slsDetectorSoftware/generator/autocomplete/bash_autocomplete.in.sh @@ -162,3 +162,6 @@ complete -F _sd -o filenames detg complete -F _sd -o filenames sls_detector_put complete -F _sd -o filenames p complete -F _sd -o filenames detp + +complete -F _sd -o filenames sls_detector +complete -F _sd -o filenames det diff --git a/slsDetectorSoftware/generator/autocomplete/bash_autocomplete.sh b/slsDetectorSoftware/generator/autocomplete/bash_autocomplete.sh index 62764f094..6ed628f94 100644 --- a/slsDetectorSoftware/generator/autocomplete/bash_autocomplete.sh +++ b/slsDetectorSoftware/generator/autocomplete/bash_autocomplete.sh @@ -503,7 +503,7 @@ __dac() { FCN_RETURN="" if [[ ${IS_GET} -eq 1 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="mV mv" @@ -511,7 +511,7 @@ fi fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" @@ -544,12 +544,12 @@ __dacname() { FCN_RETURN="" if [[ ${IS_GET} -eq 1 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" @@ -627,21 +627,21 @@ __defaultdac() { FCN_RETURN="" if [[ ${IS_GET} -eq 1 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then -FCN_RETURN="`detg settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" fi if [[ "${cword}" == "4" ]]; then -FCN_RETURN="`detg settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi fi return 0 @@ -650,13 +650,13 @@ __defaultpattern() { FCN_RETURN="" if [[ ${IS_GET} -eq 1 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" fi if [[ "${cword}" == "4" ]]; then -FCN_RETURN="`detg settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi fi return 0 @@ -1634,12 +1634,12 @@ __powername() { FCN_RETURN="" if [[ ${IS_GET} -eq 1 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" @@ -2163,7 +2163,7 @@ __scan() { FCN_RETURN="" if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" @@ -2213,7 +2213,7 @@ __settings() { FCN_RETURN="" if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi fi return 0 @@ -2303,12 +2303,12 @@ __slowadcname() { FCN_RETURN="" if [[ ${IS_GET} -eq 1 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" @@ -2505,13 +2505,13 @@ if [[ "${cword}" == "2" ]]; then FCN_RETURN="" fi if [[ "${cword}" == "3" ]]; then -FCN_RETURN="`detg settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "4" ]]; then FCN_RETURN="" fi if [[ "${cword}" == "5" ]]; then -FCN_RETURN="`detg settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi fi return 0 @@ -2523,13 +2523,13 @@ if [[ "${cword}" == "2" ]]; then FCN_RETURN="" fi if [[ "${cword}" == "3" ]]; then -FCN_RETURN="`detg settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "4" ]]; then FCN_RETURN="" fi if [[ "${cword}" == "5" ]]; then -FCN_RETURN="`detg settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi fi return 0 @@ -2538,7 +2538,7 @@ __timing() { FCN_RETURN="" if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg timinglist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get timinglist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi fi return 0 @@ -3250,3 +3250,6 @@ complete -F _sd -o filenames detg complete -F _sd -o filenames sls_detector_put complete -F _sd -o filenames p complete -F _sd -o filenames detp + +complete -F _sd -o filenames sls_detector +complete -F _sd -o filenames det diff --git a/slsDetectorSoftware/generator/autocomplete/slsdet-completion.bash b/slsDetectorSoftware/generator/autocomplete/slsdet-completion.bash index 0572be712..2ae81a4b8 100644 --- a/slsDetectorSoftware/generator/autocomplete/slsdet-completion.bash +++ b/slsDetectorSoftware/generator/autocomplete/slsdet-completion.bash @@ -162,10 +162,16 @@ _sd() { } +complete -F _sd -o filenames sls_detector_put complete -F _sd -o filenames sls_detector_get + complete -F _sd -o filenames g complete -F _sd -o filenames p + complete -F _sd -o filenames detg complete -F _sd -o filenames detp -complete -F _sd -o filenames sls_detector_put + +complete -F _sd -o filenames sls_detector +complete -F _sd -o filenames det + diff --git a/slsDetectorSoftware/generator/autocomplete/zsh_autocomplete.in.sh b/slsDetectorSoftware/generator/autocomplete/zsh_autocomplete.in.sh index 5b34c2bc6..cbf8fad6b 100644 --- a/slsDetectorSoftware/generator/autocomplete/zsh_autocomplete.in.sh +++ b/slsDetectorSoftware/generator/autocomplete/zsh_autocomplete.in.sh @@ -71,4 +71,7 @@ complete -F _sd -o filenames detg complete -F _sd -o filenames sls_detector_put complete -F _sd -o filenames p -complete -F _sd -o filenames detp \ No newline at end of file +complete -F _sd -o filenames detp + +complete -F _sd -o filenames sls_detector +complete -F _sd -o filenames det diff --git a/slsDetectorSoftware/generator/autocomplete/zsh_autocomplete.sh b/slsDetectorSoftware/generator/autocomplete/zsh_autocomplete.sh index 07b4728dd..0ac10863c 100644 --- a/slsDetectorSoftware/generator/autocomplete/zsh_autocomplete.sh +++ b/slsDetectorSoftware/generator/autocomplete/zsh_autocomplete.sh @@ -427,7 +427,7 @@ __dac() { FCN_RETURN="" if [[ ${IS_GET} -eq 1 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="mV mv" @@ -435,7 +435,7 @@ fi fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" @@ -468,12 +468,12 @@ __dacname() { FCN_RETURN="" if [[ ${IS_GET} -eq 1 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" @@ -551,21 +551,21 @@ __defaultdac() { FCN_RETURN="" if [[ ${IS_GET} -eq 1 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then -FCN_RETURN="`detg settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" fi if [[ "${cword}" == "4" ]]; then -FCN_RETURN="`detg settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi fi return 0 @@ -574,13 +574,13 @@ __defaultpattern() { FCN_RETURN="" if [[ ${IS_GET} -eq 1 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" fi if [[ "${cword}" == "4" ]]; then -FCN_RETURN="`detg settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi fi return 0 @@ -1558,12 +1558,12 @@ __powername() { FCN_RETURN="" if [[ ${IS_GET} -eq 1 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" @@ -2087,7 +2087,7 @@ __scan() { FCN_RETURN="" if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" @@ -2137,7 +2137,7 @@ __settings() { FCN_RETURN="" if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi fi return 0 @@ -2227,12 +2227,12 @@ __slowadcname() { FCN_RETURN="" if [[ ${IS_GET} -eq 1 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" @@ -2429,13 +2429,13 @@ if [[ "${cword}" == "2" ]]; then FCN_RETURN="" fi if [[ "${cword}" == "3" ]]; then -FCN_RETURN="`detg settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "4" ]]; then FCN_RETURN="" fi if [[ "${cword}" == "5" ]]; then -FCN_RETURN="`detg settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi fi return 0 @@ -2447,13 +2447,13 @@ if [[ "${cword}" == "2" ]]; then FCN_RETURN="" fi if [[ "${cword}" == "3" ]]; then -FCN_RETURN="`detg settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "4" ]]; then FCN_RETURN="" fi if [[ "${cword}" == "5" ]]; then -FCN_RETURN="`detg settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi fi return 0 @@ -2462,7 +2462,7 @@ __timing() { FCN_RETURN="" if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`detg timinglist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get timinglist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" fi fi return 0 @@ -3159,4 +3159,7 @@ complete -F _sd -o filenames detg complete -F _sd -o filenames sls_detector_put complete -F _sd -o filenames p -complete -F _sd -o filenames detp \ No newline at end of file +complete -F _sd -o filenames detp + +complete -F _sd -o filenames sls_detector +complete -F _sd -o filenames det diff --git a/slsDetectorSoftware/generator/cpp_codegen/codegen.py b/slsDetectorSoftware/generator/cpp_codegen/codegen.py index 03dac76cf..ffb2c52e8 100644 --- a/slsDetectorSoftware/generator/cpp_codegen/codegen.py +++ b/slsDetectorSoftware/generator/cpp_codegen/codegen.py @@ -93,7 +93,7 @@ class CodeGenerator: with function('int', f"InferAction::{command['function_alias']}", []) as f: if (command_name, -1) in non_dist| type_dist: self.write_line( - f'throw RuntimeError("sls_detector is disabled for command: {command_name}. Use detg or detp");') + f'throw RuntimeError("sls_detector is disabled for command: {command_name}. Use sls_detector_get or sls_detector_put");') elif not command['infer_action']: self.write_line('throw RuntimeError("infer_action is disabled");') else: @@ -107,7 +107,7 @@ class CodeGenerator: # check if this argc is not distinguishable if (command_name, arg["argc"]) in non_dist | type_dist: self.write_line( - f'throw RuntimeError("sls_detector is disabled for command: {command_name} with number of arguments {arg["argc"]}. Use detg or detp");') + f'throw RuntimeError("sls_detector is disabled for command: {command_name} with number of arguments {arg["argc"]}. Use sls_detector_get or sls_detector_put");') else: self.write_line(f'return {self.actions_dict[action]};') with else_block(): diff --git a/slsDetectorSoftware/generator/inferAction.in.cpp b/slsDetectorSoftware/generator/inferAction.in.cpp index 3e355bf4e..715109075 100644 --- a/slsDetectorSoftware/generator/inferAction.in.cpp +++ b/slsDetectorSoftware/generator/inferAction.in.cpp @@ -9,8 +9,9 @@ int InferAction::infer(sls::CmdParser &parser, std::ostream &os) { if (it != functions.end()) { return ((*this).*(it->second))(); } else { - throw RuntimeError("sls_detector not implemented for command: " + - parser.command()); + throw RuntimeError( + "sls_detector not implemented for command: " + parser.command() + + ". Use sls_detector_get or sls_detector_put."); } } diff --git a/slsDetectorSoftware/src/inferAction.cpp b/slsDetectorSoftware/src/inferAction.cpp index 4bc9b3fbe..31ae6919d 100644 --- a/slsDetectorSoftware/src/inferAction.cpp +++ b/slsDetectorSoftware/src/inferAction.cpp @@ -18,17 +18,20 @@ int InferAction::infer(sls::CmdParser &parser, std::ostream &os) { } else { - throw RuntimeError("sls_detector not implemented for command: " + + throw RuntimeError( - parser.command()); + "sls_detector not implemented for command: " + parser.command() + + + ". Use sls_detector_get or sls_detector_put."); } } int InferAction::acquire() { if (args.size() == 0) { - throw RuntimeError("sls_detector is disabled for command: acquire with " - "number of arguments 0. Use detg or detp"); + throw RuntimeError( + "sls_detector is disabled for command: acquire with number of " + "arguments 0. Use sls_detector_get or sls_detector_put"); } else { @@ -131,8 +134,8 @@ int InferAction::adcinvert() { int InferAction::adclist() { - throw RuntimeError( - "sls_detector is disabled for command: adclist. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: adclist. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::adcname() { @@ -158,8 +161,9 @@ int InferAction::adcphase() { } if (args.size() == 1) { - throw RuntimeError("sls_detector is disabled for command: adcphase " - "with number of arguments 1. Use detg or detp"); + throw RuntimeError( + "sls_detector is disabled for command: adcphase with number of " + "arguments 1. Use sls_detector_get or sls_detector_put"); } if (args.size() == 2) { @@ -207,8 +211,9 @@ int InferAction::adcvpp() { } if (args.size() == 1) { - throw RuntimeError("sls_detector is disabled for command: adcvpp with " - "number of arguments 1. Use detg or detp"); + throw RuntimeError( + "sls_detector is disabled for command: adcvpp with number of " + "arguments 1. Use sls_detector_get or sls_detector_put"); } if (args.size() == 2) { @@ -271,8 +276,8 @@ int InferAction::autocompdisable() { int InferAction::badchannels() { - throw RuntimeError( - "sls_detector is disabled for command: badchannels. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: badchannels. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::blockingtrigger() { @@ -310,8 +315,9 @@ int InferAction::burstperiod() { } if (args.size() == 1) { - throw RuntimeError("sls_detector is disabled for command: burstperiod " - "with number of arguments 1. Use detg or detp"); + throw RuntimeError( + "sls_detector is disabled for command: burstperiod with number of " + "arguments 1. Use sls_detector_get or sls_detector_put"); } if (args.size() == 2) { @@ -475,8 +481,9 @@ int InferAction::clkphase() { } if (args.size() == 2) { - throw RuntimeError("sls_detector is disabled for command: clkphase " - "with number of arguments 2. Use detg or detp"); + throw RuntimeError( + "sls_detector is disabled for command: clkphase with number of " + "arguments 2. Use sls_detector_get or sls_detector_put"); } if (args.size() == 3) { @@ -514,7 +521,7 @@ int InferAction::compdisabletime() { if (args.size() == 1) { throw RuntimeError( "sls_detector is disabled for command: compdisabletime with number " - "of arguments 1. Use detg or detp"); + "of arguments 1. Use sls_detector_get or sls_detector_put"); } if (args.size() == 2) { @@ -557,8 +564,8 @@ int InferAction::config() { int InferAction::counters() { - throw RuntimeError( - "sls_detector is disabled for command: counters. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: counters. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::currentsource() { @@ -592,8 +599,9 @@ int InferAction::dac() { } if (args.size() == 2) { - throw RuntimeError("sls_detector is disabled for command: dac with " - "number of arguments 2. Use detg or detp"); + throw RuntimeError( + "sls_detector is disabled for command: dac with number of " + "arguments 2. Use sls_detector_get or sls_detector_put"); } if (args.size() == 3) { @@ -620,8 +628,8 @@ int InferAction::dacindex() { int InferAction::daclist() { - throw RuntimeError( - "sls_detector is disabled for command: daclist. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: daclist. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::dacname() { @@ -695,8 +703,9 @@ int InferAction::dbitphase() { } if (args.size() == 1) { - throw RuntimeError("sls_detector is disabled for command: dbitphase " - "with number of arguments 1. Use detg or detp"); + throw RuntimeError( + "sls_detector is disabled for command: dbitphase with number of " + "arguments 1. Use sls_detector_get or sls_detector_put"); } if (args.size() == 2) { @@ -732,8 +741,9 @@ int InferAction::defaultdac() { } if (args.size() == 2) { - throw RuntimeError("sls_detector is disabled for command: defaultdac " - "with number of arguments 2. Use detg or detp"); + throw RuntimeError( + "sls_detector is disabled for command: defaultdac with number of " + "arguments 2. Use sls_detector_get or sls_detector_put"); } if (args.size() == 3) { @@ -765,8 +775,9 @@ int InferAction::delay() { } if (args.size() == 1) { - throw RuntimeError("sls_detector is disabled for command: delay with " - "number of arguments 1. Use detg or detp"); + throw RuntimeError( + "sls_detector is disabled for command: delay with number of " + "arguments 1. Use sls_detector_get or sls_detector_put"); } if (args.size() == 2) { @@ -897,8 +908,8 @@ int InferAction::dsamples() { int InferAction::execcommand() { - throw RuntimeError( - "sls_detector is disabled for command: execcommand. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: execcommand. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::exptime() { @@ -908,8 +919,9 @@ int InferAction::exptime() { } if (args.size() == 1) { - throw RuntimeError("sls_detector is disabled for command: exptime with " - "number of arguments 1. Use detg or detp"); + throw RuntimeError( + "sls_detector is disabled for command: exptime with number of " + "arguments 1. Use sls_detector_get or sls_detector_put"); } if (args.size() == 2) { @@ -929,8 +941,9 @@ int InferAction::exptime1() { } if (args.size() == 1) { - throw RuntimeError("sls_detector is disabled for command: exptime1 " - "with number of arguments 1. Use detg or detp"); + throw RuntimeError( + "sls_detector is disabled for command: exptime1 with number of " + "arguments 1. Use sls_detector_get or sls_detector_put"); } if (args.size() == 2) { @@ -950,8 +963,9 @@ int InferAction::exptime2() { } if (args.size() == 1) { - throw RuntimeError("sls_detector is disabled for command: exptime2 " - "with number of arguments 1. Use detg or detp"); + throw RuntimeError( + "sls_detector is disabled for command: exptime2 with number of " + "arguments 1. Use sls_detector_get or sls_detector_put"); } if (args.size() == 2) { @@ -971,8 +985,9 @@ int InferAction::exptime3() { } if (args.size() == 1) { - throw RuntimeError("sls_detector is disabled for command: exptime3 " - "with number of arguments 1. Use detg or detp"); + throw RuntimeError( + "sls_detector is disabled for command: exptime3 with number of " + "arguments 1. Use sls_detector_get or sls_detector_put"); } if (args.size() == 2) { @@ -1308,8 +1323,9 @@ int InferAction::frametime() { int InferAction::free() { if (args.size() == 0) { - throw RuntimeError("sls_detector is disabled for command: free with " - "number of arguments 0. Use detg or detp"); + throw RuntimeError( + "sls_detector is disabled for command: free with number of " + "arguments 0. Use sls_detector_get or sls_detector_put"); } else { @@ -1336,8 +1352,8 @@ int InferAction::fwrite() { int InferAction::gaincaps() { - throw RuntimeError( - "sls_detector is disabled for command: gaincaps. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: gaincaps. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::gainmode() { @@ -1379,8 +1395,9 @@ int InferAction::gatedelay() { } if (args.size() == 1) { - throw RuntimeError("sls_detector is disabled for command: gatedelay " - "with number of arguments 1. Use detg or detp"); + throw RuntimeError( + "sls_detector is disabled for command: gatedelay with number of " + "arguments 1. Use sls_detector_get or sls_detector_put"); } if (args.size() == 2) { @@ -1400,8 +1417,9 @@ int InferAction::gatedelay1() { } if (args.size() == 1) { - throw RuntimeError("sls_detector is disabled for command: gatedelay1 " - "with number of arguments 1. Use detg or detp"); + throw RuntimeError( + "sls_detector is disabled for command: gatedelay1 with number of " + "arguments 1. Use sls_detector_get or sls_detector_put"); } if (args.size() == 2) { @@ -1421,8 +1439,9 @@ int InferAction::gatedelay2() { } if (args.size() == 1) { - throw RuntimeError("sls_detector is disabled for command: gatedelay2 " - "with number of arguments 1. Use detg or detp"); + throw RuntimeError( + "sls_detector is disabled for command: gatedelay2 with number of " + "arguments 1. Use sls_detector_get or sls_detector_put"); } if (args.size() == 2) { @@ -1442,8 +1461,9 @@ int InferAction::gatedelay3() { } if (args.size() == 1) { - throw RuntimeError("sls_detector is disabled for command: gatedelay3 " - "with number of arguments 1. Use detg or detp"); + throw RuntimeError( + "sls_detector is disabled for command: gatedelay3 with number of " + "arguments 1. Use sls_detector_get or sls_detector_put"); } if (args.size() == 2) { @@ -1514,8 +1534,8 @@ int InferAction::highvoltage() { int InferAction::hostname() { - throw RuntimeError( - "sls_detector is disabled for command: hostname. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: hostname. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::im_a() { @@ -1956,32 +1976,32 @@ int InferAction::patioctrl() { int InferAction::patlimits() { - throw RuntimeError( - "sls_detector is disabled for command: patlimits. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: patlimits. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::patloop() { - throw RuntimeError( - "sls_detector is disabled for command: patloop. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: patloop. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::patloop0() { - throw RuntimeError( - "sls_detector is disabled for command: patloop0. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: patloop0. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::patloop1() { - throw RuntimeError( - "sls_detector is disabled for command: patloop1. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: patloop1. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::patloop2() { - throw RuntimeError( - "sls_detector is disabled for command: patloop2. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: patloop2. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::patmask() { @@ -2002,26 +2022,26 @@ int InferAction::patmask() { int InferAction::patnloop() { - throw RuntimeError( - "sls_detector is disabled for command: patnloop. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: patnloop. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::patnloop0() { - throw RuntimeError( - "sls_detector is disabled for command: patnloop0. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: patnloop0. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::patnloop1() { - throw RuntimeError( - "sls_detector is disabled for command: patnloop1. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: patnloop1. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::patnloop2() { - throw RuntimeError( - "sls_detector is disabled for command: patnloop2. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: patnloop2. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::patsetbit() { @@ -2066,50 +2086,50 @@ int InferAction::patternstart() { int InferAction::patwait() { - throw RuntimeError( - "sls_detector is disabled for command: patwait. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: patwait. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::patwait0() { - throw RuntimeError( - "sls_detector is disabled for command: patwait0. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: patwait0. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::patwait1() { - throw RuntimeError( - "sls_detector is disabled for command: patwait1. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: patwait1. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::patwait2() { - throw RuntimeError( - "sls_detector is disabled for command: patwait2. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: patwait2. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::patwaittime() { - throw RuntimeError( - "sls_detector is disabled for command: patwaittime. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: patwaittime. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::patwaittime0() { - throw RuntimeError( - "sls_detector is disabled for command: patwaittime0. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: patwaittime0. " + "Use sls_detector_get or sls_detector_put"); } int InferAction::patwaittime1() { - throw RuntimeError( - "sls_detector is disabled for command: patwaittime1. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: patwaittime1. " + "Use sls_detector_get or sls_detector_put"); } int InferAction::patwaittime2() { - throw RuntimeError( - "sls_detector is disabled for command: patwaittime2. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: patwaittime2. " + "Use sls_detector_get or sls_detector_put"); } int InferAction::patword() { @@ -2155,8 +2175,9 @@ int InferAction::period() { } if (args.size() == 1) { - throw RuntimeError("sls_detector is disabled for command: period with " - "number of arguments 1. Use detg or detp"); + throw RuntimeError( + "sls_detector is disabled for command: period with number of " + "arguments 1. Use sls_detector_get or sls_detector_put"); } if (args.size() == 2) { @@ -2247,8 +2268,8 @@ int InferAction::powerindex() { int InferAction::powerlist() { - throw RuntimeError( - "sls_detector is disabled for command: powerlist. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: powerlist. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::powername() { @@ -2601,8 +2622,8 @@ int InferAction::rx_clearroi() { int InferAction::rx_dbitlist() { - throw RuntimeError( - "sls_detector is disabled for command: rx_dbitlist. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: rx_dbitlist. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::rx_dbitoffset() { @@ -2695,21 +2716,23 @@ int InferAction::rx_framesperfile() { int InferAction::rx_hostname() { - throw RuntimeError( - "sls_detector is disabled for command: rx_hostname. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: rx_hostname. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::rx_jsonaddheader() { - throw RuntimeError("sls_detector is disabled for command: " - "rx_jsonaddheader. Use detg or detp"); + throw RuntimeError( + "sls_detector is disabled for command: rx_jsonaddheader. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::rx_jsonpara() { if (args.size() == 1) { - throw RuntimeError("sls_detector is disabled for command: rx_jsonpara " - "with number of arguments 1. Use detg or detp"); + throw RuntimeError( + "sls_detector is disabled for command: rx_jsonpara with number of " + "arguments 1. Use sls_detector_get or sls_detector_put"); } if (args.size() == 2) { @@ -2852,8 +2875,8 @@ int InferAction::rx_start() { int InferAction::rx_status() { - throw RuntimeError( - "sls_detector is disabled for command: rx_status. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: rx_status. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::rx_stop() { @@ -3182,8 +3205,8 @@ int InferAction::signalindex() { int InferAction::signallist() { - throw RuntimeError( - "sls_detector is disabled for command: signallist. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: signallist. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::signalname() { @@ -3228,8 +3251,8 @@ int InferAction::slowadcindex() { int InferAction::slowadclist() { - throw RuntimeError( - "sls_detector is disabled for command: slowadclist. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: slowadclist. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::slowadcname() { @@ -3274,8 +3297,8 @@ int InferAction::start() { int InferAction::status() { - throw RuntimeError( - "sls_detector is disabled for command: status. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: status. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::stop() { @@ -3315,7 +3338,7 @@ int InferAction::storagecell_delay() { if (args.size() == 1) { throw RuntimeError( "sls_detector is disabled for command: storagecell_delay with " - "number of arguments 1. Use detg or detp"); + "number of arguments 1. Use sls_detector_get or sls_detector_put"); } if (args.size() == 2) { @@ -3351,8 +3374,9 @@ int InferAction::subdeadtime() { } if (args.size() == 1) { - throw RuntimeError("sls_detector is disabled for command: subdeadtime " - "with number of arguments 1. Use detg or detp"); + throw RuntimeError( + "sls_detector is disabled for command: subdeadtime with number of " + "arguments 1. Use sls_detector_get or sls_detector_put"); } if (args.size() == 2) { @@ -3372,8 +3396,9 @@ int InferAction::subexptime() { } if (args.size() == 1) { - throw RuntimeError("sls_detector is disabled for command: subexptime " - "with number of arguments 1. Use detg or detp"); + throw RuntimeError( + "sls_detector is disabled for command: subexptime with number of " + "arguments 1. Use sls_detector_get or sls_detector_put"); } if (args.size() == 2) { @@ -3769,8 +3794,9 @@ int InferAction::triggersl() { int InferAction::trimbits() { if (args.size() == 1) { - throw RuntimeError("sls_detector is disabled for command: trimbits " - "with number of arguments 1. Use detg or detp"); + throw RuntimeError( + "sls_detector is disabled for command: trimbits with number of " + "arguments 1. Use sls_detector_get or sls_detector_put"); } else { @@ -3781,8 +3807,8 @@ int InferAction::trimbits() { int InferAction::trimen() { - throw RuntimeError( - "sls_detector is disabled for command: trimen. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: trimen. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::trimval() { @@ -3939,8 +3965,8 @@ int InferAction::udp_dstip2() { int InferAction::udp_dstlist() { - throw RuntimeError( - "sls_detector is disabled for command: udp_dstlist. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: udp_dstlist. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::udp_dstmac() { @@ -4441,8 +4467,8 @@ int InferAction::vetoalg() { int InferAction::vetofile() { - throw RuntimeError( - "sls_detector is disabled for command: vetofile. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: vetofile. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::vetophoton() { @@ -4463,14 +4489,14 @@ int InferAction::vetophoton() { int InferAction::vetoref() { - throw RuntimeError( - "sls_detector is disabled for command: vetoref. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: vetoref. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::vetostream() { - throw RuntimeError( - "sls_detector is disabled for command: vetostream. Use detg or detp"); + throw RuntimeError("sls_detector is disabled for command: vetostream. Use " + "sls_detector_get or sls_detector_put"); } int InferAction::virtualFunction() {