From 22c887bcf77c0b40aaeffbe18a8a5afcc77b03e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Wed, 3 Sep 2008 09:34:50 +0000 Subject: added stephen sinclairs "urloader" svn path=/trunk/externals/loaders/urloader/; revision=10275 --- baseurl.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 baseurl.c (limited to 'baseurl.c') diff --git a/baseurl.c b/baseurl.c new file mode 100644 index 0000000..a0fce40 --- /dev/null +++ b/baseurl.c @@ -0,0 +1,58 @@ +/* Copyright (c) 2008 Steve Sinclair + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," that comes with Pd. + */ + +/* + * This code provides a canvas with a base URL to inform the baseurl + * where to look. + */ + + +#ifdef __WIN32__ +# define MSW +#endif + +#include "m_pd.h" + +#if (PD_MINOR_VERSION >= 40) + +#include "s_stuff.h" +#include "g_canvas.h" +#include +#include +#include + +#include "baseurl.h" + +typedef void (*t_baseurl_setup)(void); + +/* definitions taken from s_loader.c */ +typedef int (*loader_t)(t_canvas *canvas, char *classname); +void sys_register_loader(loader_t loader); +void class_set_extern_dir(t_symbol *s); + +/* ==================================================== */ + +static t_class *baseurl_class; + +static char *version = "0.0.1"; + +#endif /* PD_MINOR_VERSION>=40 */ + +static void*baseurl_new(t_symbol *s, int argc, t_atom *argv) +{ + t_baseurl *x = (t_baseurl*)pd_new(baseurl_class); + SETSYMBOL(&x->url, argv[0].a_w.w_symbol); + return (x); +} + +void baseurl_setup(void) +{ + post("baseurl %s",version); + post("\twritten by Steve Sinclair"); + post("\tcompiled on "__DATE__" at "__TIME__ " "); + post("\tcompiled against Pd version %d.%d.%d.%s", PD_MAJOR_VERSION, PD_MINOR_VERSION, PD_BUGFIX_VERSION, PD_TEST_VERSION); + + baseurl_class = class_new(gensym("baseurl"), (t_newmethod)baseurl_new, 0, sizeof(t_baseurl), CLASS_NOINLET, A_GIMME, 0); +} -- cgit v1.2.1