Fixed missing fprintf argument.
[AROS.git] / rom / dos / dos_intern.h
blobfafe6cc936ec45ba7f0deddc123b0bb70480682f
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Internal types and stuff for dos
6 Lang: English
7 */
8 #ifndef DOS_INTERN_H
9 #define DOS_INTERN_H
11 #include <aros/system.h>
12 #include <exec/io.h>
13 #include <dos/dos.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"
21 #ifdef SysBase
22 #undef SysBase
23 #endif
24 #define SysBase (DOSBase->dl_SysBase)
25 #ifdef UtilityBase
26 #undef UtilityBase
27 #endif
28 #define UtilityBase (DOSBase->dl_UtilityBase)
29 #ifdef TimerBase
30 #undef TimerBase
31 #endif
32 #define TimerBase (DOSBase->dl_TimerBase)
34 /* Needed for close() */
35 #define expunge() \
36 AROS_LC0(BPTR, expunge, struct DosLibrary *, DOSBase, 3, Dos)
38 #define RDAF_ALLOCATED_BY_READARGS (1L << 31)
40 struct DAList
42 STRPTR *ArgBuf;
43 UBYTE *StrBuf;
44 STRPTR *MultVec;
45 BOOL FreeRDA;
48 struct EString
50 LONG Number;
51 STRPTR String;
54 extern struct EString EString[];
56 #ifndef EOF
57 #define EOF -1
58 #endif
59 #ifndef IOBUFSIZE
60 #define IOBUFSIZE 4096
61 #endif
63 struct vfp
65 BPTR file;
66 LONG count;
67 struct DosLibrary *DOSBase;
70 #define FPUTC(f,c) \
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);
108 LONG InternalSeek
110 struct FileHandle *fh,
111 LONG position,
112 LONG mode,
113 struct DosLibrary *DOSBase
115 LONG InternalFlush( struct FileHandle *fh, struct DosLibrary *DOSBase );
118 /* match_misc.c */
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 *);
129 struct marker
131 UBYTE type; /* 0: Split 1: MP_NOT */
132 STRPTR pat; /* Pointer into pattern */
133 STRPTR str; /* Pointer into string */
136 struct markerarray
138 struct markerarray *next;
139 struct markerarray *prev;
140 struct marker marker[128];
143 #define PUSH(t,p,s) \
145 if(macnt==128) \
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; \
154 macur=macur->next; \
155 macnt=0; \
157 macur->marker[macnt].type=(t); \
158 macur->marker[macnt].pat=(p); \
159 macur->marker[macnt].str=(s); \
160 macnt++; \
163 #define POP(t,p,s) \
165 macnt--; \
166 if(macnt<0) \
168 macnt=127; \
169 macur=macur->prev; \
170 if(macur==NULL) \
171 ERROR(0); \
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)
222 struct debug_segnode
224 struct MinNode node;
225 UBYTE name[200];
226 BPTR seglist;
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 */