26#ifndef DOXYGEN_SHOULD_SKIP_THIS
52 for (
i=0;
i<size;
i++) {
68static void xwrite(
const char* filename,
int fd,
const void*
data,
int size)
76static int xread(
const char* filename,
int fd,
void*
data,
int size)
83 }
else if (
rd != size) {
84 cm_msg(
MERROR,
"xread",
"truncated read from \'%s\', read(%d) returned %d", filename, size,
rd);
153 bedit = (tag[0] != 0);
159 cm_msg(
MERROR,
"el_submit",
"Cannot lock experiment semaphore, ss_semaphore_wait_for() status %d",
status);
183 const char* buffer =
NULL;
190 }
else if (
idx == 1) {
194 }
else if (
idx == 2) {
233 tms.tm_year % 100,
tms.tm_mon + 1,
tms.tm_mday,
236 tms.tm_year % 100,
tms.tm_mon + 1,
tms.tm_mday,
293 cm_msg(
MERROR,
"el_submit",
"cannot read from \'%s\', corrupted file: bad size %d in \"%s\"",
file_name, size,
str);
301 cm_msg(
MERROR,
"el_submit",
"cannot read from \'%s\', corrupted file: bad size %d in \"%s\", cannot malloc(%d): errno %d (%s)",
file_name, size,
str, size,
errno,
strerror(
errno));
327 if (buffer ==
NULL) {
353 assert(
sizeof(
date) >= 32);
427 assert(size < 999999);
497#ifndef DOXYGEN_SHOULD_SKIP_THIS
538 tms.tm_year = (tag[0] -
'0') * 10 + (tag[1] -
'0');
539 tms.tm_mon = (tag[2] -
'0') * 10 + (tag[3] -
'0') - 1;
540 tms.tm_mday = (tag[4] -
'0') * 10 + (tag[5] -
'0');
543 if (
tms.tm_year < 90)
575 sprintf(tag,
"%02d%02d%02d.0",
tms.tm_year % 100,
tms.tm_mon + 1,
tms.tm_mday);
579 if (direction != -1 &&
ltime > time(
NULL) + 3600 * 24)
631 sprintf(tag,
"%02d%02d%02d",
tms.tm_year % 100,
tms.tm_mon + 1,
tms.tm_mday);
639 if (direction == -1) {
699 if (direction == 1) {
839 if ((
strncmp(
str,
"$Start$:", 8) != 0) || (size <= 15)) {
840 cm_msg(
MERROR,
"el_retrieve",
"cannot read from \'%s\', corrupted file: no $Start$ or bad size in \"%s\"", filename,
str);
858 if (
rd <= 0 || !((
rd + 15 == size) || (
rd == size))) {
914 p =
strstr(
message,
"========================================\n");
928 if (
strstr(text,
"$End$"))
929 *
strstr(text,
"$End$") = 0;
985 strcpy(
strchr(tag,
'.'),
".0");
1032#ifdef LOCAL_ROUTINES
1038 char *buffer =
NULL;
1047 "Cannot lock experiment semaphore, ss_semaphore_wait_for() status %d",
status);
1084 if (buffer ==
NULL) {
INT cm_get_experiment_database(HNDLE *hDB, HNDLE *hKeyClient)
INT cm_get_experiment_semaphore(INT *semaphore_alarm, INT *semaphore_elog, INT *semaphore_history, INT *semaphore_msg)
INT el_search_run(int run, char *return_tag)
static void el_decode(const char *message, const char *key, char *result, int size)
static void xwrite(const char *filename, int fd, const void *data, int size)
INT el_retrieve(char *tag, char *date, int *run, char *author, char *type, char *syst, char *subject, char *text, int *textsize, char *orig_tag, char *reply_tag, char *attachment1, char *attachment2, char *attachment3, char *encoding)
INT el_delete_message(const char *tag)
INT el_submit(int run, const char *author, const char *type, const char *syst, const char *subject, const char *text, const char *reply_to, const char *encoding, const char *afilename1, const char *buffer1, INT buffer_size1, const char *afilename2, const char *buffer2, INT buffer_size2, const char *afilename3, const char *buffer3, INT buffer_size3, char *tag, INT tag_size)
static int xread(const char *filename, int fd, void *data, int size)
static void xtruncate(const char *filename, int fd)
INT el_search_message(char *tag, int *fh, BOOL walk, char *xfilename, int xfilename_size)
time_t ss_mktime(struct tm *tms)
INT ss_semaphore_release(HNDLE semaphore_handle)
INT ss_semaphore_wait_for(HNDLE semaphore_handle, DWORD timeout_millisec)
INT cm_msg(INT message_type, const char *filename, INT line, const char *routine, const char *format,...)
INT db_get_value(HNDLE hDB, HNDLE hKeyRoot, const char *key_name, void *data, INT *buf_size, DWORD type, BOOL create)
INT rpc_call(DWORD routine_id,...)
#define DIR_SEPARATOR_STR
#define message(type, str)
#define write(n, a, f, d)
static std::string remove(const std::string s, char c)
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)