]> code.bitgloo.com Git - clyne/stmdspgui.git/commitdiff
update documentation, fix some includes
authorClyne Sullivan <clyne@bitgloo.com>
Sat, 21 Jan 2023 15:48:40 +0000 (10:48 -0500)
committerClyne Sullivan <clyne@bitgloo.com>
Sat, 21 Jan 2023 15:48:40 +0000 (10:48 -0500)
source/code.cpp
source/gui_code.cpp
source/gui_help.cpp
source/main.cpp
source/stmdsp/stmdsp.cpp

index 8e3bd6c578374450693473a6a992df7ec5806e8e..f24bb5c7864adbd061f84433a8f240354d8a231e 100644 (file)
@@ -2,13 +2,14 @@
  * @file code.cpp
  * @brief Functionality for compiling and disassembling source code.
  *
- * Copyright (C) 2021 Clyne Sullivan
+ * Copyright (C) 2022 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 <https://www.gnu.org/licenses/>.
  */
 
+#include "main.hpp"
 #include "stmdsp.hpp"
 #include "stmdsp_code.hpp"
 
 #include <string>
 
 extern std::shared_ptr<stmdsp::device> m_device;
-void log(const std::string& str);
-
-std::ifstream compileOpenBinaryFile();
-void compileEditorCode(const std::string& code);
-void disassembleCode();
 
+// Stores the temporary file name currently used for compiling the algorithm.
 static std::string tempFileName;
+
+/**
+ * Generates a new temporary file name.
+ * @return A string containing the path and file name.
+ */
 static std::string newTempFileName();
-static bool codeExecuteCommand(
-    const std::string& command,
-    const std::string& file);
-static void stringReplaceAll(
-    std::string& str,
-    const std::string& what,
+
+/**
+ * Executes the given command using system(), collecting the text output in the
+ * given file.
+ * @param command The command to be executed.
+ * @param file The file to write command output to.
+ * @return True if the command was successful (i.e. returned zero).
+ */
+static bool codeExecuteCommand(const std::string& command, const std::string& file);
+
+/**
+ * Does an in-place replacement of all occurances of "what" with "with".
+ * @param str The text string to operate on.
+ * @param what The text to search for.
+ * @param with The text that will replace occurances of "what".
+ */
+static void stringReplaceAll(std::string& str, const std::string& what,
     const std::string& with);
 
 std::ifstream compileOpenBinaryFile()
index 50fd0c8274cb6eaa1cafdaf299a5ef8c84b1ef20..b797e51adbdc8a1a4ea4fbd2a0e7593d9a44d012 100644 (file)
@@ -9,6 +9,7 @@
  * If not, see <https://www.gnu.org/licenses/>.
  */
 
+#include "code.hpp"
 #include "imgui.h"
 #include "backends/imgui_impl_sdl.h"
 #include "backends/imgui_impl_opengl2.h"
@@ -16,9 +17,6 @@
 
 #include <string>
 
-extern void compileEditorCode(const std::string& code);
-extern void disassembleCode();
-
 TextEditor editor; // file.cpp
 
 static std::string editorCompiled;
index a17d9fa470941a5ccc7845b67a639c994e1f9675..b60387bd4b045aa83103c67dc6fd4cf04a22bd81 100644 (file)
@@ -1,3 +1,14 @@
+/**
+ * @file gui_help.cpp
+ * @brief Defines the "Help" menu and provides its functionality.
+ *
+ * Copyright (C) 2022 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 <https://www.gnu.org/licenses/>.
+ */
+
 #include "imgui.h"
 #include "ImGuiFileDialog.h"
 
index aa9f7c42d81623a71010f5549facf3de7eba570f..a6244992b357472ac2ad273c144a581a4a3408b3 100644 (file)
@@ -2,7 +2,7 @@
  * @file main.cpp
  * @brief Program entry point and main loop.
  *
- * Copyright (C) 2021 Clyne Sullivan
+ * Copyright (C) 2022 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.
@@ -13,7 +13,9 @@
 #include "backends/imgui_impl_sdl.h"
 #include "backends/imgui_impl_opengl2.h"
 
+#include "gui_help.hpp"
 #include "logview.h"
+#include "main.hpp"
 #include "stmdsp.hpp"
 
 #include <chrono>
@@ -37,10 +39,6 @@ bool guiInitialize();
 bool guiHandleEvents();
 void guiShutdown();
 void guiRender();
-void helpRenderMenu();
-void helpRenderDialog();
-
-void log(const std::string& str);
 
 static LogView logView;
 static ImFont *fontSans = nullptr;
index 294e98f2a292a304ce6cd58e4534d7cc24556d7d..c50845fc5dcf1e6cbb15bfde3c8462ae515cad3c 100644 (file)
@@ -14,6 +14,7 @@
 #include <serial/serial.h>
 
 #include <algorithm>
+#include <array>
 
 extern void log(const std::string& str);