1: # include   "../ingres.h"
   2: # include   "../access.h"
   3: 
   4: del_tuple(tid, width)
   5: struct tup_id   *tid;
   6: int     width;
   7: 
   8: /*
   9: **	Delete the specified tuple from the
  10: **	current page.
  11: **
  12: **	The space occupied by the tuple is
  13: **	compacted and the effected remaining
  14: **	tuple line offsets are adjusted.
  15: */
  16: 
  17: {
  18:     register char   *startpt, *midpt;
  19:     register int    i;
  20:     char        *endpt;
  21:     int     cnt, offset, nextline;
  22:     int     linenum;
  23:     char        *get_addr();
  24: 
  25:     linenum = tid->line_id & I1MASK;
  26:     offset = Acc_head->linetab[-linenum];
  27:     nextline = Acc_head->nxtlino;
  28: 
  29:     startpt = get_addr(tid);
  30:     midpt = startpt + width;
  31:     endpt = &((struct raw_accbuf *)Acc_head)->acc_buf[0] + Acc_head->linetab[-nextline];
  32: 
  33:     cnt = endpt - midpt;
  34: 
  35:     /* delete tuple */
  36:     Acc_head->linetab[-linenum] = 0;
  37: 
  38:     /* update affected line numbers */
  39:     for (i = 0; i <= nextline; i++)
  40:     {
  41:         if (Acc_head->linetab[-i] > offset)
  42:             Acc_head->linetab[-i] -= width;
  43:     }
  44: 
  45:     /* compact the space */
  46:     while (cnt--)
  47:         *startpt++ = *midpt++;
  48:     Acc_head->bufstatus |= BUF_DIRTY;
  49: }

Defined functions

Last modified: 1995-02-12
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1714
Valid CSS Valid XHTML 1.0 Strict