home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / os-include / dos / dosextens.h < prev    next >
C/C++ Source or Header  |  1993-10-15  |  17KB  |  495 lines

  1. #ifndef DOS_DOSEXTENS_H
  2. #define DOS_DOSEXTENS_H
  3. /*
  4. **    $VER: dosextens.h 36.41 (14.5.92)
  5. **    Includes Release 40.15
  6. **
  7. **    DOS structures not needed for the casual AmigaDOS user
  8. **
  9. **    (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  10. **        All Rights Reserved
  11. */
  12.  
  13. #ifndef EXEC_TASKS_H
  14. #include "exec/tasks.h"
  15. #endif
  16. #ifndef EXEC_PORTS_H
  17. #include "exec/ports.h"
  18. #endif
  19. #ifndef EXEC_LIBRARIES_H
  20. #include "exec/libraries.h"
  21. #endif
  22. #ifndef EXEC_SEMAPHORES_H
  23. #include "exec/semaphores.h"
  24. #endif
  25. #ifndef DEVICES_TIMER_H
  26. #include "devices/timer.h"
  27. #endif
  28.  
  29. #ifndef DOS_DOS_H
  30. #include "dos/dos.h"
  31. #endif
  32.  
  33. /* All DOS processes have this structure */
  34. /* Create and Device Proc returns pointer to the MsgPort in this structure */
  35. /* dev_proc = (struct Process *) (DeviceProc(..) - sizeof(struct Task)); */
  36.  
  37. struct Process {
  38.     struct  Task    pr_Task;
  39.     struct  MsgPort pr_MsgPort; /* This is BPTR address from DOS functions  */
  40.     WORD    pr_Pad;        /* Remaining variables on 4 byte boundaries */
  41.     BPTR    pr_SegList;        /* Array of seg lists used by this process  */
  42.     LONG    pr_StackSize;    /* Size of process stack in bytes        */
  43.     APTR    pr_GlobVec;        /* Global vector for this process (BCPL)    */
  44.     LONG    pr_TaskNum;        /* CLI task number of zero if not a CLI        */
  45.     BPTR    pr_StackBase;    /* Ptr to high memory end of process stack  */
  46.     LONG    pr_Result2;        /* Value of secondary result from last call */
  47.     BPTR    pr_CurrentDir;    /* Lock associated with current directory   */
  48.     BPTR    pr_CIS;        /* Current CLI Input Stream            */
  49.     BPTR    pr_COS;        /* Current CLI Output Stream            */
  50.     APTR    pr_ConsoleTask;    /* Console handler process for current window*/
  51.     APTR    pr_FileSystemTask;    /* File handler process for current drive   */
  52.     BPTR    pr_CLI;        /* pointer to CommandLineInterface        */
  53.     APTR    pr_ReturnAddr;    /* pointer to previous stack frame        */
  54.     APTR    pr_PktWait;        /* Function to be called when awaiting msg  */
  55.     APTR    pr_WindowPtr;    /* Window for error printing            */
  56.  
  57.     /* following definitions are new with 2.0 */
  58.     BPTR    pr_HomeDir;        /* Home directory of executing program        */
  59.     LONG    pr_Flags;        /* flags telling dos about process        */
  60.     void    (*pr_ExitCode)();    /* code to call on exit of program or NULL  */
  61.     LONG    pr_ExitData;    /* Passed as an argument to pr_ExitCode.    */
  62.     UBYTE   *pr_Arguments;    /* Arguments passed to the process at start */
  63.     struct MinList pr_LocalVars; /* Local environment variables            */
  64.     ULONG   pr_ShellPrivate;    /* for the use of the current shell        */
  65.     BPTR    pr_CES;        /* Error stream - if NULL, use pr_COS        */
  66. };  /* Process */
  67.  
  68. /*
  69.  * Flags for pr_Flags
  70.  */
  71. #define    PRB_FREESEGLIST        0
  72. #define    PRF_FREESEGLIST        1
  73. #define    PRB_FREECURRDIR        1
  74. #define    PRF_FREECURRDIR        2
  75. #define    PRB_FREECLI        2
  76. #define    PRF_FREECLI        4
  77. #define    PRB_CLOSEINPUT        3
  78. #define    PRF_CLOSEINPUT        8
  79. #define    PRB_CLOSEOUTPUT        4
  80. #define    PRF_CLOSEOUTPUT        16
  81. #define    PRB_FREEARGS        5
  82. #define    PRF_FREEARGS        32
  83.  
  84. /* The long word address (BPTR) of this structure is returned by
  85.  * Open() and other routines that return a file.  You need only worry
  86.  * about this struct to do async io's via PutMsg() instead of
  87.  * standard file system calls */
  88.  
  89. struct FileHandle {
  90.    struct Message *fh_Link;     /* EXEC message          */
  91.    struct MsgPort *fh_Port;     /* Reply port for the packet */
  92.    struct MsgPort *fh_Type;     /* Port to do PutMsg() to
  93.                   * Address is negative if a plain file */
  94.    LONG fh_Buf;
  95.    LONG fh_Pos;
  96.    LONG fh_End;
  97.    LONG fh_Funcs;
  98. #define fh_Func1 fh_Funcs
  99.    LONG fh_Func2;
  100.    LONG fh_Func3;
  101.    LONG fh_Args;
  102. #define fh_Arg1 fh_Args
  103.    LONG fh_Arg2;
  104. }; /* FileHandle */
  105.  
  106. /* This is the extension to EXEC Messages used by DOS */
  107.  
  108. struct DosPacket {
  109.    struct Message *dp_Link;     /* EXEC message          */
  110.    struct MsgPort *dp_Port;     /* Reply port for the packet */
  111.                  /* Must be filled in each send. */
  112.    LONG dp_Type;         /* See ACTION_... below and
  113.                   * 'R' means Read, 'W' means Write to the
  114.                   * file system */
  115.    LONG dp_Res1;         /* For file system calls this is the result
  116.                   * that would have been returned by the
  117.                   * function, e.g. Write ('W') returns actual
  118.                   * length written */
  119.    LONG dp_Res2;         /* For file system calls this is what would
  120.                   * have been returned by IoErr() */
  121. /*  Device packets common equivalents */
  122. #define dp_Action  dp_Type
  123. #define dp_Status  dp_Res1
  124. #define dp_Status2 dp_Res2
  125. #define dp_BufAddr dp_Arg1
  126.    LONG dp_Arg1;
  127.    LONG dp_Arg2;
  128.    LONG dp_Arg3;
  129.    LONG dp_Arg4;
  130.    LONG dp_Arg5;
  131.    LONG dp_Arg6;
  132.    LONG dp_Arg7;
  133. }; /* DosPacket */
  134.  
  135. /* A Packet does not require the Message to be before it in memory, but
  136.  * for convenience it is useful to associate the two.
  137.  * Also see the function init_std_pkt for initializing this structure */
  138.  
  139. struct StandardPacket {
  140.    struct Message   sp_Msg;
  141.    struct DosPacket sp_Pkt;
  142. }; /* StandardPacket */
  143.  
  144. /* Packet types */
  145. #define ACTION_NIL        0
  146. #define ACTION_STARTUP        0
  147. #define ACTION_GET_BLOCK    2    /* OBSOLETE */
  148. #define ACTION_SET_MAP        4
  149. #define ACTION_DIE        5
  150. #define ACTION_EVENT        6
  151. #define ACTION_CURRENT_VOLUME    7
  152. #define ACTION_LOCATE_OBJECT    8
  153. #define ACTION_RENAME_DISK    9
  154. #define ACTION_WRITE        'W'
  155. #define ACTION_READ        'R'
  156. #define ACTION_FREE_LOCK    15
  157. #define ACTION_DELETE_OBJECT    16
  158. #define ACTION_RENAME_OBJECT    17
  159. #define ACTION_MORE_CACHE    18
  160. #define ACTION_COPY_DIR        19
  161. #define ACTION_WAIT_CHAR    20
  162. #define ACTION_SET_PROTECT    21
  163. #define ACTION_CREATE_DIR    22
  164. #define ACTION_EXAMINE_OBJECT    23
  165. #define ACTION_EXAMINE_NEXT    24
  166. #define ACTION_DISK_INFO    25
  167. #define ACTION_INFO        26
  168. #define ACTION_FLUSH        27
  169. #define ACTION_SET_COMMENT    28
  170. #define ACTION_PARENT        29
  171. #define ACTION_TIMER        30
  172. #define ACTION_INHIBIT        31
  173. #define ACTION_DISK_TYPE    32
  174. #define ACTION_DISK_CHANGE    33
  175. #define ACTION_SET_DATE        34
  176.  
  177. #define ACTION_SCREEN_MODE    994
  178.  
  179. #define ACTION_READ_RETURN    1001
  180. #define ACTION_WRITE_RETURN    1002
  181. #define ACTION_SEEK        1008
  182. #define ACTION_FINDUPDATE    1004
  183. #define ACTION_FINDINPUT    1005
  184. #define ACTION_FINDOUTPUT    1006
  185. #define ACTION_END        1007
  186. #define ACTION_SET_FILE_SIZE    1022    /* fast file system only in 1.3 */
  187. #define ACTION_WRITE_PROTECT    1023    /* fast file system only in 1.3 */
  188.  
  189. /* new 2.0 packets */
  190. #define ACTION_SAME_LOCK    40
  191. #define ACTION_CHANGE_SIGNAL    995
  192. #define ACTION_FORMAT        1020
  193. #define ACTION_MAKE_LINK    1021
  194. /**/
  195. /**/
  196. #define ACTION_READ_LINK    1024
  197. #define ACTION_FH_FROM_LOCK    1026
  198. #define ACTION_IS_FILESYSTEM    1027
  199. #define ACTION_CHANGE_MODE    1028
  200. /**/
  201. #define ACTION_COPY_DIR_FH    1030
  202. #define ACTION_PARENT_FH    1031
  203. #define ACTION_EXAMINE_ALL    1033
  204. #define ACTION_EXAMINE_FH    1034
  205.  
  206. #define ACTION_LOCK_RECORD    2008
  207. #define ACTION_FREE_RECORD    2009
  208.  
  209. #define ACTION_ADD_NOTIFY    4097
  210. #define ACTION_REMOVE_NOTIFY    4098
  211.  
  212. /* Added in V39: */
  213. #define ACTION_EXAMINE_ALL_END    1035
  214. #define ACTION_SET_OWNER    1036
  215.  
  216. /* Tell a file system to serialize the current volume. This is typically
  217.  * done by changing the creation date of the disk. This packet does not take
  218.  * any arguments.  NOTE: be prepared to handle failure of this packet for
  219.  * V37 ROM filesystems.
  220.  */
  221. #define    ACTION_SERIALIZE_DISK    4200
  222.  
  223. /*
  224.  * A structure for holding error messages - stored as array with error == 0
  225.  * for the last entry.
  226.  */
  227. struct ErrorString {
  228.     LONG  *estr_Nums;
  229.     UBYTE *estr_Strings;
  230. };
  231.  
  232. /* DOS library node structure.
  233.  * This is the data at positive offsets from the library node.
  234.  * Negative offsets from the node is the jump table to DOS functions
  235.  * node = (struct DosLibrary *) OpenLibrary( "dos.library" .. )         */
  236.  
  237. struct DosLibrary {
  238.     struct Library dl_lib;
  239.     struct RootNode *dl_Root; /* Pointer to RootNode, described below */
  240.     APTR    dl_GV;          /* Pointer to BCPL global vector          */
  241.     LONG    dl_A2;          /* BCPL standard register values          */
  242.     LONG    dl_A5;
  243.     LONG    dl_A6;
  244.     struct ErrorString *dl_Errors;      /* PRIVATE pointer to array of error msgs */
  245.     struct timerequest *dl_TimeReq;      /* PRIVATE pointer to timer request */
  246.     struct Library     *dl_UtilityBase;   /* PRIVATE ptr to utility library */
  247.     struct Library     *dl_IntuitionBase; /* PRIVATE ptr to intuition library */
  248. };  /*    DosLibrary */
  249.  
  250. /*                   */
  251.  
  252. struct RootNode {
  253.     BPTR    rn_TaskArr