/*-------------------------------------------------------------------- * push_back * + push to the back of the queue */ static void pd_deque_push_back(t_pd_deque *x, t_symbol *sel, int argc, t_atom *argv) { t_pd_deque_elt *elt = pd_deque_elt_new(sel,argc,argv); #ifdef DEQUE_DEBUG post("pd_deque_push_back: got sel='%s', argc=%d", sel->s_name, argc); #endif dsqueue_append(x->x_deque, elt); ++x->x_size; }
/// Append Holmes-elements for phones in (phonestr) to (eltq). /// Returns ps->t. unsigned phone_to_elm(phtoelm_state_t *ps, char *phonestr, dsqueue_t *eltq) { #ifdef PHOLMES_DEBUG post("phone_to_elm(): called with phonestr='%s'", phonestr); #endif ps->s = phonestr; while (ps->s && *ps->s) { pte_eltseq_str es = trie_lookup(&phtoelm, &(ps->s)); if (es) { int n = *es++; while (n-- > 0) { int eid = *es++; // -- index of sequence-element in Elements[] holmes_qelt_t he; // -- encoded Holmes-triple for output-queue Elm_ptr ep = &Elements[eid]; // -- pointer to actual current element int dur; // -- placeholder for element duration // // This works because only vowels have ud != du, // and we set stress just before a vowel // if (!(ep->feat & vwl)) ps->stress = 0; dur = StressDur(ep,ps->stress); he = hqeNew(eid,dur,ps->stress); // append the encoded element to the output queue dsqueue_append(eltq, (void *)he); #ifdef PHOLMES_DEBUG post("phone_to_elm(): enqueued Holmes-triple %s,%d,%d", ep->name,dur,ps->stress); #endif } } else { char ch = *(ps->s++); switch (ch) { case '\'': // Primary stress ps->stress = 3; break; case ',': // Secondary stress ps->stress = 2; break; case '+': // Tertiary stress ps->stress = 1; break; case '-': // hyphen in input break; case '.': // literal dot indicates end-of-utterance dsqueue_append(eltq, (void *)hqeNew(0,0,0)); break; default: { fprintf(stderr, "phone_to_elm(): ignoring unknown character '%c'\n", ch); break; } } } } return ps->t; }