/*
 * The line
    { PM_ERR_$X{ErrorCode}, "$X{ErrorDescription}"},
 * (without the Xs)
 * will be replaced by values from errorCodes.dat
 */
#include <pslib.h>
#include "pmErrorCodes.h"

void pmErrorRegister(void)
{
    static psErrorDescription errors[] = {
       { PM_ERR_BASE, "First value we use; lower values belong to psLib" },
       { PM_ERR_${ErrorCode}, "${ErrorDescription}"},
    };
    static int nerror = PM_ERR_NERROR - PM_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
}
