/* File struct.h */

/* Various structures used in SuperDark, */
/* especally to communicate with the	 */
/* current blanking module!		 */

/* This file is included here for various reasons! */
#include <graphics/displayinfo.h>
#include <dos/dos.h>

#define	MAX_NOM	50	/* nombre maximum de modules*/

/* Type of screen wanted by the application  */

typedef enum{
	SCR_GIVEN,	/* The module want a copy of current screen (in	*/
			/* appel_proc->s				*/
	SCR_OWN		/* The module will create his own screen (default)*/
}type_screen;

/* Was used to said if we want to be run only in wb2.0...But now */
/* SuperDark only run in wb2.0 or higher!			 */

#define	DARK_WB_13	0x1234
#define	DARK_WB_20	0x4321

typedef	struct	ModeNode
{
	struct	Node	mn_Node;
	ULONG	DisplayID;
	SHORT	MaxDepth;
	SHORT	MinX,MinY;
	SHORT	MaxX,MaxY;
	char	Name[DISPLAYNAMELEN];
};

/* Private structure used by the commodities and proc_main.o	*/

struct	my_data{
	struct	Task	*task;
	struct	Task	*task_dark;
	int		sigstop;	/* Fin de l'effet			*/
	int		sigstart;	/* Demarrage de l'effet blank		*/
	int		signext;	/* Prochain effet			*/
	ULONG		sigtimeout;	/* Signal de timeout */
	int		flg_stop;	/* si TRUE alors il faut arreter l'effet*/
	int		flg_send;	/* si TRUE alors on peut envoyer signal */
	int		flg_alea;	/* TRUE -> Mode aleatoire		*/
	int		tempo;		/* valeur de la tempo d'attente 	*/
	int		tempo_end;	/* valeur de la tempo d'attente de fin, en mode aleatoire */
	int		debug1;
	int		debug2;
};

/* Note: only names of unused fields have changed since the older */
/*       version of superdark, but nothing else                   */

struct	appel_proc{
	struct	MsgPort	mp;
	struct	RastPort *rp;	/* Pointer to s->RastPort		*/
				/* (SCREEN_GIVEN) only			*/
	struct	RastPort *rps;	/* Pointer to the rastport of the	*/
				/* current screen			*/
	struct	Screen	*s;	/* copy of current Screen is		*/
				/* SCREEN_GIVEN mode			*/
	UBYTE	version;	/* Version number of SuperDark 		*/
	UBYTE	revision;	/* revision number of SDark		*/
	UBYTE	proc_main_ver;	/* Version of proc main.o, set by proc_main.o */
	UBYTE	fut1;		/* for future use			*/

	BPTR	out_hd;		/* Handler to an output. Used by	*/
				/* proc_main for debugging		*/

	struct	my_data	*p_info;
	struct	Window	*win;
	UBYTE	flg_watchdog;	/* used by the watch dog system	   	*/
	UBYTE	enable_watchdog;/* flg to say if watchdog is ok or not	*/
	UBYTE	flg_test;	/* Said that the blanker is running in  */
				/* test mode				*/
	UBYTE	flags;		/* Some more flags			*/

	type_screen	type_screen;
	int	code_ret;	/* code ret				*/
	struct	tom_gadget	*p_gadg;

	char	*p_texte;	/* ptr to information text		*/
	struct	List	*ml;	/* List of available modes		*/
	struct	Screen	*scr;	/* last screen used in random mode	*/
	struct	Screen	*current_scr; /* current screen			*/
};

typedef	enum {DO_DARK,DO_EXIT,DO_STOP}Type_Action;

/* Structure returned by the loaded module!	*/
/* or send to the module			*/

typedef	struct	BlankerMsg{
	struct	Message	Msg;
	struct	Task	*Blanker_Task;
	Type_Action Action;
};

#define SIG_MAIN_DARK_DO_DARK	SIGBREAKF_CTRL_D
#define SIG_MAIN_DARK_STOP_DARK	SIGBREAKF_CTRL_C
#define SIG_MAIN_DARK_EXIT	SIGBREAKF_CTRL_E
#define SIG_MAIN_DARK_WATCHDOG	SIGBREAKF_CTRL_F

#define	SIG_DARK_MAIN_STOPPED	SIGBREAKF_CTRL_E
#define	SIG_DARK_MAIN_EXITED	SIGBREAKF_CTRL_D


#define	printd	if(flg_debug)printf

/* Name of the filename where the random files are selected */
#define	NAME_FILE_ALEA	"s:dark_random.cfg"

extern	int	tst_end();
extern	VOID	proc_init();
extern	VOID	proc_end();
extern	VOID	proc_save();
