From 1b176cf6cd75c8031a140961655cdd3c16589a68 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Sun, 9 Jan 2022 12:28:19 -0500 Subject: small changes; sig gen square(), triangle(), pulse() --- source/code.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'source/code.cpp') diff --git a/source/code.cpp b/source/code.cpp index 7a9afaa..14f603c 100644 --- a/source/code.cpp +++ b/source/code.cpp @@ -1,3 +1,14 @@ +/** + * @file code.cpp + * @brief Functionality for compiling and disassembling source code. + * + * Copyright (C) 2021 Clyne Sullivan + * + * Distributed under the GNU GPL v3 or later. You should have received a copy of + * the GNU General Public License along with this program. + * If not, see . + */ + #include "stmdsp.hpp" #include "stmdsp_code.hpp" @@ -9,10 +20,13 @@ #include extern std::shared_ptr m_device; -extern void log(const std::string& str); +void log(const std::string& str); -std::string tempFileName; // device.cpp +std::ifstream compileOpenBinaryFile(); +void compileEditorCode(const std::string& code); +void disassembleCode(); +static std::string tempFileName; static std::string newTempFileName(); static bool codeExecuteCommand( const std::string& command, @@ -22,6 +36,14 @@ static void stringReplaceAll( const std::string& what, const std::string& with); +std::ifstream compileOpenBinaryFile() +{ + if (!tempFileName.empty()) + return std::ifstream(tempFileName + ".o"); + else + return std::ifstream(); +} + void compileEditorCode(const std::string& code) { log("Compiling..."); -- cgit v1.2.3