Method: RCSimCinterface.rcsim_make_unary
- Defined in:
- ext/hruby_sim/hruby_rcsim_build.c
.rcsim_make_unary(type, operator, child) ⇒ Object
Creating a unary value C object.
749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 |
# File 'ext/hruby_sim/hruby_rcsim_build.c', line 749 VALUE rcsim_make_unary(VALUE mod, VALUE type, VALUE operator, VALUE child) { // printf("rcsim_make_unary\n"); /* Allocates the unary. */ Unary unary= (Unary)malloc(sizeof(UnaryS)); // printf("unary=%p\n",unary); /* Set it up. */ unary->kind = UNARY; unary->owner = NULL; value_to_rcsim(TypeS,type,unary->type); switch(sym_to_char(operator)) { case (unsigned char)'~': unary->oper = not_value; break; case (unsigned char)('-'+'@'*2): unary->oper = neg_value; break; default: perror("Invalid operator for unary."); } value_to_rcsim(ExpressionS,child,unary->child); /* Returns the C unary embedded into a ruby VALUE. */ VALUE res; rcsim_to_value(UnaryS,unary,res); return res; } |