/* gridpix.h */

#define Magic1 "Grid"
#define Magic2 "GPX2"

/* I'm not sure if I will ever use this much, but just in case */
#define MaxLayers 20

/* "Old" header type for file (for compatibility) */
struct gridheader1 {
    unsigned char magic[4] ;
    int headersize ;		/* size of this struct */
    int width, height ;
    int layers ;		/* layers of real tiles */
    int tilewidth, tileheight ;
    int ratio ;
    int numfiles ;		/* not really necessary */
    int layersize[MaxLayers] ;	/* number of files in layers up to this one */
} ;

typedef unsigned char g_int64_t[8];
#define f_int_t g_int64_t	/* on file */
#define m_int_t int64_t	/* in memory */

/* New header type for file, endian and word length independent */
struct gridheader2 {
    unsigned char magic[4] ;
    f_int_t headersize ;
    f_int_t width, height ;
    f_int_t layers ;
    f_int_t tilewidth, tileheight ;
    f_int_t ratio ;
    f_int_t numfiles ;
    f_int_t layersize[MaxLayers] ;
} ;

/* New header type in memory */
struct gridheader {
    unsigned char magic[4] ;
    m_int_t headersize ;
    m_int_t width, height ;
    m_int_t layers ;
    m_int_t tilewidth, tileheight ;
    m_int_t ratio ;
    m_int_t numfiles ;
    m_int_t layersize[MaxLayers] ;
} ;

struct gridpix {
    struct gridheader header ;
    m_int_t offsets[1] ; /* actually an array */
} ;

#if !defined(GRIDROOT)
#define GRIDROOT "/usr/local/www/data/gridpix/"
#endif
