/* szModuleName__ []  = "c:/nordrad/unix/shft.h" */
/* szLastVersion []   = "Version 0.5" */
/* szLastSave []      = "1997-02-09*22:19" */
/* -------------------------------- shft.h ---------------------------------- */

#define FLEN 200
#define WLEN 1280
#define L1 4
#define L2 8
#define L3 12

int repar(FILE *ff,unsigned char *s);
int wrpar(FILE *ff,unsigned char *s);
void exbit(FILE *ff,int *dat, int nbit,char *nfree,unsigned char *ch);
void wrpix(FILE *ff,int *bcol, int jcol);
void repix(FILE *ff,int *rcol, int jcol);
int bufrl(int *bcol,int bncol,int *cor,int *cou,int *bncg,int *bnnp,int *ntp);
void stbit(FILE *ff,int dat,int nbit,char *nfree,unsigned char *ch);
int sgbit(int dat,int nbit);
void clbit(FILE *ff,char *nfree,unsigned char *ch);

/* -------------------------------------------------------------------------- */

typedef struct IDAT
{ 
  int datim[6],trtim[6];
} idat;
typedef idat DAT;
typedef struct IBUF 
{ 
  int bufred,bufver,locver,iorg,ntcols,ntlin,iproj,ipict,icomb;
  int igrid,ical,iclutt,ioccul,irange,ibrigh,iradom,iprec,izr;
  int ntpixv,isizeh,isizev,iclair,ibotvl,iPictType;
  float ilat[5],ilon[5],ilat1,ilat2,itopvl[17];
  float ifaczr,iexpzr;
  float Ord, Slope;
} ibuf;
typedef ibuf BUF;

typedef struct IBUF2   /* This is the old rejected one. /ADS*/
{ 
  int bufred,bufver,locver,iorg,ntcols,ntlin,iproj,ipict,icomb;
  int igrid,ical,iclutt,ioccul,irange,ibrigh,iradom,iprec,izr;
  int ntpixv,isizeh,isizev,iclair,iexpzr,ibotvl;
  int ilat[5],ilon[5],itopvl[17];   /* BBN-changed itopvl from 7 to 16 */
  float ilat1,ilat2,ifaczr;
} ibuf2;
typedef ibuf2 BUF2;


/*
static DAT d;
static BUF b;
static int n2=2,n3=3,n4=4,n5=5,n6=6,n8=8,n9=9,n12=12,n15=15,n16=16;
static int nbival=L1,nbilin=L3,nbintp=L2,nbincg=L2,nbifac=L2;

int fdes[]={0,  3, 3, 3, 3, 3, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0};
int xdes[]={0,  1,21,13,21,21,10,31, 5, 7,31, 2,31,31,30, 1,31,30};
int ydes[]={0,192,11,10, 8, 7, 0, 2,31, 0, 1, 0, 1,11, 1, 0, 1, 1};

unsigned char bit[]={0,1,3,7,15,31,63,127,255};
*/

/* BBN - above changed to two parts below,  */
/*       one for ENCBUF and one for DECBUF  */
#ifdef ENCBUF
extern DAT d;
extern BUF b;
static int n2=2,n3=3,n4=4,n5=5,n6=6,n8=8,n9=9,n12=12,n15=15,n16=16;
static int nbival=L1,nbilin=L3,nbintp=L2,nbincg=L2,nbifac=L2;
static char nbuf[FLEN],npar[FLEN],npix[FLEN];
extern int col[WLEN];
extern int fdes[];
extern int xdes[];
extern int ydes[];
extern unsigned char bit[];
#endif

#ifdef DECBUF
DAT d;
BUF b;
static int n2=2,n3=3,n4=4,n5=5,n6=6,n8=8,n9=9,n12=12,n15=15,n16=16;
static int nbival=L1,nbilin=L3,nbintp=L2,nbincg=L2,nbifac=L2;
static char nbuf[FLEN],npar[FLEN],npix[FLEN];
int col[WLEN];
int fdes[]={0,  3, 3, 3, 3, 3, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0};
int xdes[]={0,  1,21,13,21,21,10,31, 5, 7,31, 2,31,31,30, 1,31,30};
int ydes[]={0,192,11,10, 8, 7, 0, 2,31, 0, 1, 0, 1,11, 1, 0, 1, 1};
unsigned char bit[]={0,1,3,7,15,31,63,127,255};
#endif

/* -------------------------------------------------------------------------- */

#ifdef ENCBUF

static int nbinnp=L2,rpf=255,nclim=1;
int ncol[WLEN],ncou[WLEN],ncg[WLEN],nnp[WLEN],wcol[WLEN],wcou[WLEN];

#endif

/* ----------------------------- end of shft.h ------------------------------ */
