home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume10 / ifp / part05 / interp / debug.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-07-06  |  2.6 KB  |  79 lines

  1.  
  2. /****** debug.c *******************************************************/
  3. /**                                                                  **/
  4. /**                    University of Illinois                        **/
  5. /**                                                                  **/
  6. /**                Department of Computer Science                    **/
  7. /**                                                                  **/
  8. /**   Tool: IFP                         Version: 0.5                 **/
  9. /**                                                                  **/
  10. /**   Author:  Arch D. Robison          Date:   May 1, 1985          **/
  11. /**                                                                  **/
  12. /**   Revised by: Arch D. Robison       Date:   Dec 5, 1985          **/
  13. /**                                                                  **/
  14. /**   Principal Investigators: Prof. R. H. Campbell                  **/
  15. /**                            Prof. W. J. Kubitz                    **/
  16. /**                                                                  **/
  17. /**                                                                  **/
  18. /**------------------------------------------------------------------**/
  19. /**   (C) Copyright 1987  University of Illinois Board of Trustees   **/
  20. /**                       All Rights Reserved.                       **/
  21. /**********************************************************************/
  22.  
  23.  
  24. #include <stdio.h>
  25. #include "struct.h"
  26. #include "string.h"
  27.  
  28. #if DEBUG
  29. int Debug = 0;     /* Print debugging statements if true */
  30. #endif
  31.  
  32. #if DUMP
  33. /*
  34.  * DumpNode
  35.  *
  36.  * Print out node N and all its decendants.
  37.  */
  38. void DumpNode (N,Indent)
  39.    register NodePtr N;
  40.    int Indent;
  41.    {
  42.       extern void OutIndent ();
  43.  
  44.       OutIndent (3*Indent);
  45.       if (N == NULL) printf ("DumpNode: N = NULL\n");
  46.       else {
  47.      OutString (N->NodeName);
  48.      switch (N->NodeType) {
  49.          case NEWNODE: printf ("(new) "); break;
  50.          case MODULE:
  51.         printf (" module\n");
  52.         for (N = N->NodeData.NodeMod.FirstChild; N!=NULL; N=N->NodeSib)
  53.            DumpNode (N,Indent+1);
  54.         break;
  55.          case DEF:
  56.            printf (" function");
  57.            if (N->NodeData.NodeDef.DefFlags & TRACE)
  58.           printf ("(trace) ");
  59.            OutObject (&N->NodeData.NodeDef.DefCode);
  60.            printf ("\n");
  61.            break;
  62.         case IMPORT:
  63.            printf (" import");
  64.            OutObject (&N->NodeData.NodeImp.ImpDef);
  65.            printf ("\n");
  66.            break;
  67.         default:
  68.            printf (" invalid NodeType (%x)\n",N->NodeType);
  69.            break;
  70.      }
  71.       }
  72.    }
  73.  
  74. #endif /* DUMP */
  75.  
  76.  
  77. /*************************** end of debug.c *********************************/
  78.  
  79.