Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11622
Modified Files: Tag: desiredata kernel.c Log Message: cleanup
Index: kernel.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/kernel.c,v retrieving revision 1.1.2.82 retrieving revision 1.1.2.83 diff -C2 -d -r1.1.2.82 -r1.1.2.83 *** kernel.c 9 Aug 2007 07:18:17 -0000 1.1.2.82 --- kernel.c 12 Aug 2007 03:19:13 -0000 1.1.2.83 *************** *** 760,783 **** }
! /* move an inlet or outlet to the head of the list */ ! /* this code is not safe with the latest additions in t_outconnect ! */ ! void obj_moveinletfirst(t_object *x, t_inlet *i) { if (x->inlet == i) return; ! each_inlet(i2,x) if (i2->next == i) { ! i2->next = i->next; ! i->next = x->inlet; ! x->inlet = i; ! return; ! } ! } void obj_moveoutletfirst(t_object *x, t_outlet *o) { if (x->outlet == o) return; ! each_outlet(o2,x) if (o2->next == o) { ! o2->next = o->next; ! o->next = x->outlet; ! x->outlet = o; ! return; ! } ! }
/* routines for DSP sorting, which are used in d_ugen.c and g_canvas.c */ --- 760,770 ---- }
! /* move an inlet or outlet to the head of the list. this code is not safe with the latest additions in t_outconnect ! */ ! void obj_moveinletfirst( t_object *x, t_inlet *i) { if (x->inlet == i) return; ! each_inlet( i2,x) if (i2->next == i) {i2->next = i->next; i->next = x-> inlet; x-> inlet = i; return;}} void obj_moveoutletfirst(t_object *x, t_outlet *o) { if (x->outlet == o) return; ! each_outlet(o2,x) if (o2->next == o) {o2->next = o->next; o->next = x->outlet; x->outlet = o; return;}}
/* routines for DSP sorting, which are used in d_ugen.c and g_canvas.c */ *************** *** 799,825 **** int obj_siginletindex(t_object *x, int m) { int n=0; ! if (x->_class->firstin && x->_class->floatsignalin) { ! if (!m--) return 0; else n++; ! } ! each_inlet(i,x) if (i->symfrom == &s_signal) { ! if (!m) return n; ! n++; m--; ! } return -1; } int obj_sigoutletindex(t_object *x, int m) { int n=0; ! each_outlet(o,x) if (o->sym == &s_signal) { ! if (m == 0) return n; ! n++; m--; ! } return -1; }
int obj_issignalinlet(t_object *x, int m) { ! if (x->_class->firstin) { ! if (!m) return x->_class->firstin && x->_class->floatsignalin; ! else m--; ! } t_inlet *i; for (i = x->inlet; i && m; i = i->next, m--) {} --- 786,801 ---- int obj_siginletindex(t_object *x, int m) { int n=0; ! if (x->_class->firstin && x->_class->floatsignalin) {if (!m--) return 0; else n++;} ! each_inlet(i,x) if (i->symfrom == &s_signal) {if (!m) return n; else {n++; m--;}} return -1; } int obj_sigoutletindex(t_object *x, int m) { int n=0; ! each_outlet(o,x) if (o->sym == &s_signal) {if (!m) return n; else {n++; m--;}} return -1; }
int obj_issignalinlet(t_object *x, int m) { ! if (x->_class->firstin) {if (!m) return x->_class->floatsignalin; else m--;} t_inlet *i; for (i = x->inlet; i && m; i = i->next, m--) {} *************** *** 846,860 **** }
! /* and those two are only used in g_io.c... */ int inlet_getsignalindex(t_inlet *x) { ! int n=0; t_inlet *i; ! for (i = x->owner->inlet; i && i != x; i = i->next) if (i->symfrom == &s_signal) n++; ! return n; ! } int outlet_getsignalindex(t_outlet *x) { ! int n=0; t_outlet *o; ! for (o = x->owner->outlet; o && o != x; o = o->next) if (o->sym == &s_signal) n++; ! return n; ! }
#ifdef QUALIFIED_NAME --- 822,832 ---- }
! /* and those two are only used in desire.c... */ int inlet_getsignalindex(t_inlet *x) { ! int n=0; for ( t_inlet *i = x->owner-> inlet; i; i = i->next) if (i->symfrom == &s_signal) n++; else if (i==x) return n; ! return -1;} int outlet_getsignalindex(t_outlet *x) { ! int n=0; for (t_outlet *o = x->owner->outlet; o; o = o->next) if (o->sym == &s_signal) n++; else if (o==x) return n; ! return -1;}
#ifdef QUALIFIED_NAME *************** *** 1901,1917 **** if (!ac) break; if (at->a_type == A_DOLLAR) { ! if (at->a_index <= 0 || at->a_index > argc) { ! error("$%d: not enough arguments supplied", at->a_index); ! goto cleanup; ! } else if (argv[at->a_index-1].a_type != A_SYMBOL) { ! error("$%d: symbol needed as message destination", at->a_index); ! goto cleanup; ! } else s = argv[at->a_index-1].a_symbol; } else if (at->a_type == A_DOLLSYM) { s = binbuf_realizedollsym(at->a_symbol, argc, argv, 0); ! if (!s) { ! error("$%s: not enough arguments supplied", at->a_symbol->name); ! goto cleanup; ! } } else s = atom_getsymbol(at); target = s->thing; --- 1873,1882 ---- if (!ac) break; if (at->a_type == A_DOLLAR) { ! if (at->a_index <= 0 || at->a_index > argc) {error("$%d: not enough arguments supplied", at->a_index); goto cleanup;} ! else if (argv[at->a_index-1].a_type != A_SYMBOL) {error("$%d: symbol needed as receiver", at->a_index); goto cleanup;} ! else s = argv[at->a_index-1].a_symbol; } else if (at->a_type == A_DOLLSYM) { s = binbuf_realizedollsym(at->a_symbol, argc, argv, 0); ! if (!s) {error("$%s: not enough arguments supplied", at->a_symbol->name); goto cleanup;} } else s = atom_getsymbol(at); target = s->thing; *************** *** 1926,1940 **** } } ! if (!target) { ! error("%s: no such object", s->name); cleanup: ! do at++, ac--; ! while (ac && at->a_type != A_SEMI); ! /* LATER eat args until semicolon and continue */ continue; - } else { - at++, ac--; - break; - } } if (!ac) break; --- 1891,1901 ---- } } ! if (!target) {error("%s: no such object", s->name); goto cleanup;} ! at++; ! ac--; ! break; cleanup: ! do {at++; ac--;} while (ac && at->a_type != A_SEMI); /* is this the correct thing to do? */ continue; } if (!ac) break; *************** *** 1942,1957 **** nexttarget = target; while (1) { - t_symbol *s9; if (!ac) goto gotmess; ! if (msp >= ems) {error("message stack overflow"); goto broken;} switch (at->a_type) { ! case A_SEMI: ! /* semis and commas in new message just get bashed to ! a symbol. This is needed so you can pass them to "expr." */ ! if (target == &pd_objectmaker) {SETSYMBOL(msp, gensym(";")); break;} ! else {nexttarget = 0; goto gotmess;} ! case A_COMMA: ! if (target == &pd_objectmaker) {SETSYMBOL(msp, gensym(",")); break;} ! else goto gotmess; case A_FLOAT: case A_SYMBOL: --- 1903,1912 ---- nexttarget = target; while (1) { if (!ac) goto gotmess; ! if (msp >= ems) {error("message too long"); goto broken;} switch (at->a_type) { ! /* semis and commas in new message just get bashed to a symbol. This is needed so you can pass them to "expr." */ ! case A_SEMI: if (target == &pd_objectmaker) {SETSYMBOL(msp, gensym(";")); break;} else {nexttarget = 0; goto gotmess;} ! case A_COMMA: if (target == &pd_objectmaker) {SETSYMBOL(msp, gensym(",")); break;} else goto gotmess; case A_FLOAT: case A_SYMBOL: *************** *** 1959,1981 **** break; case A_DOLLAR: ! if (at->a_index > 0 && at->a_index <= argc) ! *msp = argv[at->a_index-1]; ! else if (at->a_index == 0) ! SETFLOAT(msp, canvas_getdollarzero()); else { ! if (target == &pd_objectmaker) SETFLOAT(msp, 0); ! else { ! error("$%d: argument number out of range", at->a_index); ! SETFLOAT(msp, 0); ! } } break; ! case A_DOLLSYM: ! s9 = binbuf_realizedollsym(at->a_symbol, argc, argv, target == &pd_objectmaker); if (!s9) { error("%s: argument number out of range", at->a_symbol->name); SETSYMBOL(msp, at->a_symbol); } else SETSYMBOL(msp, s9); ! break; default: bug("bad item in binbuf"); --- 1914,1931 ---- break; case A_DOLLAR: ! if (at->a_index > 0 && at->a_index <= argc) *msp = argv[at->a_index-1]; ! else if (at->a_index == 0) SETFLOAT(msp, canvas_getdollarzero()); else { ! SETFLOAT(msp, 0); ! if (target != &pd_objectmaker) error("$%d: argument number out of range", at->a_index); } break; ! case A_DOLLSYM: { ! t_symbol *s9 = binbuf_realizedollsym(at->a_symbol, argc, argv, target == &pd_objectmaker); if (!s9) { error("%s: argument number out of range", at->a_symbol->name); SETSYMBOL(msp, at->a_symbol); } else SETSYMBOL(msp, s9); ! break;} default: bug("bad item in binbuf"); *************** *** 2001,2005 **** ac--; } - return; broken: --- 1951,1954 ----