diff --git a/CMakeLists.txt b/CMakeLists.txt index 08be657..d338d5d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ add_compile_options( ) option( - BUILD_FRONTENDS + BUILD_FRONTEND "If ON, build the default frontend executables" OFF ) @@ -86,33 +86,42 @@ target_compile_definitions( ## Test Frontends ################################################################################ -if(${BUILD_FRONTENDS}) +if(${BUILD_FRONTEND}) - # ============================================================================ - # Frontend used at FLAME + # Example name from GPS + set(EL734_FRONTEND_NAME "smel734" CACHE STRING "Overridable frontend name") add_executable( - el734_flame_fe + el734_scfe frontend/el734_flame_fe.cxx ) + add_compile_definitions(el734_scfe PRIVATE FRONTEND_NAME="${EL734_FRONTEND_NAME}") + set_property( TARGET - el734_flame_fe + el734_scfe PROPERTY CXX_STANDARD 11 ) target_include_directories( - el734_flame_fe + el734_scfe PRIVATE $ENV{MIDASSYS}/drivers ) target_link_libraries( - el734_flame_fe + el734_scfe el734 midas::mfe ) + install( + TARGETS + el734_scfe + RUNTIME DESTINATION bin + ) + + endif() diff --git a/frontend/el734_flame_fe.cxx b/frontend/el734_flame_fe.cxx index 3aca785..3eab731 100644 --- a/frontend/el734_flame_fe.cxx +++ b/frontend/el734_flame_fe.cxx @@ -62,7 +62,7 @@ extern BOOL should_exit; /*-- Globals -------------------------------------------------------*/ /* The frontend name (client name) as seen by other MIDAS clients */ -const char *frontend_name = "EL734 smel734o"; +const char *frontend_name = FRONTEND_NAME; /* The frontend file name, don't change it */ const char *frontend_file_name = __FILE__; @@ -76,20 +76,21 @@ INT display_period = 1000; INT max_event_size = 10000; /* maximum event size for fragmented events (EQ_FRAGMENTED) */ -INT max_event_size_frag = 5*1024*1024; +INT max_event_size_frag = 5 * 1024 * 1024; /* buffer size to hold events */ -INT event_buffer_size = 10*10000; +INT event_buffer_size = 10 * 10000; extern BOOL should_exit; /*! * equipment_common_overwrite: * - * - If that flag is TRUE, then the contents of the "equipment" structure is copied to - * the ODB on each start of the front-end. + * - If that flag is TRUE, then the contents of the "equipment" structure is + * copied to the ODB on each start of the front-end. * - * - If the flag is FALSE, then the ODB values are kept on the start of the front-end + * - If the flag is FALSE, then the ODB values are kept on the start of the + * front-end */ BOOL equipment_common_overwrite = FALSE; @@ -97,62 +98,56 @@ BOOL equipment_common_overwrite = FALSE; /* device driver list */ DEVICE_DRIVER sm_driver[] = { - { "EL734", el734dev, 2, tcpip, DF_PRIO_DEVICE }, - /* only initial demand value is taken from instrument */ - { "" } -}; - + {"EL734", el734dev, 2, tcpip, DF_PRIO_DEVICE}, + /* only initial demand value is taken from instrument */ + {""}}; EQUIPMENT equipment[] = { - { "smel734o", /* equipment name */ - {7, 0, /* event ID, trigger mask */ - "SYSTEM", /* event buffer */ - EQ_SLOW, /* equipment type */ - 0, /* event source */ - "FIXED", /* format */ - TRUE, /* enabled */ - RO_RUNNING | - RO_TRANSITIONS, /* read when running and on transitions */ - 60000, /* read every 60 sec */ - 0, /* stop run after this event limit */ - 0, /* number of sub events */ - 1, /* log history every event */ - "", "", ""}, - cd_gen_read, /* readout routine */ - cd_gen, /* class driver main routine */ - sm_driver, /* device driver list */ - NULL, /* init string */ - }, - - { "" } -}; + { + FRONTEND_NAME, /* equipment name */ + {7, 0, /* event ID, trigger mask */ + "SYSTEM", /* event buffer */ + EQ_SLOW, /* equipment type */ + 0, /* event source */ + "FIXED", /* format */ + TRUE, /* enabled */ + RO_RUNNING | RO_TRANSITIONS, /* read when running and on transitions */ + 60000, /* read every 60 sec */ + 0, /* stop run after this event limit */ + 0, /* number of sub events */ + 1, /* log history every event */ + "", "", ""}, + cd_gen_read, /* readout routine */ + cd_gen, /* class driver main routine */ + sm_driver, /* device driver list */ + NULL, /* init string */ + }, + {""}}; /*-- Dummy routines ------------------------------------------------*/ -INT poll_event(INT source, INT count, BOOL test) {return 1;}; -INT interrupt_configure(INT cmd, INT source, POINTER_T adr) {return 1;}; +INT poll_event(INT source, INT count, BOOL test) { return 1; }; +INT interrupt_configure(INT cmd, INT source, POINTER_T adr) { return 1; }; /*-- Frontend Init -------------------------------------------------*/ -INT frontend_init() -{ +INT frontend_init() { #ifdef FORTIFY Fortify_CheckAllMemory(); #endif - return CM_SUCCESS; + return CM_SUCCESS; } /*-- Frontend Exit -------------------------------------------------*/ -INT frontend_exit() -{ +INT frontend_exit() { #ifdef FORTIFY - Fortify_CheckAllMemory(); - Fortify_OutputStatistics(); + Fortify_CheckAllMemory(); + Fortify_OutputStatistics(); #endif - return CM_SUCCESS; + return CM_SUCCESS; } /*-- Frontend Loop -------------------------------------------------*/ @@ -161,37 +156,22 @@ INT frontend_exit() static DWORD last_time_fortify = 0; #endif -INT frontend_loop() -{ - return CM_SUCCESS; -} +INT frontend_loop() { return CM_SUCCESS; } /*-- Begin of Run --------------------------------------------------*/ -INT begin_of_run(INT run_number, char *error) -{ - return CM_SUCCESS; -} +INT begin_of_run(INT run_number, char *error) { return CM_SUCCESS; } /*-- End of Run ----------------------------------------------------*/ -INT end_of_run(INT run_number, char *error) -{ - return CM_SUCCESS; -} +INT end_of_run(INT run_number, char *error) { return CM_SUCCESS; } /*-- Pause Run -----------------------------------------------------*/ -INT pause_run(INT run_number, char *error) -{ - return CM_SUCCESS; -} +INT pause_run(INT run_number, char *error) { return CM_SUCCESS; } /*-- Resuem Run ----------------------------------------------------*/ -INT resume_run(INT run_number, char *error) -{ - return CM_SUCCESS; -} +INT resume_run(INT run_number, char *error) { return CM_SUCCESS; } -/*------------------------------------------------------------------*/ \ No newline at end of file +/*------------------------------------------------------------------*/