home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / TRSICAT.LZX / CATS_CD2_TRSI / Inc&AD2.1 / includes / dos / dosextens.i < prev    next >
Encoding:
Text File  |  1992-09-11  |  14.7 KB  |  460 lines

  1.     IFND    DOS_DOSEXTENS_I
  2. DOS_DOSEXTENS_I    SET    1
  3. **
  4. **    $VER: dosextens.i 36.37 (08.11.91)
  5. **    Includes Release 38.56
  6. **
  7. **    DOS structures not needed for the casual AmigaDOS user
  8. **
  9. **    (C) Copyright 1985-1992 Commodore-Amiga, Inc.
  10. **        All Rights Reserved
  11. **
  12.  
  13.      IFND  EXEC_TYPES_I
  14.      INCLUDE "exec/types.i"
  15.      ENDC
  16.      IFND  EXEC_TASKS_I
  17.      INCLUDE "exec/tasks.i"
  18.      ENDC
  19.      IFND  EXEC_PORTS_I
  20.      INCLUDE "exec/ports.i"
  21.      ENDC
  22.      IFND  EXEC_LIBRARIES_I
  23.      INCLUDE "exec/libraries.i"
  24.      ENDC
  25.      IFND  EXEC_SEMAPHORES_I
  26.      INCLUDE "exec/semaphores.i"
  27.      ENDC
  28.      IFND  DEVICES_TIMER_I
  29.      INCLUDE "devices/timer.i"
  30.      ENDC
  31.  
  32.      IFND  DOS_DOS_I
  33.      INCLUDE "dos/dos.i"
  34.      ENDC
  35.  
  36.  
  37. * All DOS processes have this STRUCTure
  38. * Create and DeviceProc returns pointer to the MsgPort in this STRUCTure
  39. * Process_addr = DeviceProc(..) - TC_SIZE
  40.  
  41.  STRUCTURE Process,0
  42.     STRUCT  pr_Task,TC_SIZE
  43.     STRUCT  pr_MsgPort,MP_SIZE    * This is BPTR address from DOS functions
  44.     WORD    pr_Pad        * Remaining variables on 4 byte boundaries
  45.     BPTR    pr_SegList        * Array of seg lists used by this process
  46.     LONG    pr_StackSize    * Size of process stack in bytes
  47.     APTR    pr_GlobVec        * Global vector for this process (BCPL)
  48.     LONG    pr_TaskNum        * CLI task number of zero if not a CLI
  49.     BPTR    pr_StackBase    * Ptr to high memory end of process stack
  50.     LONG    pr_Result2        * Value of secondary result from last call
  51.     BPTR    pr_CurrentDir    * Lock associated with current directory
  52.     BPTR    pr_CIS        * Current CLI Input Stream
  53.     BPTR    pr_COS        * Current CLI Output Stream
  54.     APTR    pr_ConsoleTask    * Console handler process for current window
  55.     APTR    pr_FileSystemTask    * File handler process for current drive
  56.     BPTR    pr_CLI        * pointer to CommandLineInterface
  57.     APTR    pr_ReturnAddr    * pointer to previous stack frame
  58.     APTR    pr_PktWait        * Function to be called when awaiting msg
  59.     APTR    pr_WindowPtr    * Window pointer for errors
  60.  
  61. * following definitions are new with 2.0
  62.     BPTR    pr_HomeDir        * Home directory of executing program
  63.     LONG    pr_Flags        * flags telling dos about process
  64.     APTR    pr_ExitCode        * code to call on exit of program or NULL
  65.     LONG    pr_ExitData        * Passed as an argument to pr_ExitCode
  66.     APTR    pr_Arguments    * Arguments passed to the process at start
  67.     STRUCT  pr_LocalVars,MLH_SIZE * Local environment variables
  68.     APTR    pr_ShellPrivate    * for the use of the current shell
  69.     BPTR    pr_CES        * Error stream - if NULL, use pr_COS
  70.    LABEL   pr_SIZEOF        * Process
  71.  
  72. *
  73. * Flags for pr_Flags
  74. *
  75.     BITDEF PR,FREESEGLIST,0
  76.     BITDEF PR,FREECURRDIR,1
  77.     BITDEF PR,FREECLI,2
  78.     BITDEF PR,CLOSEINPUT,3
  79.     BITDEF PR,CLOSEOUTPUT,4
  80.     BITDEF PR,FREEARGS,5
  81.  
  82. * The long word address (BPTR) of this STRUCTure is returned by
  83. * Open() and other routines that return a file.     You need only worry
  84. * about this STRUCT to do async io's via PutMsg() instead of
  85. * standard file system calls
  86.  
  87.  STRUCTURE FileHandle,0
  88.    APTR      fh_Link        * pointer to EXEC message
  89.    APTR      fh_Interactive    * Boolean; TRUE if interactive handle
  90.    APTR      fh_Type        * Port to do PutMsg() to
  91.    LONG      fh_Buf
  92.    LONG      fh_Pos
  93.    LONG      fh_End
  94.    LONG      fh_Funcs
  95. fh_Func1 EQU fh_Funcs
  96.    LONG      fh_Func2
  97.    LONG      fh_Func3
  98.    LONG      fh_Args
  99. fh_Arg1 EQU fh_Args
  100.    LONG      fh_Arg2
  101.    LABEL  fh_SIZEOF * FileHandle
  102.  
  103. * This is the extension to EXEC Messages used by DOS
  104.  STRUCTURE DosPacket,0
  105.    APTR      dp_Link      * pointer to EXEC message
  106.    APTR      dp_Port      * pointer to Reply port for the packet
  107. *              * Must be filled in each send.
  108.    LONG      dp_Type      * See ACTION_... below and
  109. *              * 'R' means Read, 'W' means Write to the file system
  110.    LONG      dp_Res1      * For file system calls this is the result
  111. *              * that would have been returned by the
  112. *              * function, e.g. Write ('W') returns actual
  113. *              * length written
  114.    LONG      dp_Res2      * For file system calls this is what would
  115. *              * have been returned by IoErr()
  116.    LONG      dp_Arg1
  117. *  Device packets common equivalents
  118. dp_Action  EQU    dp_Type
  119. dp_Status  EQU    dp_Res1
  120. dp_Status2 EQU    dp_Res2
  121. dp_BufAddr EQU    dp_Arg1
  122.    LONG      dp_Arg2
  123.    LONG      dp_Arg3
  124.    LONG      dp_Arg4
  125.    LONG      dp_Arg5
  126.    LONG      dp_Arg6
  127.    LONG      dp_Arg7
  128.    LABEL  dp_SIZEOF * DosPacket
  129.  
  130. * A Packet does not require the Message to before it in memory, but
  131. * for convenience it is useful to associate the two.
  132. * Also see the function init_std_pkt for initializing this STRUCTure
  133.  
  134.  STRUCTURE StandardPacket,0
  135.    STRUCT sp_Msg,MN_SIZE
  136.    STRUCT sp_Pkt,dp_SIZEOF
  137.    LABEL  sp_SIZEOF * StandardPacket
  138.  
  139.  
  140. * Packet types
  141. ACTION_NIL        EQU    0
  142. ACTION_STARTUP        EQU    0
  143. ACTION_GET_BLOCK    EQU    2    ;OBSOLETE
  144. ACTION_SET_MAP        EQU    4
  145. ACTION_DIE        EQU    5
  146. ACTION_EVENT        EQU    6
  147. ACTION_CURRENT_VOLUME    EQU    7
  148. ACTION_LOCATE_OBJECT    EQU    8
  149. ACTION_RENAME_DISK    EQU    9
  150. ACTION_WRITE        EQU    'W'
  151. ACTION_READ        EQU    'R'
  152. ACTION_FREE_LOCK    EQU    15
  153. ACTION_DELETE_OBJECT    EQU    16
  154. ACTION_RENAME_OBJECT    EQU    17
  155. ACTION_MORE_CACHE    EQU    18
  156. ACTION_COPY_DIR        EQU    19
  157. ACTION_WAIT_CHAR    EQU    20
  158. ACTION_SET_PROTECT    EQU    21
  159. ACTION_CREATE_DIR    EQU    22
  160. ACTION_EXAMINE_OBJECT    EQU    23
  161. ACTION_EXAMINE_NEXT    EQU    24
  162. ACTION_DISK_INFO    EQU    25
  163. ACTION_INFO        EQU    26
  164. ACTION_FLUSH        EQU    27
  165. ACTION_SET_COMMENT    EQU    28
  166. ACTION_PARENT        EQU    29
  167. ACTION_TIMER        EQU    30
  168. ACTION_INHIBIT        EQU    31
  169. ACTION_DISK_TYPE    EQU    32
  170. ACTION_DISK_CHANGE    EQU    33
  171. ACTION_SET_DATE        EQU    34
  172.  
  173. ACTION_SCREEN_MODE    EQU    994
  174.  
  175. ACTION_READ_RETURN    EQU    1001
  176. ACTION_WRITE_RETURN    EQU    1002
  177. ACTION_SEEK        EQU    1008
  178. ACTION_FINDUPDATE    EQU    1004
  179. ACTION_FINDINPUT    EQU    1005
  180. ACTION_FINDOUTPUT    EQU    1006
  181. ACTION_END        EQU    1007
  182. ACTION_SET_FILE_SIZE    EQU    1022    ; fast file system only
  183. ACTION_WRITE_PROTECT    EQU    1023    ; fast file system only
  184.  
  185. * new 2.0 packets
  186. ACTION_SAME_LOCK    EQU    40
  187. ACTION_CHANGE_SIGNAL    EQU    995
  188. ACTION_FORMAT        EQU    1020
  189. ACTION_MAKE_LINK    EQU    1021
  190. *
  191. *
  192. ACTION_READ_LINK    EQU    1024
  193. ACTION_FH_FROM_LOCK    EQU    1026
  194. ACTION_IS_FILESYSTEM    EQU    1027
  195. ACTION_CHANGE_MODE    EQU    1028
  196. *
  197. ACTION_COPY_DIR_FH    EQU    1030
  198. ACTION_PARENT_FH    EQU    1031
  199. ACTION_EXAMINE_ALL    EQU    1033
  200. ACTION_EXAMINE_FH    EQU    1034
  201.  
  202. ACTION_LOCK_RECORD    EQU    2008
  203. ACTION_FREE_RECORD    EQU    2009
  204.  
  205. ACTION_ADD_NOTIFY    EQU    4097
  206. ACTION_REMOVE_NOTIFY    EQU    4098
  207.  
  208. * Tell a file system to serialize the current volume. This is typically
  209. * done by changing the creation date of the disk. This packet does not take
  210. * any arguments.  NOTE: be prepared to handle failure of this packet for
  211. * V37 ROM filesystems.
  212.  
  213. ACTION_SERIALIZE_DISK    EQU    4200
  214.    
  215. * A structure for holding error messages - stored as array with error == 0
  216. * for the last entry.
  217.  
  218.  STRUCTURE ErrorString,0
  219.     APTR   estr_Nums
  220.     APTR   estr_Strings
  221.         LABEL  ErrorString_SIZEOF
  222.  
  223. * DOS library node structure.
  224. * This is the data at positive offsets from the library node.
  225. * Negative offsets from the node is the jump table to DOS functions
  226. * node = (STRUCT DosLibrary *) OpenLibrary( "dos.library" .. )
  227.  
  228.  STRUCTURE DosLibrary,0
  229.     STRUCT  dl_lib,LIB_SIZE
  230.     APTR    dl_Root         * Pointer to RootNode, described below
  231.     APTR    dl_GV         * Pointer to BCPL global vector
  232.     LONG    dl_A2         * BCPL standard register values
  233.     LONG    dl_A5
  234.     LONG    dl_A6
  235.     APTR    dl_Errors         * PRIVATE pointer to array of error msgs
  236.     APTR    dl_TimeReq         * PRIVATE pointer to timer request 
  237.     APTR    dl_UtilityBase   * PRIVATE pointer to utility library base
  238.     APTR    dl_IntuitionBase * PRIVATE pointer to intuition library base
  239.     LABEL   dl_SIZEOF *     DosLibrary
  240.  
  241. *
  242.  
  243.  STRUCTURE RootNode,0
  244.     BPTR    rn_TaskArray       * [0] is max number of CLI's
  245. *                   * [1] is APTR to process id of CLI 1
  246. *                   * [n] is APTR to process id of CLI n
  247.     BPTR    rn_ConsoleSegment  * SegList for the CLI
  248.     STRUCT  rn_Time,ds_SIZEOF  * Current time
  249.     LONG    rn_RestartSeg      * SegList for the disk validator process
  250.     BPTR    rn_Info           * Pointer to the Info structure
  251.     BPTR    rn_FileHandlerSegment * code for file handler
  252.     STRUCT  rn_CliList,MLH_SIZE * new list of all CLI processes
  253. *                   * the first cpl_Array is also rn_TaskArray
  254.     APTR    rn_BootProc           * private! ptr to msgport of boot fs
  255.     BPTR    rn_ShellSegment    * seglist for Shell (for NewShell)
  256.     LONG    rn_Flags           * dos flags
  257.     LABEL   rn_SIZEOF * RootNode
  258.  
  259.  BITDEF    RN,WILDSTAR,24
  260.  BITDEF RN,PRIVATE1,1
  261.  
  262. * ONLY to be allocated by DOS!
  263.  STRUCTURE CliProcList,0
  264.     STRUCT  cpl_Node,MLN_SIZE
  265.     LONG    cpl_First           * number of first entry in array
  266.     APTR    cpl_Array           * pointer to array of process msgport pointers
  267. *                   * [0] is max number of CLI's in this entry (n)
  268. *                   * [1] is APTR to process id of CLI cpl_First
  269. *                   * [n] is APTR to process id of CLI cpl_First+n-1
  270.     LABEL   cpl_SIZEOF
  271.  
  272.  STRUCTURE DosInfo,0
  273.     BPTR    di_McName           * PRIVATE: system resident module list
  274. di_ResList EQU di_McName
  275.     BPTR    di_DevInfo           * Device List
  276.     BPTR    di_Devices           * Currently zero
  277.     BPTR    di_Handlers           * Currently zero
  278.     APTR    di_NetHand           * Network handler processid currently zero
  279.     STRUCT  di_DevLock,SS_SIZE    * do NOT access directly!
  280.     STRUCT  di_EntryLock,SS_SIZE  * do NOT access directly!
  281.     STRUCT  di_DeleteLock,SS_SIZE * do NOT access directly!
  282.     LABEL   di_SIZEOF * DosInfo
  283.  
  284. * structure for the Dos resident list.  Do NOT allocate these, use
  285. * AddSegment(), and heed the warnings in the autodocs!
  286.  
  287.  STRUCTURE Segment,0
  288.     BPTR seg_Next
  289.     LONG seg_UC
  290.     BPTR seg_Seg
  291.     STRUCT seg_Name,4    ; Actually the first 4 chars of BSTR name
  292.     LABEL seg_SIZEOF
  293.  
  294. CMD_SYSTEM    EQU    -1
  295. CMD_INTERNAL    EQU    -2
  296. CMD_DISABLED    EQU    -999
  297.  
  298.  
  299. * DOS Processes started from the CLI via RUN or NEWCLI have this additional
  300. * set to data associated with them
  301.  
  302.  STRUCTURE CommandLineInterface,0
  303.     LONG   cli_Result2           * Value of IoErr from last command
  304.     BSTR   cli_SetName           * Name of current directory
  305.     BPTR   cli_CommandDir      * Head of the path locklist
  306.     LONG   cli_ReturnCode      * Return code from last command
  307.     BSTR   cli_CommandName     * Name of current command
  308.     LONG   cli_FailLevel       * Fail level (set by FAILAT)
  309.     BSTR   cli_Prompt           * Current prompt (set by PROMPT)
  310.     BPTR   cli_StandardInput   * Default (terminal) CLI input
  311.     BPTR   cli_CurrentInput    * Current CLI input
  312.     BSTR   cli_CommandFile     * Name of EXECUTE command file
  313.     LONG   cli_Interactive     * Boolean True if prompts required
  314.     LONG   cli_Background      * Boolean True if CLI created by RUN
  315.     BPTR   cli_CurrentOutput   * Current CLI output
  316.     LONG   cli_DefaultStack    * Stack size to be obtained in long words
  317.     BPTR   cli_StandardOutput  * Default (terminal) CLI output
  318.     BPTR   cli_Module           * SegList of currently loaded command
  319.     LABEL  cli_SIZEOF           * CommandLineInterface
  320.  
  321. * This structure can take on different values depending on whether it is
  322. * a device, an assigned directory, or a volume.     Below is the structure
  323. * reflecting volumes only.  Following that is the structure representing
  324. * only devices. Following that is the unioned structure representing all
  325. * the values
  326.   
  327. * structure representing a volume 
  328.  
  329.  STRUCTURE DevList,0
  330.     BPTR    dl_Next            ; bptr to next device list
  331.     LONG    dl_Type            ; see DLT below
  332.     APTR    dl_Task            ; ptr to handler task
  333.     BPTR    dl_Lock            ; not for volumes
  334.     STRUCT    dl_VolumeDate,ds_SIZEOF ; creation date
  335.     BPTR    dl_LockList        ; outstanding locks
  336.     LONG    dl_DiskType        ; 'DOS', etc
  337.     LONG    dl_unused
  338.     BSTR    dl_Name            ; bptr to bcpl name
  339.     LABEL    DevList_SIZEOF
  340.  
  341. * device structure (same as the DeviceNode structure in filehandler.i
  342.  
  343.  STRUCTURE     DevInfo,0
  344.     BPTR    dvi_Next
  345.     LONG    dvi_Type
  346.     APTR    dvi_Task
  347.     BPTR    dvi_Lock
  348.     BSTR    dvi_Handler
  349.     LONG    dvi_Stacksize
  350.     LONG    dvi_Priority
  351.     LONG    dvi_Startup
  352.     BPTR    dvi_SegList
  353.     BPTR    dvi_GlobVec
  354.     BSTR    dvi_Name
  355.     LABEL   dvi_SIZEOF
  356.  
  357. * combined structure for devices, assigned directories, volumes 
  358.  
  359.  STRUCTURE DosList,0
  360.     BPTR     dol_Next         ; bptr to next device on lis
  361.     LONG     dol_Type         ; see DLT below
  362.     APTR     dol_Task         ; ptr to handler task
  363.     BPTR     dol_Lock
  364.  
  365.     STRUCT    dol_VolumeDate,0    ; creation date (UNION)
  366.     STRUCT    dol_AssignName,0    ; name for assign path (UNION)
  367.     BSTR    dol_Handler        ; file name to load if seglist is null
  368.     STRUCT    dol_List,0        ; List of directories assigned (UNION)
  369.     LONG    dol_StackSize        ; stacksize to use when starting process
  370.     LONG    dol_Priority        ; task priority when starting process
  371.  
  372.     STRUCT    dol_LockList,0        ; outstanding locks (UNION)
  373.     ULONG    dol_Startup        ; startup msg: FileSysStartupMsg
  374.                     ; for disks
  375.  
  376.     STRUCT    dol_DiskType,0        ; 'DOS', etc (UNION)
  377.     BPTR    dol_SegList        ; already loaded code for new task
  378.  
  379.     BPTR    dol_GlobVec        ; BCPL global vector
  380.  
  381.     BSTR    dol_Name        ; bptr to bcpl name
  382.     LABEL    DosList_SIZEOF
  383.  
  384.  
  385.  
  386. * definitions for dl_Type
  387. DLT_DEVICE    EQU    0
  388. DLT_DIRECTORY    EQU    1    ; assign
  389. DLT_VOLUME    EQU    2
  390. DLT_LATE    EQU    3    ; late-binding assign
  391. DLT_NONBINDING    EQU    4    ; non-binding assign (AssignPath)
  392. DLT_PRIVATE    EQU    -1    ; for internal use only
  393.  
  394. * structure return by GetDeviceProc()
  395.  STRUCTURE DevProc,0
  396.     APTR    dvp_Port    ; struct MsgPort *
  397.     BPTR    dvp_Lock
  398.     ULONG    dvp_Flags
  399.     APTR    dvp_DevNode    ; struct DosList * - DON'T TOUCH OR USE!
  400.     LABEL    dvp_SIZEOF
  401.  
  402. * definitions for dvp_Flags
  403.  BITDEF    DVP,UNLOCK,0
  404.  BITDEF    DVP,ASSIGN,1
  405.  
  406. * Flags to be passed to LockDosList(), etc
  407.  BITDEF LD,DEVICES,2
  408.  BITDEF LD,VOLUMES,3
  409.  BITDEF LD,ASSIGNS,4
  410.  BITDEF LD,ENTRY,5
  411.  BITDEF LD,DELETE,6
  412.  
  413. * You MUST specify one of LDF_READ or LDF_WRITE
  414.  BITDEF LD,READ,0
  415.  BITDEF LD,WRITE,1
  416.  
  417. * actually all but LDF_ENTRY (which is used for internal locking)
  418. LDF_ALL    EQU    (LDF_DEVICES!LDF_VOLUMES!LDF_ASSIGNS)
  419.  
  420. * a lock structure, as returned by Lock() or DupLock()
  421.  STRUCTURE FileLock,0
  422.     BPTR    fl_Link            ; bcpl pointer to next lock
  423.     LONG    fl_Key            ; disk block number
  424.     LONG    fl_Access        ; exclusive or shared
  425.     APTR    fl_Task            ; handler task's port
  426.     BPTR    fl_Volume        ; bptr to DLT_VOLUME DosList entry
  427.     LABEL    fl_SIZEOF
  428.  
  429. * error report types for ErrorReport()
  430. REPORT_STREAM    EQU    0    ; a stream 
  431. REPORT_TASK    EQU    1    ; a process - unused 
  432. REPORT_LOCK    EQU    2    ; a lock 
  433. REPORT_VOLUME    EQU    3    ; a volume node 
  434. REPORT_INSERT    EQU    4    ; please insert volume 
  435.  
  436. * Special error codes for ErrorReport()
  437. ABORT_DISK_ERROR    EQU    296    ; Read/write error 
  438. ABORT_BUSY        EQU    288    ; You MUST replace... 
  439.  
  440. * types for initial packets to shells from run/newcli/execute/system.
  441. * For shell-writers only
  442. RUN_EXECUTE        EQU    -1
  443. RUN_SYSTEM        EQU    -2
  444. RUN_SYSTEM_ASYNCH    EQU    -3
  445.  
  446. * Types for fib_DirEntryType.  NOTE that both USERDIR and ROOT are
  447. * directories, and that directory/file checks should use <0 and >=0.
  448. * This is not necessarily exhaustive!  Some handlers may use other
  449. * values as needed, though <0 and >=0 should remain as supported as
  450. * possible.
  451. ST_ROOT        EQU    1
  452. ST_USERDIR    EQU    2
  453. ST_SOFTLINK    EQU    3    ; looks like dir, but may point to a file!
  454. ST_LINKDIR    EQU    4    ; hard link to dir
  455. ST_FILE        EQU    -3    ; must be negative for FIB!
  456. ST_LINKFILE    EQU    -4    ; hard link to file
  457. ST_PIPEFILE    EQU    -5    ; for pipes that support ExamineFH
  458.  
  459.     ENDC    ; DOS_DOSEXTENS_I
  460.