/* $Revision Header * Header built automatically - do not edit! *************
 *
 *	(C) Copyright 1990 by MXM
 *
 *	Name .....: PreInclude.c
 *	Created ..: Saturday 11-May-90 12:30
 *	Revision .: 1
 *
 *	Date            Author          Comment
 *	=========       ========        ====================
 *	11-May-90       Olsen           Created this file!
 *
 * $Revision Header ********************************************************/

#include <intuition/intuitionbase.h>
#include <libraries/dosextens.h>
#include <libraries/arpbase.h>
#include <workbench/startup.h>
#include <graphics/gfxbase.h>
#include <hardware/intbits.h>
#include <exec/interrupts.h>
#include <devices/printer.h>
#include <exec/execbase.h>
#include <graphics/view.h>
#include <clib/macros.h>
#include <exec/memory.h>

#define __NO_PRAGMAS

#include <functions.h>

#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <fcntl.h>
#include <stat.h>

	/* Some useful macros. */

#define LineBytes(n) (((n + 15) >> 4) << 1)	/* Word aligned width in bytes. */

	/* The real BitMapHeader... "I ain't 'fraid of no pic!" */

typedef struct
{
	UWORD w,h;			/* Raster width & height. */
	UWORD x,y;			/* Pixel position. */
	UBYTE nPlanes;			/* Number of source bitplanes. */
	UBYTE masking;			/* Masking... maybe good for nothing. */
	UBYTE compression;		/* Compressed or not? */
	UBYTE pad1;			/* We don't like odd length structures. */
	UWORD transparentColor;		/* Maybe good for... */
	UBYTE xAspect, yAspect;		/* Kind of quotient, width / height. */
	WORD pageWidth, pageHeight;	/* Source page size. */
} BitMapHeader;

	/* The typical format of a DPaint colour cycling range. */

typedef struct
{
	WORD pad1;	/* Not used. */
	WORD rate;	/* Cycling speed. */
	WORD active;	/* Is it active? Which way is it cycling? */
	UBYTE low,high;	/* Start and stop colour. */
} CRange;

	/* The mystical, archetypical IFF chunk... */

typedef struct
{
	ULONG	IFF_Type;	/* Chunk type. */
	LONG	IFF_Length;	/* Chunk length. */
} IFF_Chunk;

	/* Miscellaneous error codes. */

#define ERR_NOIFF	1	/* Not an IFF-ILBM file. */
#define ERR_NOCOLMAP	2	/* No colour map. */
#define ERR_NOMEM	3	/* Not enough memory. */
#define ERR_DOS		4	/* A DOS error. */

	/* Prototypes for Cycling.c . */

LONG	InitCycleCode(struct ViewPort *ViewPort,UWORD *ColMap,LONG ColNum,CRange *Range,LONG RangeNum);
VOID	ClearCycleCode(VOID);
VOID	ToggleCycleCode(VOID);
LONG	IsCycling(VOID);
LONG	LoadCycleRange(char *FileName,CRange *Range,LONG MaxRange);

	/* Prototypes for LoadImage.c */

ULONG	MakeID(char *IDString);
LONG	FindChunk(char *ChunkName,FILE *FilePointer);
LONG	LoadHeader(char *FileName,BitMapHeader *BMHeader);
LONG	LoadCMAP(char *FileName,UWORD *ColourMap,LONG MaxCol,BitMapHeader *BMHeader);
UBYTE	LoadRaster(char *FileName,PLANEPTR *BitPlanes,BitMapHeader *BMHeader);
VOID	FadeTo(struct ViewPort *VPort,UWORD *From,UWORD *To,LONG NumColours,LONG ToCol,LONG FromCol);
UBYTE	InitTinyBitMap(VOID);
VOID	CleanExit(LONG ExitCode);
VOID	CloseDisplay(VOID);
VOID	PrintScreen(UBYTE Large);
VOID	GetRealName(char *FullName,char *RealName);
LONG	LoadImage(char *FileName,UBYTE ForceScroll,UBYTE ForceLace,UBYTE CycleOnStartup,UBYTE LastOne);
VOID	QuickSort(char **av,LONG n);
LONG	QSplit(char **av,LONG n);

	/* Pragmas for LoadImage.c */

#pragma regcall(MakeID(a0))
#pragma regcall(FindChunk(a0,a1))
