Skip to content

Commit

Permalink
View history
Browse files Browse the repository at this point in the history
  • Loading branch information
FernandoAiresCastello committed Jun 24, 2023
1 parent 201eb3f commit 0da7700
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ PTM.last
temp.ptm
*.odt#
*.ods#
_DOCGEN
Binary file modified v0.2b/Build/PTM.exe
Binary file not shown.
Binary file modified v0.2b/Build/PTM_v0.2b.zip
Binary file not shown.
1 change: 1 addition & 0 deletions v0.2b/Build/test/test_main.ptm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
INCL games/quest.ptm
2 changes: 2 additions & 0 deletions v0.2b/PTM.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ cd "$(SolutionDir)Build"
<ClInclude Include="Src\PTM\ptm_sprites.h" />
<ClInclude Include="Src\PTM\ptm_text_font.h" />
<ClInclude Include="Src\PTM\ptm_tile_system.h" />
<ClInclude Include="Src\Util\docgen.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Resources\PTM.rc" />
Expand Down Expand Up @@ -202,6 +203,7 @@ cd "$(SolutionDir)Build"
<ClCompile Include="Src\PTM\ptm_sprites.cpp" />
<ClCompile Include="Src\PTM\ptm_text_font.cpp" />
<ClCompile Include="Src\PTM\ptm_tile_system.cpp" />
<ClCompile Include="Src\Util\docgen.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
9 changes: 9 additions & 0 deletions v0.2b/PTM.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
<ClCompile Include="Src\PTM\ptm_mml.cpp">
<Filter>PTM</Filter>
</ClCompile>
<ClCompile Include="Src\Util\docgen.cpp">
<Filter>Util</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Src\Common\common.h">
Expand Down Expand Up @@ -154,6 +157,9 @@
<ClInclude Include="Src\PTM\ptm_mml.h">
<Filter>PTM</Filter>
</ClInclude>
<ClInclude Include="Src\Util\docgen.h">
<Filter>Util</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="CppUtils">
Expand All @@ -171,6 +177,9 @@
<Filter Include="Resources">
<UniqueIdentifier>{874d3363-3914-4234-8308-467ca70c840d}</UniqueIdentifier>
</Filter>
<Filter Include="Util">
<UniqueIdentifier>{29be0ea6-60b2-41e3-955d-e204b4bcdd13}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<Image Include="Resources\app_icon.ico">
Expand Down
89 changes: 89 additions & 0 deletions v0.2b/Src/Util/docgen.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#include "docgen.h"
#include "../CppUtils/CppUtils.h"
#include "../Common/common.h"
using namespace CppUtils;

#define DOCGEN_SRC_FILE "_DOCGEN/docgen_src.tsv"
#define DOCGEN_OUT_FILE "_DOCGEN/docgen_output.html"

struct t_doc_entry {
string cmd;
string params;
string description;
string category;
};
struct t_doc {
vector<t_doc_entry> entries;
};
struct t_html {
vector<string> lines;
void println(string line) {
lines.push_back(line);
}
};

t_doc docgen_parse_file()
{
t_doc doc;
auto lines = File::ReadLines(DOCGEN_SRC_FILE, "\n");
for (auto& line : lines) {
auto parts = String::Split(line, "\t", true);
t_doc_entry entry;
entry.cmd = parts[0];
entry.params = parts[1];
entry.description = parts[2];
entry.category = parts[3];
doc.entries.push_back(entry);
}
return doc;
}
void docgen_main()
{
t_html html;
t_doc doc = docgen_parse_file();

html.println("<html>");
html.println("<head>");
html.println("<link rel='stylesheet' href='style.css'>");
html.println("</head>");
html.println("<body>");

html.println("<div class='content'>");

html.println("<div class='title'>");
html.println("<h1>PTM v0.2b</h1>");
html.println("</div>");

for (auto& entry : doc.entries) {
html.println("<table class='entry'>");

html.println("<tr>");
html.println("<td class='cmd'>");
html.println(entry.cmd);
html.println("</td>");
html.println("<td class='params'>");
html.println(entry.params);
html.println("</td>");
html.println("</tr>");

html.println("<tr>");
html.println("<td class='description' colspan=2>");
html.println(entry.description);
html.println("</td>");
html.println("</tr>");

html.println("<tr>");
html.println("<td class='category' colspan=2>");
html.println("Category: " + entry.category);
html.println("</td>");
html.println("</tr>");

html.println("</table>");
}

html.println("</div>");
html.println("</body>");
html.println("</html>");

File::WriteLines(DOCGEN_OUT_FILE, html.lines, "\n");
}
3 changes: 3 additions & 0 deletions v0.2b/Src/Util/docgen.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#pragma once

void docgen_main();
6 changes: 6 additions & 0 deletions v0.2b/Src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#include "PTM/ptm_core.h"
#include "Util/docgen.h"

int main(int argc, char* argv[])
{
/*
docgen_main();
return 0;
*/

if (argc > 1) {
return ptm_run(argv[1]);
}
Expand Down

0 comments on commit 0da7700

Please sign in to comment.