void hammer_setup(void) { if (canvas_getcurrent()) { /* Loading the library by object creation is banned, because of a danger of having some of the classes already loaded. LATER rethink. */ loud_error(0, "apparently an attempt to create a 'hammer' object"); loud_errand(0, "without having hammer library preloaded"); return; } if (zgetfn(&pd_objectmaker, gensym("hammer"))) { loud_error(0, "hammer is already loaded"); return; } if (!zgetfn(&pd_objectmaker, gensym("cyclone"))) post("this is hammer %s, %s %s build", CYCLONE_VERSION, loud_ordinal(CYCLONE_BUILD), CYCLONE_RELEASE); hammer_class = class_new(gensym("hammer"), (t_newmethod)hammer_new, (t_method)hammer_free, sizeof(t_hammer), 0, 0); class_addbang(hammer_class, hammer_bang); class_addmethod(hammer_class, (t_method)hammer_cd, gensym("cd"), A_DEFSYM, 0); class_addmethod(hammer_class, (t_method)hammer_pwd, gensym("pwd"), A_SYMBOL, 0); class_addmethod(hammer_class, (t_method)hammer_import, gensym("import"), A_DEFSYM, 0); class_addmethod(hammer_class, (t_method)hammer_click, gensym("click"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); hammerfile_setup(hammer_class, 0); hammer_firstndx = fragile_class_count(); allhammers_setup(); hammer_lastndx = fragile_class_count() - 1; }
static void testmess_setnames(t_testmess *x, t_symbol *s, int natoms, int nchars) { if (!s) s = &s_; if (*s->s_name == 'c') { natoms = fragile_class_count(); if (natoms > 0 && testmess_makeroom(x, natoms * 2, 0)) { testmess_setnatoms(x, natoms); fragile_class_getnames(x->x_message, natoms); } } else { if (natoms <= 0) natoms = 100; if (nchars <= 0) nchars = 10; if (testmess_makeroom(x, natoms * 2, 0)) { char buf[MAXPDSTRING], fmt[16]; int i = 0; t_atom *ap; testmess_setnatoms(x, natoms); ap = x->x_message; sprintf(fmt, "%%.%dx", nchars); while (natoms--) { snprintf(buf, MAXPDSTRING-1, fmt, i); SETSYMBOL(ap, gensym(buf)); i++; ap++; } } } }
void maxmode_setup(void) { int dresult = LOADER_OK; if (zgetfn(&pd_objectmaker, gensym("maxmode"))) { loud_error(0, "maxmode is already loaded"); return; } maxmode_class = class_new(gensym("maxmode"), (t_newmethod)maxmode_new, (t_method)maxmode_free, sizeof(t_maxmode), 0, A_GIMME, 0); class_addbang(maxmode_class, maxmode_bang); class_addmethod(maxmode_class, (t_method)maxmode_set, gensym("set"), A_DEFSYM, 0); class_addmethod(maxmode_class, (t_method)maxmode_get, gensym("get"), 0); class_addmethod(maxmode_class, (t_method)maxmode_cd, gensym("cd"), A_DEFSYM, 0); class_addmethod(maxmode_class, (t_method)maxmode_pwd, gensym("pwd"), A_SYMBOL, 0); class_addmethod(maxmode_class, (t_method)maxmode_import, gensym("import"), A_DEFSYM, 0); class_addmethod(maxmode_class, (t_method)maxmode_click, gensym("click"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); hammerfile_setup(maxmode_class, 0); if (canvas_getcurrent()) { fitter_setup(0, 0); if (!zgetfn(&pd_objectmaker, gensym("cyclone"))) /* cycloneless maxmode -- banner is posted by the oldest maxmode object with no creation arguments */ maxmode_withbanner = 1; } else { fittermax_set(); if (zgetfn(&pd_objectmaker, gensym("cyclone"))) loud_warning(0, "maxmode", "cyclone is already loaded"); else { if (unstable_load_lib("", "cyclone") == LOADER_NOFILE) loud_error(0, "cyclone library is missing"); else if (!zgetfn(&pd_objectmaker, gensym("cyclone"))) loud_error(0, "miXed/Pd version mismatch"); } } maxmode_dummiesndx = fragile_class_count(); if (zgetfn(&pd_objectmaker, gensym("dummies"))) loud_warning(0, "maxmode", "dummies are already loaded"); else dresult = unstable_load_lib("", "dummies"); maxmode_lastndx = fragile_class_count() - 1; if (dresult == LOADER_NOFILE) loud_warning(0, "maxmode", "dummies not found"); else { t_symbol *s = gensym("_cc.dummies"); if (s->s_thing && !s->s_next && !strcmp(class_getname(*s->s_thing), "_cc.dummies")) maxmode_dproxy = s->s_thing; else loudbug_bug("maxmode_setup"); /* FIXME */ } }