Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
v1.1 more debug
Browse files Browse the repository at this point in the history
  • Loading branch information
HZZcode authored Sep 27, 2024
1 parent f0278b8 commit 2c19be1
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 39 deletions.
56 changes: 28 additions & 28 deletions CMakeLists.txt.user
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 14.0.1, 2024-09-27T11:35:23. -->
<!-- Written by QtCreator 14.0.1, 2024-09-27T17:51:07. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
Expand Down Expand Up @@ -101,22 +101,22 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 6.7.2 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 6.7.2 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt6.672.win64_mingw_kit</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="CMake.Build.Type">Debug</value>
<value type="int" key="CMake.Configure.BaseEnvironment">2</value>
<value type="bool" key="CMake.Configure.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="CMake.Configure.UserEnvironmentChanges"/>
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
-DCMAKE_GENERATOR:STRING=Ninja
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_BUILD_TYPE:STRING=Debug
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DCMAKE_BUILD_TYPE:STRING=Debug</value>
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
-DCMAKE_GENERATOR:STRING=Ninja</value>
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\14354\Documents\Qt Projects\MicrologicIDE\build\Desktop_Qt_6_7_2_MinGW_64_bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
Expand Down Expand Up @@ -166,14 +166,14 @@
<value type="int" key="CMake.Configure.BaseEnvironment">2</value>
<value type="bool" key="CMake.Configure.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="CMake.Configure.UserEnvironmentChanges"/>
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
-DCMAKE_GENERATOR:STRING=Ninja
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_BUILD_TYPE:STRING=Release
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DCMAKE_BUILD_TYPE:STRING=Release</value>
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
-DCMAKE_GENERATOR:STRING=Ninja</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\14354\Documents\Qt Projects\MicrologicIDE\build\Desktop_Qt_6_7_2_MinGW_64_bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
Expand Down Expand Up @@ -222,14 +222,14 @@
<value type="int" key="CMake.Configure.BaseEnvironment">2</value>
<value type="bool" key="CMake.Configure.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="CMake.Configure.UserEnvironmentChanges"/>
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
-DCMAKE_GENERATOR:STRING=Ninja
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo</value>
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
-DCMAKE_GENERATOR:STRING=Ninja</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\14354\Documents\Qt Projects\MicrologicIDE\build\Desktop_Qt_6_7_2_MinGW_64_bit-RelWithDebInfo</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
Expand Down Expand Up @@ -276,14 +276,14 @@
<value type="int" key="CMake.Configure.BaseEnvironment">2</value>
<value type="bool" key="CMake.Configure.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="CMake.Configure.UserEnvironmentChanges"/>
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
-DCMAKE_GENERATOR:STRING=Ninja
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo</value>
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
-DCMAKE_GENERATOR:STRING=Ninja</value>
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\14354\Documents\Qt Projects\MicrologicIDE\build\Desktop_Qt_6_7_2_MinGW_64_bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
Expand Down Expand Up @@ -331,14 +331,14 @@
<value type="int" key="CMake.Configure.BaseEnvironment">2</value>
<value type="bool" key="CMake.Configure.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="CMake.Configure.UserEnvironmentChanges"/>
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
-DCMAKE_GENERATOR:STRING=Ninja
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_BUILD_TYPE:STRING=MinSizeRel
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DCMAKE_BUILD_TYPE:STRING=MinSizeRel</value>
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
-DCMAKE_GENERATOR:STRING=Ninja</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\14354\Documents\Qt Projects\MicrologicIDE\build\Desktop_Qt_6_7_2_MinGW_64_bit-MinSizeRel</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
Expand Down Expand Up @@ -413,7 +413,7 @@
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Users/14354/Documents/Qt Projects/MicrologicIDE/build/Desktop_Qt_6_7_2_MinGW_64_bit-Release</value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Users/14354/Documents/Qt Projects/MicrologicIDE/build/Desktop_Qt_6_7_2_MinGW_64_bit-Debug</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
Expand Down
Binary file modified Micrologic.exe
Binary file not shown.
36 changes: 26 additions & 10 deletions MicrologicIDE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,24 +619,40 @@ void MicrologicIDE::updateDebug()

