# include "markrock.h"

gcatalog (Catalog *catalog) {
  
  char filename[128];
  int i, status, mode;
  unsigned int NotTrail;
  unsigned short NotBad;

  mode = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;

  if (!load_catalog (catalog, mode, VERBOSE)) {
    fprintf (stderr, "ERROR: failure loading catalog\n");
    exit (1);
  }

  if (RESET) {
    NotBad = (0xffff ^ 0xc003);
    for (i = 0; i < catalog[0].Naverage; i++) {
      if ((catalog[0].average[i].code & ID_MOVING) &&
	  (catalog[0].average[i].code & ID_BAD_OBJECT) &&
	  (catalog[0].average[i].code & 0x0003)) {
	/* this will set the correct bit for each to 0 */ 
	catalog[0].average[i].code &= NotBad;
      }
    }
    for (i = 0; i < catalog[0].Nmeasure; i++) {
      catalog[0].measure[i].flags &= ~PART_OF_TRAIL;
    }
  }
}
