#ifndef LIBRARIES_STC_H
#define LIBRARIES_STC_H
/*
**
**	$Filename: libraries/stc.h $
**	$Revision: 2.0 $
**	$Date: 93/12/28 $
**
**      stc.library definitions
**
**	(C) Copyright 1991-1993 Jouni 'Mr.Spiv' Korhonen
**	    All Rights Reserved
**
*/

#ifndef EXEC_TYPES_H
#include <exec/types.h>
#endif
#ifndef EXEC_LISTS_H
#include <exec/lists.h>
#endif
#ifndef EXEC_LIBRARIES_H
#include <exec/libraries.h>
#endif
#ifndef GRAPHICS_GFXBASE_H
#include <graphics/gfxbase.h>
#endif
#ifndef	GRAPHICS_RASTPORT_H
#include <graphics/rastport.h>
#endif
#ifndef	GRAPHICS_RASTPORT_H
#include <graphics/rastport.h>
#endif
#ifndef  INTUITION_INTUITION_H
#include <intuition/intuition.h>
#endif
#ifndef DOS_DOS_H
#include <dos/dos.h>
#endif
#ifndef  DOS_DOSEXTENS_H
#include <dos/dosextens.h>
#endif
#ifndef  UTILITY_TAGITEM_H
#include <utility/tagitem.h>
#endif

#define	STCNAME          "stc.library"
#define	STCVERSION      3L

/*****************************************************************************
*                                                                            *
* Preferences                                                                *
*                                                                            *
*****************************************************************************/

#define S403           0L
#define S404           1L

#define phNOHEADER     1L
#define phNOMATCH      2L
#define phUNIT         3L
#define phNAME         4L
#define phREHEADER     5L
#define phOVERLAY      6L
#define phBREAK        7L
#define phHUNKID       8L

#define seEXEC         0L
#define sePEXEC        1L
#define seLIBRARY      2L
#define seOVERLAY      3L
#define seABSOLUTE     4L

#define isEXEC         0x80000000L  /* Note! Only bits 31-24 include info */
#define isDATA         0x40000000L  /* about the file.                    */
#define isS403         0x20000000L  /* Bits 23-0 amount of bytes from the */
#define isS404         0x10000000L  /* beginning of the file to decrunch  */
#define isNPEXEC       0x01000000L  /* header.                            */
#define isLPEXEC       0x02000000L
#define isNABS         0x03000000L
#define isPABS         0x04000000L
#define isKABS         0x05000000L
#define isSKIPMASK     0x00ffffffL
#define isINFOMASK     0xff000000L
#define isERRORMASK    isSKIPMASK

#define	stc_TagBase	TAG_USER

/* CrunchDataTags() tags */
#define	cdDESTINATION   stc_TagBase+0x01
#define	cdLENGTH        stc_TagBase+0x02
#define	cdABORTFLAGS    stc_TagBase+0x03
#define	cdOUTPUTFLAGS   stc_TagBase+0x04
#define	cdXPOS          stc_TagBase+0x05
#define	cdYPOS          stc_TagBase+0x06
#define	cdRASTPORT      stc_TagBase+0x07
#define	cdMSGPORT       stc_TagBase+0x08
#define	cdDISTBITS      stc_TagBase+0x09
#define	cdBUFFER        stc_TagBase+0x0a

#define	cdOutPutNIL     0L
#define	cdOutPutCLI     1L
#define	cdOutPutWIN     2L
#define	cdAbortNIL      0L
#define	cdAbortGADGET   1L
#define	cdAbortCTRLC    2L
#define	cdDist1K        10L
#define	cdDist2K        11L
#define	cdDist4K        12L
#define	cdDist8K        13L
#define	cdDist16K       14L

/* SaveExecTags() tags */
#define	sxSAVETYPE      stc_TagBase+0x0b
#define	sxFILENAME      stc_TagBase+0x0c
#define	sxDATABUFFER    stc_TagBase+0x0d
#define	sxLENGTH        stc_TagBase+0x0e
#define	sxLOAD          stc_TagBase+0x0f
#define	sxJUMP          stc_TagBase+0x10
#define	sxDECR          stc_TagBase+0x11
#define	sxUSP           stc_TagBase+0x12
#define	sxSSP           stc_TagBase+0x13
#define	sxSR            stc_TagBase+0x14

#define	sxData          0L
#define	sxPExec         1L
#define	sxPExecLib      2L
#define	sxAbsNormal     3L
#define	sxAbsPlain      4L
#define	sxAbsKillSystem 5L



/* For older library version. DON'T use in new code!! */
struct  stcCrunchInfo
{
  ULONG FileLength;
  APTR Buffer;
  APTR FileBuffer;
  struct MsgPort *MsgPort;                      /* If NULL no event check */
  struct RastPort *RastPort;
  struct GfxBase *GfxBase;                      /* If NULL no crunchcounter */
  WORD XPos;
  WORD YPos;
};

/*****************************************************************************
*                                                                            *
* Library Base                                                               *
*                                                                            *
*****************************************************************************/


struct StcBase
{
  struct Library LibNode;
  struct DosLibrary *DosBase;
  BPTR SegList;
  ULONG Flags;
  ULONG pad;

/* For compatibily.. Don't read or write..                                 */
  APTR FirstBuffer;
  ULONG BufferSize;

/* For compatibily.. Don't read or write..                                 */
  ULONG SecurityLen;

/* This error message is GLOBAL data and includes more specific info about */
/* the last error. In most cases it's the result of IoErr() function.      */
/* Note! If there are several tasks using stc.library the value might not  */
/* contain correct value.. (this is my fault.. due the lack of references  */
/* when I started programming stc.library!)                                */
  ULONG ErrorMsg;
  struct GfxBase *GfxBase;
  struct IntuitionBase *IntuiBase;
};

#endif	/* LIBRARIES_STC_H */

