bydgoszcz

simple, fast and efficient programming language
git clone git://git.kocotian.pl/bydgoszczscript.git
Log | Files | Refs | README | LICENSE

commit 842f1d29e7540bcef277e573fc1ce6688c114cbf
parent 11dba642a0c7553e931dd8b176c15bc68d1ec033
Author: kocotian <kocotian@kocotian.pl>
Date:   Tue,  8 Jun 2021 11:52:15 +0200

oznakowane / nieoznakowane (casting to signed/unsigned)

Diffstat:
Mcompile.c | 16++++++++++++++++
1 file changed, 16 insertions(+), 0 deletions(-)

diff --git a/compile.c b/compile.c @@ -496,6 +496,22 @@ tester: g_type(f, &type); str->len = (size_t)snprintf(str->data, MAX_EXPRESSIONSIZE, "(%.*s)(%.*s)", (int)(type.llen), type.ldata, Strevalf(expr)); + } else if (!Strccmp(t->c, "nieoznakowane")) { + ExpressionString expr; + TypeString type; + initType(&type, 1); + t = enextToken(f, TokenNULL); + g_expression(f, &expr); + str->len = (size_t)snprintf(str->data, MAX_EXPRESSIONSIZE, "(unsigned)(%.*s)", + Strevalf(expr)); + } else if (!Strccmp(t->c, "oznakowane")) { + ExpressionString expr; + TypeString type; + initType(&type, 1); + t = enextToken(f, TokenNULL); + g_expression(f, &expr); + str->len = (size_t)snprintf(str->data, MAX_EXPRESSIONSIZE, "(signed)(%.*s)", + Strevalf(expr)); } else if (!Strccmp(t->c, "__c")) { t = enextToken(f, TokenString); strncpy(str->data, t->c.data + 1, t->c.len - 2);