revert between 56095 -> 55830 in arch
[AROS.git] / workbench / devs / diskimage / include / support.h
blob514c871f443ba91f4c52263aa6ea88a7de58496e
1 /* Copyright 2007-2012 Fredrik Wikstrom. All rights reserved.
2 **
3 ** Redistribution and use in source and binary forms, with or without
4 ** modification, are permitted provided that the following conditions
5 ** are met:
6 **
7 ** 1. Redistributions of source code must retain the above copyright
8 ** notice, this list of conditions and the following disclaimer.
9 **
10 ** 2. Redistributions in binary form must reproduce the above copyright
11 ** notice, this list of conditions and the following disclaimer in the
12 ** documentation and/or other materials provided with the distribution.
14 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
15 ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
18 ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 ** POSSIBILITY OF SUCH DAMAGE.
27 #ifndef SUPPORT_H
28 #define SUPPORT_H
30 #ifndef EXEC_EXEC_H
31 #include <exec/exec.h>
32 #endif
33 #ifndef DOS_DOS_H
34 #include <dos/dos.h>
35 #endif
36 #ifndef UTILITY_HOOKS_H
37 #include <utility/hooks.h>
38 #endif
39 #ifndef INTUITION_CLASSES_H
40 #include <intuition/classes.h>
41 #endif
42 #ifndef WORKBENCH_WORKBENCH_H
43 #include <workbench/workbench.h>
44 #endif
45 #ifndef PROTO_EXEC_H
46 #include <proto/exec.h>
47 #endif
48 #ifndef PROTO_LOCALE_H
49 #include <proto/locale.h>
50 #endif
51 #ifndef LIBRARIES_GADTOOLS_H
52 #include <libraries/gadtools.h>
53 #endif
54 #ifndef __AROS__
55 #ifndef CLASSES_WINDOW_H
56 #include <classes/window.h>
57 #endif
58 #ifndef GADGETS_LISTBROWSER_H
59 #include <gadgets/listbrowser.h>
60 #endif
61 #endif
62 #ifndef TYPES_H
63 #include "types.h"
64 #endif
65 #include <SDI_compiler.h>
66 #include <SDI_stdarg.h>
67 #include <string.h>
69 #ifndef __AROS__
70 #define GetHead(list) (((list) && (list)->lh_Head && (list)->lh_Head->ln_Succ) \
71 ? (list)->lh_Head : (struct Node *)NULL)
72 #define GetSucc(node) (((node) && (node)->ln_Succ && (node)->ln_Succ->ln_Succ) \
73 ? (node)->ln_Succ : (struct Node *)NULL)
74 #endif
75 #define ClearMem(ptr,siz) memset(ptr, 0, siz)
77 #ifndef __amigaos4__
78 #define IOERR_SUCCESS 0
79 #endif
81 /* allocvec_os3.s */
82 #if !defined(__MORPHOS__) && !defined(__AROS__)
83 APTR AllocVecPooled(APTR pool, ULONG size);
84 void FreeVecPooled(APTR pool, APTR mem);
85 #endif
87 /* asprintf_os3.s / asprintf_aros.c */
88 VARARGS68K void SNPrintf (STRPTR buf, LONG len, CONST_STRPTR fmt, ...);
89 VARARGS68K STRPTR ASPrintf (CONST_STRPTR fmt, ...);
90 #ifdef __AROS__
91 void VSNPrintf (STRPTR buf, LONG len, CONST_STRPTR fmt, VA_LIST args);
92 STRPTR VASPrintf (CONST_STRPTR fmt, VA_LIST args);
93 #else
94 void VSNPrintf (STRPTR buf, LONG len, CONST_STRPTR fmt, CONST_APTR args);
95 STRPTR VASPrintf (CONST_STRPTR fmt, CONST_APTR args);
96 #endif
98 /* asprintfpooled_aros.c */
99 VARARGS68K STRPTR ASPrintfPooled (APTR pool, CONST_STRPTR fmt, ...);
100 STRPTR VASPrintfPooled (APTR pool, CONST_STRPTR fmt, VA_LIST args);
102 /* checklib.c */
103 BOOL CheckLib (struct Library *lib, ULONG ver, ULONG rev);
105 /* checkbptr.c */
106 APTR CheckBPTR (BPTR bptr);
108 /* copystringbstrtoc.c */
109 LONG CopyStringBSTRToC (BSTR src, STRPTR dst, ULONG dst_size);
111 /* deletelibrary.c */
112 void DeleteLibrary (struct Library *lb);
114 /* dos64.c */
115 QUAD GetFileSize (BPTR file);
116 QUAD GetFilePosition (BPTR file);
117 int32 ChangeFilePosition (BPTR file, QUAD position, LONG mode);
119 /* envvar.c */
120 STRPTR GetEnvVar (CONST_STRPTR name);
121 BOOL SetEnvVar (CONST_STRPTR name, CONST_STRPTR contents, BOOL envarc);
123 /* getattrs.c */
124 VARARGS68K ULONG GetAttrs (Object *obj, IPTR tag1, ...);
125 ULONG GetAttrsA (Object *obj, const struct TagItem *tags);
127 /* getcurrentdir.c */
128 BPTR GetCurrentDir (void);
130 /* hooks.c */
131 #define CreateHook(func,data) (struct Hook *)CreateExtHook(sizeof(struct Hook), func, data)
132 void FreeHook (struct Hook *hook);
133 APTR CreateExtHook (ULONG size, HOOKFUNC func, APTR data);
134 #define FreeExtHook(hook) FreeHook((struct Hook *)hook)
136 /* lists.c */
137 struct List *CreateList (BOOL min);
138 void DeleteList (struct List *list);
140 /* messages.c */
141 struct Message *CreateMsg (LONG size);
142 void DeleteMsg (struct Message *msg);
144 /* mutexes.c */
145 APTR CreateMutex (void);
146 void DeleteMutex (APTR mutex);
147 void MutexObtain (APTR mutex);
148 void MutexRelease (APTR mutex);
149 BOOL MutexAttempt (APTR mutex);
151 /* semaphores.c */
152 struct SignalSemaphore *CreateSemaphore (void);
153 void DeleteSemaphore (struct SignalSemaphore *semaphore);
155 /* setprocwindow.c */
156 APTR SetProcWindow (APTR window);
158 /* paths.c */
159 STRPTR CombinePaths(CONST_STRPTR p1, CONST_STRPTR p2);
161 /* ports.c */
162 struct MsgPort *CreatePortNoSignal (void);
163 void DeletePortNoSignal (struct MsgPort *port);
165 /* strlcpy.c */
166 void Strlcpy (STRPTR dst, CONST_STRPTR src, int size);
167 void Strlcat (STRPTR dst, CONST_STRPTR src, int size);
169 /* swab2.c */
170 void swab2 (CONST_APTR source, APTR dest, ULONG bytes);
172 /* istext.c */
173 BOOL IsText (const UBYTE *data, LONG len);
175 /* trimstr.c */
176 STRPTR TrimStr (STRPTR str);
178 /* tooltypes.c */
179 BOOL TTBoolean (struct DiskObject *icon, CONST_STRPTR name);
180 LONG TTInteger (struct DiskObject *icon, CONST_STRPTR name, LONG def_value);
181 STRPTR TTString (struct DiskObject *icon, CONST_STRPTR name, STRPTR def_value);
183 /* diskimagedevice.c */
184 BOOL OpenDiskImageDevice (ULONG unit_num);
185 void CloseDiskImageDevice (void);
187 struct LocaleInfo {
188 struct Library *li_LocaleBase;
189 struct Catalog *li_Catalog;
192 /* localeinfo.c */
193 void InitLocaleInfo (APTR SysBase, struct LocaleInfo *li, CONST_STRPTR catalog);
194 void FreeLocaleInfo (APTR SysBase, struct LocaleInfo *li);
195 CONST_STRPTR GetString (struct LocaleInfo *li, LONG stringNum);
197 #ifndef STR_ID
198 #define STR_ID(x) ((STRPTR)(x))
199 #endif
201 /* translatefuncs.c */
202 void TranslateMenus (struct LocaleInfo *li, struct NewMenu *nm);
203 void TranslateArray (struct LocaleInfo *li, CONST_STRPTR *array);
204 #ifndef __AROS__
205 void TranslateHints (struct LocaleInfo *li, struct HintInfo *hi);
206 void TranslateColumnTitles (struct LocaleInfo *li, struct ColumnInfo *ci);
207 #endif
209 /* reallocbuf.c */
210 APTR ReAllocBuf (APTR buf, ULONG *size, ULONG new_size);
212 #endif