X-Git-Url: https://code.kerkeslager.com/?p=fur;a=blobdiff_plain;f=templates%2Fprogram2.c;h=ffd014ca1ffeede9cef8c49f7abdba8b41c87070;hp=1610a540db5c977f832eb7e163feda85395b5c5b;hb=edc05c8d2d465653c02c350592eff62c542a37ed;hpb=d28e140fd317ef3d63286ba6d87eb0418ee536c9 diff --git a/templates/program2.c b/templates/program2.c index 1610a54..ffd014c 100644 --- a/templates/program2.c +++ b/templates/program2.c @@ -117,6 +117,7 @@ void call(struct Thread* thread, Argument argument) { if(arg.value.boolean) printf("true"); else printf("false"); break; + case INTEGER: printf("%i", arg.value.integer); break; @@ -157,10 +158,30 @@ void drop(struct Thread* thread, Argument argument) { void end(struct Thread* thread, Argument argument) { } +{% with name='eq', operation='==' %} + {% include "comparison_instruction.c" %} +{% endwith %} + +{% with name='gt', operation='>' %} + {% include "comparison_instruction.c" %} +{% endwith %} + +{% with name='gte', operation='>=' %} + {% include "comparison_instruction.c" %} +{% endwith %} + {% with name='idiv', operation='/' %} {% include "arithmetic_instruction.c" %} {% endwith %} +{% with name='lt', operation='<' %} + {% include "comparison_instruction.c" %} +{% endwith %} + +{% with name='lte', operation='<=' %} + {% include "comparison_instruction.c" %} +{% endwith %} + {% with name='mod', operation='%' %} {% include "arithmetic_instruction.c" %} {% endwith %} @@ -169,6 +190,10 @@ void end(struct Thread* thread, Argument argument) { {% include "arithmetic_instruction.c" %} {% endwith %} +{% with name='neq', operation='!=' %} + {% include "comparison_instruction.c" %} +{% endwith %} + void neg(struct Thread* thread, Argument argument) { assert(!Stack_isEmpty(&(thread->stack))); Object result = Stack_pop(&(thread->stack));