#ifndef DOS_DOSEXTENS_H
#define DOS_DOSEXTENS_H
/*
** $Filename: dos/dosextens.h $
** $Release: 2.04 Includes, V37.4 $
** $Revision: 36.38 $
** $Date: 91/11/08 $
**
** DOS structures not needed for the casual AmigaDOS user
**
** (C) Copyright 1985-1991 Commodore-Amiga, Inc.
** All Rights Reserved
*/

#ifndef EXEC_TASKS_H
#include "exec/tasks.h"
#endif
#ifndef EXEC_PORTS_H
#include "exec/ports.h"
#endif
#ifndef EXEC_LIBRARIES_H
#include "exec/libraries.h"
#endif
#ifndef EXEC_SEMAPHORES_H
#include "exec/semaphores.h"
#endif
#ifndef DEVICES_TIMER_H
#include "devices/timer.h"
#endif

#ifndef DOS_DOS_H
#include "dos/dos.h"
#endif





struct Process {
 struct Task pr_Task;
 struct MsgPort pr_MsgPort; 
 WORD pr_Pad; 
 BPTR pr_SegList; 
 LONG pr_StackSize; 
 APTR pr_GlobVec; 
 LONG pr_TaskNum; 
 BPTR pr_StackBase; 
 LONG pr_Result2; 
 BPTR pr_CurrentDir; 
 BPTR pr_CIS; 
 BPTR pr_COS; 
 APTR pr_ConsoleTask; 
 APTR pr_FileSystemTask; 
 BPTR pr_CLI; 
 APTR pr_ReturnAddr; 
 APTR pr_PktWait; 
 APTR pr_WindowPtr; 

 
 BPTR pr_HomeDir; 
 LONG pr_Flags; 
 void (*pr_ExitCode)(); 
 LONG pr_ExitData; 
 UBYTE *pr_Arguments; 
 struct MinList pr_LocalVars; 
 ULONG pr_ShellPrivate; 
 BPTR pr_CES; 
}; 


#define PRB_FREESEGLIST 0
#define PRF_FREESEGLIST 1
#define PRB_FREECURRDIR 1
#define PRF_FREECURRDIR 2
#define PRB_FREECLI 2
#define PRF_FREECLI 4
#define PRB_CLOSEINPUT 3
#define PRF_CLOSEINPUT 8
#define PRB_CLOSEOUTPUT 4
#define PRF_CLOSEOUTPUT 16
#define PRB_FREEARGS 5
#define PRF_FREEARGS 32



struct FileHandle {
 struct Message *fh_Link; 
 struct MsgPort *fh_Port; 
 struct MsgPort *fh_Type; 
 LONG fh_Buf;
 LONG fh_Pos;
 LONG fh_End;
 LONG fh_Funcs;
#define fh_Func1 fh_Funcs
 LONG fh_Func2;
 LONG fh_Func3;
 LONG fh_Args;
#define fh_Arg1 fh_Args
 LONG fh_Arg2;
}; 



struct DosPacket {
 struct Message *dp_Link; 
 struct MsgPort *dp_Port; 
 
 LONG dp_Type; 
 LONG dp_Res1; 
 LONG dp_Res2; 

#define dp_Action dp_Type
#define dp_Status dp_Res1
#define dp_Status2 dp_Res2
#define dp_BufAddr dp_Arg1
 LONG dp_Arg1;
 LONG dp_Arg2;
 LONG dp_Arg3;
 LONG dp_Arg4;
 LONG dp_Arg5;
 LONG dp_Arg6;
 LONG dp_Arg7;
}; 



struct StandardPacket {
 struct Message sp_Msg;
 struct DosPacket sp_Pkt;
}; 


