Method: RCSimCinterface.rcsim_make_hif

Defined in:
ext/hruby_sim/hruby_rcsim_build.c

.rcsim_make_hif(conditionV, yesV, noV) ⇒ Object

Creating a hardware if C object.



613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
# File 'ext/hruby_sim/hruby_rcsim_build.c', line 613

VALUE rcsim_make_hif(VALUE mod, VALUE conditionV, VALUE yesV, VALUE noV) {
    // printf("rcsim_make_hif\n");
    /* Allocates the hardware if. */
    HIf hif = (HIf)malloc(sizeof(HIfS));
    // printf("hif=%p\n",hif);
    /* Set it up. */
    hif->kind = HIF;
    hif->owner = NULL;
    value_to_rcsim(ExpressionS,conditionV,hif->condition);
    value_to_rcsim(StatementS,yesV,hif->yes);
    if (TYPE(noV) == T_NIL)
        hif->no = NULL;
    else
        value_to_rcsim(StatementS,noV,hif->no);
    hif->num_noifs = 0;
    hif->noconds = NULL;
    hif->nostmnts = NULL;
    /* Returns the C hardware if embedded into a ruby VALUE. */
    VALUE res;
    rcsim_to_value(HIfS,hif,res);
    return res;
}