# 2.11BSD#431 - /usr/ingres/source/iutil/printup.c

##### Functions

    beginhdr          X
    printatt          X
    printeh           X
    printeol          X
    printfatt         X
    printhdr          X
    printup           X

##### Variables

    Printlgth         X

##### Macros

    PAGELGTH          X

       1: # include   <stdio.h>
       2:
       3: # include   "../ingres.h"
       4: # include   "../aux.h"
       5: # include   "../access.h"
       6: # include   "../symbol.h"
       7:
       8: # define    PAGELGTH    56
       9:
      10: int Printlgth;
      11: extern struct out_arg   Out_arg;
      12:
      13: printup(d, tuple)
      14: struct descriptor   *d;
      15: char            *tuple;
      16: {
      17:     register char       *ftype, *flen;
      18:     register int        *foff;
      19:     int         i, type;
      20:
      21:     ftype = &d->relfrmt[1];
      22:     flen = &d->relfrml[1];
      23:     foff = &d->reloff[1];
      24:     i = d->relatts;
      25:
      26:     /* If relation is S_BINARY then print char fields escaped */
      27:     if (d->relstat & S_BINARY)
      28:     {
      29:         while (i--)
      30:             printatt((type = *ftype++) == CHAR ? BINARY : type, *flen++, &tuple[*foff++]);
      31:     }
      32:     else
      33:     {
      34:         while (i--)
      35:             printatt(*ftype++, *flen++, &tuple[*foff++]);
      36:     }
      37:     printeol();
      38: }
      39:
      40: printatt(type, length1, value1)
      41: char    type;
      42: int length1;
      43: char    *value1;
      44: {
      45:     register int        length;
      46:     register char       *value;
      47:     char            buf[MAXFIELD];
      48:     extern char     *locv();
      49:     int         valbuf[4];
      50:
      51:     putc(Out_arg.coldelim, stdout);
      52:     length = length1;
      53:     switch (type)
      54:     {
      55:
      56:       case INT:
      57:         value = (char *) valbuf;
      58:         bmove(value1, value, length);
      59:         switch (length)
      60:         {
      61:
      62:           case 1:
      63:             printfatt(Out_arg.i1width, iocv(i1deref(value)));
      64:             break;
      65:
      66:           case 2:
      67:             printfatt(Out_arg.i2width, iocv(i2deref(value)));
      68:             break;
      69:
      70:           case 4:
      71:             printfatt(Out_arg.i4width, locv(i4deref(value)));
      72:             break;
      73:
      74:           default:
      75:             syserr("printatt: i%d", length);
      76:
      77:         }
      78:         return (0);
      79:
      80:       case FLOAT:
      81:         value = (char *) valbuf;
      82:         bmove(value1, value, length);
      83:         switch (length)
      84:         {
      85:
      86:           case 4:
      87:             ftoa(f4deref(value), buf, Out_arg.f4width, Out_arg.f4prec, Out_arg.f4style);
      88:             printfatt(Out_arg.f4width, buf);
      89:             break;
      90:
      91:           case 8:
      92:             ftoa(f8deref(value), buf, Out_arg.f8width, Out_arg.f8prec, Out_arg.f8style);
      93:             printfatt(Out_arg.f8width, buf);
      94:             break;
      95:
      96:           default:
      97:             syserr("printatt: f%d", length);
      98:
      99:         }
     100:         return (0);
     101:
     102:       case CHAR:
     103:         length &= 0377;
     104:         fwrite(value1, 1, length, stdout);
     105:         if ((length = Out_arg.c0width - length) > 0)
     106:             while (length--)
     107:                 putc(' ', stdout);
     108:         return (0);
     109:
     110:       case BINARY:
     111:         length &= 0377;
     112:         value = value1;
     113:         while (length--)
     114:             xputchar(*value++);
     115:         return (0);
     116:
     117:       default:
     118:         syserr("printatt type %d", type);
     119:     }
     120: }
     121:
     122:
     123: /*
     124: **  FORMATTED ATTRIBUTE PRINT
     125: **
     126: **	Attribute 'value' is printed.  It is type 'type' and has a
     127: **	field width of 'width'.
     128: */
     129:
     130: printfatt(width, value)
     131: int width;
     132: int value;
     133: {
     134:     register char   *p;
     135:     register int    w;
     136:     register int    v;
     137:
     138:     w = width;
     139:     p = (char *) value;
     140:     v = length(p);
     141:
     142:     if (v > w)
     143:     {
     144:         /* field overflow */
     145:         while (w--)
     146:             putc('*', stdout);
     147:         return;
     148:     }
     149:
     150:     /* output the field */
     151:     for (w -= v; w > 0; w--)
     152:         putc(' ', stdout);
     153:     fwrite(p, 1, v, stdout);
     154: }
     155:
     156:
     157: printeol()
     158: {
     159:     putc(Out_arg.coldelim, stdout);
     160:     putc('\n', stdout);
     161: }
     162:
     163: printeh()
     164: {
     165:     register int        i;
     166:
     167:     putc(Out_arg.coldelim, stdout);
     168:     for (i = 1; i < Printlgth; i++)
     169:         putc('-', stdout);
     170:     printeol();
     171: }
     172:
     173: printhdr(type, length1, value1)
     174: char    type;
     175: int length1;
     176: char    *value1;
     177: {
     178:     register int        length, i;
     179:     register char       *value;
     180:     char            c;
     181:
     182:     value = value1;
     183:     length = length1 & 0377;
     184:
     185:     switch (type)
     186:     {
     187:       case INT:
     188:         switch (length)
     189:         {
     190:
     191:           case 1:
     192:             length = Out_arg.i1width;
     193:             break;
     194:
     195:           case 2:
     196:             length = Out_arg.i2width;
     197:             break;
     198:
     199:           case 4:
     200:             length = Out_arg.i4width;
     201:             break;
     202:
     203:           default:
     204:             syserr("printhdr: i%d", length);
     205:
     206:         }
     207:         break;
     208:
     209:       case FLOAT:
     210:         switch (length)
     211:         {
     212:
     213:           case 4:
     214:             length = Out_arg.f4width;
     215:             break;
     216:
     217:           case 8:
     218:             length = Out_arg.f8width;
     219:             break;
     220:
     221:           default:
     222:             syserr("printhdr: f%d", length);
     223:
     224:         }
     225:         break;
     226:
     227:       case CHAR:
     228:         if (length < Out_arg.c0width)
     229:             length = Out_arg.c0width;
     230:         break;
     231:
     232:       default:
     233:         syserr("printhdr: type 0%o", type);
     234:     }
     235:
     236:     putc(Out_arg.coldelim, stdout);
     237:     for (i = 0; i < length && i < MAXNAME; i++)
     238:         if (c = *value++)
     239:             putc(c, stdout);
     240:         else
     241:             break;
     242:
     243:     for ( ; i < length; i++)
     244:         putc(' ', stdout);
     245:
     246:     Printlgth += length + 1;
     247: }
     248:
     249: beginhdr()
     250: {
     251:     Printlgth = 0;
     252:     putchar('\n');
     253: }

