Exemple #1
0
void
q_addPar(
    q_expr expr,
    q_expr par)
{
    assert(expr->kind == T_FNC);

    expr->info.function->params = q_append(expr->info.function->params, par);
}
Exemple #2
0
q_list
q_listCopy(
    q_list l)
{
    q_list n = NULL;
    while (l != NULL) {
        n = q_append(n,q_exprCopy(l->expr));
        l = l->next;
    }
    return n;
}
/*
 * Add a target position to the interpolation plan
 *
 * The interpolator will target this immediately if it is not already
 * targetting a position.  The interpolator will target the next position
 * if it has been within 15 degrees of its target for 1s.
 */
void
interpolator_add_target_position(int32_t target_position)
{
    q_append(target_position);
}
Exemple #4
0
q_expr
q_exprCopy(
    q_expr e)
{
    q_list n = NULL;
    q_expr copy;

    if (e == NULL) {
        return NULL;
    }
    switch (q_getKind(e)) {
    case T_FNC:
        if (e->info.function->tag == Q_EXPR_CALLBACK) {

            /* The first parameter specifies the result type of the callback function. */
            /* The second parameter is not of type q_expr but is a function pointer. */
            /* The function pointer is the address of the callback function.         */

            /* increment ref count of internal c_type because it is being copied */
            c_keep (q_getTyp(q_getPar(e,0)));
            n = q_append(n,q_getPar(e,0));
            n = q_append(n,q_getPar(e,1));
            n = q_append(n,q_exprCopy(q_getPar(e,2)));
            copy = q_newFnc(q_getTag(e),n);
            q_exprSetText(copy, e->text);
            q_exprSetInstanceState(copy, e->instanceState);
            q_exprSetSampleState(copy, e->sampleState);
            q_exprSetViewState(copy, e->viewState);
            return copy;
        } else {
            copy = q_newFnc(q_getTag(e),q_listCopy(q_getLst(e,0)));
            q_exprSetText(copy, e->text);
            q_exprSetInstanceState(copy, e->instanceState);
            q_exprSetSampleState(copy, e->sampleState);
            q_exprSetViewState(copy, e->viewState);
            return copy;
        }
    case T_TYP:
        copy = q_newTyp(q_getTyp(e));
        q_exprSetText(copy, e->text);
        q_exprSetInstanceState(copy, e->instanceState);
        q_exprSetSampleState(copy, e->sampleState);
        q_exprSetViewState(copy, e->viewState);
        return copy;
    case T_VAR:
        copy = q_newVar(q_getVar(e));
        q_exprSetText(copy, e->text);
        q_exprSetInstanceState(copy, e->instanceState);
        q_exprSetSampleState(copy, e->sampleState);
        q_exprSetViewState(copy, e->viewState);
        return copy;
    case T_INT:
        copy = q_newInt(q_getInt(e));
        q_exprSetText(copy, e->text);
        q_exprSetInstanceState(copy, e->instanceState);
        q_exprSetSampleState(copy, e->sampleState);
        q_exprSetViewState(copy, e->viewState);
        return copy;
    case T_DBL:
        copy = q_newDbl(q_getDbl(e));
        q_exprSetText(copy, e->text);
        q_exprSetInstanceState(copy, e->instanceState);
        q_exprSetSampleState(copy, e->sampleState);
        q_exprSetViewState(copy, e->viewState);
        return copy;
    case T_CHR:
        copy = q_newChr(q_getChr(e));
        q_exprSetText(copy, e->text);
        q_exprSetInstanceState(copy, e->instanceState);
        q_exprSetSampleState(copy, e->sampleState);
        q_exprSetViewState(copy, e->viewState);
        return copy;
    case T_STR:
        copy = q_newStr(q_getStr(e));
        q_exprSetText(copy, e->text);
        q_exprSetInstanceState(copy, e->instanceState);
        q_exprSetSampleState(copy, e->sampleState);
        q_exprSetViewState(copy, e->viewState);
        return copy;
    case T_ID:
        copy = q_newId(q_getId(e));
        q_exprSetText(copy, e->text);
        q_exprSetInstanceState(copy, e->instanceState);
        q_exprSetSampleState(copy, e->sampleState);
        q_exprSetViewState(copy, e->viewState);
        return copy;
    default:
        assert(FALSE);
    break;
    }
    return NULL;
}
Exemple #5
0
void si_append(sorted_intlist si, int to_append) {
  q_append(si->q, (void *)to_append);
}