IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 2, 2005, 9:40:50 AM (21 years ago)
Author:
eugene
Message:

psched bugfixes, moved IOBuffers and queues

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/pantasks/TaskOps.c

    r4693 r4697  
    6868      fprintf (stderr, "- ");
    6969    }
    70     fprintf (stderr, "%-15s %4d   %-20s\n", tasks[i][0].name, tasks[i][0].Njobs, tasks[i][0].argv[0]);
     70    if (tasks[i][0].argv == NULL) {
     71      fprintf (stderr, "%-15s %4d   %-20s\n", tasks[i][0].name, tasks[i][0].Njobs, "dynamic");
     72    } else {
     73      fprintf (stderr, "%-15s %4d   %-20s\n", tasks[i][0].name, tasks[i][0].Njobs, tasks[i][0].argv[0]);
     74    }
    7175    if (verbose) {
    7276      fprintf (stderr, "    spawn period: %f, polling period: %f, timeout period: %f\n",
     
    209213}
    210214
    211 int ValidateTask (Task *task) {
    212 
    213   if (task[0].argc == 0) {
     215int ValidateTask (Task *task, int RequireStatic) {
     216
     217  int i, hash;
     218
     219  /* is a static command defined? */
     220  if (task[0].argc != 0) {
     221    if (task[0].argv == NULL) {
     222      fprintf (stderr, "task command arguments not defined (programming error)\n");
     223      return (FALSE);
     224    }
     225    return (TRUE);
     226  }
     227  if (RequireStatic) {
    214228    fprintf (stderr, "task command not defined\n");
    215229    return (FALSE);
    216230  }
    217   if (task[0].argv == NULL) {
    218     fprintf (stderr, "task command arguments not defined (programming error)\n");
    219     return (FALSE);
    220   }
    221   return (TRUE);
     231
     232  /* no static command; dynamic command? */
     233  if (task[0].exec != NULL) {
     234    for (i = 0; i < task[0].exec[0].Nlines; i++) {
     235      hash = TaskHash (task[0].exec[0].line[i]);
     236      if (hash == TASK_COMMAND) return (TRUE);
     237    }
     238  }
     239  fprintf (stderr, "task command not defined\n");
     240  return (FALSE);
    222241}
    223242
     
    250269}
    251270
     271Task *GetActiveTask () {
     272  Task *task;
     273  if (ActiveTask < 0) return (NULL);
     274  task = tasks[ActiveTask];
     275  return (task);
     276}
     277
     278int TaskHash (char *input) {
     279 
     280  int hash;
     281  char *command;
     282
     283  hash = TASK_NONE;
     284
     285  command = thisword (input);
     286  if (command == NULL) return (TASK_EMPTY);
     287
     288  if (command[0] == '#')                  hash = TASK_COMMENT;
     289  if (!strcasecmp (command, "END"))       hash = TASK_END;
     290  if (!strcasecmp (command, "HOST"))      hash = TASK_HOST;
     291  if (!strcasecmp (command, "NMAX"))      hash = TASK_NMAX;
     292  if (!strcasecmp (command, "TRANGE"))    hash = TASK_TRANGE;
     293  if (!strcasecmp (command, "COMMAND"))   hash = TASK_COMMAND;
     294  if (!strcasecmp (command, "PERIODS"))   hash = TASK_PERIODS;
     295  if (!strcasecmp (command, "TASK.EXIT")) hash = TASK_EXIT;
     296  if (!strcasecmp (command, "TASK.EXEC")) hash = TASK_EXEC;
     297
     298  free (command);
     299  return (hash);
     300}
     301
    252302/*** task timer functions ***/
    253303
Note: See TracChangeset for help on using the changeset viewer.