job.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #include "mk.h"
  10. Job *
  11. newjob(Rule *r, Node *nlist, char *stem, char **match, Word *pre,
  12. Word *npre, Word *tar, Word *atar)
  13. {
  14. register Job *j;
  15. j = (Job *)Malloc(sizeof(Job));
  16. j->r = r;
  17. j->n = nlist;
  18. j->stem = stem;
  19. j->match = match;
  20. j->p = pre;
  21. j->np = npre;
  22. j->t = tar;
  23. j->at = atar;
  24. j->nproc = -1;
  25. j->next = 0;
  26. return(j);
  27. }
  28. void
  29. dumpj(char *s, Job *j, int all)
  30. {
  31. Bprint(&bout, "%s\n", s);
  32. while(j){
  33. Bprint(&bout, "job@%p: r=%p n=%p stem='%s' nproc=%d\n",
  34. j, j->r, j->n, j->stem, j->nproc);
  35. Bprint(&bout, "\ttarget='%s' alltarget='%s' prereq='%s' nprereq='%s'\n",
  36. wtos(j->t, ' '), wtos(j->at, ' '), wtos(j->p, ' '), wtos(j->np, ' '));
  37. j = all? j->next : 0;
  38. }
  39. }