1 /***************************************************************************
3 openurl.library - universal URL display and browser launcher library
4 Copyright (C) 1998-2005 by Troels Walsted Hansen, et al.
5 Copyright (C) 2005-2013 by openurl.library Open Source Team
7 This library is free software; it has been placed in the public domain
8 and you can freely redistribute it and/or modify it. Please note, however,
9 that some components may be under the LGPL or GPL license.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 openurl.library project: http://sourceforge.net/projects/openurllib/
19 ***************************************************************************/
21 #include <exec/lists.h>
22 #include <rexx/storage.h>
29 ULONG
freeBase(struct LibraryHeader
* lib
);
30 ULONG
initBase(struct LibraryHeader
* lib
);
33 #if defined(__amigaos4__) || defined(__MORPHOS__)
34 #define HAVE_ALLOCVECPOOLED 1
35 #define HAVE_FREEVECPOOLED 1
38 #if defined(HAVE_ALLOCVECPOOLED)
39 #define allocVecPooled(pool,size) AllocVecPooled(pool,size)
41 APTR
allocVecPooled(APTR pool
, ULONG size
);
43 #if defined(HAVE_FREEVECPOOLED)
44 #define freeVecPooled(pool,mem) FreeVecPooled(pool,mem)
46 void freeVecPooled(APTR pool
, APTR mem
);
48 APTR
reallocVecPooled(APTR pool
, APTR mem
, ULONG oldSize
, ULONG newSize
);
49 APTR
allocArbitrateVecPooled(ULONG size
);
50 void freeArbitrateVecPooled(APTR mem
);
51 BOOL
sendToBrowser(STRPTR URL
, struct List
*portlist
, ULONG flags
, STRPTR pubScreenName
);
52 BOOL
sendToFTP(STRPTR URL
, struct List
*portlist
, ULONG flags
, STRPTR pubScreenName
);
53 BOOL
sendToMailer(STRPTR URL
, struct List
*portlist
, ULONG flags
, STRPTR pubScreenName
);
54 BOOL
copyList(struct List
*dst
, struct List
*src
, ULONG size
);
55 void freeList(struct List
*list
);
56 BOOL
isdigits(STRPTR str
);
58 #define SENDTOB_SHOW 0
59 #define SENDTOF_SHOW (1<<SENDTOB_SHOW)
60 #define SENDTOB_TOFRONT 1
61 #define SENDTOF_TOFRONT (1<<SENDTOB_TOFRONT)
62 #define SENDTOB_NEWWINDOW 2
63 #define SENDTOF_NEWWINDOW (1<<SENDTOB_NEWWINDOW)
64 #define SENDTOB_LAUNCH 3
65 #define SENDTOF_LAUNCH (1<<SENDTOB_LAUNCH)
69 LIBPROTO(URL_OpenA
, ULONG
, REG(a6
, UNUSED __BASE_OR_IFACE
), REG(a0
, STRPTR url
), REG(a1
, struct TagItem
*attrs
));
70 LIBPROTOVA(URL_Open
, ULONG
, REG(a6
, UNUSED __BASE_OR_IFACE
), REG(a0
, STRPTR url
), ...);
71 LIBPROTO(URL_OldGetPrefs
, struct URL_Prefs
*, REG(a6
, UNUSED __BASE_OR_IFACE
));
72 LIBPROTO(URL_OldFreePrefs
, void, REG(a6
, UNUSED __BASE_OR_IFACE
), REG(a0
, struct URL_Prefs
*up
));
73 LIBPROTO(URL_OldSetPrefs
, ULONG
, REG(a6
, UNUSED __BASE_OR_IFACE
), REG(a0
, struct URL_Prefs
*p
), REG(d0
, ULONG permanent
));
74 LIBPROTO(URL_OldGetDefaultPrefs
, struct URL_Prefs
*, REG(a6
, UNUSED __BASE_OR_IFACE
));
75 LIBPROTO(URL_OldLaunchPrefsApp
, ULONG
, REG(a6
, UNUSED __BASE_OR_IFACE
));
76 LIBPROTO(dispatch
, LONG
, REG(a6
, UNUSED __BASE_OR_IFACE
), REG(a0
, struct RexxMsg
*msg
), REG(a1
, STRPTR
*resPtr
));
77 LIBPROTO(URL_GetPrefsA
, struct URL_Prefs
*, REG(a6
, UNUSED __BASE_OR_IFACE
), REG(a0
, struct TagItem
*attrs
));
78 #if defined(__amigaos4__)
79 LIBPROTOVA(URL_GetPrefs
, struct URL_Prefs
*, REG(a6
, UNUSED __BASE_OR_IFACE
), ...);
81 LIBPROTOVA(URL_GetPrefs
, struct URL_Prefs
*, REG(a6
, UNUSED __BASE_OR_IFACE
), REG(a0
, Tag tag1
), ...);
83 LIBPROTO(URL_FreePrefsA
, void, REG(a6
, UNUSED __BASE_OR_IFACE
), REG(a0
, struct URL_Prefs
*up
), REG(a1
, struct TagItem
*attrs
));
84 LIBPROTOVA(URL_FreePrefs
, void, REG(a6
, UNUSED __BASE_OR_IFACE
), REG(a0
, struct URL_Prefs
*up
), ...);
85 LIBPROTO(URL_SetPrefsA
, ULONG
, REG(a6
, UNUSED __BASE_OR_IFACE
), REG(a0
, struct URL_Prefs
*p
), REG(a1
, struct TagItem
*attrs
));
86 LIBPROTOVA(URL_SetPrefs
, ULONG
, REG(a6
, UNUSED __BASE_OR_IFACE
), REG(a0
, struct URL_Prefs
*p
), ...);
87 LIBPROTO(URL_LaunchPrefsAppA
, ULONG
, REG(a6
, UNUSED __BASE_OR_IFACE
), REG(a0
, struct TagItem
*attrs
));
88 #if defined(__amigaos4__)
89 LIBPROTOVA(URL_LaunchPrefsApp
, ULONG
, REG(a6
, UNUSED __BASE_OR_IFACE
), ...);
91 LIBPROTOVA(URL_LaunchPrefsApp
, ULONG
, REG(a6
, UNUSED __BASE_OR_IFACE
), REG(a0
, Tag tag1
), ...);
93 LIBPROTO(URL_GetAttr
, ULONG
, REG(a6
, UNUSED __BASE_OR_IFACE
), REG(d0
, ULONG attr
), REG(a0
, IPTR
*storage
));
96 void SAVEDS
handler(void);
99 struct URL_Prefs
*copyPrefs(struct URL_Prefs
*old
);
100 void initPrefs(struct URL_Prefs
*p
);
101 void setDefaultPrefs(struct URL_Prefs
*up
);
102 BOOL
savePrefs(CONST_STRPTR filename
, struct URL_Prefs
*up
);
103 BOOL
loadPrefs(struct URL_Prefs
*p
, ULONG mode
);
104 struct URL_Prefs
*loadPrefsNotFail(void);
106 #if defined(__AROS__)
107 AROS_LD2(ULONG
, URL_OpenA
,
108 AROS_LDA(STRPTR
, ___url
, A0
),
109 AROS_LDA(struct TagItem
*, ___tags
, A1
),
110 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
113 AROS_LD0(struct URL_Prefs
*, URL_OldGetPrefs
,
114 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
117 AROS_LD1(void, URL_OldFreePrefs
,
118 AROS_LDA(struct URL_Prefs
*, ___up
, A0
),
119 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
122 AROS_LD2(ULONG
, URL_OldSetPrefs
,
123 AROS_LDA(struct URL_Prefs
*, ___up
, A0
),
124 AROS_LDA(BOOL
, ___permanent
, D0
),
125 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
128 AROS_LD0(struct URL_Prefs
*, URL_OldGetDefaultPrefs
,
129 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
132 AROS_LD0(ULONG
, URL_OldLaunchPrefsApp
,
133 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
136 AROS_LD1(struct URL_Prefs
*, URL_GetPrefsA
,
137 AROS_LDA(struct TagItem
*, ___tags
, A0
),
138 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
141 AROS_LD2(void, URL_FreePrefsA
,
142 AROS_LDA(struct URL_Prefs
*, ___prefs
, A0
),
143 AROS_LDA(struct TagItem
*, ___tags
, A1
),
144 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
147 AROS_LD2(ULONG
, URL_SetPrefsA
,
148 AROS_LDA(struct URL_Prefs
*, ___up
, A0
),
149 AROS_LDA(struct TagItem
*, ___tags
, A1
),
150 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
153 AROS_LD1(ULONG
, URL_LaunchPrefsAppA
,
154 AROS_LDA(struct TagItem
*, ___tags
, A0
),
155 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
158 AROS_LD2(ULONG
, URL_GetAttr
,
159 AROS_LDA(ULONG
, ___attr
, D0
),
160 AROS_LDA(IPTR
*, ___storage
, A0
),
161 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
165 AROS_LD2(LONG
, dispatch
,
166 AROS_LDA(struct RexxMsg
*, ___msg
, A0
),
167 AROS_LDA(STRPTR
*, ___resPtr
, A1
),
168 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB