Belarusian
[AROS.git] / rom / dos / dos_intern.h
blob8f3676ee9b448b880eec4a5d847016b38fbba945
1 /*
2 Copyright © 1995-2010, 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 /* the alternative is to do something similar in clib or
22 to have two files with the same contents
24 #include "../../compiler/clib/__filesystem_support.h"
26 #ifdef TimerBase
27 #undef TimerBase
28 #endif
29 #define TimerBase (DOSBase->dl_TimerBase)
31 /* Needed for close() */
32 #define expunge() \
33 AROS_LC0(BPTR, expunge, struct DosLibrary *, DOSBase, 3, Dos)
35 #define RDAF_ALLOCATED_BY_READARGS (1L << 31)
37 struct IntDosBase
39 struct DosLibrary pub;
40 APTR KernelBase;
43 #define KernelBase ((struct IntDosBase *)DOSBase)->KernelBase
45 struct DAList
47 STRPTR *ArgBuf;
48 UBYTE *StrBuf;
49 STRPTR *MultVec;
50 BOOL FreeRDA;
53 struct EString
55 LONG Number;
56 STRPTR String;
59 extern CONST struct EString EString[];
61 #ifndef EOF
62 #define EOF -1
63 #endif
64 #ifndef IOBUFSIZE
65 #define IOBUFSIZE 4096
66 #endif
68 struct vfp
70 BPTR file;
71 LONG count;
72 struct DosLibrary *DOSBase;
75 #define FPUTC(f,c) \
76 (((struct FileHandle *)BADDR(f))->fh_Flags&FHF_WRITE&& \
77 ((struct FileHandle *)BADDR(f))->fh_Pos<((struct FileHandle *)BADDR(f))->fh_End? \
78 *((struct FileHandle *)BADDR(f))->fh_Pos++=c,0:FPutC(f,c))
80 void IOFS_SendPkt(struct DosPacket *dp, struct MsgPort *replyport, struct DosLibrary *DOSBase);
82 struct DosPacket *internal_WaitPkt(struct MsgPort *msgPort,
83 struct DosLibrary *DOSBase);
85 BOOL RunHandler(struct DeviceNode *deviceNode, struct DosLibrary *DOSBase);
87 /* Cli dependent SetProgramName() for use in CreateNewProc() */
88 BOOL internal_SetProgramName(struct CommandLineInterface *cli,
89 CONST_STRPTR name, struct DosLibrary *DOSBase);
92 /* Pattern matching function used by MatchPattern() and MatchPatternNoCase() */
93 BOOL patternMatch(CONST_STRPTR pat, CONST_STRPTR str, BOOL useCase,
94 struct DosLibrary *DOSBase);
96 /* Pattern parsing function used by ParsePattern() and ParsePatternNoCase() */
97 LONG patternParse(CONST_STRPTR Source, STRPTR Dest, LONG DestLength,
98 BOOL useCase, struct DosLibrary *DOSBase);
101 LONG InternalSeek
103 struct FileHandle *fh,
104 LONG position,
105 LONG mode,
106 struct DosLibrary *DOSBase
108 LONG InternalFlush( struct FileHandle *fh, struct DosLibrary *DOSBase );
111 /* match_misc.c */
113 struct AChain *Match_AllocAChain(LONG extrasize, struct DosLibrary *DOSBase);
114 void Match_FreeAChain(struct AChain *ac, struct DosLibrary *DOSBase);
115 LONG Match_BuildAChainList(CONST_STRPTR pattern, struct AnchorPath *ap,
116 struct AChain **retac, struct DosLibrary *DOSBase);
117 LONG Match_MakeResult(struct AnchorPath *ap, struct DosLibrary *DOSBase);
119 void addprocesstoroot(struct Process * , struct DosLibrary *);
120 void removefromrootnode(struct Process *, struct DosLibrary *);
122 struct marker
124 UBYTE type; /* 0: Split 1: MP_NOT */
125 CONST_STRPTR pat; /* Pointer into pattern */
126 CONST_STRPTR str; /* Pointer into string */
129 struct markerarray
131 struct markerarray *next;
132 struct markerarray *prev;
133 struct marker marker[128];
136 #define PUSH(t,p,s) \
138 if(macnt==128) \
140 if(macur->next==NULL) \
142 macur->next=AllocMem(sizeof(struct markerarray),MEMF_ANY); \
143 if(macur->next==NULL) \
144 ERROR(ERROR_NO_FREE_STORE); \
145 macur->next->prev=macur; \
147 macur=macur->next; \
148 macnt=0; \
150 macur->marker[macnt].type=(t); \
151 macur->marker[macnt].pat=(p); \
152 macur->marker[macnt].str=(s); \
153 macnt++; \
156 #define POP(t,p,s) \
158 macnt--; \
159 if(macnt<0) \
161 macnt=127; \
162 macur=macur->prev; \
163 if(macur==NULL) \
164 ERROR(0); \
166 (t)=macur->marker[macnt].type; \
167 (p)=macur->marker[macnt].pat; \
168 (s)=macur->marker[macnt].str; \
171 #define MP_ESCAPE 0x81 /* Before characters in [0x81;0x8a] */
172 #define MP_MULT 0x82 /* _#(_a) */
173 #define MP_MULT_END 0x83 /* #(a_)_ */
174 #define MP_NOT 0x84 /* _~(_a) */
175 #define MP_NOT_END 0x85 /* ~(a_)_ */
176 #define MP_OR 0x86 /* _(_a|b) */
177 #define MP_OR_NEXT 0x87 /* (a_|_b) */
178 #define MP_OR_END 0x88 /* (a|b_)_ */
179 #define MP_SINGLE 0x89 /* ? */
180 #define MP_ALL 0x8a /* #? or * */
181 #define MP_SET 0x8b /* _[_ad-g] */
182 #define MP_NOT_SET 0x8c /* _[~_ad-g] */
183 #define MP_DASH 0x8d /* [ad_-g_] */
184 #define MP_SET_END 0x8e /* [ad-g_]_ */
186 /* Whether MatchFirst/MatchNext/MatchEnd in case of the base
187 AChain should just take the currentdir lock pointer, or
188 make a real duplicate with DupLock() */
190 #define MATCHFUNCS_NO_DUPLOCK 0
192 /* DosGetString additional codes (printf style parametrized) */
194 #define STRING_DISK_NOT_VALIDATED -4000
195 #define STRING_DISK_WRITE_PROTECTED -4001
196 #define STRING_DEVICE_NOT_MOUNTED_INSERT -4002
197 #define STRING_DEVICE_NOT_MOUNTED_REPLACE -4003
198 #define STRING_DEVICE_NOT_MOUNTED_REPLACE_TARGET -4004
199 #define STRING_DISK_FULL -4005
200 #define STRING_NOT_A_DOS_DISK -4006
201 #define STRING_NO_DISK -4007
202 #define STRING_ABORT_BUSY -4008
203 #define STRING_ABORT_DISK_ERROR -4009
205 #define STRING_RETRY -5000
206 #define STRING_CANCEL -5001
207 #define STRING_REQUESTTITLE -5002
209 #include "dos_commanderrors.h"
211 /* Force attempts to use DosLibrary->dl_Errors to fail. This is used by
212 locale.library's replacement function for DosGetString() to peek
213 the pointer of the catalog to use */
215 #define dl_Errors do_not_use_is_reserved_for_locale_dosgetstring_replacement
217 #define __is_task(task) (((struct Task *)task)->tc_Node.ln_Type == NT_TASK)
218 #define __is_process(task) (((struct Task *)task)->tc_Node.ln_Type == NT_PROCESS)
220 struct seginfo
222 struct MinNode node;
223 APTR addr;
224 char name[32];
227 struct debug_segnode
229 struct MinNode node;
230 UBYTE name[200];
231 BPTR seglist;
232 IPTR start_address; // start address of loaded executable segment
233 struct MinList seginfos;
236 struct InternalExAllControl
238 struct ExAllControl eac;
239 /* Used for ExAll emulation. If non null, it means
240 ExAll emulation is being performed. */
241 struct FileInfoBlock *fib;
245 typedef struct FileHandle* FileHandlePtr;
247 void vbuf_free(FileHandlePtr fh);
249 APTR vbuf_alloc(FileHandlePtr fh, ULONG size, struct DosLibrary *DOSBase);
251 LONG FWriteChars(BPTR file, CONST UBYTE* buffer, ULONG length, struct DosLibrary *DOSBase);
253 #endif /* DOS_INTERN_H */