#ifndef	QUICKDOS_QUICKDOS_H
#define	QUICKDOS_QUICKDOS_H
/**************************************************
*
*	QuickDOS V1.00
*
*	Written by Alexis WILKE (c) 1994
*
**************************************************/


#ifndef	EXEC_LIBRARIES_H
#include	<EXEC/libraries.h>
#endif
#ifndef	EXEC_LISTS_H
#include	<EXEC/lists.h>
#endif
#ifndef	DOS_DOS_H
#include	<DOS/dos.h>
#endif


struct QuickDOS {
    struct Library	LibNode;
    struct Library	*DOSBase;
    long		Flags;
    struct List		Files;		/* List of files */
};

#define	FQDF_FASTONLY	(1<<0)		/* Allocates buffers only in fast memory */
#define	FQDB_FASTONLY	0


struct QDFile {
    struct Node		FileNode;
    unsigned char	Flags;
    unsigned char	pad;		/* <- this byte is used by the system... */
    unsigned long	Size;
    char		*Data;		/* Null represent an empty file */
  struct FileInfoBlock	Info;		/* Must be long word aligned */
};

#define	FQDFF_READ	(1<<0)		/* File needs to be read */
#define	FQDFB_READ	0
#define	FQDFF_WRITE	(1<<1)		/* File needs to be written */
#define	FQDFB_WRITE	1
#define	FQDFF_READING	(1<<2)		/* File is actually read */
#define	FQDFB_READING	2
#define	FQDFF_WRITING	(1<<3)		/* File is actually written */
#define	FQDFB_WRITING	3
#define	FQDFF_CHECK	(1<<4)		/* File needs a check-up */
#define	FQDFB_CHECK	4
#define	FQDFF_CHECKING	(1<<5)		/* File is actually checked */
#define	FQDFB_CHECKING	5
#define	FQDFF_ERROR	(1<<7)		/* Last command generates an error */
#define	FQDFB_ERROR	7


typedef long QDFileHandle;


		/**** Flags for QDOpen function ****/

#define	QDOFF_MEMORY	(1<<16)		/* In memory only (NEWFILE) */
#define	QDOFB_MEMORY	16
#define	QDOFF_SHARED	(1<<17)		/* Let other tasks play with the file */
#define	QDOFB_SHARED	17
#define	QDOFF_APPEND	(1<<18)		/* Cannot write in existing data (READWRITE) */
#define	QDOFB_APPEND	18

#define	QDF_UNKNOWN	0		/* Case the file is not open */
#define	QDF_OLDFILE	1		/* Saved in qdfile->FileNode.ln_Type */
#define	QDF_READWRITE	2
#define	QDF_NEWFILE	3



#define	QDF_DEFREALLOC	(16*1024)	/* Default size for realloc purpose */



#define	QUICKDOSNAME	"quickdos.library"
#define	INTERNALDEVICE	"quickdos:"	/* Used for memory only files */


#define	QUICKDOSVERSION		1
#define	QUICKDOSRELEASE		1
#define	QUICKDOSPRIORITY	5



extern	long		QDClose(struct QDFileHandle *);
extern	long		QDCloseAll(void);
extern	long		QDDiscard(char *);
extern	struct FileInfoBlock *	QDExamine(QDFileHandle *, struct FileInfoBlock *);
extern	struct QDFile *	QDExNext(struct QDFile *);
extern	long		QDFlush(QDFileHandle *);
extern	long		QDForget(QDFileHandle *);
extern	struct QDFile * QDInfo(QDFileHandle *);
extern	long		QDIoErr(void);
extern	QDFileHandle *	QDOpen(char *, long);
extern	long		QDRead(QDFileHandle *, void *, long);
extern	long		QDRallocStep(long);
extern	long		QDSeek(QDFileHandle *, long, long);
extern	long		SetSize(QDFileHandle *, long);
extern	long		QDTell(QDFileHandle *);
extern	long		QDWrite(QDFileHandle *, void *, long);


#endif		/* QUICKDOS_QUICKDOS_H */
