#ifndef LIBRARIES_FILEID_H
#define LIBRARIES_FILEID_H TRUE
/*
**
**  $VER: FileID.h 8.0
**
**  Standard C definitions for FileID.library
**
**  (C) Copyright 1993-1998 Oliver "Bloodrock" Lange
**      All Rights Reserved
**
*/

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

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

/*
*
* 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
{
  STRPTR FI_Description;     /* Points to the 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 (for example) if 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. Sometimes 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  FIGFCF_EXECUTABLE      (1L<<0)   /* executable file */
#define  FIGFCF_PACKED          (1L<<1)   /* file is packed/crunched */
#define  FIGFCF_ENCRYPTED       (1L<<2)   /* encrypted file, may need a password */
#define  FIGFCF_IFF_HEADER      (1L<<3)   /* file has "FORM" IFF header */
#define  FIGFCF_MUSIC_SCORE     (1L<<4)   /* sound module / music score (song) */
#define  FIGFCF_GRAPHIC_IMAGE   (1L<<5)   /* picture/brush, anim or color palette */
#define  FIGFCF_FORMATTED_TEXT  (1L<<6)   /* special formatted text file */
#define  FIGFCF_SCRIPT          (1L<<7)   /* script file */

#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 */


/* 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 */
#define  FIPFB_PPMM         1       /* (V3+) crunched with PPx.x in "master mode" */

#define  FIPFF_KILLSYS      (1L<<0) /* file has KillSys decrunch header */
#define  FIPFF_PPMM         (1L<<1) /* (V3+) crunched with PPx.x in "master mode" */


/* 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 */

  struct DosLibrary * 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 */

  /* V6 */

  LONG  FI_HighID;        /* -for the hackers. See FIGetHighID() */
};

#endif  /* LIBRARIES_FILEID_H */
