diff options
author | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2006-11-26 06:04:12 +0000 |
---|---|---|
committer | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2006-11-26 06:04:12 +0000 |
commit | 2840a5b73baab25b4736873375f3128838aa40c7 (patch) | |
tree | 135cc5255b1e399f9a0f869e4be06ede6be8d0a6 /externals | |
parent | 405ea477a0f27b6362390506cfae9c9739d16a1d (diff) |
moved these to 'externals/hcs' since they are not loaders
svn path=/trunk/; revision=6433
Diffstat (limited to 'externals')
-rw-r--r-- | externals/loaders/help/import-help.pd | 12 | ||||
-rw-r--r-- | externals/loaders/import.c | 135 |
2 files changed, 0 insertions, 147 deletions
diff --git a/externals/loaders/help/import-help.pd b/externals/loaders/help/import-help.pd deleted file mode 100644 index c640ef82..00000000 --- a/externals/loaders/help/import-help.pd +++ /dev/null @@ -1,12 +0,0 @@ -#N canvas 476 83 465 356 10; -#X msg 112 134 bang; -#X text 33 42 [import] loads libraries from the patch. Currently \, -it loads the libraries into the global namespace \, but the grand plan -is for it only load the libraries into the patch's namespace.; -#X obj 112 159 import ext13 memento rradical; -#X text 37 204 Sending a bang to [import] makes it output information -about the libraries it loaded to the Console.; -#X text 27 300 (C) Copyright 2004 Hans-Christoph Steiner <hans@at.or.at> -; -#X text 244 314 released under the GNU GPL; -#X connect 0 0 2 0; diff --git a/externals/loaders/import.c b/externals/loaders/import.c deleted file mode 100644 index 21ecd656..00000000 --- a/externals/loaders/import.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * This object loads libraries and libdirs from within a patch. It is the - * first small step towards a patch-specific namespace. Currently, it just - * adds things to the global path. It is a reimplementation of a similar/same - * idea from Guenter Geiger's [using] object. <hans@at.or.at> - * - * This object currently depends on the packages/patches/libdir-0.38-4.patch - * for sys_load_lib_dir(). - */ - -#include "m_pd.h" -#include "s_stuff.h" - -static t_class *import_class; - -typedef struct _import -{ - t_object x_obj; - t_atom* loaded_libs; - t_atom* current; - t_int num_libs; - t_outlet *x_data_outlet; - t_outlet *x_status_outlet; -} t_import; - - -static int import_load_lib(char *libname) -{ - post("import_load_lib"); -/* sys_load_lib_dir is only used on Pd-extended < 0.40 */ -#if (PD_MINOR_VERSION >= 40) - t_canvas *canvas = canvas_getcurrent(); - - if (!sys_load_lib(canvas, libname)) - { - post("%s: can't load library in %s", libname, sys_libdir->s_name); - return 0; - } -#else - if (!sys_load_lib(sys_libdir->s_name, libname)) - { - if (!sys_load_lib_dir(sys_libdir->s_name, libname)) - { - post("%s: can't load library in %s", libname, sys_libdir->s_name); - return 0; - } - } - return 1; -#endif -} - - -static void import_load_arguments(t_import *x, int argc, t_atom *argv) -{ - t_symbol *libname; - - while (argc--) { - switch (argv->a_type) { - case A_FLOAT: - post("[import] ERROR: floats not supported yet: %f",atom_getfloat(argv)); - break; - case A_SYMBOL: - libname = atom_getsymbol(argv); - - if (import_load_lib(libname->s_name)) - { - x->loaded_libs = copybytes(libname, sizeof(t_atom)); - x->current = x->loaded_libs; - x->num_libs++; - } - post("[import] loaded library: %s",libname->s_name); - break; - default: - post("[import] ERROR: Unsupported atom type"); - } - argv++; - } -} - - -static void import_bang(t_import *x) -{ - t_int i = x->num_libs; - t_atom* libs_list = x->loaded_libs; - - post("[import]: %d libs loaded.",x->num_libs); - while(i--) - { - startpost(" %s",(atom_getsymbol(libs_list))->s_name); - libs_list++; - } - endpost(); -} - - -static void *import_new(t_symbol *s, int argc, t_atom *argv) -{ - t_import *x = (t_import *)pd_new(import_class); - char buffer[MAXPDSTRING]; - - x->loaded_libs = 0; - x->num_libs = 0; - x->x_data_outlet = outlet_new(&x->x_obj, &s_symbol); - x->x_status_outlet = outlet_new(&x->x_obj, 0); - - import_load_arguments(x,argc,argv); - - return (x); -} - - -static void import_free(t_import *x) -{ - - if (x->loaded_libs) { - freebytes(x->loaded_libs, x->num_libs * sizeof(t_atom)); - x->loaded_libs = 0; - x->num_libs = 0; - } - /* TODO: look into freeing the namelist. It probably does not need to - * happen, since this class is just copying the pointer of an existing - * namelist that is handled elsewhere. */ -} - - -void import_setup(void) -{ - import_class = class_new(gensym("import"), (t_newmethod)import_new, - (t_method)import_free, - sizeof(t_import), - CLASS_DEFAULT, - A_GIMME, - 0); - class_addbang (import_class, import_bang); -} |