home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_10_10 / 1010042b < prev    next >
Text File  |  1992-08-10  |  733b  |  29 lines

  1. Listing 2.
  2.  
  3. typedef struct { int DelFrom , DelThru } DelTyp;
  4. #define DelsMax 20
  5. DelTyp Dels [ DelsMax ];
  6. DelTyp * DelPtr = Dels;
  7. DelTyp * DelMaxPtr = Dels + DelsMax;
  8.  
  9. BOOL CheckDeleted
  10.      ( ItemNo )
  11.        int ItemNo;
  12.  
  13.      { if ( DelPtr < DelMaxPtr
  14.             /* There is a deletion */
  15.             && DelPtr -> DelFrom >= ItemNo )
  16.                /* and it applies to ItemNo */
  17.        { assert ( ItemNo <= DelPtr -> DelThru )
  18.          /* We didn't slip past this deletion. */
  19.          if ( ItemNo == DelPtr -> DelThru )
  20.               /* ItemNo is the last covered 
  21.                  by the deletion */
  22.             DelPtr ++;
  23.             /* Consume the deletion. */
  24.          return TRUE;
  25.        } 
  26.        else return FALSE;
  27.      }
  28.  
  29.