#ifndef LIBRARIES_FILEID_H
#define LIBRARIES_FILEID_H TRUE
/*
**
**	$VER: FileID.h 5.1
**
**	Standard C definitions for FileID.library
**
**	(C) Copyright 1993,1994 BLOODROCK of SYNDICATE
**	    All Rights Reserved
**
*/

#ifndef EXEC_LIBRARIES_H
#include <exec/libraries.h>
#endif


#define  FILEIDNAME     "FileID.library"
#define  FILEIDVERSION  5

/*
* IMPORTANT NOTE: PLEASE DO NOT USE V1.0 ! IT HAS A VERY HARD BUG ! *
* ALWAYS OPEN FILEID.LIBRARY WITH VERSION == 2 OR HIGHER ! *

*
* FI_FileInfo Structure *
*
* Note: The fields FI_DLPackNum, FI_DLPackType and FI_PackFlags are only
* filled if the file type is one of the crunchers as identified by the
* Decrunch.library.
*/

struct FI_FileInfo {
   APTR		FI_Description;	    /* Pointer to a file description string */
   UWORD	FI_ID;		    /* file type ID number */
   UWORD        FI_GlobalFileClass; /* global file class definition */

   /* V2 fields */

   UWORD	FI_DLPackNum;	    /* Decrunch.library internal PackNum */
   UBYTE	FI_DLPackType;	    /* Decrunch.library packer type */
   UBYTE	FI_PackFlags;	    /* special flags for crunched files */
};

#define ID_MAXLENGTH	35
	/* Maximum file description length
	   (also error messages max_length) */

/*
* Global file class definitions *
*
* The global class definition gives you some primary information about the
* global file type. This is useful if you want to know about e.g. a file
* is packed.
* For example, a PowerPacker password crunched executable gets a global
* class value of $0007 ( EXECUTABLE|PACKED|ENCRYPTED )
*
* Note that on some special data formats, like e.g. IFF-ILBM files with
* crunched bitmap chunks, bit 1 isn't set. If an IFF picture was packed
* (e.g. using Xpk), FileID.library would report an Xpk compressed file,
* not an IFF picture. Do not mischange this.
* For example, NoisePacker modules or JPEG pictures DON'T have bit 1 set,
* even when everybody knows that these files contain packed data. Got me ?
*
* FIGFC_GRAFIC_IMAGE does NOT include any 2-D or 3-D rendering data formats,
* like imagine objects, vector fonts etc. Somtimes, it was really hard to
* decide if this bit should be set or not. So please treat bit #5 as a kind
* of help, not as warranty.
*/

#define  FIGFCB_EXECUTABLE	0   /* executable file */
#define  FIGFCB_PACKED		1   /* file is packed/crunched */
#define  FIGFCB_ENCRYPTED	2   /* encrypted file, may need a password */
#define  FIGFCB_IFF_HEADER	3   /* file has "FORM" IFF header
#define  FIGFCB_MUSIC_SCORE	4   /* sound module / music score (song) */
#define  FIGFCB_GRAPHIC_IMAGE	5   /* picture/brush, anim or color palette */
#define  FIGFCB_FORMATTED_TEXT	6   /* special formatted text file */
#define  FIGFCB_SCRIPT		7   /* script file */

#define  FIGFCF_EXECUTABLE	(1L<<0)
#define  FIGFCF_PACKED		(1L<<1)
#define  FIGFCF_ENCRYPTED	(1L<<2)
#define  FIGFCF_IFF_HEADER	(1L<<3)
#define  FIGFCF_MUSIC_SCORE	(1L<<4)
#define  FIGFCF_GRAPHIC_IMAGE	(1L<<5)
#define  FIGFCF_FORMATTED_TEXT	(1L<<6)
#define  FIGFCF_SCRIPT		(1L<<7)


/* FI_DLPackType */

#define        PTYP_RELOC  0        /* normal relocatible loadfile */
#define        PTYP_ABS    1        /* absolute adress decruncher  */
#define        PTYP_DATA   2        /* data file                   */


/* FI_PackFlags */

#define  FIPFB_KILLSYS		0   /* file has KillSys decrunch header */

	/* V 3 */

#define  FIPFB_PPMM		1   /* crunched with PPx.x in "master mode" */


#define  FIPFF_KILLSYS		(1L<<0)

	/* V 3 */

#define  FIPFF_PPMM		(1L<<1)


/* FileID error codes returned by FIIdentifyFromName() */

#define  ERR_FILOCKFAILED	-1	/* couldn't get entry lock. */
#define  ERR_FIEXAMINEFAILED	-2	/* couldn't examine entry. */
#define  ERR_FIOPENFAILED	-3	/* couldn't open file. */
#define  ERR_FIOUTOFMEM		-4	/* out of memory. */
#define  ERR_FIREADERROR	-5	/* file read error. */
#define  ERR_EMPTYFILE		-6	/* filesize is ZERO. */
#define  ERR_NONAME		-7	/* the passed filename is empty. */


/* Library base */

struct FileIDBase {
   struct Library LibNode; /* Standard library node */

   /* LIBRARY PRIVATE */

   UBYTE   FI_Flags;	   /* see also: */
   UBYTE   FI_pad;	   /* "sample.library.asm", documented in the */
   ULONG   FI_SegList;	   /* Amiga ROM Kernel Reference Manual: Libraries */

   /* PUBLIC FIELDS *	    ; may be READ from your program */

   APTR    FI_DosBase;	   /* dos.library base address */

   /* V5 */

/*
* If locale.library V38+ or FileID_lib.catalog couldn't be opened, the
* two following fields will both contain NULL.
*/

   APTR    FI_LocaleBase   /* locale.library V38+ base address */
   APTR    FI_FIDCat       /* address of the library locale catalog */
};

#endif  /* LIBRARIES_FILEID_H */
