2 Copyright © 1995-2001, 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 SysBase (DOSBase->dl_SysBase)
28 #define UtilityBase (DOSBase->dl_UtilityBase)
32 #define TimerBase (DOSBase->dl_TimerBase)
34 /* Needed for close() */
36 AROS_LC0(BPTR, expunge, struct DosLibrary *, DOSBase, 3, Dos)
38 #define RDAF_ALLOCATED_BY_READARGS (1L << 31)
54 extern struct EString EString
[];
60 #define IOBUFSIZE 4096
67 struct DosLibrary
*DOSBase
;
71 (((struct FileHandle *)BADDR(f))->fh_Flags&FHF_WRITE&& \
72 ((struct FileHandle *)BADDR(f))->fh_Pos<((struct FileHandle *)BADDR(f))->fh_End? \
73 *((struct FileHandle *)BADDR(f))->fh_Pos++=c,0:FPutC(f,c))
75 LONG
DoName(struct IOFileSys
*iofs
, CONST_STRPTR name
,
76 struct DosLibrary
*DOSBase
);
77 LONG
DevName(CONST_STRPTR name
, struct Device
**devptr
,
78 struct DosLibrary
*DOSBase
);
80 void InitIOFS(struct IOFileSys
*iofs
, ULONG type
,
81 struct DosLibrary
*DOSBase
);
83 struct Device
*GetDevice(CONST_STRPTR name
, struct Unit
**unit
,
84 struct DosLibrary
*DOSBase
);
86 struct Device
*GetVolume(CONST_STRPTR name
, struct Unit
**unit
,
87 struct DosLibrary
*DOSBase
);
89 struct DosPacket
*internal_WaitPkt(struct MsgPort
*msgPort
,
90 struct DosLibrary
*DOSBase
);
94 /* Cli dependent SetProgramName() for use in CreateNewProc() */
95 BOOL
internal_SetProgramName(struct CommandLineInterface
*cli
, STRPTR name
,
96 struct DosLibrary
*DOSBase
);
99 /* Pattern matching function used by MatchPattern() and MatchPatternNoCase() */
100 BOOL
patternMatch(STRPTR pat
, STRPTR str
, BOOL useCase
,
101 struct DosLibrary
*DOSBase
);
103 /* Pattern parsing function used by ParsePattern() and ParsePatternNoCase() */
104 LONG
patternParse(STRPTR Source
, STRPTR Dest
, LONG DestLength
, BOOL useCase
,
105 struct DosLibrary
*DOSBase
);
110 struct FileHandle
*fh
,
113 struct DosLibrary
*DOSBase
115 LONG
InternalFlush( struct FileHandle
*fh
, struct DosLibrary
*DOSBase
);
120 struct AChain
*Match_AllocAChain(LONG extrasize
, struct DosLibrary
*DOSBase
);
121 void Match_FreeAChain(struct AChain
*ac
, struct DosLibrary
*DOSBase
);
122 LONG
Match_BuildAChainList(STRPTR pattern
, struct AnchorPath
*ap
,
123 struct AChain
**retac
, struct DosLibrary
*DOSBase
);
124 LONG
Match_MakeResult(struct AnchorPath
*ap
, struct DosLibrary
*DOSBase
);
126 void addprocesstoroot(struct Process
* , struct DosLibrary
*);
127 void removefromrootnode(struct Process
*, struct DosLibrary
*);
131 UBYTE type
; /* 0: Split 1: MP_NOT */
132 STRPTR pat
; /* Pointer into pattern */
133 STRPTR str
; /* Pointer into string */
138 struct markerarray
*next
;
139 struct markerarray
*prev
;
140 struct marker marker
[128];
143 #define PUSH(t,p,s) \
147 if(macur->next==NULL) \
149 macur->next=AllocMem(sizeof(struct markerarray),MEMF_ANY); \
150 if(macur->next==NULL) \
151 ERROR(ERROR_NO_FREE_STORE); \
152 macur->next->prev=macur; \
157 macur->marker[macnt].type=(t); \
158 macur->marker[macnt].pat=(p); \
159 macur->marker[macnt].str=(s); \
173 (t)=macur->marker[macnt].type; \
174 (p)=macur->marker[macnt].pat; \
175 (s)=macur->marker[macnt].str; \
178 #define MP_ESCAPE 0x81 /* Before characters in [0x81;0x8a] */
179 #define MP_MULT 0x82 /* _#(_a) */
180 #define MP_MULT_END 0x83 /* #(a_)_ */
181 #define MP_NOT 0x84 /* _~(_a) */
182 #define MP_NOT_END 0x85 /* ~(a_)_ */
183 #define MP_OR 0x86 /* _(_a|b) */
184 #define MP_OR_NEXT 0x87 /* (a_|_b) */
185 #define MP_OR_END 0x88 /* (a|b_)_ */
186 #define MP_SINGLE 0x89 /* ? */
187 #define MP_ALL 0x8a /* #? or * */
188 #define MP_SET 0x8b /* _[_ad-g] */
189 #define MP_NOT_SET 0x8c /* _[~_ad-g] */
190 #define MP_DASH 0x8d /* [ad_-g_] */
191 #define MP_SET_END 0x8e /* [ad-g_]_ */
193 /* Whether MatchFirst/MatchNext/MatchEnd in case of the base
194 AChain should just take the currentdir lock pointer, or
195 make a real duplicate with DupLock() */
197 #define MATCHFUNCS_NO_DUPLOCK 0
199 /* DosGetString additional codes (printf style parametrized) */
201 #define STRING_INSERT_VOLUME -4000
202 #define STRING_VOLUME_FULL -4001
203 #define STRING_NO_DISK -4002
204 #define STRING_NO_DOS_DISK -4003
205 #define STRING_MUST_REPLACE -4004
207 #define STRING_RETRY -5000
208 #define STRING_CANCEL -5001
209 #define STRING_REQUESTTITLE -5002
211 #include <dos_commanderrors.h>
213 /* Force attempts to use DosLibrary->dl_Errors to fail. This is used by
214 locale.library's replacement function for DosGetString() to peek
215 the pointer of the catalog to use */
217 #define dl_Errors do_not_use_is_reserved_for_locale_dosgetstring_replacement
219 #define __is_task(task) (((struct Task *)task)->tc_Node.ln_Type == NT_TASK)
220 #define __is_process(task) (((struct Task *)task)->tc_Node.ln_Type == NT_PROCESS)
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 IPTR
vbuf_alloc(FileHandlePtr fh
, ULONG size
);
244 LONG
FWriteChars(BPTR file
, CONST UBYTE
* buffer
, ULONG length
);
246 #endif /* DOS_INTERN_H */