2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
5 Desc: Internal types and stuff for dos
11 #include <aros/system.h>
14 #include <dos/dosextens.h>
15 #include <dos/filesystem.h>
16 #include <dos/dosasl.h>
17 #include <utility/tagitem.h>
19 #include "dos_dosdoio.h"
24 #define TimerBase (DOSBase->dl_TimerBase)
26 /* Needed for close() */
28 AROS_LC0(BPTR, expunge, struct DosLibrary *, DOSBase, 3, Dos)
30 #define RDAF_ALLOCATED_BY_READARGS (1L << 31)
46 extern struct EString EString
[];
52 #define IOBUFSIZE 4096
59 struct DosLibrary
*DOSBase
;
63 (((struct FileHandle *)BADDR(f))->fh_Flags&FHF_WRITE&& \
64 ((struct FileHandle *)BADDR(f))->fh_Pos<((struct FileHandle *)BADDR(f))->fh_End? \
65 *((struct FileHandle *)BADDR(f))->fh_Pos++=c,0:FPutC(f,c))
67 void InitIOFS(struct IOFileSys
*iofs
, ULONG type
,
68 struct DosLibrary
*DOSBase
);
70 CONST_STRPTR
StripVolume(CONST_STRPTR name
);
72 LONG
DoIOFS(struct IOFileSys
*iofs
, struct DevProc
*dvp
, CONST_STRPTR name
,
73 struct DosLibrary
*DOSBase
);
75 struct DosPacket
*internal_WaitPkt(struct MsgPort
*msgPort
,
76 struct DosLibrary
*DOSBase
);
78 BOOL
RunHandler(struct DeviceNode
*deviceNode
, struct DosLibrary
*DOSBase
);
80 /* Cli dependent SetProgramName() for use in CreateNewProc() */
81 BOOL
internal_SetProgramName(struct CommandLineInterface
*cli
,
82 CONST_STRPTR name
, struct DosLibrary
*DOSBase
);
85 /* Pattern matching function used by MatchPattern() and MatchPatternNoCase() */
86 BOOL
patternMatch(CONST_STRPTR pat
, CONST_STRPTR str
, BOOL useCase
,
87 struct DosLibrary
*DOSBase
);
89 /* Pattern parsing function used by ParsePattern() and ParsePatternNoCase() */
90 LONG
patternParse(CONST_STRPTR Source
, STRPTR Dest
, LONG DestLength
,
91 BOOL useCase
, struct DosLibrary
*DOSBase
);
96 struct FileHandle
*fh
,
99 struct DosLibrary
*DOSBase
101 LONG
InternalFlush( struct FileHandle
*fh
, struct DosLibrary
*DOSBase
);
106 struct AChain
*Match_AllocAChain(LONG extrasize
, struct DosLibrary
*DOSBase
);
107 void Match_FreeAChain(struct AChain
*ac
, struct DosLibrary
*DOSBase
);
108 LONG
Match_BuildAChainList(CONST_STRPTR pattern
, struct AnchorPath
*ap
,
109 struct AChain
**retac
, struct DosLibrary
*DOSBase
);
110 LONG
Match_MakeResult(struct AnchorPath
*ap
, struct DosLibrary
*DOSBase
);
112 void addprocesstoroot(struct Process
* , struct DosLibrary
*);
113 void removefromrootnode(struct Process
*, struct DosLibrary
*);
117 UBYTE type
; /* 0: Split 1: MP_NOT */
118 CONST_STRPTR pat
; /* Pointer into pattern */
119 CONST_STRPTR str
; /* Pointer into string */
124 struct markerarray
*next
;
125 struct markerarray
*prev
;
126 struct marker marker
[128];
129 #define PUSH(t,p,s) \
133 if(macur->next==NULL) \
135 macur->next=AllocMem(sizeof(struct markerarray),MEMF_ANY); \
136 if(macur->next==NULL) \
137 ERROR(ERROR_NO_FREE_STORE); \
138 macur->next->prev=macur; \
143 macur->marker[macnt].type=(t); \
144 macur->marker[macnt].pat=(p); \
145 macur->marker[macnt].str=(s); \
159 (t)=macur->marker[macnt].type; \
160 (p)=macur->marker[macnt].pat; \
161 (s)=macur->marker[macnt].str; \
164 #define MP_ESCAPE 0x81 /* Before characters in [0x81;0x8a] */
165 #define MP_MULT 0x82 /* _#(_a) */
166 #define MP_MULT_END 0x83 /* #(a_)_ */
167 #define MP_NOT 0x84 /* _~(_a) */
168 #define MP_NOT_END 0x85 /* ~(a_)_ */
169 #define MP_OR 0x86 /* _(_a|b) */
170 #define MP_OR_NEXT 0x87 /* (a_|_b) */
171 #define MP_OR_END 0x88 /* (a|b_)_ */
172 #define MP_SINGLE 0x89 /* ? */
173 #define MP_ALL 0x8a /* #? or * */
174 #define MP_SET 0x8b /* _[_ad-g] */
175 #define MP_NOT_SET 0x8c /* _[~_ad-g] */
176 #define MP_DASH 0x8d /* [ad_-g_] */
177 #define MP_SET_END 0x8e /* [ad-g_]_ */
179 /* Whether MatchFirst/MatchNext/MatchEnd in case of the base
180 AChain should just take the currentdir lock pointer, or
181 make a real duplicate with DupLock() */
183 #define MATCHFUNCS_NO_DUPLOCK 0
185 /* DosGetString additional codes (printf style parametrized) */
187 #define STRING_DISK_NOT_VALIDATED -4000
188 #define STRING_DISK_WRITE_PROTECTED -4001
189 #define STRING_DEVICE_NOT_MOUNTED_INSERT -4002
190 #define STRING_DEVICE_NOT_MOUNTED_REPLACE -4003
191 #define STRING_DEVICE_NOT_MOUNTED_REPLACE_TARGET -4004
192 #define STRING_DISK_FULL -4005
193 #define STRING_NOT_A_DOS_DISK -4006
194 #define STRING_NO_DISK -4007
195 #define STRING_ABORT_BUSY -4008
196 #define STRING_ABORT_DISK_ERROR -4009
198 #define STRING_RETRY -5000
199 #define STRING_CANCEL -5001
200 #define STRING_REQUESTTITLE -5002
202 #include "dos_commanderrors.h"
204 /* Force attempts to use DosLibrary->dl_Errors to fail. This is used by
205 locale.library's replacement function for DosGetString() to peek
206 the pointer of the catalog to use */
208 #define dl_Errors do_not_use_is_reserved_for_locale_dosgetstring_replacement
210 #define __is_task(task) (((struct Task *)task)->tc_Node.ln_Type == NT_TASK)
211 #define __is_process(task) (((struct Task *)task)->tc_Node.ln_Type == NT_PROCESS)
225 IPTR start_address
; // start address of loaded executable segment
226 struct MinList seginfos
;
229 struct InternalExAllControl
231 struct ExAllControl eac
;
232 /* Used for ExAll emulation. If non null, it means
233 ExAll emulation is being performed. */
234 struct FileInfoBlock
*fib
;
238 typedef struct FileHandle
* FileHandlePtr
;
240 void vbuf_free(FileHandlePtr fh
);
242 APTR
vbuf_alloc(FileHandlePtr fh
, ULONG size
, struct DosLibrary
*DOSBase
);
244 LONG
FWriteChars(BPTR file
, CONST UBYTE
* buffer
, ULONG length
, struct DosLibrary
*DOSBase
);
246 #endif /* DOS_INTERN_H */