New bitmap method SetRGBConversionFunction which can be used to
[tangerine.git] / rom / dos / dos_intern.h
blob99a74679b91977fd3fa5d410a1398c8dcf2875e6
1 /*
2 Copyright © 1995-2006, 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 LONG DoName(struct IOFileSys *iofs, CONST_STRPTR name,
68 struct DosLibrary *DOSBase);
69 LONG DevName(CONST_STRPTR name, struct Device **devptr,
70 struct DosLibrary *DOSBase);
72 void InitIOFS(struct IOFileSys *iofs, ULONG type,
73 struct DosLibrary *DOSBase);
75 struct Device *GetDevice(CONST_STRPTR name, struct Unit **unit,
76 struct DosLibrary *DOSBase);
78 struct Device *GetVolume(CONST_STRPTR name, struct Unit **unit,
79 struct DosLibrary *DOSBase);
81 struct DosPacket *internal_WaitPkt(struct MsgPort *msgPort,
82 struct DosLibrary *DOSBase);
86 /* Cli dependent SetProgramName() for use in CreateNewProc() */
87 BOOL internal_SetProgramName(struct CommandLineInterface *cli, STRPTR name,
88 struct DosLibrary *DOSBase);
91 /* Pattern matching function used by MatchPattern() and MatchPatternNoCase() */
92 BOOL patternMatch(STRPTR pat, STRPTR str, BOOL useCase,
93 struct DosLibrary *DOSBase);
95 /* Pattern parsing function used by ParsePattern() and ParsePatternNoCase() */
96 LONG patternParse(STRPTR Source, STRPTR Dest, LONG DestLength, BOOL useCase,
97 struct DosLibrary *DOSBase);
100 LONG InternalSeek
102 struct FileHandle *fh,
103 LONG position,
104 LONG mode,
105 struct DosLibrary *DOSBase
107 LONG InternalFlush( struct FileHandle *fh, struct DosLibrary *DOSBase );
110 /* match_misc.c */
112 struct AChain *Match_AllocAChain(LONG extrasize, struct DosLibrary *DOSBase);
113 void Match_FreeAChain(struct AChain *ac, struct DosLibrary *DOSBase);
114 LONG Match_BuildAChainList(STRPTR pattern, struct AnchorPath *ap,
115 struct AChain **retac, struct DosLibrary *DOSBase);
116 LONG Match_MakeResult(struct AnchorPath *ap, struct DosLibrary *DOSBase);
118 void addprocesstoroot(struct Process * , struct DosLibrary *);
119 void removefromrootnode(struct Process *, struct DosLibrary *);
121 struct marker
123 UBYTE type; /* 0: Split 1: MP_NOT */
124 STRPTR pat; /* Pointer into pattern */
125 STRPTR str; /* Pointer into string */
128 struct markerarray
130 struct markerarray *next;
131 struct markerarray *prev;
132 struct marker marker[128];
135 #define PUSH(t,p,s) \
137 if(macnt==128) \
139 if(macur->next==NULL) \
141 macur->next=AllocMem(sizeof(struct markerarray),MEMF_ANY); \
142 if(macur->next==NULL) \
143 ERROR(ERROR_NO_FREE_STORE); \
144 macur->next->prev=macur; \
146 macur=macur->next; \
147 macnt=0; \
149 macur->marker[macnt].type=(t); \
150 macur->marker[macnt].pat=(p); \
151 macur->marker[macnt].str=(s); \
152 macnt++; \
155 #define POP(t,p,s) \
157 macnt--; \
158 if(macnt<0) \
160 macnt=127; \
161 macur=macur->prev; \
162 if(macur==NULL) \
163 ERROR(0); \
165 (t)=macur->marker[macnt].type; \
166 (p)=macur->marker[macnt].pat; \
167 (s)=macur->marker[macnt].str; \
170 #define MP_ESCAPE 0x81 /* Before characters in [0x81;0x8a] */
171 #define MP_MULT 0x82 /* _#(_a) */
172 #define MP_MULT_END 0x83 /* #(a_)_ */
173 #define MP_NOT 0x84 /* _~(_a) */
174 #define MP_NOT_END 0x85 /* ~(a_)_ */
175 #define MP_OR 0x86 /* _(_a|b) */
176 #define MP_OR_NEXT 0x87 /* (a_|_b) */
177 #define MP_OR_END 0x88 /* (a|b_)_ */
178 #define MP_SINGLE 0x89 /* ? */
179 #define MP_ALL 0x8a /* #? or * */
180 #define MP_SET 0x8b /* _[_ad-g] */
181 #define MP_NOT_SET 0x8c /* _[~_ad-g] */
182 #define MP_DASH 0x8d /* [ad_-g_] */
183 #define MP_SET_END 0x8e /* [ad-g_]_ */
185 /* Whether MatchFirst/MatchNext/MatchEnd in case of the base
186 AChain should just take the currentdir lock pointer, or
187 make a real duplicate with DupLock() */
189 #define MATCHFUNCS_NO_DUPLOCK 0
191 /* DosGetString additional codes (printf style parametrized) */
193 #define STRING_INSERT_VOLUME -4000
194 #define STRING_VOLUME_FULL -4001
195 #define STRING_NO_DISK -4002
196 #define STRING_NO_DOS_DISK -4003
197 #define STRING_MUST_REPLACE -4004
199 #define STRING_RETRY -5000
200 #define STRING_CANCEL -5001
201 #define STRING_REQUESTTITLE -5002
203 #include <dos_commanderrors.h>
205 /* Force attempts to use DosLibrary->dl_Errors to fail. This is used by
206 locale.library's replacement function for DosGetString() to peek
207 the pointer of the catalog to use */
209 #define dl_Errors do_not_use_is_reserved_for_locale_dosgetstring_replacement
211 #define __is_task(task) (((struct Task *)task)->tc_Node.ln_Type == NT_TASK)
212 #define __is_process(task) (((struct Task *)task)->tc_Node.ln_Type == NT_PROCESS)
214 struct debug_segnode
216 struct MinNode node;
217 UBYTE name[200];
218 BPTR seglist;
219 IPTR start_address; // start address of loaded executable segment
222 struct InternalExAllControl
224 struct ExAllControl eac;
225 /* Used for ExAll emulation. If non null, it means
226 ExAll emulation is being performed. */
227 struct FileInfoBlock *fib;
231 typedef struct FileHandle* FileHandlePtr;
233 void vbuf_free(FileHandlePtr fh);
235 IPTR vbuf_alloc(FileHandlePtr fh, ULONG size, struct DosLibrary *DOSBase);
237 LONG FWriteChars(BPTR file, CONST UBYTE* buffer, ULONG length, struct DosLibrary *DOSBase);
239 #endif /* DOS_INTERN_H */