home *** CD-ROM | disk | FTP | other *** search
/ Vectronix 2 / VECTRONIX2.iso / FILES_01 / X_PROLOG.LZH / X_PROLOG / SOURCES / DEBUG.C < prev    next >
C/C++ Source or Header  |  1990-08-13  |  1KB  |  71 lines

  1. /*
  2.  *        X PROLOG  Vers. 2.0
  3.  *
  4.  *
  5.  *    Written by :     Andreas Toenne
  6.  *            CS Dept. , IRB
  7.  *            University of Dortmund, W-Germany
  8.  *            <at@unido.uucp>
  9.  *            <....!seismo!unido!at>
  10.  *            <at@unido.bitnet>
  11.  *
  12.  *    Copyright :    This software is copyrighted by Andreas Toenne.
  13.  *            Permission is granted hereby to copy the entire
  14.  *            package including this copyright notice without fee.
  15.  *
  16.  */
  17.  
  18. #include <stdio.h>
  19. #include "prolog.h"
  20. #include "extern.h"
  21.  
  22. void debug()
  23. {
  24.     env *e;
  25.     backlog *b;
  26.     short i;
  27.     
  28.     e = Topenv;
  29.     b = Backpoint;
  30.     printf("********\n");
  31.     while (TRUE)
  32.     {
  33.         if (e)                /* have some enviroments left */
  34.         {
  35.             if (b)            /* and some backpoints too */
  36.             {
  37.                 if ((long)e < (long)b) /* print backlog first */
  38.                 {
  39.                     db_backlog(b,e);
  40.                     b = b->pre;
  41.                 }
  42.                 else
  43.                 {
  44.                     db_env(e);
  45.                     e = e->pre;
  46.                 }
  47.             }
  48.             else
  49.             {
  50.                 db_env(e);
  51.                 e = e->pre;
  52.             }
  53.         }
  54.         else
  55.             break;
  56.     }
  57. }
  58.  
  59. db_backlog(b,e)
  60. {
  61.     printf("B> ");
  62. }
  63.  
  64. db_env(e)
  65. env *e;
  66. {
  67.     printf("E> ");
  68.     display(e->current, e, 255, TRUE, TRUE);
  69.     puts("");
  70. }
  71.