Updated PCI IDs to latest snapshot.
[tangerine.git] / rom / dos / dos_intern.h
blob514fe7f597f46eb2ee53b578b6ae5cba5a00c700
1 /*
2 Copyright © 1995-2008, 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 TimerBase
22 #undef TimerBase
23 #endif
24 #define TimerBase (DOSBase->dl_TimerBase)
26 /* Needed for close() */
27 #define expunge() \
28 AROS_LC0(BPTR, expunge, struct DosLibrary *, DOSBase, 3, Dos)
30 #define RDAF_ALLOCATED_BY_READARGS (1L << 31)
32 struct DAList
34 STRPTR *ArgBuf;
35 UBYTE *StrBuf;
36 STRPTR *MultVec;
37 BOOL FreeRDA;
40 struct EString
42 LONG Number;
43 STRPTR String;
46 extern struct EString EString[];
48 #ifndef EOF
49 #define EOF -1
50 #endif
51 #ifndef IOBUFSIZE
52 #define IOBUFSIZE 4096
53 #endif
55 struct vfp
57 BPTR file;
58 LONG count;
59 struct DosLibrary *DOSBase;
62 #define FPUTC(f,c) \
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 void IOFS_SendPkt(struct DosPacket *dp, struct MsgPort *replyport, struct DosLibrary *DOSBase);
77 struct DosPacket *internal_WaitPkt(struct MsgPort *msgPort,
78 struct DosLibrary *DOSBase);
80 BOOL RunHandler(struct DeviceNode *deviceNode, struct DosLibrary *DOSBase);
82 /* Cli dependent SetProgramName() for use in CreateNewProc() */
83 BOOL internal_SetProgramName(struct CommandLineInterface *cli,
84 CONST_STRPTR name, struct DosLibrary *DOSBase);
87 /* Pattern matching function used by MatchPattern() and MatchPatternNoCase() */
88 BOOL patternMatch(CONST_STRPTR pat, CONST_STRPTR str, BOOL useCase,
89 struct DosLibrary *DOSBase);
91 /* Pattern parsing function used by ParsePattern() and ParsePatternNoCase() */
92 LONG patternParse(CONST_STRPTR Source, STRPTR Dest, LONG DestLength,
93 BOOL useCase, struct DosLibrary *DOSBase);
96 LONG InternalSeek
98 struct FileHandle *fh,
99 LONG position,
100 LONG mode,
101 struct DosLibrary *DOSBase
103 LONG InternalFlush( struct FileHandle *fh, struct DosLibrary *DOSBase );
106 /* match_misc.c */
108 struct AChain *Match_AllocAChain(LONG extrasize, struct DosLibrary *DOSBase);
109 void Match_FreeAChain(struct AChain *ac, struct DosLibrary *DOSBase);
110 LONG Match_BuildAChainList(CONST_STRPTR pattern, struct AnchorPath *ap,
111 struct AChain **retac, struct DosLibrary *DOSBase);
112 LONG Match_MakeResult(struct AnchorPath *ap, struct DosLibrary *DOSBase);
114 void addprocesstoroot(struct Process * , struct DosLibrary *);
115 void removefromrootnode(struct Process *, struct DosLibrary *);
117 struct marker
119 UBYTE type; /* 0: Split 1: MP_NOT */
120 CONST_STRPTR pat; /* Pointer into pattern */
121 CONST_STRPTR str; /* Pointer into string */
124 struct markerarray
126 struct markerarray *next;
127 struct markerarray *prev;
128 struct marker marker[128];
131 #define PUSH(t,p,s) \
133 if(macnt==128) \
135 if(macur->next==NULL) \
137 macur->next=AllocMem(sizeof(struct markerarray),MEMF_ANY); \
138 if(macur->next==NULL) \
139 ERROR(ERROR_NO_FREE_STORE); \
140 macur->next->prev=macur; \
142 macur=macur->next; \
143 macnt=0; \
145 macur->marker[macnt].type=(t); \
146 macur->marker[macnt].pat=(p); \
147 macur->marker[macnt].str=(s); \
148 macnt++; \
151 #define POP(t,p,s) \
153 macnt--; \
154 if(macnt<0) \
156 macnt=127; \
157 macur=macur->prev; \
158 if(macur==NULL) \
159 ERROR(0); \
161 (t)=macur->marker[macnt].type; \
162 (p)=macur->marker[macnt].pat; \
163 (s)=macur->marker[macnt].str; \
166 #define MP_ESCAPE 0x81 /* Before characters in [0x81;0x8a] */
167 #define MP_MULT 0x82 /* _#(_a) */
168 #define MP_MULT_END 0x83 /* #(a_)_ */
169 #define MP_NOT 0x84 /* _~(_a) */
170 #define MP_NOT_END 0x85 /* ~(a_)_ */
171 #define MP_OR 0x86 /* _(_a|b) */
172 #define MP_OR_NEXT 0x87 /* (a_|_b) */
173 #define MP_OR_END 0x88 /* (a|b_)_ */
174 #define MP_SINGLE 0x89 /* ? */
175 #define MP_ALL 0x8a /* #? or * */
176 #define MP_SET 0x8b /* _[_ad-g] */
177 #define MP_NOT_SET 0x8c /* _[~_ad-g] */
178 #define MP_DASH 0x8d /* [ad_-g_] */
179 #define MP_SET_END 0x8e /* [ad-g_]_ */
181 /* Whether MatchFirst/MatchNext/MatchEnd in case of the base
182 AChain should just take the currentdir lock pointer, or
183 make a real duplicate with DupLock() */
185 #define MATCHFUNCS_NO_DUPLOCK 0
187 /* DosGetString additional codes (printf style parametrized) */
189 #define STRING_DISK_NOT_VALIDATED -4000
190 #define STRING_DISK_WRITE_PROTECTED -4001
191 #define STRING_DEVICE_NOT_MOUNTED_INSERT -4002
192 #define STRING_DEVICE_NOT_MOUNTED_REPLACE -4003
193 #define STRING_DEVICE_NOT_MOUNTED_REPLACE_TARGET -4004
194 #define STRING_DISK_FULL -4005
195 #define STRING_NOT_A_DOS_DISK -4006
196 #define STRING_NO_DISK -4007
197 #define STRING_ABORT_BUSY -4008
198 #define STRING_ABORT_DISK_ERROR -4009
200 #define STRING_RETRY -5000
201 #define STRING_CANCEL -5001
202 #define STRING_REQUESTTITLE -5002
204 #include "dos_commanderrors.h"
206 /* Force attempts to use DosLibrary->dl_Errors to fail. This is used by
207 locale.library's replacement function for DosGetString() to peek
208 the pointer of the catalog to use */
210 #define dl_Errors do_not_use_is_reserved_for_locale_dosgetstring_replacement
212 #define __is_task(task) (((struct Task *)task)->tc_Node.ln_Type == NT_TASK)
213 #define __is_process(task) (((struct Task *)task)->tc_Node.ln_Type == NT_PROCESS)
215 struct seginfo
217 struct MinNode node;
218 APTR addr;
219 char name[32];
222 struct debug_segnode
224 struct MinNode node;
225 UBYTE name[200];
226 BPTR seglist;
227 IPTR start_address; // start address of loaded executable segment
228 struct MinList seginfos;
231 struct InternalExAllControl
233 struct ExAllControl eac;
234 /* Used for ExAll emulation. If non null, it means
235 ExAll emulation is being performed. */
236 struct FileInfoBlock *fib;
240 typedef struct FileHandle* FileHandlePtr;
242 void vbuf_free(FileHandlePtr fh);
244 APTR vbuf_alloc(FileHandlePtr fh, ULONG size, struct DosLibrary *DOSBase);
246 LONG FWriteChars(BPTR file, CONST UBYTE* buffer, ULONG length, struct DosLibrary *DOSBase);
248 #endif /* DOS_INTERN_H */