#define ACTION_NIL 0
#define ACTION_STARTUP 0
#define ACTION_GET_BLOCK 2 
#define ACTION_SET_MAP 4
#define ACTION_DIE 5
#define ACTION_EVENT 6
#define ACTION_CURRENT_VOLUME 7
#define ACTION_LOCATE_OBJECT 8
#define ACTION_RENAME_DISK 9
#define ACTION_WRITE 'W'
#define ACTION_READ 'R'
#define ACTION_FREE_LOCK 15
#define ACTION_DELETE_OBJECT 16
#define ACTION_RENAME_OBJECT 17
#define ACTION_MORE_CACHE 18
#define ACTION_COPY_DIR 19
#define ACTION_WAIT_CHAR 20
#define ACTION_SET_PROTECT 21
#define ACTION_CREATE_DIR 22
#define ACTION_EXAMINE_OBJECT 23
#define ACTION_EXAMINE_NEXT 24
#define ACTION_DISK_INFO 25
#define ACTION_INFO 26
#define ACTION_FLUSH 27
#define ACTION_SET_COMMENT 28
#define ACTION_PARENT 29
#define ACTION_TIMER 30
#define ACTION_INHIBIT 31
#define ACTION_DISK_TYPE 32
#define ACTION_DISK_CHANGE 33
#define ACTION_SET_DATE 34

#define ACTION_SCREEN_MODE 994

#define ACTION_READ_RETURN 1001
#define ACTION_WRITE_RETURN 1002
#define ACTION_SEEK 1008
#define ACTION_FINDUPDATE 1004
#define ACTION_FINDINPUT 1005
#define ACTION_FINDOUTPUT 1006
#define ACTION_END 1007
#define ACTION_SET_FILE_SIZE 1022 
#define ACTION_WRITE_PROTECT 1023 


#define ACTION_SAME_LOCK 40
#define ACTION_CHANGE_SIGNAL 995
#define ACTION_FORMAT 1020
#define ACTION_MAKE_LINK 1021


#define ACTION_READ_LINK 1024
#define ACTION_FH_FROM_LOCK 1026
#define ACTION_IS_FILESYSTEM 1027
#define ACTION_CHANGE_MODE 1028

#define ACTION_COPY_DIR_FH 1030
#define ACTION_PARENT_FH 1031
#define ACTION_EXAMINE_ALL 1033
#define ACTION_EXAMINE_FH 1034

#define ACTION_LOCK_RECORD 2008
#define ACTION_FREE_RECORD 2009

#define ACTION_ADD_NOTIFY 4097
#define ACTION_REMOVE_NOTIFY 4098


#define ACTION_SERIALIZE_DISK 4200


struct ErrorString {
 LONG *estr_Nums;
 UBYTE *estr_Strings;
};



struct DosLibrary {
 struct Library dl_lib;
 struct RootNode *dl_Root; 
 APTR dl_GV; 
 LONG dl_A2; 
 LONG dl_A5;
 LONG dl_A6;
 struct ErrorString *dl_Errors; 
 struct timerequest *dl_TimeReq; 
 struct Library *dl_UtilityBase; 
 struct Library *dl_IntuitionBase; 
}; 



struct RootNode {
 BPTR rn_TaskArray; 
 BPTR rn_ConsoleSegment; 
 struct DateStamp rn_Time; 
 LONG rn_RestartSeg; 
 BPTR rn_Info; 
 BPTR rn_FileHandlerSegment; 
 struct MinList rn_CliList; 
 
 struct MsgPort *rn_BootProc; 
 BPTR rn_ShellSegment; 
 LONG rn_Flags; 
}; 

#define RNB_WILDSTAR 24
#define RNF_WILDSTAR (1L<<24)
#define RNB_PRIVATE1 1 
#define RNF_PRIVATE1 2


struct CliProcList {
 struct MinNode cpl_Node;
 LONG cpl_First; 
 struct MsgPort **cpl_Array;
 
};

struct DosInfo {
 BPTR di_McName; 
#define di_ResList di_McName
 BPTR di_DevInfo; 
 BPTR di_Devices; 
 BPTR di_Handlers; 
 APTR di_NetHand; 
 struct SignalSemaphore di_DevLock; 
 struct SignalSemaphore di_EntryLock; 
 struct SignalSemaphore di_DeleteLock; 
}; 




struct Segment {
 BPTR seg_Next;
 LONG seg_UC;
 BPTR seg_Seg;
 UBYTE seg_Name[4]; 
};

#define CMD_SYSTEM -1
#define CMD_INTERNAL -2
#define CMD_DISABLED -999




