home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / ingres04.lzh / source / ovqp / prsym.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-05-30  |  2.6 KB  |  153 lines

  1. # include    <ingres.h>
  2. # include    <aux.h>
  3. # include    <symbol.h>
  4. # include    <tree.h>
  5. # include    "../decomp/globs.h"
  6. # include    <sccs.h>
  7.  
  8. SCCSID(@(#)prsym.c    8.3    5/30/88)
  9.  
  10. prsym(s)
  11. register SYMBOL    *s;
  12. {
  13.     register union symvalue    *p;
  14.     register int        type;
  15.     register int        len;
  16.     union symvalue        temp;
  17.  
  18.     type = s->type;
  19.     len = s->len & I1MASK;
  20.     p = &s->value;
  21.     if (type == S_VAR)
  22.     {
  23.         /* actually, S_VAR's are rendered the same as VAR's
  24.          * by call_ovqp70.c's ovqpnod()
  25.          */
  26.         printf("s_");    /* first part of "s_var" message */
  27.         type = VAR;    /* execute var portion */
  28.     }
  29.     if (type == VAR)
  30.     {
  31.         printf("var:att#=%d:", p->sym_var.attno);
  32.         type = p->sym_var.varfrmt;
  33.         len = p->sym_var.varfrml;
  34.         if (type != CHAR)
  35.         {
  36.             /* move anytype to symvalue boundary */
  37.             bmove((char *)p->sym_var.valptr, (char *)&temp, sizeof *p);
  38.             p = &temp;
  39.         }
  40.     }
  41.     xputchar(type);
  42.     printf("%d:value='", len);
  43.     switch (type)
  44.     {
  45.       case AND:
  46.         printf("%d [AND] (operator)", p->sym_op.opno);
  47.         break;
  48.       case AOP:
  49.         printf("%d [AOP] (operator)", p->sym_op.opno);
  50.         break;
  51.       case BOP:
  52.         printf("%d [BOP] (operator)", p->sym_op.opno);
  53.         break;
  54.       case OR:
  55.         printf("%d [OR] (operator)", p->sym_op.opno);
  56.         break;
  57.       case RESDOM:
  58.         printf("%d [RESDOM] (operator)", p->sym_op.opno);
  59.         break;
  60.       case UOP:
  61.         printf("%d [UOP] (operator)", p->sym_op.opno);
  62.         break;
  63.       case COP:
  64.         printf("%d [COP] (operator)", p->sym_op.opno);
  65.         break;
  66.  
  67.       case INT:
  68.         switch (len)
  69.         {
  70.           case 1:
  71.             printf("%d", p->sym_data.i1type);
  72.             break;
  73.  
  74.           case 2:
  75.             printf("%d", p->sym_data.i2type);
  76.             break;
  77.  
  78.           case 4:
  79.             printf("%ld", p->sym_data.i4type);
  80.         }
  81.         break;
  82.  
  83.       case FLOAT:
  84.         if (len == 4)
  85.             printf("%10.3f", p->sym_data.f4type);
  86.         else
  87.             printf("%10.3f", p->sym_data.f8type);
  88.         break;
  89.  
  90.       case RESULTID:
  91.       case SOURCEID:
  92.       case CHAR:
  93.         printf("%x=", p->sym_data.c0type);
  94.         prstr(p->sym_data.c0type, len);
  95.         break;
  96.  
  97.       case AGHEAD:
  98.         printf("AGHEAD (delim)");
  99.         break;
  100.       case BYHEAD:
  101.         printf("BYHEAD (delim)");
  102.         break;
  103.       case QLEND:
  104.         printf("QLEND (delim)");
  105.         break;
  106.       case ROOT:
  107.         printf("ROOT (delim)");
  108.         break;
  109.       case TREE:
  110.         printf("TREE (delim)");
  111.         break;
  112.  
  113.       case CHANGESTRAT:
  114.       case REOPENRES:
  115.       case EXIT:
  116.       case QMODE:
  117.       case RETVAL:
  118.       case USERQRY:
  119.         if (len)
  120.             printf("%d", p->sym_op.opno);
  121.         printf(" (status)");
  122.         break;
  123.  
  124.       default:
  125.         printf("\nError in prsym: bad type= %d\n", type);
  126.     }
  127.     printf("'\n");
  128. }
  129.  
  130.  
  131. prstack(s)
  132. register SYMBOL    *s;
  133. {
  134.     if (s->type == CHAR)
  135.     {
  136.         printf("c%d:value='%x=", s->len,s->value.sym_data.cptype);
  137.         prstr(s->value.sym_data.cptype, s->len & I1MASK);
  138.         printf("'\n");
  139.     }
  140.     else
  141.         prsym(s);
  142. }
  143.  
  144.  
  145.  
  146. prstr(p, l)
  147. register char    *p;
  148. register int    l;
  149. {
  150.     while (--l >= 0)
  151.         putchar(*p++);
  152. }
  153.