home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 334_02 / misc2.c < prev    next >
Text File  |  1991-02-05  |  2KB  |  66 lines

  1. /*
  2.  *
  3.  *    G N U P L O T  --  misc.c
  4.  *
  5.  *  Copyright (C) 1986 Thomas Williams, Colin Kelley
  6.  *
  7.  *  You may use this code as you wish if credit is given and this message
  8.  *  is retained.
  9.  *
  10.  *  Please e-mail any useful additions to vu-vlsi!plot so they may be
  11.  *  included in later releases.
  12.  *
  13.  *  This file should be edited with 4-column tabs!  (:set ts=4 sw=4 in vi)
  14.  */
  15.  
  16. #include <stdio.h>
  17. #include "plot.h"
  18.  
  19. extern struct curve_points plot[];
  20. extern int c_token,next_value,next_function;
  21. extern struct udft_entry udft[];
  22. extern struct at_type *curr_at;
  23. extern struct ft_entry ft[];
  24. extern struct vt_entry vt[];
  25.  
  26.  
  27. show_at(level)
  28. int level;
  29. {
  30. struct at_type *at_address;
  31. int i, j;
  32. struct value *arg;
  33.  
  34.     at_address = curr_at;
  35.     for (i = 0; i < at_address->count; i++) {
  36.         for (j = 0; j < level; j++)
  37.             (void) putc(' ',stderr);    /* indent */
  38.  
  39.             /* print name of action instruction */
  40.         fputs(ft[at_address->actions[i].index].ft_name,stderr);
  41.         arg = &(at_address->actions[i].arg);
  42.             /* now print optional argument */
  43.  
  44.         switch(at_address->actions[i].index) {
  45.           case (int)PUSH:    fprintf(stderr," (%s)\n",
  46.                       vt[arg->v.int_val].vt_name);
  47.                     break;
  48.           case (int)PUSHC:    (void) putc('(',stderr);
  49.                     show_value(stderr,arg);
  50.                     fputs(")\n",stderr);
  51.                     break;
  52.           case (int)PUSHD:    fprintf(stderr," (%s dummy)\n",
  53.                       udft[arg->v.int_val].udft_name);
  54.                     break;
  55.           case (int)CALL:    fprintf(stderr," (%s)\n",
  56.                       udft[arg->v.int_val].udft_name);
  57.                     curr_at = &udft[arg->v.int_val].at;
  58.                     show_at(level+2); /* recurse! */
  59.                     curr_at = at_address;
  60.                     break;
  61.           default:
  62.                     (void) putc('\n',stderr);
  63.         }
  64.     }
  65. }
  66.