MIDAS
Loading...
Searching...
No Matches
mfed.cxx
Go to the documentation of this file.
1/********************************************************************\
2
3 Name: mfed.c
4 Created by: Stefan Ritt
5
6 Contents: Dummy routines to simplify syntax for mfe based
7 frontends.
8
9 Users must #defien MFED before #include "mfe.h"
10 and link against mfed.cxx
11
12\********************************************************************/
13
14#include <cstdio>
15#include <cstring>
16#include <history.h>
17#include "midas.h"
18#include "mfe.h"
19#include "odbxx.h"
20
21/*-- Globals -------------------------------------------------------*/
22
23/* frontend_loop is called periodically if this variable is TRUE */
25
26/* a frontend status page is displayed with this frequency in ms */
28
29/* maximum event size produced by this frontend */
30INT max_event_size = 1024 * 1024;
31
32/* maximum event size for fragmented events (EQ_FRAGMENTED) */
33INT max_event_size_frag = 5 * 1024 * 1024;
34
35/* buffer size to hold events */
36INT event_buffer_size = 2 * 1024 * 1024;
37
38/*------------------------------------------------------------------*/
39
40void set_max_event_size(int size)
41{
42 max_event_size = size;
43}
44
46{
47 event_buffer_size = size;
48}
49
50/*------------------------------------------------------------------*/
51
53
55{
56 p_poll_event = f;
57}
58
60{
61 if (p_poll_event)
62 return p_poll_event(source, count, test);
63 return 1;
64}
65
66INT interrupt_configure(__attribute__((unused)) INT cmd, __attribute__((unused)) INT source, __attribute__((unused)) PTYPE adr)
67{
68 return 1;
69}
70
71/*------------------------------------------------------------------*/
72
74
76{
78}
79
81{
83 return p_frontend_exit();
84 return CM_SUCCESS;
85}
86
87/*------------------------------------------------------------------*/
88
90
92{
94}
95
96INT begin_of_run(__attribute__((unused)) INT rn, __attribute__((unused)) char *error)
97{
99 return p_begin_of_run();
100 return CM_SUCCESS;
101}
102
103/*------------------------------------------------------------------*/
104
106
108{
109 p_end_of_run = f;
110}
111
112INT end_of_run(__attribute__((unused)) INT rn, __attribute__((unused)) char *error)
113{
114 if (p_end_of_run)
115 return p_end_of_run();
116 return CM_SUCCESS;
117}
118
119/*------------------------------------------------------------------*/
120
122
124{
125 p_pause_run = f;
126}
127
128INT pause_run(__attribute__((unused)) INT rn, __attribute__((unused)) char *error)
129{
130 if (p_pause_run)
131 return p_pause_run();
132 return CM_SUCCESS;
133}
134
135/*------------------------------------------------------------------*/
136
138
140{
141 p_resume_run = f;
142}
143
144INT resume_run(__attribute__((unused)) INT rn, __attribute__((unused)) char *error)
145{
146 if (p_resume_run)
147 return p_resume_run();
148 return CM_SUCCESS;
149}
150
151/*------------------------------------------------------------------*/
152
154
156{
157 p_frontend_loop = f;
158}
159
160/*------------------------------------------------------------------*/
161
163{
164 if (p_frontend_loop)
165 return p_frontend_loop();
166 else
167 ss_sleep(10); // don't eat all CPU
168 return CM_SUCCESS;
169}
#define CM_SUCCESS
Definition midas.h:582
INT ss_sleep(INT millisec)
Definition system.cxx:3628
double count
Definition mdump.cxx:33
BOOL frontend_call_loop
Definition mfed.cxx:24
INT begin_of_run(__attribute__((unused)) INT rn, __attribute__((unused)) char *error)
Definition mfed.cxx:96
void install_begin_of_run(INT(*f)())
Definition mfed.cxx:91
INT max_event_size
Definition mfed.cxx:30
INT frontend_exit()
Frontend exit.
Definition mfed.cxx:80
INT(* p_begin_of_run)()
Definition mfed.cxx:89
void set_max_event_size(int size)
Definition mfed.cxx:40
INT poll_event(__attribute__((unused)) INT source, __attribute__((unused)) INT count, __attribute__((unused)) BOOL test)
Definition mfed.cxx:59
INT(* p_frontend_loop)()
Definition mfed.cxx:153
INT event_buffer_size
Definition mfed.cxx:36
INT max_event_size_frag
Definition mfed.cxx:33
INT interrupt_configure(__attribute__((unused)) INT cmd, __attribute__((unused)) INT source, __attribute__((unused)) PTYPE adr)
Definition mfed.cxx:66
INT(* p_resume_run)()
Definition mfed.cxx:137
INT(* p_pause_run)()
Definition mfed.cxx:121
void set_event_buffer_size(int size)
Definition mfed.cxx:45
void install_resume_run(INT(*f)())
Definition mfed.cxx:139
void install_pause_run(INT(*f)())
Definition mfed.cxx:123
INT(* p_end_of_run)()
Definition mfed.cxx:105
INT(* p_poll_event)(INT, INT, BOOL)
Definition mfed.cxx:52
void install_frontend_exit(INT(*f)())
Definition mfed.cxx:75
INT display_period
Definition mfed.cxx:27
INT(* p_frontend_exit)()
Definition mfed.cxx:73
INT end_of_run(__attribute__((unused)) INT rn, __attribute__((unused)) char *error)
Definition mfed.cxx:112
void install_end_of_run(INT(*f)())
Definition mfed.cxx:107
INT frontend_loop()
Frontend loop.
Definition mfed.cxx:162
void install_poll_event(INT(*f)(INT, INT, BOOL))
Definition mfed.cxx:54
void install_frontend_loop(INT(*f)())
Definition mfed.cxx:155
DWORD BOOL
Definition midas.h:105
int INT
Definition midas.h:129
#define PTYPE
Definition midas.h:170
#define TRUE
Definition midas.h:182
#define resume_run
#define pause_run
program test
Definition miniana.f:6
INT rn
Definition mstat.cxx:30
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24