diff options
author | N.N. <krzyszcz@users.sourceforge.net> | 2003-09-05 10:03:46 +0000 |
---|---|---|
committer | N.N. <krzyszcz@users.sourceforge.net> | 2003-09-05 10:03:46 +0000 |
commit | 53f05d96ff8e49c87977fa91a06ebade8893606e (patch) | |
tree | 51bd07eb57c532e61515fb85a0fcd83698054854 /cyclone/shadow | |
parent | 672477f94d2d0701f75f2546ad79980dc9ac8543 (diff) |
*** empty log message ***
svn path=/trunk/externals/miXed/; revision=931
Diffstat (limited to 'cyclone/shadow')
-rw-r--r-- | cyclone/shadow/Makefile.objects | 1 | ||||
-rw-r--r-- | cyclone/shadow/Makefile.sources | 6 | ||||
-rw-r--r-- | cyclone/shadow/cyclone.c | 48 | ||||
-rw-r--r-- | cyclone/shadow/dummies.c | 51 | ||||
-rw-r--r-- | cyclone/shadow/shadow.h | 3 |
5 files changed, 72 insertions, 37 deletions
diff --git a/cyclone/shadow/Makefile.objects b/cyclone/shadow/Makefile.objects index f77675c..f06e939 100644 --- a/cyclone/shadow/Makefile.objects +++ b/cyclone/shadow/Makefile.objects @@ -5,5 +5,6 @@ common/binport.o \ common/port.o \ hammer/file.o \ sickle/sic.o \ +unstable/forky.o \ unstable/fragile.o \ unstable/loader.o diff --git a/cyclone/shadow/Makefile.sources b/cyclone/shadow/Makefile.sources index 8ba4681..061f37b 100644 --- a/cyclone/shadow/Makefile.sources +++ b/cyclone/shadow/Makefile.sources @@ -1,6 +1,6 @@ CX_SOURCES = \ -cyclone.c +cyclone.c \ +dummies.c OTHER_SOURCES = \ -nettles.c \ -dummies.c +nettles.c diff --git a/cyclone/shadow/cyclone.c b/cyclone/shadow/cyclone.c index 047d39d..10ae142 100644 --- a/cyclone/shadow/cyclone.c +++ b/cyclone/shadow/cyclone.c @@ -28,6 +28,8 @@ static int cyclone_nettlesndx; static int cyclone_dummiesndx; static int cyclone_lastndx; +static t_pd *cyclone_dproxy = 0; + static void cyclone_readhook(t_pd *z, t_symbol *fn, int ac, t_atom *av) { import_max(fn->s_name, ""); @@ -59,28 +61,33 @@ static void cyclone_bang(t_cyclone *x) cyclone_sicklendx, cyclone_nettlesndx - 1); fragile_class_printnames("nettles are: ", cyclone_nettlesndx, cyclone_dummiesndx - 1); - if (i = dummy_nreplacements()) - post("send 'reps' message to see the list of %d \ -replacement abstractions", i); + if (cyclone_dproxy) + pd_bang(cyclone_dproxy); else post("no replacement abstractions"); - post("send 'dummies' message to see the list of %d dummy classes", - /* cyclone_lastndx points to the "_dummy" sentinel class */ - cyclone_lastndx - cyclone_dummiesndx); + if (cyclone_lastndx > cyclone_dummiesndx) + post("send 'dummies' message to see the list of %d dummy classes", + /* cyclone_lastndx points to the "_dummy" sentinel class */ + cyclone_lastndx - cyclone_dummiesndx); + else + post("no dummies"); } static void cyclone_reps(t_cyclone *x) { - if (dummy_nreplacements()) - dummy_printreplacements("replacement abstractions are: "); + if (cyclone_dproxy) + typedmess(cyclone_dproxy, gensym("reps"), 0, 0); else post("no replacement abstractions"); } static void cyclone_dummies(t_cyclone *x) { - fragile_class_printnames("dummies are: ", - cyclone_dummiesndx, cyclone_lastndx); + if (cyclone_lastndx > cyclone_dummiesndx) + fragile_class_printnames("dummies are: ", + cyclone_dummiesndx, cyclone_lastndx); + else + post("no dummies"); } static void cyclone_free(t_cyclone *x) @@ -98,8 +105,8 @@ static void *cyclone_new(t_symbol *s) void cyclone_setup(void) { - int hresult, sresult; - hresult = sresult = LOADER_OK; + int hresult, sresult, dresult; + hresult = sresult = dresult = LOADER_OK; if (canvas_getcurrent()) { /* Loading the library by object creation is banned, because of a danger @@ -142,7 +149,11 @@ void cyclone_setup(void) allnettles_setup(); cyclone_dummiesndx = fragile_class_count(); - alldummies_setup(); + if (zgetfn(&pd_objectmaker, gensym("dummies"))) + loud_warning(0, "dummies are already loaded"); + else + dresult = unstable_load_lib("", "dummies"); + cyclone_lastndx = fragile_class_count() - 1; if (hresult == LOADER_NOFILE) @@ -156,4 +167,15 @@ void cyclone_setup(void) loud_errand(0, "use a more recent Pd release (or recompile the cyclone)."); } + else if (dresult == LOADER_NOFILE) + loud_warning(0, "dummies not found"); + else + { + t_symbol *s = gensym("_ccdummies"); + if (s->s_thing && !s->s_next + && !strcmp(class_getname(*s->s_thing), "_ccdummies")) + cyclone_dproxy = s->s_thing; + else + bug("cyclone_setup"); /* FIXME */ + } } diff --git a/cyclone/shadow/dummies.c b/cyclone/shadow/dummies.c index be9a886..c6d53fe 100644 --- a/cyclone/shadow/dummies.c +++ b/cyclone/shadow/dummies.c @@ -11,8 +11,8 @@ #endif #include "m_pd.h" #include "common/loud.h" -#include "shadow.h" +static t_class *ccdummies_class; static int dummy_nclasses = 0; static t_class **dummy_classes; static int dummy_nreps = 0; @@ -351,7 +351,6 @@ static t_dummy_slot dummy_slots[] = { "Biquad~", 6, 1, 0, 0 }, /* LATER try mapping bpatcher to a gop abstraction/subpatch */ { "buffer~", 1, 2, 0, 0 }, - { "buffir~", 3, 1, 0, 0 }, { "cd", 1, 2, 0, 0 }, /* CHECKED (refman error?) */ { "cd~", 1, 6, 0, 0 }, /* CHECKED (refman error?) */ { "Change", 1, 3, 0, 0 }, @@ -554,34 +553,43 @@ static t_object *dummy_newobject(t_symbol *s, t_dummy_slot **slotp) return (x); } -int dummy_nreplacements(void) +static void ccdummies_bang(t_pd *x) { - return (dummy_nreps); + if (dummy_nreps) + post("send 'reps' message to see the list of %d \ +replacement abstractions", dummy_nreps); + else + post("no replacement abstractions"); } -void dummy_printreplacements(char *msg) +static void ccdummies_reps(t_pd *x) { - int i, len = strlen(msg); - t_dummy_slot *sl; - startpost(msg); - for (i = 0, sl = dummy_slots; i < dummy_nclasses; i++, sl++) + if (dummy_nreps) { - if (!dummy_classes[i]) + char *msg = "replacement abstractions are: "; + int i, len = strlen(msg); + t_dummy_slot *sl; + startpost(msg); + for (i = 0, sl = dummy_slots; i < dummy_nclasses; i++, sl++) { - int l = 1 + strlen(sl->s_name); - if ((len += l) > 66) + if (!dummy_classes[i]) { - endpost(); - startpost(" "); - len = 3 + l; + int l = 1 + strlen(sl->s_name); + if ((len += l) > 66) + { + endpost(); + startpost(" "); + len = 3 + l; + } + poststring(sl->s_name); } - poststring(sl->s_name); } + endpost(); } - endpost(); + else post("no replacement abstractions"); } -void alldummies_setup(void) +void dummies_setup(void) { t_dummy_slot *sl; int i; @@ -606,4 +614,11 @@ void alldummies_setup(void) (sl->s_nins ? 0 : CLASS_NOINLET), A_GIMME, 0); } dummy_nclasses--; /* use "_dummy" as a sentinel */ + + ccdummies_class = class_new(gensym("_ccdummies"), 0, 0, + sizeof(t_pd), CLASS_PD | CLASS_NOINLET, 0); + class_addbang(ccdummies_class, ccdummies_bang); + class_addmethod(ccdummies_class, (t_method)ccdummies_reps, + gensym("reps"), 0); + pd_bind(pd_new(ccdummies_class), gensym("_ccdummies")); /* never freed */ } diff --git a/cyclone/shadow/shadow.h b/cyclone/shadow/shadow.h index aefc46e..878a95b 100644 --- a/cyclone/shadow/shadow.h +++ b/cyclone/shadow/shadow.h @@ -6,8 +6,5 @@ #define __SHADOW_H__ void allnettles_setup(void); -void alldummies_setup(void); -int dummy_nreplacements(void); -void dummy_printreplacements(char *msg); #endif |