62{
65 int debug_flag = 0;
71
74
75#ifndef OS_WINNT
77#endif
78
79
81
82
83
86
87 for (
int i = 1;
i <
argc;
i++) {
88 if (
argv[
i][0] ==
'-') {
89 if (
argv[
i][1] ==
'v')
91 else if (
argv[
i][1] ==
'f')
93 else if (
argv[
i][1] ==
'a')
95 else if (
argv[
i][1] ==
'm')
103 else
105 }
106 }
107
108 if (debug_flag)
111 debug_flag = 1;
112
113
115
120 fprintf(
stderr,
"Error: Cannot connect to experiment \'%s\' on host \'%s\', status %d\n",
124 exit(1);
125 }
126
129
131
134
140
142
143 if (
argv[
i][0] ==
'-') {
144
145
146
147 if (
argv[
i][1] ==
'd')
149 else if (
argv[
i][1] ==
'h')
151 if (
argv[
i][1] ==
'e')
153
154 continue;
155
157
158
159
160
162
164 printf(
"START: Run is already started\n");
167 exit(1);
169 printf(
"START: Run is paused, please use \"RESUME\"\n");
172 exit(1);
173 }
174
175
181
183
188 }
189 }
190
193
197
200
201 printf(
"START: cm_transition status %d, message \'%s\'\n",
status,
str);
202 }
203
205
206
207
209
211 printf(
"Run is already stopped, stopping again.\n");
212 }
213
216
218 printf(
"STOP: cm_transition status %d, message \'%s\'\n",
status,
str);
219
221
222
223
225
227 printf(
"PAUSE: Run is already paused\n");
228 continue;
229 }
230
232 printf(
"PAUSE: Run is not started\n");
235 exit(1);
236 }
237
240
242 printf(
"PAUSE: cm_transition status %d, message \'%s\'\n",
status,
str);
243
245
247
249 printf(
"RESUME: Run is already running\n");
250 continue;
252 printf(
"RESUME: Run is not paused\n");
255 exit(1);
256 }
257
261 printf(
"RESUME: cm_transition status %d, message \'%s\'\n",
status,
str);
262
264
268 printf(
"STARTABORT: cm_transition status %d, message \'%s\'\n",
status,
str);
269
271
275 }
276
277 const char* arg =
argv[++
i];
278 int delay = 0;
279
282 } else if (arg[0] == '/') {
283 int size = sizeof(delay);
289 exit(1);
290 }
291 }
292
294 printf(
"DELAY \'%s\' %d sec\n", arg, delay);
295
298
300
304 }
305
306 const char* arg =
argv[++
i];
308
311 } else if (arg[0] == '/') {
312 int size =
sizeof(
value);
316 }
321 exit(1);
322 }
323 }
324
327
331 exit(0);
332 }
333
334 } else {
335
338
339 }
340 }
341
342 while (1) {
345 break;
346 printf(
"waiting for transition to finish!\n");
348 }
349
350
352
354
355 return 0;
356}
INT cm_get_experiment_database(HNDLE *hDB, HNDLE *hKeyClient)
INT cm_transition(INT transition, INT run_number, char *errstr, INT errstr_size, INT async_flag, INT debug_flag)
INT cm_connect_experiment1(const char *host_name, const char *default_exp_name, const char *client_name, void(*func)(char *), INT odb_size, DWORD watchdog_timeout)
INT cm_disconnect_experiment(void)
INT cm_get_environment(char *host_name, int host_name_size, char *exp_name, int exp_name_size)
INT cm_transition_cleanup()
INT ss_sleep(INT millisec)
INT cm_set_msg_print(INT system_mask, INT user_mask, int(*func)(const char *))
INT db_get_value(HNDLE hDB, HNDLE hKeyRoot, const char *key_name, void *data, INT *buf_size, DWORD type, BOOL create)
INT db_set_value(HNDLE hDB, HNDLE hKeyRoot, const char *key_name, const void *data, INT data_size, INT num_values, DWORD type)
char exp_name[NAME_LENGTH]
char host_name[HOST_NAME_LENGTH]
#define DEFAULT_WATCHDOG_TIMEOUT
int read_state(HNDLE hDB)
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)