/* PreInclude.c *************************************************************
 *
 *	PreInclude.c ----------	Source for precompiled header file.
 *
 *	Author ----------------	Olaf 'Olsen' Barthel, MXM
 *				Brabeckstrasse 35
 *				D-3000 Hannover 71
 *
 *				Federal Republic of Germany
 *
 *	This program truly is in the PUBLIC DOMAIN. Written on a cold
 *	and damp September evening, hoping the next morning would  be
 *	better.
 *
 *	Compiled using Aztec C 5.0a, CygnusEd Professional 2 & ARexx.
 *
 ***************************************************************************/

#define __NO_PRAGMAS 1

#include <intuition/intuitionbase.h>
#include <libraries/rexxhostbase.h>
#include <libraries/dosextens.h>
#include <workbench/workbench.h>
#include <devices/inputevent.h>
#include <graphics/gfxmacros.h>
#include <workbench/startup.h>
#include <graphics/gfxbase.h>
#include <devices/narrator.h>
#include <exec/interrupts.h>
#include <devices/input.h>
#include <devices/audio.h>
#include <exec/execbase.h>
#include <devices/timer.h>
#include <hardware/cia.h>
#include <exec/memory.h>

#include <functions.h>

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>

	/* Global MessagePort identifier. */

#define PORTNAME "DPort"

	/* Current DClock revision. */

#define REVISION 27

	/* Raster size macro. */

#define Byte(Width) (((Width + 15) >> 4) << 1)

	/* Key combinations (didn't like typing them again and again). */

#define RIGHT_AMIGA	(IEQUALIFIER_RELATIVEMOUSE | IEQUALIFIER_RCOMMAND)
#define RIGHT_ALT	(IEQUALIFIER_RELATIVEMOUSE | IEQUALIFIER_RALT)

	/* A date information tag. */

struct DateTag
{
	SHORT	Year;		/* Year (e.g. 1990). */
	BYTE	Month;		/* Month of year (0-11) */
	BYTE	Day;		/* Day in month (1-31) */

	BYTE	Hour;		/* 0-23 */
	BYTE	Minute;		/* 0-59 */
	BYTE	Second;		/* 0-59 */

	BYTE	Weekday;	/* Day of week (Sunday = 0) */
};

	/* Definitions for AmigaDOS date conversion routine. */

#define MINS_PER_HOUR	60
#define TICS_PER_SEC	50
#define DAYS_PER_WEEK	7

	/* Days from Jan.1, 0000 to Jan.1, 1978 */

#define DDELTA		722449

	/* Global MsgPort structure. Note: if you are up to
	 * expand this structure, add the new identifiers at the
	 * bottom. This will insure upward-compatibility with
	 * older DClock and DClock-Handler revisions.
	 */

struct DSeg
{
	/*******************************************
	 * Vital data! Don't change ANYTHING here! *
	 *******************************************/

	struct MsgPort		 Port;		/* Global messageport. */

	BPTR			 Segment;	/* Pointer to handler segment. */
	LONG			 SegSize;	/* Size of DSeg structure. */

	struct Task		*Father;	/* Calling process. */
	struct Task		*Child;		/* Waiting process (usually handler). */

	ULONG			 RingBack;	/* Multi-purpose signal bit. */

	ULONG			 LastSecs;	/* Timer control. */
	BYTE			 Priority;	/* Handler priority. */
	UBYTE			 Revision;	/* Could come in handy for future revisions. */

	/***********************************************
	 * Custom data, open to expansion and changes. *
	 ***********************************************/

	UBYTE			 Beep;		/* Audible beep selected? */
	UBYTE			 Click;		/* Keyboard click selected? */

	UBYTE			 ClickVolume;	/* Volume of keyboard click. */
	UBYTE			 Reserved1;

	UBYTE			 TextColour;	/* Guess what? */
	UBYTE			 BackColour;	/* Guess what? */

	UBYTE			 Alarm;		/* Alarm clock enabled? */
	UBYTE			 AlarmHour;	/* Alarm time hour. */
	UBYTE			 AlarmMinute;	/* Alarm time minute. */
	UBYTE			 AlarmSecond;	/* Alarm time second. */

	UBYTE			 SetEnv;	/* Set environment variables? */
	UBYTE			 Hour;		/* Beep every full hour? */

	struct RexxHost		*RexxHost;	/* Rexx host port. */

	ULONG			 Countdown;	/* Countdown tea timer. */

	UBYTE			 Seconds;	/* Display seconds? */

	UBYTE			 Page;		/* Current text display. */

	UBYTE			 Speech;	/* Speech enabled? */

	UBYTE			 Online;	/* Are we online? */

	struct SignalSemaphore	*SoundSemaphore;/* Hour chime lock. */
	APTR			 SoundData;	/* Hour chime data. */
	LONG			 SoundLength;	/* Length of hour chime. */
	LONG			 SoundRate;	/* Sound replay rate. */
	LONG			 SoundVolume;	/* Sound replay volume. */

	struct DateTag		 CurrentTime;	/* Current time, replaces ExtraTime entry. */

	ULONG			 Reserved2[10];	/* Expansion data, DO NOT TOUCH! */

	/***********************************
	 * Append your custom flags below. *
	 ***********************************/
};
