home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 186_01 / mdebug.c < prev    next >
Text File  |  1985-08-21  |  2KB  |  69 lines

  1. /* MDEBUG.C -- Debug routines for MAKE.C.
  2.  *
  3.  * These routines should be linked in if DEBUG is #defined in MAKE.H.
  4.  * Otherwise, they are unnecessary.
  5.  *
  6.  * CREDITS:
  7.  *
  8.  * -- trav() and pnode() functions by Allen Holub (DDJ #106)
  9.  * -- debug() function by James Pritchett
  10.  * -- All code by Allen Holub adapted for BDS C (where necessary) by
  11.  *    James Pritchett.
  12.  *
  13.  * Version 1.0 -- 10/28/85
  14.  * Version 1.1 -- 12/06/85
  15.  */
  16.  
  17. #include    <bdscio.h>
  18. #include    "make.h"
  19.  
  20. void debug(s,p)     /* Print a message with a string parameter and
  21.                      * wait for console input to continue.
  22.                      */
  23. char    *s, *p;
  24. {
  25.     printf(s,p);
  26.     getchar();
  27. }
  28.  
  29. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  30.  
  31. trav(root)          /* Print the objectname tree.  This function
  32.                      * is recursive, printing the left branch, then
  33.                      * the root, then the right branch.
  34.                      */
  35. TNODE   *root;
  36. {
  37.     if(root == NULL)    /* NULL node is leaf */
  38.         return;
  39.     trav(root->lnode);  /* Do the left branch */
  40.     pnode(root);        /* Then the node */
  41.     trav(root->rnode);  /* Then the right branch */
  42. }
  43.  
  44. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  45.  
  46. pnode(node)     /* Print a node */
  47. TNODE   *node;
  48. {
  49.     char    **linev;
  50.  
  51.     printf("+-----------------------------------------\n");
  52.     printf("|   Node at 0x%x\n",node);
  53.     printf("+-----------------------------------------\n");
  54.     printf("|   lnode = 0x%x, rnode = 0x%x\n",node->rnode,node->lnode);
  55.     printf("|   status = %d\n",node->changed);
  56.     printf("|   target = <%s>\n",node->being_made);
  57.     printf("|   dependancies:\n");
  58.     for(linev = node->depends_on; *linev; printf("|\t%s\n",*linev++))
  59.         ;
  60.     printf("|   actions:\n");
  61.     for(linev = node->do_this; *linev; printf("|\t%s\n",*linev++))
  62.         ;
  63.     printf("+-----------------------------------------\n");
  64.     getchar();
  65. }
  66.  
  67. /* end */
  68.  
  69. root =