From c14f671a0d73548d77e822a4bcdb7b8ff7213455 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Fri, 10 Feb 2023 09:27:10 +0300 Subject: [PATCH] Add object and string concatenation Fixes #232 --- src/interpreter.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/interpreter.cc b/src/interpreter.cc index 14eebc0..8729fd5 100644 --- a/src/interpreter.cc +++ b/src/interpreter.cc @@ -1491,6 +1491,21 @@ static void opAdd(Program* program) break; } break; + // Sonora folks use "object + string" concatenation for debug purposes. + case VALUE_TYPE_PTR: + switch (value[0].opcode) { + case VALUE_TYPE_STRING: + case VALUE_TYPE_DYNAMIC_STRING: + strings[0] = programGetString(program, value[0].opcode, value[0].integerValue); + tempString = (char*)internal_malloc_safe(strlen(strings[0]) + 80, __FILE__, __LINE__); + snprintf(tempString, strlen(strings[0]) + 80, "%p", value[1].pointerValue); + strcat(tempString, strings[0]); + + programStackPushString(program, tempString); + + internal_free_safe(tempString, __FILE__, __LINE__); + break; + } } }