/*		QuickTools.h 		*/

#ifndef	QUICKTOOLS_H
#define	QUICKTOOLS_H

#ifndef	EXEC_TYPES_H
#include <exec/types.h>
#endif   /* EXEC_TYPES_H */

#ifndef	EXEC_NODES_H
#include <exec/nodes.h>
#endif	/* EXEC_NODES_H */

#ifndef	EXEC_LISTS_H
#include <exec/lists.h>
#endif	/* EXEC_LISTS_H */

#ifndef	EXEC_SEMAPHORES_H
#include	<exec/semaphores.h>
#endif	/* EXEC_SEMAPHORES_H */

#ifndef	EXEC_TASKS_H
#include	<exec/tasks.h>
#endif	/* EXEC_TASKS_H */

#ifndef UTILITY_TAGITEM_H
#include <utility/tagitem.h> 
#endif	/* UTILITY_TAGITEM_H */

#define	QUICKTOOLSNAME			"quicktools.library"
#define	QUICKTOOLSVERSION		2L

#define	REG(x)	register __ ## x

#ifdef QUICKTOOLS_PRIVATE	/* Private structures and definitions. */

#define FILEBUFFERSIZE		5120

struct QToolsData
{
	struct SignalSemaphore DataSem;
	struct SignalSemaphore DirLoadSem;
	APTR DirDataBuffer;
	ULONG DirDataLength;
	struct Qdata **DirData;
	UWORD NumDirs;
};

struct ParsePathPart
{
	struct ParsePathPart *pp_Next;
	ULONG pp_Size;
	BOOL  pp_Root;
	UBYTE pp_ParsePattern[1];
};

struct MatchData
{
	ULONG	md_ScanType;		/*  What kind of matchdata is this  */
	BOOL md_Done;

	ULONG md_CurData;			/*  Common data for file and dir matching  */
	struct ParsePathPart *md_Patterns;
	char md_SearchBuf[32];

	struct Qdata *md_CurQdata;	/*  Data used only for file matching  */
	BPTR md_FileHandle;
	APTR md_FileBuffer;
	ULONG md_NumFiles;
};

#endif /* QUICKTOOLS_PRIVATE */	/* Public structures and definitions */

#define QUICKTOOLSDATAPATH	"s:"
#define QUICKTOOLSDIRS 		"QuickTools.Dirs"
#define QUICKTOOLSFILES 	"QuickTools.Files"

struct Qdata {
	UWORD	qd_ParrID;
	unsigned char qd_UsePrev;	/*  Nr of chars from previous to use	*/
	char qd_FileName[1];			/*  Packed name of this file				*/
};

/*  Scantypes defined for the QT_ScanType tag  */

#define QT_SCAN_FILE			1
#define QT_SCAN_DIRECTORY	2

/*  Tags  */

#define	QT_TagBase					TAG_USER

/*  Tags understood by SetupMatchData() and FindMatchReq()  */

/*  Type of items to scan for								*/
#define QT_ScanType					(QT_TagBase+1)
/*  Don't add '#?' to the last part						*/
#define QT_ExactLastPart			(QT_TagBase+2)
/*  Don't add any '#?' to the given match				*/
#define QT_ExactMatch				(QT_TagBase+3)


/*  Tags understood by FindMatchReq()  */

/*  Title to use for requesterwindow					*/
#define QT_ReqTitle					(QT_TagBase+100)
/*  Center the requester on the screen					*/
#define QT_CenterReq					(QT_TagBase+101)
/*  Screen to open requester on							*/
#define QT_PubScreen					(QT_TagBase+102)

#endif	/* QUICKTOOLS_H */
