working now
parent
4c79cf6808
commit
42a27d021b
|
@ -160,7 +160,10 @@ def process_errors(div):
|
|||
def process_seealso(div):
|
||||
if div is None:
|
||||
return []
|
||||
div = div.find('p').find_all('a')
|
||||
div = div.find('p')
|
||||
if div is None:
|
||||
return []
|
||||
div = div.find_all('a')
|
||||
|
||||
alsos = []
|
||||
for a in div:
|
||||
|
|
Binary file not shown.
|
@ -1,10 +1,10 @@
|
|||
# ninja log v5
|
||||
3 1437 1703269248001211383 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/string.cpp.o 7372d87554025941
|
||||
1 1319 1703313187097385701 CMakeFiles/gl_doc_generator.dir/src/main.cpp.o f2846e1dc111dd8
|
||||
2 3380 1703353050513441920 CMakeFiles/gl_doc_generator.dir/src/main.cpp.o f2846e1dc111dd8
|
||||
3 3035 1703269249601195503 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/system.cpp.o 6b34ee1aa4557b8
|
||||
4 6430 1703269252993161839 libraries/BLT/CMakeFiles/BLT.dir/src/blt/profiling/profiler_v2.cpp.o f7d76198a6666d0a
|
||||
3 4901 1703269251465177003 libraries/BLT/CMakeFiles/BLT.dir/src/blt/profiling/profiler.cpp.o 98c3613a268835f7
|
||||
1 505 1703313186281395730 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
2 7745 1703353054881368391 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
2 4864 1703269251429177360 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/format.cpp.o 86854dbc10b97205
|
||||
5 6828 1703269253393157869 libraries/BLT/CMakeFiles/BLT.dir/src/blt/parse/argparse.cpp.o c25a8a66b746b95f
|
||||
6829 6962 1703269253521156599 libraries/BLT/libBLT.a f5b601d9b774b003
|
||||
|
@ -12,13 +12,82 @@
|
|||
2 2026 1703269248589205547 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/loader.cpp.o c1e2cebc92cff5ff
|
||||
4 891 1703269247453216823 libraries/BLT/CMakeFiles/BLT.dir/src/blt/nbt/nbt_block.cpp.o c189cbf7574512a
|
||||
4 3961 1703269250525186332 libraries/BLT/CMakeFiles/BLT.dir/src/blt/nbt/nbt.cpp.o 439363bdbfdd4452
|
||||
1319 1357 1703313187133385258 gl_doc_generator 7126d327cf7747a5
|
||||
7745 7834 1703353054969366907 gl_doc_generator 7126d327cf7747a5
|
||||
1 1470 1703269248033211066 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/filesystem.cpp.o 1c0fd59b23c040f5
|
||||
1 2400 1703269248965201816 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/assert.cpp.o 8c3d34b2a042cd0c
|
||||
1 634 1703316313529228992 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
1 1475 1703316327113168829 CMakeFiles/gl_doc_generator.dir/src/main.cpp.o f2846e1dc111dd8
|
||||
1475 1531 1703316327169168575 gl_doc_generator 7126d327cf7747a5
|
||||
1 1448 1703316339001113988 CMakeFiles/gl_doc_generator.dir/src/main.cpp.o f2846e1dc111dd8
|
||||
1448 1500 1703316339049113762 gl_doc_generator 7126d327cf7747a5
|
||||
1 603 1703316356065031799 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
603 652 1703316356113031561 gl_doc_generator 7126d327cf7747a5
|
||||
2 7882 1703353456545697234 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
7882 7969 1703353456633694882 gl_doc_generator 7126d327cf7747a5
|
||||
1 7770 1703353812000823453 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
7770 7859 1703353812088821379 gl_doc_generator 7126d327cf7747a5
|
||||
3 7947 1703353852407876544 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
7947 8039 1703353852499874400 gl_doc_generator 7126d327cf7747a5
|
||||
2 7835 1703353899214791309 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
7835 7921 1703353899298789372 gl_doc_generator 7126d327cf7747a5
|
||||
2 8211 1703353936837927363 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
8211 8299 1703353936925925350 gl_doc_generator 7126d327cf7747a5
|
||||
2 7721 1703353972317118960 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
7721 7811 1703353972409116872 gl_doc_generator 7126d327cf7747a5
|
||||
2 7785 1703354088982498934 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
7785 7875 1703354089070496978 gl_doc_generator 7126d327cf7747a5
|
||||
2 7782 1703354119481822575 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
7782 7871 1703354119573820539 gl_doc_generator 7126d327cf7747a5
|
||||
1 7652 1703354172588652301 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
7652 7741 1703354172676650369 gl_doc_generator 7126d327cf7747a5
|
||||
2 8388 1703354219347629093 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
8388 8478 1703354219439627087 gl_doc_generator 7126d327cf7747a5
|
||||
3 7731 1703354256770814617 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
7732 7819 1703354256858812706 gl_doc_generator 7126d327cf7747a5
|
||||
2 7960 1703354288242132501 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
7960 8050 1703354288330130597 gl_doc_generator 7126d327cf7747a5
|
||||
2 7872 1703354314569563740 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
7872 7959 1703354314657561841 gl_doc_generator 7126d327cf7747a5
|
||||
2 3483 1703355098073116037 CMakeFiles/gl_doc_generator.dir/src/main.cpp.o f2846e1dc111dd8
|
||||
2 8854 1703355103445005159 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
8854 8943 1703355103533003342 gl_doc_generator 7126d327cf7747a5
|
||||
2 8857 1703355194647124741 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
8857 8970 1703355194759122434 gl_doc_generator 7126d327cf7747a5
|
||||
1 10123 1703355231838358972 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
10123 10229 1703355231942356831 gl_doc_generator 7126d327cf7747a5
|
||||
2 8857 1703355303164891819 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
8857 8948 1703355303256889928 gl_doc_generator 7126d327cf7747a5
|
||||
2 3776 1703355671948307462 CMakeFiles/gl_doc_generator.dir/src/main.cpp.o f2846e1dc111dd8
|
||||
3776 3863 1703355672032308032 gl_doc_generator 7126d327cf7747a5
|
||||
2 3717 1703355699140475710 CMakeFiles/gl_doc_generator.dir/src/main.cpp.o f2846e1dc111dd8
|
||||
3717 3803 1703355699224476180 gl_doc_generator 7126d327cf7747a5
|
||||
3 3723 1703355724856605984 CMakeFiles/gl_doc_generator.dir/src/main.cpp.o f2846e1dc111dd8
|
||||
3724 3809 1703355724940606365 gl_doc_generator 7126d327cf7747a5
|
||||
2 3705 1703355826332872325 CMakeFiles/gl_doc_generator.dir/src/main.cpp.o f2846e1dc111dd8
|
||||
3705 3791 1703355826416872394 gl_doc_generator 7126d327cf7747a5
|
||||
3 11502 1703359121098301556 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
2 4697 1703359332975585666 CMakeFiles/gl_doc_generator.dir/src/main.cpp.o f2846e1dc111dd8
|
||||
3 10886 1703359339163505482 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
10886 11014 1703359339291503823 gl_doc_generator 7126d327cf7747a5
|
||||
2 11207 1703359391998819148 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
11207 11335 1703359392126817482 gl_doc_generator 7126d327cf7747a5
|
||||
2 10801 1703359573617077113 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
10802 10935 1703359573749080040 gl_doc_generator 7126d327cf7747a5
|
||||
2 10717 1703359675831056203 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
10717 10835 1703359675947058147 gl_doc_generator 7126d327cf7747a5
|
||||
2 4992 1703359987206357503 CMakeFiles/gl_doc_generator.dir/src/main.cpp.o f2846e1dc111dd8
|
||||
3 11612 1703359993822393884 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
11612 11738 1703359993950394577 gl_doc_generator 7126d327cf7747a5
|
||||
2 11005 1703360158590971654 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
11005 11141 1703360158718971884 gl_doc_generator 7126d327cf7747a5
|
||||
2 11252 1703360243279060305 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
11252 11380 1703360243403060347 gl_doc_generator 7126d327cf7747a5
|
||||
2 4637 1703360309375049757 CMakeFiles/gl_doc_generator.dir/src/main.cpp.o f2846e1dc111dd8
|
||||
2 10921 1703360315655045477 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
10921 11063 1703360315799045372 gl_doc_generator 7126d327cf7747a5
|
||||
2 10267 1703360810045443703 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
1 4116 1703360818853398878 CMakeFiles/gl_doc_generator.dir/src/main.cpp.o f2846e1dc111dd8
|
||||
4116 4211 1703360818949398388 gl_doc_generator 7126d327cf7747a5
|
||||
2 9900 1703361190007220755 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
9900 10004 1703361190111220083 gl_doc_generator 7126d327cf7747a5
|
||||
2 4153 1703361518472988555 CMakeFiles/gl_doc_generator.dir/src/main.cpp.o f2846e1dc111dd8
|
||||
4153 4275 1703361518592987708 gl_doc_generator 7126d327cf7747a5
|
||||
2 4112 1703361529852908082 CMakeFiles/gl_doc_generator.dir/src/main.cpp.o f2846e1dc111dd8
|
||||
2 3913 1703361708772029328 CMakeFiles/gl_doc_generator.dir/src/main.cpp.o f2846e1dc111dd8
|
||||
2 9197 1703361714055826294 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||
9197 9285 1703361714143822928 gl_doc_generator 7126d327cf7747a5
|
||||
2 2121 1703363408342744474 CMakeFiles/gl_doc_generator.dir/src/main.cpp.o f2846e1dc111dd8
|
||||
2121 2208 1703363408430743349 gl_doc_generator 7126d327cf7747a5
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,3 +1,3 @@
|
|||
Start testing: Dec 23 02:25 EST
|
||||
Start testing: Dec 23 18:49 EST
|
||||
----------------------------------------------------------
|
||||
End testing: Dec 23 02:25 EST
|
||||
End testing: Dec 23 18:49 EST
|
||||
|
|
Binary file not shown.
|
@ -160,7 +160,10 @@ def process_errors(div):
|
|||
def process_seealso(div):
|
||||
if div is None:
|
||||
return []
|
||||
div = div.find('p').find_all('a')
|
||||
div = div.find('p')
|
||||
if div is None:
|
||||
return []
|
||||
div = div.find_all('a')
|
||||
|
||||
alsos = []
|
||||
for a in div:
|
||||
|
|
|
@ -160,7 +160,10 @@ def process_errors(div):
|
|||
def process_seealso(div):
|
||||
if div is None:
|
||||
return []
|
||||
div = div.find('p').find_all('a')
|
||||
div = div.find('p')
|
||||
if div is None:
|
||||
return []
|
||||
div = div.find_all('a')
|
||||
|
||||
alsos = []
|
||||
for a in div:
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -160,7 +160,10 @@ def process_errors(div):
|
|||
def process_seealso(div):
|
||||
if div is None:
|
||||
return []
|
||||
div = div.find('p').find_all('a')
|
||||
div = div.find('p')
|
||||
if div is None:
|
||||
return []
|
||||
div = div.find_all('a')
|
||||
|
||||
alsos = []
|
||||
for a in div:
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "load_file.h"
|
||||
#include <blt/std/loader.h>
|
||||
#include <regex>
|
||||
#include <utility>
|
||||
|
||||
namespace blt
|
||||
{
|
||||
|
@ -139,29 +140,165 @@ namespace blt
|
|||
break;
|
||||
}
|
||||
}
|
||||
std::string finished;
|
||||
for (auto& v : partial_blocks)
|
||||
{
|
||||
finished += v.parsed;
|
||||
auto p = found_docs.find(v.waiting_for);
|
||||
if (p != found_docs.end())
|
||||
{
|
||||
BLT_TRACE0_STREAM << "I was able to find the docs for " << v.waiting_for << "\n";
|
||||
finished += strip_codes(std::string(p->second), v.waiting_for);
|
||||
} else
|
||||
{
|
||||
BLT_TRACE1_STREAM << "I was unable to find the docs for " << v.waiting_for << "\n";
|
||||
finished += "// Unable to find the docs for this function!\n";
|
||||
notfound.insert(v.waiting_for);
|
||||
BLT_WARN("Unable to find docs for function '%s'", v.waiting_for.c_str());
|
||||
}
|
||||
}
|
||||
finished += parsed;
|
||||
parsed = std::move(finished);
|
||||
// BLT_DEBUG("Finished in state %d", (int) state);
|
||||
//BLT_DEBUG("With data %s", parsed.c_str());
|
||||
for (auto& v : notfound)
|
||||
{
|
||||
BLT_WARN("Unable to find docs for function '%s'", v.c_str());
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
void parser::process_gl_func(std::string_view func_name)
|
||||
{
|
||||
// std::string reference_link = "https://registry.khronos.org/OpenGL-Refpages/gl4/html/";
|
||||
// reference_link.reserve(func_name.length() + 6);
|
||||
// reference_link += func_name;
|
||||
// reference_link += ".xhtml";
|
||||
// auto pid = popen(pythonPath + " " + generatorPath + " " + reference_link, "r");
|
||||
// BLT_INFO("Running on function %s", std::string(func_name).c_str());
|
||||
std::cout << std::string(func_name) << std::endl;
|
||||
auto p = found_docs.find(std::string(func_name));
|
||||
if (p != found_docs.end())
|
||||
{
|
||||
BLT_TRACE("Using cached docs!");
|
||||
parsed += p->second;
|
||||
return;
|
||||
}
|
||||
std::string reference_link = "https://registry.khronos.org/OpenGL-Refpages/gl4/html/";
|
||||
reference_link.reserve(func_name.length() + 6);
|
||||
reference_link += strip_func(func_name);
|
||||
reference_link += ".xhtml";
|
||||
std::string command = pythonPath + " " + generatorPath + " " + reference_link;
|
||||
auto pFile = popen(command.c_str(), "r");
|
||||
|
||||
std::string doc;
|
||||
char buf[4096];
|
||||
size_t readn;
|
||||
while ((readn = fread(buf, 1, sizeof(buf), pFile)) > 0)
|
||||
doc += std::string(buf, readn);
|
||||
|
||||
pclose(pFile);
|
||||
|
||||
blt::string::trim(doc);
|
||||
// no way for a proper generated doc to be this small
|
||||
const std::string NULL_STR = "NULL";
|
||||
if (doc.length() <= NULL_STR.length() * 2)
|
||||
{
|
||||
partial_blocks.emplace_back(parsed, std::string(func_name));
|
||||
parsed.clear();
|
||||
BLT_DEBUG("Failed to find function '%s'", std::string(func_name).c_str());
|
||||
return;
|
||||
}
|
||||
strip_extras(doc);
|
||||
|
||||
BLT_INFO("Running on function %s", std::string(func_name).c_str());
|
||||
|
||||
doc_string_storage.push_back(std::move(doc));
|
||||
auto& doc_ref = doc_string_storage.back();
|
||||
|
||||
size_t search = doc_ref.find("@code");
|
||||
while (search != std::string::npos)
|
||||
{
|
||||
// skip through @code
|
||||
search += 5;
|
||||
// skip through spaces
|
||||
while (search < doc_ref.size() && std::isspace(doc_ref[search]))
|
||||
search++;
|
||||
// then through the first identifier
|
||||
while (search < doc_ref.size() && is_ident(doc_ref[search]))
|
||||
search++;
|
||||
// then more space
|
||||
while (search < doc_ref.size() && std::isspace(doc_ref[search]))
|
||||
search++;
|
||||
|
||||
auto s2 = doc_ref.find('(', search);
|
||||
auto var = doc_ref.substr(search, s2 - search);
|
||||
BLT_TRACE("Found docs for function '%s'", var.c_str());
|
||||
|
||||
found_docs.insert({var, std::string_view(doc_ref.data(), doc_ref.size())});
|
||||
|
||||
search = doc_ref.find("@code", search);
|
||||
}
|
||||
|
||||
parsed += strip_codes(doc_ref, std::string(func_name));
|
||||
|
||||
//BLT_INFO("Docs: %s", doc_ref.c_str());
|
||||
}
|
||||
|
||||
std::string parser::strip_func(std::string_view func)
|
||||
{
|
||||
std::string f(func);
|
||||
|
||||
std::regex matrx(R"(((Matrix)(\d|\w)+)|(\d|I|L)+(i|u|f|d|v|s|N|b|I)+)");
|
||||
std::regex matrx(R"(((Matrix)(\d|\w)+)|\d+(i|u|f|d|v|s|N|b|I|^(Is))+)");
|
||||
|
||||
return f;
|
||||
return std::regex_replace(f, matrx, "");
|
||||
}
|
||||
|
||||
std::string parser::strip_codes(const std::string& str, const std::string& func_name)
|
||||
{
|
||||
static volatile bool b = true;
|
||||
if (b)
|
||||
return str;
|
||||
std::string new_str;
|
||||
|
||||
auto lines = blt::string::split(str, '\n');
|
||||
for (auto& line : lines)
|
||||
{
|
||||
blt::string::trim(line);
|
||||
if (line.empty())
|
||||
continue;
|
||||
if (blt::string::contains(line, "@code") && !blt::string::contains(line, func_name + "("))
|
||||
continue;
|
||||
new_str += line += '\n';
|
||||
}
|
||||
|
||||
|
||||
return new_str;
|
||||
}
|
||||
|
||||
void parser::strip_extras(std::string& str) const
|
||||
{
|
||||
std::string new_str;
|
||||
|
||||
auto lines = blt::string::split(str, '\n');
|
||||
for (size_t i = 0; i < lines.size(); i++)
|
||||
{
|
||||
auto& line = lines[i];
|
||||
blt::string::trim(line);
|
||||
if (line.empty())
|
||||
continue;
|
||||
if (clear_see_also && blt::string::contains(line, "@see"))
|
||||
continue;
|
||||
if (clear_desc && blt::string::contains(line, "@description"))
|
||||
{
|
||||
while (i < lines.size())
|
||||
{
|
||||
if (lines[i] == " * ")
|
||||
break;
|
||||
i++;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
new_str += line += '\n';
|
||||
}
|
||||
|
||||
str = new_str;
|
||||
}
|
||||
|
||||
partial_container::partial_container(std::string parsed, std::string waitingFor): parsed(std::move(parsed)), waiting_for(std::move(waitingFor))
|
||||
{}
|
||||
}
|
|
@ -23,6 +23,7 @@
|
|||
#include <string_view>
|
||||
#include <blt/std/logging.h>
|
||||
#include <cctype>
|
||||
#include <blt/std/hashmap.h>
|
||||
|
||||
namespace blt
|
||||
{
|
||||
|
@ -36,16 +37,22 @@ namespace blt
|
|||
FUNCTION // myfunctioname(
|
||||
};
|
||||
|
||||
struct state_container
|
||||
struct partial_container
|
||||
{
|
||||
std::string full_data; // the entire parsed string
|
||||
std::string_view data; // a view into full_data containing relevant data (GL function name)
|
||||
state_type type; // the type of data stored
|
||||
// the complete previous block of data we parsed through
|
||||
std::string parsed;
|
||||
// the function documentation we are waiting for
|
||||
std::string waiting_for;
|
||||
// the next block will contain the actual function definition
|
||||
partial_container(std::string parsed, std::string waitingFor);
|
||||
};
|
||||
|
||||
class parser
|
||||
{
|
||||
private:
|
||||
bool clear_see_also = false;
|
||||
bool clear_desc = false;
|
||||
bool brief = false;
|
||||
std::string path;
|
||||
std::string file;
|
||||
std::string data;
|
||||
|
@ -54,7 +61,16 @@ namespace blt
|
|||
std::string pythonPath;
|
||||
std::string generatorPath;
|
||||
state_type state = state_type::OTHER;
|
||||
std::vector<state_container> parsed_tokens;
|
||||
|
||||
// holds the owning memory for the comment strings
|
||||
std::vector<std::string> doc_string_storage;
|
||||
// holds a mapping between all param names and a corresponding string_view to a string stored in doc_string_storage containing the doc
|
||||
HASHMAP<std::string, std::string_view> found_docs;
|
||||
|
||||
// list of partially compiled blocks we will need to loop through
|
||||
std::vector<partial_container> partial_blocks;
|
||||
// list of not found docs. useful for debug.
|
||||
HASHSET<std::string> notfound;
|
||||
|
||||
inline void reset()
|
||||
{
|
||||
|
@ -73,12 +89,17 @@ namespace blt
|
|||
return std::isalnum(c) || c == '_';
|
||||
}
|
||||
|
||||
std::string strip_func(std::string_view func);
|
||||
static std::string strip_func(std::string_view func);
|
||||
|
||||
void strip_extras(std::string& str) const;
|
||||
|
||||
static std::string strip_codes(const std::string& str, const std::string& func_name);
|
||||
|
||||
void process_gl_func(std::string_view func_name);
|
||||
|
||||
public:
|
||||
explicit parser(std::string_view path, std::string_view pythonPath, std::string_view generatorPath):
|
||||
path(path), pythonPath(pythonPath), generatorPath(generatorPath)
|
||||
explicit parser(std::string_view path, std::string_view pythonPath, std::string_view generatorPath, bool seeAlso, bool desc, bool brief):
|
||||
clear_see_also(seeAlso), clear_desc(desc), brief(brief), path(path), pythonPath(pythonPath), generatorPath(generatorPath)
|
||||
{}
|
||||
|
||||
parser& load_file();
|
||||
|
|
46
src/main.cpp
46
src/main.cpp
|
@ -1,10 +1,14 @@
|
|||
#include <iostream>
|
||||
#include <blt/parse/argparse.h>
|
||||
#include <blt/std/logging.h>
|
||||
#include <fstream>
|
||||
#include "load_file.h"
|
||||
|
||||
#include "../gl_doc.h"
|
||||
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
glBindBuffer(50, 10);
|
||||
blt::arg_parse parser;
|
||||
|
||||
parser.addArgument(blt::arg_builder("--generator").setAction(blt::arg_action_t::STORE).setDefault("./gl_doc_generator.py")
|
||||
|
@ -14,6 +18,15 @@ int main(int argc, const char** argv)
|
|||
.setHelp("Path / command to execute python with")
|
||||
.setNArgs(1).build());
|
||||
|
||||
parser.addArgument(blt::arg_builder("--output", "-o").setAction(blt::arg_action_t::STORE)
|
||||
.setHelp("set the output file to write to. Defaults to $(gl_file)_doc.$(ext)").setNArgs(1)
|
||||
.build());
|
||||
|
||||
parser.addArgument(blt::arg_builder("--no-see", "-s").setAction(blt::arg_action_t::STORE_TRUE).setHelp("Don't include see also").build());
|
||||
parser.addArgument(blt::arg_builder("--no-desc", "-d").setAction(blt::arg_action_t::STORE_TRUE).setHelp("Don't include description").build());
|
||||
parser.addArgument(
|
||||
blt::arg_builder("--brief", "-b").setAction(blt::arg_action_t::STORE_TRUE).setHelp("Make the comments as short as possible").build());
|
||||
|
||||
parser.addArgument(blt::arg_builder("gl_file").setAction(blt::arg_action_t::STORE).setHelp("OpenGL header file to put the docs into").setNArgs(1)
|
||||
.setRequired().build());
|
||||
|
||||
|
@ -23,12 +36,41 @@ int main(int argc, const char** argv)
|
|||
auto pythonPath = args.get<std::string>("python");
|
||||
auto filePath = args.get<std::string>("gl_file");
|
||||
|
||||
BLT_INFO("Using %s on file %s", generatorPath.c_str(), filePath.c_str());
|
||||
std::string outputFilePath;
|
||||
if (args.contains("output"))
|
||||
{
|
||||
outputFilePath = args.get<std::string>("output");
|
||||
} else
|
||||
{
|
||||
auto exts = blt::string::split(filePath, '.');
|
||||
if (blt::string::contains(filePath, '.'))
|
||||
{
|
||||
// cancer
|
||||
for (size_t i = 0; i < exts.size() - 1; i++)
|
||||
{
|
||||
outputFilePath += exts[i];
|
||||
if (i != exts.size() - 2)
|
||||
outputFilePath += '.';
|
||||
}
|
||||
outputFilePath += "_doc.";
|
||||
outputFilePath += exts[exts.size() - 1];
|
||||
} else
|
||||
{
|
||||
outputFilePath += filePath += "_doc";
|
||||
}
|
||||
}
|
||||
|
||||
blt::parser file_parser(filePath, pythonPath, generatorPath);
|
||||
BLT_INFO("Using '%s' on file '%s' output to '%s'", generatorPath.c_str(), filePath.c_str(), outputFilePath.c_str());
|
||||
|
||||
blt::parser file_parser(filePath, pythonPath, generatorPath, args.contains("no-see"), args.contains("no-desc"), args.contains("brief"));
|
||||
file_parser.load_file().parse();
|
||||
auto vec = file_parser.get();
|
||||
|
||||
std::ofstream output(outputFilePath);
|
||||
|
||||
output << vec;
|
||||
output.flush();
|
||||
output.close();
|
||||
//BLT_DEBUG("Result:\n%s", vec.c_str());
|
||||
|
||||
return 0;
|
||||
|
|
3
test.h
3
test.h
|
@ -28,6 +28,9 @@ int ident = 0;
|
|||
// TODO:
|
||||
typedef void (*glCopyTextureSubImage3D)(int n, const int * pipelines);
|
||||
|
||||
#define glUniform1d glad_glUniform1d
|
||||
|
||||
#define glUniform glad_glUniform1d
|
||||
|
||||
void glDrawTransformFeedbackStream()
|
||||
{
|
||||
|
|
|
@ -0,0 +1,187 @@
|
|||
/*
|
||||
* <Short Description>
|
||||
* Copyright (C) 2023 Brett Terpstra
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* comment */
|
||||
|
||||
#ifndef GL_DOC_GENERATOR_TEST_H
|
||||
#define GL_DOC_GENERATOR_TEST_H
|
||||
|
||||
/**
|
||||
* @name glDrawTransformFeedbackStream - render primitives using a count derived from a specifed stream of a transform feedback object
|
||||
* @usage
|
||||
* @code void glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream); @endcode
|
||||
* @param mode Specifies what kind of primitives to render. Symbolic constants <b>GL_POINTS</b>, <b>GL_LINE_STRIP</b>, <b>GL_LINE_LOOP</b>,
|
||||
* <b>GL_LINES</b>, <b>GL_LINE_STRIP_ADJACENCY</b>, <b>GL_LINES_ADJACENCY</b>, <b>GL_TRIANGLE_STRIP</b>, <b>GL_TRIANGLE_FAN</b>,
|
||||
* <b>GL_TRIANGLES</b>, <b>GL_TRIANGLE_STRIP_ADJACENCY</b>, <b>GL_TRIANGLES_ADJACENCY</b>, and <b>GL_PATCHES</b>
|
||||
* are accepted.
|
||||
* @param id Specifies the name of a transform feedback object from which to retrieve a primitive count.
|
||||
* @param stream Specifies the index of the transform feedback stream from which to retrieve a primitive count.
|
||||
*
|
||||
* @errors GL_INVALID_ENUM is generated if mode is not an accepted value.
|
||||
* @errors GL_INVALID_VALUE is generated if id is not the name of a transform feedback object.
|
||||
* @errors GL_INVALID_VALUE is generated if stream is greater than or equal to the value of GL_MAX_VERTEX_STREAMS.
|
||||
* @errors GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to an enabled array and the buffer object's
|
||||
* data store is currently mapped.
|
||||
* @errors GL_INVALID_OPERATION is generated if a geometry shader is active and mode is incompatible with the input primitive type
|
||||
* of the geometry shader in the currently installed program object.
|
||||
* @errors GL_INVALID_OPERATION is generated if mode is GL_PATCHES and no tessellation control shader is active.
|
||||
* @errors GL_INVALID_OPERATION is generated if glEndTransformFeedback has never been called while the transform feedback object named
|
||||
* by id was bound.
|
||||
*
|
||||
*/
|
||||
#define glDrawTransformFeedbackStream glad_glDrawTransformFeedbackStream
|
||||
|
||||
int ident = 0;
|
||||
|
||||
// TODO:
|
||||
typedef void (*glCopyTextureSubImage3D)(int n, const int * pipelines);
|
||||
|
||||
/**
|
||||
* @name glUniform - Specify the value of a uniform variable for the current program object
|
||||
* @usage
|
||||
* @param location Specifies the location of the uniform variable to be modified.
|
||||
* @param count For the vector (<b>glUniform*v</b>) commands, specifies the number of elements that are to be modified. This should be 1
|
||||
* if the targeted uniform variable is not an array, and 1 or more if it is an array.
|
||||
* @param transpose For the matrix commands, specifies whether to transpose the matrix as the values are loaded into the uniform variable.
|
||||
* @param v0, v1, v2, v3 For the scalar commands, specifies the new values to be used for the specified uniform variable.
|
||||
* @param value For the vector and matrix commands, specifies a pointer to an array of <em class="parameter"><b>count</b></em> values that
|
||||
* will be used to update the specified uniform variable.
|
||||
* @note glUniform1i and glUniform1iv are the only two functions that may be used to load uniform variables defined as sampler types.
|
||||
* Loading samplers with any other function will result in a GL_INVALID_OPERATION error.
|
||||
* @note If count is greater than 1 and the indicated uniform variable is not an array, a GL_INVALID_OPERATION error is generated
|
||||
* and the specified uniform variable will remain unchanged.
|
||||
* @note Other than the preceding exceptions, if the type and size of the uniform variable as defined in the shader do not match
|
||||
* the type and size specified in the name of the command used to load its value, a GL_INVALID_OPERATION error will be generated
|
||||
* and the specified uniform variable will remain unchanged.
|
||||
* @note If location is a value other than -1 and it does not represent a valid uniform variable location in the current program
|
||||
* object, an error will be generated, and no changes will be made to the uniform variable storage of the current program object.
|
||||
* If location is equal to -1, the data passed in will be silently ignored and the specified uniform variable will not
|
||||
* be changed.
|
||||
*
|
||||
* @errors GL_INVALID_OPERATION is generated if there is no current program object.
|
||||
* @errors GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated
|
||||
* by the glUniform command.
|
||||
* @errors GL_INVALID_OPERATION is generated if one of the signed or unsigned integer variants of this function is used to load a uniform
|
||||
* variable of type float, vec2, vec3, vec4, or an array of these, or if one of the floating-point variants of this
|
||||
* function is used to load a uniform variable of type int, ivec2, ivec3, ivec4, unsigned int, uvec2, uvec3, uvec4, or an array
|
||||
* of these.
|
||||
* @errors GL_INVALID_OPERATION is generated if one of the signed integer variants of this function is used to load a uniform variable
|
||||
* of type unsigned int, uvec2, uvec3, uvec4, or an array of these.
|
||||
* @errors GL_INVALID_OPERATION is generated if one of the unsigned integer variants of this function is used to load a uniform variable
|
||||
* of type int, ivec2, ivec3, ivec4, or an array of these.
|
||||
* @errors GL_INVALID_OPERATION is generated if location is an invalid uniform location for the current program object and location
|
||||
* is not equal to -1.
|
||||
* @errors GL_INVALID_VALUE is generated if count is less than 0.
|
||||
* @errors GL_INVALID_OPERATION is generated if count is greater than 1 and the indicated uniform variable is not an array variable.
|
||||
* @errors GL_INVALID_OPERATION is generated if a sampler is loaded using a command other than glUniform1i and glUniform1iv.
|
||||
*
|
||||
*/
|
||||
#define glUniform1d glad_glUniform1d
|
||||
|
||||
/**
|
||||
* @name glUniform - Specify the value of a uniform variable for the current program object
|
||||
* @usage
|
||||
* @param location Specifies the location of the uniform variable to be modified.
|
||||
* @param count For the vector (<b>glUniform*v</b>) commands, specifies the number of elements that are to be modified. This should be 1
|
||||
* if the targeted uniform variable is not an array, and 1 or more if it is an array.
|
||||
* @param transpose For the matrix commands, specifies whether to transpose the matrix as the values are loaded into the uniform variable.
|
||||
* @param v0, v1, v2, v3 For the scalar commands, specifies the new values to be used for the specified uniform variable.
|
||||
* @param value For the vector and matrix commands, specifies a pointer to an array of <em class="parameter"><b>count</b></em> values that
|
||||
* will be used to update the specified uniform variable.
|
||||
* @note glUniform1i and glUniform1iv are the only two functions that may be used to load uniform variables defined as sampler types.
|
||||
* Loading samplers with any other function will result in a GL_INVALID_OPERATION error.
|
||||
* @note If count is greater than 1 and the indicated uniform variable is not an array, a GL_INVALID_OPERATION error is generated
|
||||
* and the specified uniform variable will remain unchanged.
|
||||
* @note Other than the preceding exceptions, if the type and size of the uniform variable as defined in the shader do not match
|
||||
* the type and size specified in the name of the command used to load its value, a GL_INVALID_OPERATION error will be generated
|
||||
* and the specified uniform variable will remain unchanged.
|
||||
* @note If location is a value other than -1 and it does not represent a valid uniform variable location in the current program
|
||||
* object, an error will be generated, and no changes will be made to the uniform variable storage of the current program object.
|
||||
* If location is equal to -1, the data passed in will be silently ignored and the specified uniform variable will not
|
||||
* be changed.
|
||||
*
|
||||
* @errors GL_INVALID_OPERATION is generated if there is no current program object.
|
||||
* @errors GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated
|
||||
* by the glUniform command.
|
||||
* @errors GL_INVALID_OPERATION is generated if one of the signed or unsigned integer variants of this function is used to load a uniform
|
||||
* variable of type float, vec2, vec3, vec4, or an array of these, or if one of the floating-point variants of this
|
||||
* function is used to load a uniform variable of type int, ivec2, ivec3, ivec4, unsigned int, uvec2, uvec3, uvec4, or an array
|
||||
* of these.
|
||||
* @errors GL_INVALID_OPERATION is generated if one of the signed integer variants of this function is used to load a uniform variable
|
||||
* of type unsigned int, uvec2, uvec3, uvec4, or an array of these.
|
||||
* @errors GL_INVALID_OPERATION is generated if one of the unsigned integer variants of this function is used to load a uniform variable
|
||||
* of type int, ivec2, ivec3, ivec4, or an array of these.
|
||||
* @errors GL_INVALID_OPERATION is generated if location is an invalid uniform location for the current program object and location
|
||||
* is not equal to -1.
|
||||
* @errors GL_INVALID_VALUE is generated if count is less than 0.
|
||||
* @errors GL_INVALID_OPERATION is generated if count is greater than 1 and the indicated uniform variable is not an array variable.
|
||||
* @errors GL_INVALID_OPERATION is generated if a sampler is loaded using a command other than glUniform1i and glUniform1iv.
|
||||
*
|
||||
*/
|
||||
#define glUniform glad_glUniform1d
|
||||
|
||||
/**
|
||||
* @name glDrawTransformFeedbackStream - render primitives using a count derived from a specifed stream of a transform feedback object
|
||||
* @usage
|
||||
* @code void glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream); @endcode
|
||||
* @param mode Specifies what kind of primitives to render. Symbolic constants <b>GL_POINTS</b>, <b>GL_LINE_STRIP</b>, <b>GL_LINE_LOOP</b>,
|
||||
* <b>GL_LINES</b>, <b>GL_LINE_STRIP_ADJACENCY</b>, <b>GL_LINES_ADJACENCY</b>, <b>GL_TRIANGLE_STRIP</b>, <b>GL_TRIANGLE_FAN</b>,
|
||||
* <b>GL_TRIANGLES</b>, <b>GL_TRIANGLE_STRIP_ADJACENCY</b>, <b>GL_TRIANGLES_ADJACENCY</b>, and <b>GL_PATCHES</b>
|
||||
* are accepted.
|
||||
* @param id Specifies the name of a transform feedback object from which to retrieve a primitive count.
|
||||
* @param stream Specifies the index of the transform feedback stream from which to retrieve a primitive count.
|
||||
*
|
||||
* @errors GL_INVALID_ENUM is generated if mode is not an accepted value.
|
||||
* @errors GL_INVALID_VALUE is generated if id is not the name of a transform feedback object.
|
||||
* @errors GL_INVALID_VALUE is generated if stream is greater than or equal to the value of GL_MAX_VERTEX_STREAMS.
|
||||
* @errors GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to an enabled array and the buffer object's
|
||||
* data store is currently mapped.
|
||||
* @errors GL_INVALID_OPERATION is generated if a geometry shader is active and mode is incompatible with the input primitive type
|
||||
* of the geometry shader in the currently installed program object.
|
||||
* @errors GL_INVALID_OPERATION is generated if mode is GL_PATCHES and no tessellation control shader is active.
|
||||
* @errors GL_INVALID_OPERATION is generated if glEndTransformFeedback has never been called while the transform feedback object named
|
||||
* by id was bound.
|
||||
*
|
||||
*/
|
||||
void glDrawTransformFeedbackStream()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void func1()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
|
||||
func2
|
||||
|
||||
()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void func3
|
||||
()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endif //GL_DOC_GENERATOR_TEST_H
|
Loading…
Reference in New Issue