#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "inputfile.h"
#include "manglefn.h"


int process_next_entry_healpix(format *fmt, inputfile *thisfile, polygon **poly)
{
  long Nside = fmt->auto_healpix;
  long Npix = 12*Nside*Nside;

  if (fmt->id == Npix)
    return 0;

  *poly = get_healpix_poly(fmt->auto_healpix, fmt->id);

  (*poly)->weight = 0;
  if ((*poly)->cm[0] != 0 || (*poly)->cm[1] != 0) {
    fmt->id++;
    fmt->pixel = 0;
    fmt->weight = 0;
    (*poly)->id = fmt->id;
  }

  return 1;
}