#### Defined functions

beginhdr defined in line 249; used 2 times

- in /usr/ingres/source/dbu/print.c line 117
- in /usr/ingres/source/parser/p_util.c line 208

printatt defined in line 40; used 3 times

- in line 30-35(2)
- in /usr/ingres/source/ovqp/interp.c line 201

printeh defined in line 163; used 4 times

- in /usr/ingres/source/dbu/print.c line 124, 154
- in /usr/ingres/source/parser/call_tree.c line 56
- in /usr/ingres/source/parser/p_util.c line 215

printeol defined in line 157; used 5 times

- in line 37, 170
- in /usr/ingres/source/dbu/print.c line 123
- in /usr/ingres/source/ovqp/scan.c line 241
- in /usr/ingres/source/parser/p_util.c line 214

printfatt defined in line 130; used 5 times

- in line 63-71(3), 88-93(2)

printhdr defined in line 173; used 2 times

- in /usr/ingres/source/dbu/print.c line 121
- in /usr/ingres/source/parser/p_util.c line 212

printup defined in line 13; used 42 times

- in /usr/ingres/source/access/find.c line 68
- in /usr/ingres/source/access/get.c line 95
- in /usr/ingres/source/access/getequal.c line 40, 55
- in /usr/ingres/source/access/insert.c line 43
- in /usr/ingres/source/access/replace.c line 65
- in /usr/ingres/source/dbu/create.c line 282
- in /usr/ingres/source/dbu/modify.c line 709, 725
- in /usr/ingres/source/dbu/pr_prot.c line 297
- in /usr/ingres/source/dbu/print.c line 134
- in /usr/ingres/source/dbu/save.c line 139
- in /usr/ingres/source/dbu/secupdate.c line 51, 104, 115
- in /usr/ingres/source/decomp/decomp.c line 197
- in /usr/ingres/source/ovqp/key.c line 241
- in /usr/ingres/source/ovqp/scan.c line 150, 167, 254-256(2)
- in /usr/ingres/source/ovqp/strategy.c line 99
- in /usr/ingres/source/qrymod/integrity.c line 137
- in /usr/ingres/source/qrymod/protect.c line 495
- in /usr/ingres/source/support/restore.c line 350, 405, 428, 447, 477, 492, 507, 578, 642, 661, 855, 883, 952, 969, 985, 1039, 1056, 1072

#### Defined variables

Printlgth defined in line 10; used 3 times

- in line 168, 246-251(2)

#### Defined macros

PAGELGTH defined in line 8; never used

Last modified: 1995-02-10 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 750 |