From be15b44450e8792bc6cbd7244eef157b7fd66b75 Mon Sep 17 00:00:00 2001 From: Brian Heim Date: Sun, 15 Dec 2019 12:26:05 -0600 Subject: [PATCH] SC: cleanup getResultAsInt --- src/SuperColliderEngine.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/SuperColliderEngine.cpp b/src/SuperColliderEngine.cpp index eb93b2a..f78b3d8 100644 --- a/src/SuperColliderEngine.cpp +++ b/src/SuperColliderEngine.cpp @@ -174,12 +174,17 @@ int SC_VcvPrototypeClient::getResultAsInt(const char* text) noexcept { auto* resultSlot = &scGlobals()->result; if (IsInt(resultSlot)) { auto intResult = slotRawInt(resultSlot); - printf("%s: %d\n", text, intResult); - return intResult; + if (intResult > 0) { + return intResult; + } else { + // TODO better formatting + FAIL(std::string("Result of '") + text "' should be > 0"); + return -1; + } + } else { + FAIL(std::string("Result of '") + text + "' should be Integer"); + return -1; } - - FAIL(std::string("Result of '") + text + "' was not int as expected"); - return -1; } __attribute__((constructor(1000)))