struct CommandLineInterface {
 LONG cli_Result2; 
 BSTR cli_SetName; 
 BPTR cli_CommandDir; 
 LONG cli_ReturnCode; 
 BSTR cli_CommandName; 
 LONG cli_FailLevel; 
 BSTR cli_Prompt; 
 BPTR cli_StandardInput; 
 BPTR cli_CurrentInput; 
 BSTR cli_CommandFile; 
 LONG cli_Interactive; 
 LONG cli_Background; 
 BPTR cli_CurrentOutput; 
 LONG cli_DefaultStack; 
 BPTR cli_StandardOutput; 
 BPTR cli_Module; 
}; 





struct DeviceList {
 BPTR dl_Next; 
 LONG dl_Type; 
 struct MsgPort * dl_Task; 
 BPTR dl_Lock; 
 struct DateStamp dl_VolumeDate; 
 BPTR dl_LockList; 
 LONG dl_DiskType; 
 LONG dl_unused;
 BSTR dl_Name; 
};



struct DevInfo {
 BPTR dvi_Next;
 LONG dvi_Type;
 APTR dvi_Task;
 BPTR dvi_Lock;
 BSTR dvi_Handler;
 LONG dvi_StackSize;
 LONG dvi_Priority;
 LONG dvi_Startup;
 BPTR dvi_SegList;
 BPTR dvi_GlobVec;
 BSTR dvi_Name;
};



struct DosList {
 BPTR dol_Next; 
 LONG dol_Type; 
 struct MsgPort *dol_Task; 
 BPTR dol_Lock;
 union {
 struct {
 BSTR dol_Handler; 
 LONG dol_StackSize; 
 LONG dol_Priority; 
 ULONG dol_Startup; 
 BPTR dol_SegList; 
 BPTR dol_GlobVec; 
 } dol_handler;

 struct {
 struct DateStamp dol_VolumeDate; 
 BPTR dol_LockList; 
 LONG dol_DiskType; 
 } dol_volume;

 struct {
 UBYTE *dol_AssignName; 
 struct AssignList *dol_List; 
 } dol_assign;

 } dol_misc;

 BSTR dol_Name; 
 };



struct AssignList {
 struct AssignList *al_Next;
 BPTR al_Lock;
};


#define DLT_DEVICE 0
#define DLT_DIRECTORY 1 
#define DLT_VOLUME 2
#define DLT_LATE 3 
#define DLT_NONBINDING 4 
#define DLT_PRIVATE -1 


struct DevProc {
 struct MsgPort *dvp_Port;
 BPTR dvp_Lock;
 ULONG dvp_Flags;
 struct DosList *dvp_DevNode; 
};


#define DVPB_UNLOCK 0
#define DVPF_UNLOCK (1L << DVPB_UNLOCK)
#define DVPB_ASSIGN 1
#define DVPF_ASSIGN (1L << DVPB_ASSIGN)


#define LDB_DEVICES 2
#define LDF_DEVICES (1L << LDB_DEVICES)
#define LDB_VOLUMES 3
#define LDF_VOLUMES (1L << LDB_VOLUMES)
#define LDB_ASSIGNS 4
#define LDF_ASSIGNS (1L << LDB_ASSIGNS)
#define LDB_ENTRY 5
#define LDF_ENTRY (1L << LDB_ENTRY)
#define LDB_DELETE 6
#define LDF_DELETE (1L << LDB_DELETE)


#define LDB_READ 0
#define LDF_READ (1L << LDB_READ)
#define LDB_WRITE 1
#define LDF_WRITE (1L << LDB_WRITE)


#define LDF_ALL (LDF_DEVICES|LDF_VOLUMES|LDF_ASSIGNS)


struct FileLock {
 BPTR fl_Link; 
 LONG fl_Key; 
 LONG fl_Access; 
 struct MsgPort * fl_Task; 
 BPTR fl_Volume; 
};


#define REPORT_STREAM 0 
#define REPORT_TASK 1 
#define REPORT_LOCK 2 
#define REPORT_VOLUME 3 
#define REPORT_INSERT 4 


#define ABORT_DISK_ERROR 296 
#define ABORT_BUSY 288 



#define RUN_EXECUTE -1
#define RUN_SYSTEM -2
#define RUN_SYSTEM_ASYNCH -3






#define ST_ROOT 1
#define ST_USERDIR 2
#define ST_SOFTLINK 3 
#define ST_LINKDIR 4 
#define ST_FILE -3 
#define ST_LINKFILE -4 
#define ST_PIPEFILE -5 

#endif 
