/*
 *  WICONSETTER     A companion utility to wIconify.  wIconSetter allows
 *                  you to specify custom icons for windows ans screens
 *                  that normally use the default icons.
 *
 *  wIconFile.h     Defines and structures for the initialization file.
 *
 *  Copyright 1990 by Davide P. Cervone, all rights reserved.
 *  You may use this code, provided this copyright notice is kept intact.
 */

#define INTUITION_SCREEN_H                  /* don't need 'em */
#include "wIconSetter.h"
#undef PROGRAM


#define MAXLINE             132
#define MAXWIDTH            78
#define MAXWORDS            5
#define MAXHEIGHT           32
#define MAXDEPTH            5

/*
 *  The commands allowed in the initialization file
 */

#define COM_NONE            0
#define COM_PROGRAM         1
#define COM_SCREEN          2
#define COM_WINDOW          3
#define COM_ICON            4
#define COM_IMAGE           5
#define COM_SELECT          6
#define COM_MASK            7
#define COM_FLAGS           8
#define COM_POSITION        9
#define COM_NAME            10
#define COM_DEFINE          11

#define COM_EOF             99
#define COM_UNKNOWN         100

#define COM_LAST            COM_DEFINE


#define MATCH(n1,n2)        (PrefixMatch(n1,n2)==0 && strlen(n1)==strlen(n2))
#define PREFIXMATCH(n1,n2)  ((n1) == NAME_ANY || PrefixMatch(n1,n2) == 0)
#define WORDMATCH(w)        (stricmp(Word,w) == 0) 

struct Flag
{
   char *Name;
   ULONG Flag;
};


#ifndef FILE
#define FILE    APTR
#endif


/*
 *  Data shared by all file reading modules
 */

extern USHORT ImageData[MAXWORDS][MAXHEIGHT][MAXDEPTH];
extern short MaxWidth,MaxHeight,MaxWords;
extern UBYTE Plane0,Plane1;
extern int ImageType;
extern int IconFileOpen;
extern short BitMapLine;

/*
 *  Pointers to the pointer the current instance of each thing:
 */

extern ICONPROGRAM  **ProgramPtr;
extern ICONSCREEN   **ScreenPtr;
extern ICONWINDOW   **WindowPtr;
extern ICONWINDOW   **FirstWPtr;
extern ICONDEFINE   **DefinePtr;
extern ICONWINDOW    *IconPtr;
extern struct Image **MaskPtr;
extern int NoIcon;

/*
 *  Easy references to the pointers
 */

#define ICON        (IconPtr->Icon)
#define MASK        (*MaskPtr)
#define DEFINE      (*DefinePtr)
#define WINDOW      (*WindowPtr)
#define FIRSTWINDOW (*FirstWPtr)
#define SCREEN      (*ScreenPtr)
#define PROGRAM     (*ProgramPtr)


extern FILE *InFile;                /* The input file pointer */
extern int EndOfFile;               /* TRUE when end-of-file is reached */
extern char NextChar;               /* The next character to process */
extern char Word[MAXLINE+1];        /* The next word to be processed */

extern USHORT *AllocRaster();
extern ICONDEFINE *FindDefine();
