1 /* Copyright 2007-2012 Fredrik Wikstrom. All rights reserved.
3 ** Redistribution and use in source and binary forms, with or without
4 ** modification, are permitted provided that the following conditions
7 ** 1. Redistributions of source code must retain the above copyright
8 ** notice, this list of conditions and the following disclaimer.
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.
31 #include <exec/exec.h>
36 #ifndef UTILITY_HOOKS_H
37 #include <utility/hooks.h>
39 #ifndef INTUITION_CLASSES_H
40 #include <intuition/classes.h>
42 #ifndef WORKBENCH_WORKBENCH_H
43 #include <workbench/workbench.h>
46 #include <proto/exec.h>
48 #ifndef PROTO_LOCALE_H
49 #include <proto/locale.h>
51 #ifndef LIBRARIES_GADTOOLS_H
52 #include <libraries/gadtools.h>
55 #ifndef CLASSES_WINDOW_H
56 #include <classes/window.h>
58 #ifndef GADGETS_LISTBROWSER_H
59 #include <gadgets/listbrowser.h>
65 #include <SDI_compiler.h>
66 #include <SDI_stdarg.h>
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)
75 #define ClearMem(ptr,siz) memset(ptr, 0, siz)
78 #define IOERR_SUCCESS 0
82 #if !defined(__MORPHOS__) && !defined(__AROS__)
83 APTR
AllocVecPooled(APTR pool
, ULONG size
);
84 void FreeVecPooled(APTR pool
, APTR mem
);
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
, ...);
91 void VSNPrintf (STRPTR buf
, LONG len
, CONST_STRPTR fmt
, VA_LIST args
);
92 STRPTR
VASPrintf (CONST_STRPTR fmt
, VA_LIST args
);
94 void VSNPrintf (STRPTR buf
, LONG len
, CONST_STRPTR fmt
, CONST_APTR args
);
95 STRPTR
VASPrintf (CONST_STRPTR fmt
, CONST_APTR args
);
98 /* asprintfpooled_aros.c */
99 VARARGS68K STRPTR
ASPrintfPooled (APTR pool
, CONST_STRPTR fmt
, ...);
100 STRPTR
VASPrintfPooled (APTR pool
, CONST_STRPTR fmt
, VA_LIST args
);
103 BOOL
CheckLib (struct Library
*lib
, ULONG ver
, ULONG rev
);
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
);
115 QUAD
GetFileSize (BPTR file
);
116 QUAD
GetFilePosition (BPTR file
);
117 int32
ChangeFilePosition (BPTR file
, QUAD position
, LONG mode
);
120 STRPTR
GetEnvVar (CONST_STRPTR name
);
121 BOOL
SetEnvVar (CONST_STRPTR name
, CONST_STRPTR contents
, BOOL envarc
);
124 VARARGS68K ULONG
GetAttrs (Object
*obj
, IPTR tag1
, ...);
125 ULONG
GetAttrsA (Object
*obj
, const struct TagItem
*tags
);
127 /* getcurrentdir.c */
128 BPTR
GetCurrentDir (void);
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)
137 struct List
*CreateList (BOOL min
);
138 void DeleteList (struct List
*list
);
141 struct Message
*CreateMsg (LONG size
);
142 void DeleteMsg (struct Message
*msg
);
145 APTR
CreateMutex (void);
146 void DeleteMutex (APTR mutex
);
147 void MutexObtain (APTR mutex
);
148 void MutexRelease (APTR mutex
);
149 BOOL
MutexAttempt (APTR mutex
);
152 struct SignalSemaphore
*CreateSemaphore (void);
153 void DeleteSemaphore (struct SignalSemaphore
*semaphore
);
155 /* setprocwindow.c */
156 APTR
SetProcWindow (APTR window
);
159 STRPTR
CombinePaths(CONST_STRPTR p1
, CONST_STRPTR p2
);
162 struct MsgPort
*CreatePortNoSignal (void);
163 void DeletePortNoSignal (struct MsgPort
*port
);
166 void Strlcpy (STRPTR dst
, CONST_STRPTR src
, int size
);
167 void Strlcat (STRPTR dst
, CONST_STRPTR src
, int size
);
170 void swab2 (CONST_APTR source
, APTR dest
, ULONG bytes
);
173 BOOL
IsText (const UBYTE
*data
, LONG len
);
176 STRPTR
TrimStr (STRPTR str
);
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);
188 struct Library
*li_LocaleBase
;
189 struct Catalog
*li_Catalog
;
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
);
198 #define STR_ID(x) ((STRPTR)(x))
201 /* translatefuncs.c */
202 void TranslateMenus (struct LocaleInfo
*li
, struct NewMenu
*nm
);
203 void TranslateArray (struct LocaleInfo
*li
, CONST_STRPTR
*array
);
205 void TranslateHints (struct LocaleInfo
*li
, struct HintInfo
*hi
);
206 void TranslateColumnTitles (struct LocaleInfo
*li
, struct ColumnInfo
*ci
);
210 APTR
ReAllocBuf (APTR buf
, ULONG
*size
, ULONG new_size
);