comparison src/audacious/plugin.h @ 3682:84bc78954db5

Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
author William Pitcock <nenolod@atheme.org>
date Mon, 01 Oct 2007 23:00:46 -0500
parents 52745af33257
children 4284187479d7
comparison
equal deleted inserted replaced
3681:7865f8395437 3682:84bc78954db5
119 DiscoveryPlugin **dp_list; 119 DiscoveryPlugin **dp_list;
120 } PluginHeader; 120 } PluginHeader;
121 121
122 #define PLUGIN_MAGIC 0x8EAC8DE2 122 #define PLUGIN_MAGIC 0x8EAC8DE2
123 123
124 /* define the public API here */
125 /* add new functions to the bottom of this list!!!! --nenolod */
126 struct _AudaciousFuncVTable1 {
127
128 /* VFS */
129 VFSFile *(*vfs_fopen)(const gchar *uri, const gchar *mode);
130 gint (*vfs_fclose)(VFSFile *fd);
131 VFSFile *(*vfs_dup)(VFSFile *in);
132 size_t (*vfs_fread)(gpointer ptr,
133 size_t size,
134 size_t nmemb,
135 VFSFile * file);
136 size_t (*vfs_fwrite)(gconstpointer ptr,
137 size_t size,
138 size_t nmemb,
139 VFSFile *file);
140
141 gint (*vfs_getc)(VFSFile *stream);
142 gint (*vfs_ungetc)(gint c,
143 VFSFile *stream);
144 gchar *(*vfs_fgets)(gchar *s,
145 gint n,
146 VFSFile *stream);
147
148 gint (*vfs_fseek)(VFSFile * file,
149 glong offset,
150 gint whence);
151 void (*vfs_rewind)(VFSFile * file);
152 glong (*vfs_ftell)(VFSFile * file);
153 gboolean (*vfs_feof)(VFSFile * file);
154
155 gboolean (*vfs_file_test)(const gchar * path,
156 GFileTest test);
157
158 gboolean (*vfs_is_writeable)(const gchar * path);
159 gboolean (*vfs_truncate)(VFSFile * file, glong length);
160 off_t (*vfs_fsize)(VFSFile * file);
161 gchar *(*vfs_get_metadata)(VFSFile * file, const gchar * field);
162
163 int (*vfs_fprintf)(VFSFile *stream, gchar const *format, ...)
164 __attribute__ ((__format__ (__printf__, 2, 3)));
165
166 gboolean (*vfs_register_transport)(VFSConstructor *vtable);
167 void (*vfs_file_get_contents)(const gchar *filename, gchar **buf, gsize *size);
168 gboolean (*vfs_is_remote)(const gchar * path);
169 gboolean (*vfs_is_streaming)(VFSFile *file);
170
171 };
172
173 /* Convenience macros for accessing the public API. */
174 /* public name vtable mapping */
175 #define aud_vfs_fopen _audvt->vfs_fopen
176 #define aud_vfs_fclose _audvt->vfs_fclose
177 #define aud_vfs_dup _audvt->vfs_dup
178 #define aud_vfs_fread _audvt->vfs_fread
179 #define aud_vfs_fwrite _audvt->vfs_fwrite
180 #define aud_vfs_getc _audvt->vfs_getc
181 #define aud_vfs_ungetc _audvt->vfs_ungetc
182 #define aud_vfs_fgets _audvt->vfs_fgets
183 #define aud_vfs_fseek _audvt->vfs_fseek
184 #define aud_vfs_rewind _audvt->vfs_rewind
185 #define aud_vfs_ftell _audvt->vfs_ftell
186 #define aud_vfs_feof _audvt->vfs_feof
187 #define aud_vfs_file_test _audvt->vfs_file_test
188 #define aud_vfs_is_writeable _audvt->vfs_is_writeable
189 #define aud_vfs_truncate _audvt->vfs_truncate
190 #define aud_vfs_fsize _audvt->vfs_fsize
191 #define aud_vfs_get_metadata _audvt->vfs_get_metadata
192 #define aud_vfs_fprintf _audvt->vfs_fprintf
193 #define aud_vfs_register_transport _audvt->vfs_register_transport
194 #define aud_vfs_file_get_contents _audvt->vfs_file_get_contents
195 #define aud_vfs_is_remote _audvt->vfs_is_remote
196 #define aud_vfs_is_streaming _audvt->vfs_is_streaming
197
124 #define DECLARE_PLUGIN(name, init, fini, ...) \ 198 #define DECLARE_PLUGIN(name, init, fini, ...) \
125 G_BEGIN_DECLS \ 199 G_BEGIN_DECLS \
126 static PluginHeader _pluginInfo = { PLUGIN_MAGIC, __AUDACIOUS_PLUGIN_API__, \ 200 static PluginHeader _pluginInfo = { PLUGIN_MAGIC, __AUDACIOUS_PLUGIN_API__, \
127 (gchar *)#name, init, fini, NULL, __VA_ARGS__ }; \ 201 (gchar *)#name, init, fini, NULL, __VA_ARGS__ }; \
128 G_MODULE_EXPORT PluginHeader *get_plugin_info(void) { \ 202 static struct _AudaciousFuncVTable1 *_audvt = NULL; \
203 G_MODULE_EXPORT PluginHeader *get_plugin_info(struct _AudaciousFuncVTable1 *_vt) { \
204 _audvt = _vt; \
129 return &_pluginInfo; \ 205 return &_pluginInfo; \
130 } \ 206 } \
131 G_END_DECLS 207 G_END_DECLS
132 208
133 #define SIMPLE_INPUT_PLUGIN(name, ip_list) \ 209 #define SIMPLE_INPUT_PLUGIN(name, ip_list) \