1 #ifndef XPK_XPKPREFS_H
    2 #define XPK_XPKPREFS_H
    3 
    4 /*
    5 **	$VER: xpk/xpkprefs.h 4.13 (28.01.1998) by SDI
    6 **
    7 **	(C) Copyright 1996-1998 by Dirk Stöcker
    8 **	    All Rights Reserved
    9 */
   10 
   11 #include <exec/semaphores.h>
   12 #include <libraries/iffparse.h>
   13 
   14 #define ID_XPKT  MAKE_ID('X','P','K','T')
   15 #define ID_XPKM  MAKE_ID('X','P','K','M')
   16 
   17 /***************************************************************************
   18  *
   19  *
   20  *     XpkTypeData structure
   21  *
   22  */
   23 
   24 #define XTD_NoPack		(1<<0)	/* filetype should not be crunched */
   25 #define XTD_ReturnError		(1<<1)	/* return error XPKERR_NOMETHOD */
   26 /* These two cannot be set same time! */
   27 
   28 struct XpkTypeData {
   29   ULONG  xtd_Flags;	   /* see above XTD flags */
   30   ULONG  xtd_StdID;	   /* holding the ID --> 'NUKE' */
   31   ULONG  xtd_ChunkSize;    /* maybe useless with external crunchers */
   32   UWORD  xtd_Mode;	   /* PackMode */
   33   UWORD  xtd_Version;	   /* structure version --> 0 at the moment */
   34   STRPTR xtd_Password;	   /* not used at the moment */
   35   STRPTR xtd_Memory;	   /* memory pointer - when should be freed by */
   36   ULONG  xtd_MemorySize;   /* memory size    - receiver (xpkmaster) */
   37 }__attribute__((packed));
   38 
   39 /***************************************************************************
   40  *
   41  *
   42  *     XpkTypePrefs structure
   43  *
   44  */
   45 
   46 #define XPKT_NamePattern	(1<<0)	/* File Pattern is given */
   47 #define XPKT_FilePattern	(1<<1)  /* Name Pattern is given */
   48 /* These can both be set (in loading this means File AND Name Pattern have
   49 to match), but one is needed */
   50 
   51 struct XpkTypePrefs {
   52   ULONG 		xtp_Flags;	 /* See above XPKT Flags */
   53   STRPTR 		xtp_TypeName;	 /* Name of this file type (for prefs program) */
   54   STRPTR 		xtp_NamePattern; /* Pointer to NamePattern */
   55   STRPTR 		xtp_FilePattern; /* Pointer to FilePattern */
   56   struct XpkTypeData *	xtp_PackerData;
   57 }__attribute__((packed));
   58 
   59 /***************************************************************************
   60  *
   61  *
   62  *     XpkMainPrefs structure
   63  *
   64  */
   65 
   66 #define XPKM_UseXFD		(1<<0)	/* Use xfdmaster.library for unpacking */
   67 #define XPKM_UseExternals	(1<<1)	/* Use xex libraries */
   68 #define XPKM_AutoPassword	(1<<2)	/* Use the automatic password requester */
   69 
   70 struct XpkMainPrefs {
   71   ULONG			xmp_Version;	 /* version of structure ==> 0 */
   72   ULONG			xmp_Flags;	 /* above defined XPKM flags */
   73   struct XpkTypeData *	xmp_DefaultType; /* sets the mode used as default */
   74   UWORD			xmp_Timeout;     /* Timeout for password requester
   75 				 given in seconds, zero means no timeout */
   76 }__attribute__((packed));
   77 
   78 /* The library internal defaults are:
   79   XPKM_UseXFD			FALSE
   80   XPKM_AutoPassword		FALSE
   81   XPKM_UseExternals		TRUE
   82   XTD_ReturnError		defined as default
   83   xmp_TimeOut			set to 120	(two minutes)
   84 
   85 These defaults are used, when no preferences file is given.
   86 */
   87 
   88 /***************************************************************************
   89  *
   90  *
   91  *     XpkMasterPrefs Semaphore structure
   92  *
   93  *  find with FindSemaphore(XPKPREFSSEMNAME);
   94  *
   95  *  obtain with ObtainSemaphoreShared(),
   96  *  programs WRITING into the structure fields must know:
   97  *   - only write to them, when you created the semaphore
   98  *   - use ObtainSemaphore() instead of ObtainSemaphoreShared()
   99  */
  100 
  101 #define XPKPREFSSEMNAME		"« XpkMasterPrefs »"
  102 
  103 /* Defines used for xps_PrefsType. These help to find out, which preferences
  104  * type is used. */
  105 
  106 #define XPREFSTYPE_STANDARD	0x58504B4D	/* 'XPKM' */
  107 #define XPREFSTYPE_CYB		0x20435942	/* ' CYB' */
  108 
  109 struct XpkPrefsSemaphore {
  110   struct SignalSemaphore 	xps_Semaphore;
  111   ULONG				xps_Version;	   /* at the moment 0 */
  112   ULONG				xps_PrefsType;	   /* preferences type */
  113   APTR				xps_PrefsData;	   /* preferences data */
  114   struct XpkMainPrefs *		xps_MainPrefs;     /* defined defaults */
  115   ULONG				xps_RecogSize;	   /* needed size of Recogbuffer */
  116   struct XpkTypeData * ( *	xps_RecogFunc) (); /* Recog function */
  117   struct Hook *			xps_ProgressHook;  /* hook function */
  118   struct Task *			xps_MasterTask;	   /* Creater's task */
  119 }__attribute__((packed));
  120 
  121 /* Use Signal(sem->xps_MasterTask, SIGBREAKF_CTRL_C); to get the installer
  122    program to remove the semaphore. */
  123 
  124 /* prototype/typedef of RecogFunc:
  125 typedef struct XpkTypeData * __asm (*RecogFunc)
  126 	(register __a0 STRPTR buffer,
  127 	 register __a1 STRPTR filename,
  128 	 register __d0 ULONG  buffersize,
  129 	 register __d1 ULONG  fullsize,
  130 	 register __a2 struct TagItem *tags);
  131 */
  132 
  133 #endif /* XPK_XPKPREFS_H */