예제 #1
0
int main() {
int rcdaq,runN;
rcdaq= daqlogbook_open();
if(rcdaq!=0) {
  printf("ERROR DAQlogbook_open failed:%d\n", rcdaq);
} else {
runN=0;
rcdaq=daqlogbook_add_comment(runN,"title test","test message");
rcdaq= daqlogbook_close();
};
}
예제 #2
0
/*--------------------*/ void DOcom2daq(void *tag, void *msg, int *size)  {
// msg: runN "title" "comment" 
int ixl, runN; char errmsg[200]="";
char *line;
#define MAXDAQCOMMENT 500
char value[MAXDAQCOMMENT];
char title[MAXDAQCOMMENT];
enum Ttokentype t1;
line= (char *)msg;
printf("INFO DOcom2daq len:%d m:%s\n", *size, line); 
if(*size > MAXDAQCOMMENT) {
  printf("ERROR too long title+comment for DAQlogbook\n"); return;
};
ixl=0; t1= nxtoken(line, value, &ixl);   // runN
if(t1==tINTNUM) {
  runN= str2int(value);
  t1= nxtoken(line, value, &ixl);   // title
  if(t1==tSTRING) {
    strcpy(title, value);
    t1= nxtoken(line, value, &ixl);   // message
    if(t1==tSTRING) {
      int rcdl;
      rcdl= daqlogbook_add_comment(0,title,value);
      printf("INFO DAQlogbook comment: %d %s %s rc:%d\n",
        runN, title, value,rcdl);
    } else {
      strcpy(errmsg,"Bad message (\"string\" expected)");
    };
  } else {
    strcpy(errmsg,"Bad title (\"string\" expected)");
  };
} else {
  strcpy(errmsg,"Bad run number (int expected)");
};
if(errmsg[0]!='\0') {
  printf("ERROR DOcom2daq:%s:%s\n",errmsg, line);
};
}