std::stringstream ss(text);
std::string s{};
std::vector<std::string> nums{};
std::vector<std::string> infos{},nums{};
while (std::getline(ss, s, ' ')) {
nums.push_back(s);
infos.push_back(s);
}
std::string line1="",line2="";
for(int i=0;i<nums.size();i++){
for(int i=0;i<infos.size();i++){
nums.push_back(infos[i].substr(2,infos.size()));
bool I=(infos[i][0]=='I'),O=(infos[i][1]=='O');
std::string start="",end="";
if(I&&O){
start=IOStart;
end=IOEnd;
}
else if(I){
start=IStart;
end=IEnd;
}
else if(O){
start=OStart;
end=OEnd;
}

if(nums[i].size()==1){
line1+=("[L"+std::to_string(i)+"] ");
if(std::to_string(i).length()==1) line2+=(" "+nums[i]+" ");
else line2+=(" "+nums[i]+" ");
line1+=(start+"[L"+std::to_string(i)+"]"+end+" ");
if(std::to_string(i).length()==1) line2+=(" "+start+nums[i]+end+" ");
else line2+=(" "+start+nums[i]+end+" ");
}
else{
line1+=("[W"+std::to_string(i)+"] ");
if(std::to_string(i).length()==1) line2+=(nums[i]+" ");
else line2+=(" "+nums[i]+" ");
line1+=(start+"[W"+std::to_string(i)+"]"+end+" ");
if(std::to_string(i).length()==1) line2+=(start+nums[i]+end+" ");
else line2+=(" "+start+nums[i]+end+" ");
}
}
line1=line1.substr(0,line1.length()-1);
line2=line2.substr(0,line2.length()-1);
ui->debugText->setText((line1+"\n"+line2).c_str());
ui->debugText->setText((debugInfo+"<br>"+debugStart+line1+"<br>"+line2+debugEnd).c_str());
}
6 changes: 6 additions & 0 deletions MicrologicIDE.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ class MicrologicIDE : public QMainWindow
const std::string numStart="<span style=\"color: aqua; white-space: pre;\">",numEnd="</span>";
const std::string modStart="<span style=\"color: purple; white-space: pre;\">",modEnd="</span>";

const std::string debugStart="<span style=\"white-space: pre;\">",debugEnd="</span>";
const std::string IStart="<span style=\"color: red; white-space: pre;\">",IEnd="</span>";
const std::string OStart="<span style=\"color: blue; white-space: pre;\">",OEnd="</span>";
const std::string IOStart="<span style=\"color: purple; white-space: pre;\">",IOEnd="</span>";
const std::string debugInfo="====[DEBUG INFO] "+IStart+"input "+IEnd+OStart+"output "+OEnd+IOStart+"input&output "+IOEnd+"====";

const std::vector<std::string> blankChars={" ","\n",errorStart,errorEnd,"<br>"};
const std::vector<std::string> keys={"end","line","wline","N","A","R","T","C","P","set","check","input:","input","output:","output","tick","tick!","speed","path","open","mod","block","inspect","echo","@echo","clear","help","clear"};
const std::vector<std::string> nums={"0","1","2","3","4","5","6","7","8","9"};
Expand Down
5 changes: 4 additions & 1 deletion MicrologicIDE.ui
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,17 @@
<property name="maximumSize">
<size>
<width>16777215</width>
<height>36</height>
<height>54</height>
</size>
</property>
<property name="font">
<font>
<family>Consolas</family>
</font>
</property>
<property name="lineWrapMode">
<enum>QTextEdit::LineWrapMode::NoWrap</enum>
</property>
</widget>
</item>
</layout>
Expand Down
6 changes: 6 additions & 0 deletions help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ path [PATH] Set path of scripts. U
open [FILE] Open an Micrologic script file. Use double quotation marks when the file name include spaces.
mod [MOD] [FILE] Give an file a mod name, in order to use it as a block afterwards.
block [MOD] [INPUT [INPUT ...]] [OUTPUT [OUTPUT ...]] Creates a user-defined block.
tag [ALINE] Check whether a line is set as input or output.
type [ALINE] Check whether a line is wide.
check-input Lists the line order numbers of input lines.
check-input [INPUT] Lists the line order number of a designated input line.
check-output Lists the line order numbers of output lines.
check-output [OUTPUT] Lists the line order number of a designated output line.
inspect [BLOCKTYPE] [BLOCK] Checks whether a block connects correct line type.
echo [MESSAGE] Outputs a message.
@echo [ECHO] Set whether to echo messages. Requires 0 or 1.
Expand Down

0 comments on commit 2c19be1

Please sign in to comment.