#ifndef LIBRARIES_DOS_H
#define LIBRARIES_DOS_H






#ifndef EXEC_TYPES_H
#include "exec/types.h"
#endif

#define  DOSNAME  "dos.library"




#define MODE_OLDFILE         1005L
#define MODE_NEWFILE         1006L


#define OFFSET_BEGINNING    -1L
#define OFFSET_CURRENT       0L
#define OFFSET_END           1L

#define OFFSET_BEGINING     OFFSET_BEGINNING

#define BITSPERBYTE          8L
#define BYTESPERLONG         4L
#define BITSPERLONG          32L
#define MAXINT               0x7FFFFFFFL
#define MININT               0x80000000L


#define SHARED_LOCK          -2L
#define ACCESS_READ          -2L
#define EXCLUSIVE_LOCK       -1L
#define ACCESS_WRITE         -1L

struct DateStamp {
   LONG  ds_Days;
   LONG  ds_Minute;
   LONG  ds_Tick;
};
#define TICKS_PER_SECOND      50L


struct FileInfoBlock {
   LONG   fib_DiskKey;
   LONG   fib_DirEntryType;
   char   fib_FileName[108];
   LONG   fib_Protection;
   LONG   fib_EntryType;
   LONG   fib_Size;
   LONG   fib_NumBlocks;
   struct DateStamp fib_Date;
   char   fib_Comment[116];
};



#define FIBB_READ      3L
#define FIBB_WRITE     2L
#define FIBB_EXECUTE   1L
#define FIBB_DELETE    0L
#define FIBF_READ      (1L<<FIBB_READ)
#define FIBF_WRITE     (1L<<FIBB_WRITE)
#define FIBF_EXECUTE   (1L<<FIBB_EXECUTE)
#define FIBF_DELETE    (1L<<FIBB_DELETE)



typedef long  BPTR;
typedef long  BSTR;
#define BADDR( bptr ) (bptr << 2)



struct InfoData {
   LONG   id_NumSoftErrors;
   LONG   id_UnitNumber;
   LONG   id_DiskState;
   LONG   id_NumBlocks;
   LONG   id_NumBlocksUsed;
   LONG   id_BytesPerBlock;
   LONG   id_DiskType;
   BPTR   id_VolumeNode;
   LONG   id_InUse;
};



#define ID_WRITE_PROTECTED 80L
#define ID_VALIDATING      81L
#define ID_VALIDATED       82L


#define ID_NO_DISK_PRESENT (-1L)
#define ID_UNREADABLE_DISK ('BAD\0')
#define ID_DOS_DISK        ('DOS\0')
#define ID_NOT_REALLY_DOS  ('NDOS')
#define ID_KICKSTART_DISK  ('KICK')


#define ERROR_NO_FREE_STORE               103L
#define ERROR_NO_DEFAULT_DIR              201L
#define ERROR_OBJECT_IN_USE               202L
#define ERROR_OBJECT_EXISTS               203L
#define ERROR_DIR_NOT_FOUND               204L
#define ERROR_OBJECT_NOT_FOUND            205L
#define ERROR_BAD_STREAM_NAME             206L
#define ERROR_OBJECT_TOO_LARGE            207L
#define ERROR_ACTION_NOT_KNOWN            209L
#define ERROR_INVALID_COMPONENT_NAME      210L
#define ERROR_INVALID_LOCK                211L
#define ERROR_OBJECT_WRONG_TYPE           212L
#define ERROR_DISK_NOT_VALIDATED          213L
#define ERROR_DISK_WRITE_PROTECTED        214L
#define ERROR_RENAME_ACROSS_DEVICES       215L
#define ERROR_DIRECTORY_NOT_EMPTY         216L
#define ERROR_TOO_MANY_LEVELS             217L
#define ERROR_DEVICE_NOT_MOUNTED          218L
#define ERROR_SEEK_ERROR                  219L
#define ERROR_COMMENT_TOO_BIG             220L
#define ERROR_DISK_FULL                   221L
#define ERROR_DELETE_PROTECTED            222L
#define ERROR_WRITE_PROTECTED             223L
#define ERROR_READ_PROTECTED              224L
#define ERROR_NOT_A_DOS_DISK              225L
#define ERROR_NO_DISK                     226L
#define ERROR_NO_MORE_ENTRIES             232L



#define RETURN_OK                           0L
#define RETURN_WARN                         5L
#define RETURN_ERROR                       10L
#define RETURN_FAIL                        20L


#define SIGBREAKB_CTRL_C   12L
#define SIGBREAKB_CTRL_D   13L
#define SIGBREAKB_CTRL_E   14L
#define SIGBREAKB_CTRL_F   15L



#define SIGBREAKF_CTRL_C   (1L<<SIGBREAKB_CTRL_C)
#define SIGBREAKF_CTRL_D   (1L<<SIGBREAKB_CTRL_D)
#define SIGBREAKF_CTRL_E   (1L<<SIGBREAKB_CTRL_E)
#define SIGBREAKF_CTRL_F   (1L<<SIGBREAKB_CTRL_F)

#endif LIBRARIES_DOS_H
