Exemplo n.º 1
0
thStatus thOBook()
/* Book all the parameter, tests, and histograms and anything else that is
   in the booking order list.
   This is the pre-group booking routine.  Within each class it booked blocks
   in alphabetical order.
*/
{
  thBookList *booklist;

  /* Need to find a way to make sure these are called by anything else
     that might do booking.  Perhaps need a thInit routine. */
/*  printf("In thBook\n");*/
  if (!thBookListP) {		/* Booking order not defined */
    if(thSetBlockClasses() != S_SUCCESS){
      fprintf(STDERR,"Failed to set the th Block Class handlers\n");
      return(S_FAILURE);
    }
  }

  booklist = thBookListP;
  while(booklist){
    char *prefix; char **blist0; char **blist; int count;
    daVarStruct var, *bvar;

    if(daVarLookup(booklist->classname,&var) != S_SUCCESS){
      fprintf(STDERR,"Failed to find class variable %s\n",booklist->classname);
      return(S_FAILURE);
    }
    
    prefix = (char *) malloc(strlen(booklist->classname) + 2);
    strcpy(prefix,booklist->classname);
    strcat(prefix,".");
    
    daVarList(prefix,&blist0,&count);
    blist = blist0;
    while(count-- > 0){
      thStatus stat;

      /* printf("Booking %s\n",*blist); */
      if(daVarLookupP(*blist,&bvar) != S_SUCCESS){
	fprintf(STDERR,"Failed to find %s\n",*blist);
	return(S_FAILURE);
      }
      if(!bvar->varptr) {	/* Only book those not already booked */
	bvar->varptr = (DAINT *) malloc(sizeof(DAINT));
	*((DAINT *) bvar->varptr) = 0; /* Initializec execution counter */
	stat = ((thStatus (*)()) var.opaque)(bvar);
      }
      blist++;
    }
    
    daVarFreeList(blist0);

    booklist = booklist->next;
  }
  return(S_SUCCESS);
}
Exemplo n.º 2
0
NAMELIST *
davar_getlist_1(char **argp, CLIENT *clnt)
{

    static NAMELIST result= {0,0};
    char **list;
    int i, count;

    if(result.NAMELIST_val) {
        /*	  printf("Freeing previous list\n");*/
        daVarFreeList(result.NAMELIST_val);
    }
    daVarList(*argp,&list,&count); /* Check error code */
    result.NAMELIST_len = count;
    result.NAMELIST_val = list;

    return(&result);
}