Update of /cvsroot/pure-data/externals/miXed/cyclone/shadow In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20056/miXed/cyclone/shadow
Modified Files: dummies.c Log Message: mapping feature for ported names
Index: dummies.c =================================================================== RCS file: /cvsroot/pure-data/externals/miXed/cyclone/shadow/dummies.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dummies.c 17 Apr 2004 17:45:28 -0000 1.6 --- dummies.c 12 May 2004 15:01:35 -0000 1.7 *************** *** 1,3 **** ! /* Copyright (c) 2003 krzYszcz and others. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ --- 1,3 ---- ! /* Copyright (c) 2003-2004 krzYszcz and others. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ *************** *** 12,15 **** --- 12,16 ---- #include "m_pd.h" #include "common/loud.h" + #include "common/port.h"
//#define DUMMIES_DEBUG *************** *** 17,20 **** --- 18,22 ---- static t_class *ccdummies_class; static int dummy_nclasses = 0; + static int pending_nclasses = 0; static t_class **dummy_classes; static int dummy_nreps = 0; *************** *** 22,26 **** typedef struct _dummy_slot { ! char *s_name; int s_nins; int s_nouts; --- 24,28 ---- typedef struct _dummy_slot { ! char *s_name; /* do not use after setup: invalid for mapped names */ int s_nins; int s_nouts; *************** *** 351,360 **** { "atanh", 1, 1, 0, 0 }, { "begin~", 0, 1, 0, 0 }, - { "Biquad~", 6, 1, 0, 0 }, /* LATER try mapping bpatcher to a gop abstraction/subpatch */ { "buffer~", 1, 2, 0, 0 }, { "cd", 1, 2, 0, 0 }, /* CHECKED (refman error?) */ { "cd~", 1, 6, 0, 0 }, /* CHECKED (refman error?) */ - { "Change", 1, 3, 0, 0 }, { "clocker", 2, 1, 0, 0 }, { "closebang", 0, 1, 0, 0 }, --- 353,360 ---- *************** *** 391,395 **** { "gestalt", 1, 2, 0, 0 }, { "Ggate", 2, 2, 0, 0 }, - /* LATER glove? */ { "graphic", 1, 0, 0, 0 }, { "groove~", 3, -1, 0, (t_newmethod)dummy_groove_tilde_new }, --- 391,394 ---- *************** *** 402,411 **** { "info~", 1, 8, 0, 0 }, /* CHECKME nouts */ { "ioscbank~", 4, 1, 0, 0 }, - { "Key", 0, 3, 0, 0 }, - { "Keyup", 0, 3, 0, 0 }, { "kslider", 2, 2, 0, 0 }, { "lcd", 1, 4, 0, 0 }, /* CHECKME nouts */ { "led", 1, 1, 0, 0 }, - { "Line", 3, 2, 0, 0 }, { "matrixctrl", 1, 1, 0, 0 }, /* CHECKME nins, nouts */ { "matrix~", -1, -1, 0, (t_newmethod)dummy_matrix_tilde_new }, --- 401,407 ---- *************** *** 439,462 **** { "pictslider", 2, 2, 0, 0 }, /* CHECKME one-dimensional mode */ { "playbar", 1, 2, 0, 0 }, /* CHECKME */ - { "plugconfig", 1, 0, 0, 0 }, - { "plugin~", 2, 2, 0, 0 }, - { "plugmidiin", 0, 1, 0, 0 }, - { "plugmidiout", 1, 0, 0, 0 }, - { "plugmod", 5, 3, 0, 0 }, - { "plugmorph", 2, 3, 0, 0 }, - { "plugmultiparam", 1, 2, 0, 0 }, - { "plugout~", 2, 2, 0, 0 }, /* CHECKME nouts */ - { "plugphasor~", 0, 1, 0, 0 }, /* CHECKME nouts */ - { "plugreceive~", 1, 1, 0, 0 }, - { "plugsend~", 1, 0, 0, 0 }, - { "plugstore", 1, 1, 0, 0 }, /* CHECKME nouts */ - { "plugsync~", 0, 9, 0, 0 }, /* CHECKME nouts */ - { "Poly", 2, 4, 0, 0 }, { "polyin", 1, 3, 0, 0 }, /* LATER parse args for nouts */ { "polyout", 3, 0, 0, 0 }, /* CHECKME nins */ /* LATER poly~ */ - { "pp", 2, 2, 0, 0 }, /* CHECKME nins */ - { "pptempo", 2, 2, 0, 0 }, - { "pptime", 4, 4, 0, 0 }, { "preset", 1, 3, 0, 0 }, { "radiogroup", 1, 1, 0, 0 }, --- 435,441 ---- *************** *** 465,469 **** { "rect", 6, 0, 0, 0 }, { "relativepath", 1, 1, 0, 0 }, - { "rewire~", 1, -1, 0, (t_newmethod)dummy_rewire_tilde_new }, { "ring", 6, 0, 0, 0 }, { "round~", 2, 1, 0, 0 }, --- 444,447 ---- *************** *** 480,484 **** { "sfplay~", 1, -1, 0, (t_newmethod)dummy_sfplay_tilde_new }, { "sfrecord~", -1, 0, 0, (t_newmethod)dummy_sfrecord_tilde_new }, - { "sndmgrin~", 0, 2, 0, 0 }, /* CHECKME */ { "strippath", 1, 2, 0, 0 }, { "stutter~", -1, -1, 0, (t_newmethod)dummy_stutter_tilde_new }, --- 458,461 ---- *************** *** 508,517 **** { "ubutton", 1, 4, 0, 0 }, { "umenu", 1, 2, 0, 0 }, - { "vdp", 3, 4, 0, 0 }, { "vexpr", -1, 1, 0, (t_newmethod)dummy_vexpr_new }, { "vpicture", 0, 0, 0, 0 }, - { "vst~", -1, -1, 0, (t_newmethod)dummy_vst_tilde_new }, { "waveform~", 5, 6, 0, 0 }, /* CHECKME */ { "zigzag~", 2, 4, 0, 0 }, { "_dummy", 0, 0, 0, 0 } }; --- 485,525 ---- { "ubutton", 1, 4, 0, 0 }, { "umenu", 1, 2, 0, 0 }, { "vexpr", -1, 1, 0, (t_newmethod)dummy_vexpr_new }, { "vpicture", 0, 0, 0, 0 }, { "waveform~", 5, 6, 0, 0 }, /* CHECKME */ { "zigzag~", 2, 4, 0, 0 }, + + /* mapped names (cf the structure `importmapping_default' in port.c) */ + /* clashing dummies go first */ + { "biquad~", 6, 1, 0, 0 }, + { "change", 1, 3, 0, 0 }, + { "key", 0, 3, 0, 0 }, + { "keyup", 0, 3, 0, 0 }, + { "line", 3, 2, 0, 0 }, + { "poly", 2, 4, 0, 0 }, + + /* remaining slots define `doomed' kind of dummies */ + { "appledvd", 1, 2, 0, 0 }, + /* LATER glove? */ + { "plugconfig", 1, 0, 0, 0 }, + { "plugin~", 2, 2, 0, 0 }, + { "plugmidiin", 0, 1, 0, 0 }, + { "plugmidiout", 1, 0, 0, 0 }, + { "plugmod", 5, 3, 0, 0 }, + { "plugmorph", 2, 3, 0, 0 }, + { "plugmultiparam", 1, 2, 0, 0 }, + { "plugout~", 2, 2, 0, 0 }, /* CHECKME nouts */ + { "plugphasor~", 0, 1, 0, 0 }, /* CHECKME nouts */ + { "plugreceive~", 1, 1, 0, 0 }, + { "plugsend~", 1, 0, 0, 0 }, + { "plugstore", 1, 1, 0, 0 }, /* CHECKME nouts */ + { "plugsync~", 0, 9, 0, 0 }, /* CHECKME nouts */ + { "pp", 2, 2, 0, 0 }, /* CHECKME nins */ + { "pptempo", 2, 2, 0, 0 }, + { "pptime", 4, 4, 0, 0 }, + { "rewire~", 1, -1, 0, (t_newmethod)dummy_rewire_tilde_new }, + { "sndmgrin~", 0, 2, 0, 0 }, /* CHECKME */ + { "vdp", 3, 4, 0, 0 }, + { "vst~", -1, -1, 0, (t_newmethod)dummy_vst_tilde_new }, { "_dummy", 0, 0, 0, 0 } }; *************** *** 576,579 **** --- 584,588 ---- if (!dummy_classes[i]) { + /* name field is valid here (reps are never mapped) */ int l = 1 + strlen(sl->s_name); if ((len += l) > 66) *************** *** 594,598 **** { t_dummy_slot *sl; ! int i; dummy_nclasses = sizeof(dummy_slots)/sizeof(*dummy_slots); /* never freed: */ --- 603,609 ---- { t_dummy_slot *sl; ! int i, mapsize; ! char **mapping = import_getmapping(&mapsize); ! int ndoomed = 0; dummy_nclasses = sizeof(dummy_slots)/sizeof(*dummy_slots); /* never freed: */ *************** *** 602,605 **** --- 613,625 ---- int fd; char dirbuf[MAXPDSTRING], *nameptr; + char *name = port_usemapping(sl->s_name, mapsize, mapping); + if (name) + ndoomed++; + else if (ndoomed && i < dummy_nclasses - 1) + { + bug("dummies_setup"); + post("("%s": clashing or doomed dummy not registered for import)", + sl->s_name); + } if ((fd = open_via_path("", sl->s_name, ".pd", dirbuf, &nameptr, MAXPDSTRING, 0)) >= 0) *************** *** 609,617 **** } else dummy_classes[i] = ! class_new(gensym(sl->s_name), sl->s_method ? sl->s_method : (t_newmethod)dummy_new, 0, sizeof(t_object), (sl->s_nins ? 0 : CLASS_NOINLET), A_GIMME, 0); } dummy_nclasses--; /* use "_dummy" as a sentinel */ --- 629,639 ---- } else + { dummy_classes[i] = ! class_new((name ? gensym(name) : gensym(sl->s_name)), sl->s_method ? sl->s_method : (t_newmethod)dummy_new, 0, sizeof(t_object), (sl->s_nins ? 0 : CLASS_NOINLET), A_GIMME, 0); + } } dummy_nclasses--; /* use "_dummy" as a sentinel */