/*
 * The lines between
 *   //~Start TEMPLATE
 * and
 *   //~End
 * will be machine generated from errorCodes.dat
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include "pslib.h"
#include "poisErrorCodes.h"

void poisErrorRegister(void)
{
    static psErrorDescription errors[] = {
       { POIS_ERR_BASE, "First value we use; lower values belong to psLib" },
       //~Start       {POIS_ERR_$1, "$2"},
       {POIS_ERR_UNKNOWN, "Unknown POIS error code"},
       {POIS_ERR_NOT_IMPLEMENTED, "Desired feature is not yet implemented"},
       {POIS_ERR_FITS, "Problem in FITS I/O"},
       {POIS_ERR_FITS_WCS, "Error interpreting FITS WCS information"},
       //~End
    };
    static int nerror = POIS_ERR_NERROR - POIS_ERR_BASE; // number of values in enum

    for (int i = 0; i < nerror; i++) {
       psErrorDescription *tmp = psAlloc(sizeof(psErrorDescription));
       *tmp = errors[i];
       psErrorRegister(tmp, 1);
       psFree(tmp);                     /* it's on the internal list */
    }
    nerror = 0;                                 // don't register more than once
}
