Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / workbench / libs / openurl / library / amigaos4.c
blob61e76736d4fd53d4509be5dceb17d304e3d017aa
1 /*
2 ** openurl.library - universal URL display and browser
3 ** launcher library
4 **
5 ** AmigaOS4 Specific funcctions - Provides interface aware functions
6 **
7 ** Written by Alexandre Balaban <alexandre@balaban.name>
8 */
10 #undef __USE_INLINE__
12 #include "lib.h"
14 #if !defined(__amigaos4__)
15 # error This file is AmigaOS4 specific and should not be used/compiled on other platforms
16 #endif
18 #include <proto/exec.h>
20 struct Library * SAVEDS ASM initLib (REG(a0,ULONG segList), REG(a6,struct ExecBase *sys), REG(d0, struct Library *base));
21 struct Library * SAVEDS ASM openLib (REG(a6,struct Library *base));
22 ULONG SAVEDS ASM expungeLib (REG(a6,struct Library *base));
23 ULONG SAVEDS ASM closeLib(REG(a6,struct Library *base));
25 /* amigaos4 *****************************************************************/
27 #include <stdarg.h>
29 ULONG VARARGS68K OS4_URL_OpenA ( struct OpenURLIFace * Self, STRPTR url, struct TagItem *attrs )
31 return URL_OpenA( url, attrs );
34 /* amigaos4 *****************************************************************/
36 ULONG VARARGS68K OS4_URL_Open ( struct OpenURLIFace * Self, STRPTR url, ... )
38 va_list ap;
39 struct TagItem *tags;
41 va_startlinear(ap, url);
42 tags = va_getlinearva(ap, struct TagItem *);
44 return URL_OpenA( url, tags );
47 /* amigaos4 *****************************************************************/
49 struct URL_Prefs * VARARGS68K OS4_URL_GetPrefsA ( struct OpenURLIFace * Self, struct TagItem *attrs )
51 return URL_GetPrefsA( attrs );
54 /* amigaos4 *****************************************************************/
56 struct URL_Prefs * VARARGS68K OS4_URL_GetPrefs ( struct OpenURLIFace * Self, ... )
58 va_list ap;
59 struct TagItem *tags;
61 va_startlinear(ap, Self);
62 tags = va_getlinearva(ap, struct TagItem *);
64 return URL_GetPrefsA( tags );
67 /* amigaos4 *****************************************************************/
69 struct URL_Prefs * VARARGS68K OS4_URL_OldGetPrefs ( struct OpenURLIFace * Self )
71 return URL_OldGetPrefs();
74 /* amigaos4 *****************************************************************/
76 void VARARGS68K OS4_URL_FreePrefsA ( struct OpenURLIFace * Self, struct URL_Prefs *up , struct TagItem *attrs )
78 URL_FreePrefsA( up, attrs );
81 /* amigaos4 *****************************************************************/
83 void VARARGS68K OS4_URL_FreePrefs ( struct OpenURLIFace * Self, struct URL_Prefs *up, ... )
85 va_list ap;
86 struct TagItem *tags;
88 va_startlinear(ap, up);
89 tags = va_getlinearva(ap, struct TagItem *);
91 URL_FreePrefsA( up, tags );
94 /* amigaos4 *****************************************************************/
96 void VARARGS68K OS4_URL_OldFreePrefs ( struct OpenURLIFace * Self, struct URL_Prefs *up )
98 URL_OldFreePrefs( up );
101 /* amigaos4 *****************************************************************/
103 ULONG VARARGS68K OS4_URL_SetPrefsA ( struct OpenURLIFace * Self, struct URL_Prefs *p, struct TagItem *attrs )
105 return URL_SetPrefsA( p, attrs );
108 /* amigaos4 *****************************************************************/
110 ULONG VARARGS68K OS4_URL_SetPrefs ( struct OpenURLIFace * Self, struct URL_Prefs *p, ... )
112 va_list ap;
113 struct TagItem *tags;
115 va_startlinear(ap, p);
116 tags = va_getlinearva(ap, struct TagItem *);
118 return URL_SetPrefsA( p, tags );
121 /* amigaos4 *****************************************************************/
123 ULONG VARARGS68K OS4_URL_OldSetPrefs ( struct OpenURLIFace * Self, struct URL_Prefs *p , ULONG permanent )
125 return URL_OldSetPrefs( p, permanent );
128 /* amigaos4 *****************************************************************/
130 struct URL_Prefs * VARARGS68K OS4_URL_OldGetDefaultPrefs ( struct OpenURLIFace * Self )
132 return URL_OldGetDefaultPrefs();
135 /* amigaos4 *****************************************************************/
137 ULONG VARARGS68K OS4_URL_LaunchPrefsAppA ( struct OpenURLIFace * Self, struct TagItem *attrs )
139 return URL_LaunchPrefsAppA( attrs );
142 /* amigaos4 *****************************************************************/
144 ULONG VARARGS68K OS4_URL_LaunchPrefsApp ( struct OpenURLIFace * Self, ... )
146 va_list ap;
147 struct TagItem *tags;
149 va_startlinear(ap, Self);
150 tags = va_getlinearva(ap, struct TagItem *);
152 return URL_LaunchPrefsAppA( tags );
155 /* amigaos4 *****************************************************************/
157 ULONG VARARGS68K OS4_URL_OldLaunchPrefsApp ( struct OpenURLIFace * Self )
159 return URL_OldLaunchPrefsApp();
162 /* amigaos4 *****************************************************************/
164 ULONG VARARGS68K OS4_URL_GetAttr ( struct OpenURLIFace * Self, ULONG attr , ULONG *storage )
166 return URL_GetAttr( attr, storage );
169 /* amigaos4 *****************************************************************/
171 LONG VARARGS68K OS4_dispatch ( struct OpenURLIFace * Self, struct RexxMsg *msg, UBYTE ** resPtr )
173 return dispatch( msg, resPtr );
176 /* amigaos4 *****************************************************************/
178 struct Library * mgr_Init (struct Library *base, BPTR segList, struct ExecIFace *ISys)
180 base->lib_Node.ln_Type = NT_LIBRARY;
181 base->lib_Node.ln_Pri = 0;
182 base->lib_Node.ln_Name = lib_name;
183 base->lib_Flags = LIBF_SUMUSED|LIBF_CHANGED;
184 base->lib_Version = lib_version;
185 base->lib_Revision = lib_revision;
186 base->lib_IdString = lib_ver;
188 IExec = ISys;
189 SysBase = (struct ExecBase*)ISys->Data.LibBase;
191 return initLib( segList, SysBase, base );
194 /* amigaos4 *****************************************************************/
196 struct Library *mgr_Open( struct LibraryManagerInterface *Self, uint32 version )
198 return openLib( Self->Data.LibBase );
201 /* amigaos4 *****************************************************************/
203 APTR mgr_Close( struct LibraryManagerInterface *Self )
205 return (APTR)closeLib( Self->Data.LibBase );
208 /* amigaos4 *****************************************************************/
210 APTR mgr_Expunge( struct LibraryManagerInterface *Self )
212 return (APTR)expungeLib( Self->Data.LibBase );
215 /* amigaos4 *****************************************************************/
217 uint32 mgr_Obtain( struct LibraryManagerInterface *Self ) {
218 return( Self->Data.RefCount++ );
221 /* amigaos4 *****************************************************************/
223 uint32 mgr_Release( struct LibraryManagerInterface *Self ) {
224 return( Self->Data.RefCount-- );
227 /* amigaos4 *****************************************************************/
229 uint32 VARARGS68K OS4_URL_Obtain( struct OpenURLIFace *Self ) {
230 return( Self->Data.RefCount++ );
233 /* amigaos4 *****************************************************************/
235 uint32 VARARGS68K OS4_URL_Release( struct OpenURLIFace *Self ) {
236 return( Self->Data.RefCount-- );
239 /* amigaos4 *****************************************************************/
241 /// _start
243 * The system (and compiler) rely on a symbol named _start which marks
244 * the beginning of execution of an ELF file. To prevent others from
245 * executing this library, and to keep the compiler/linker happy, we
246 * define an empty _start symbol here.
248 * On the classic system (pre-AmigaOS4) this was usually done by
249 * moveq #0,d0
250 * rts
254 int32 _start( STRPTR argstring, int32 arglen, APTR SysBase )
257 /* If you feel like it, open DOS and print something to the user */
259 return( RETURN_OK );
262 /* amigaos4 *****************************************************************/