process functions, need to add python script next

main
Brett 2023-12-23 01:23:08 -05:00
parent 41441ba0a1
commit 033068ff74
8 changed files with 126 additions and 22 deletions

Binary file not shown.

View File

@ -27,3 +27,68 @@
523 565 1703299995223475188 gl_doc_generator 7126d327cf7747a5 523 565 1703299995223475188 gl_doc_generator 7126d327cf7747a5
1 528 1703300016059800637 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25 1 528 1703300016059800637 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
528 566 1703300016095801169 gl_doc_generator 7126d327cf7747a5 528 566 1703300016095801169 gl_doc_generator 7126d327cf7747a5
2 517 1703310567873168039 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
2 1321 1703310568677158438 CMakeFiles/gl_doc_generator.dir/src/main.cpp.o f2846e1dc111dd8
1321 1357 1703310568713158009 gl_doc_generator 7126d327cf7747a5
1 502 1703311348035650648 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
502 539 1703311348071650203 gl_doc_generator 7126d327cf7747a5
0 504 1703311392543100518 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
504 538 1703311392579100073 gl_doc_generator 7126d327cf7747a5
1 512 1703311407042921199 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
512 552 1703311407078920754 gl_doc_generator 7126d327cf7747a5
1 511 1703311428046661372 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
511 546 1703311428078660975 gl_doc_generator 7126d327cf7747a5
1 477 1703311480934006756 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
478 514 1703311480970006310 gl_doc_generator 7126d327cf7747a5
0 540 1703311516285568914 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
540 578 1703311516321568468 gl_doc_generator 7126d327cf7747a5
1 477 1703311721775020226 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
477 514 1703311721811019778 gl_doc_generator 7126d327cf7747a5
2 504 1703311739758796925 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
504 542 1703311739798796428 gl_doc_generator 7126d327cf7747a5
2 487 1703311756414590085 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
487 522 1703311756446589687 gl_doc_generator 7126d327cf7747a5
2 503 1703311797742114758 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
503 539 1703311797778114345 gl_doc_generator 7126d327cf7747a5
1 473 1703311814637921052 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
473 509 1703311814673920637 gl_doc_generator 7126d327cf7747a5
2 503 1703311830625737303 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
503 539 1703311830661736890 gl_doc_generator 7126d327cf7747a5
2 486 1703311842329602524 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
486 522 1703311842365602110 gl_doc_generator 7126d327cf7747a5
1 502 1703311864213349927 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
502 540 1703311864253349465 gl_doc_generator 7126d327cf7747a5
2 484 1703311876481207999 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
484 520 1703311876517207582 gl_doc_generator 7126d327cf7747a5
1 497 1703311898840948731 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
497 533 1703311898876948313 gl_doc_generator 7126d327cf7747a5
1 532 1703311942400441603 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
532 566 1703311942432441229 gl_doc_generator 7126d327cf7747a5
1 512 1703311976096047572 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
512 548 1703311976132047151 gl_doc_generator 7126d327cf7747a5
1 490 1703311988163906105 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
490 523 1703311988195905730 gl_doc_generator 7126d327cf7747a5
1 569 1703312010271646502 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
569 616 1703312010319645938 gl_doc_generator 7126d327cf7747a5
1 485 1703312059543065912 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
485 520 1703312059575065534 gl_doc_generator 7126d327cf7747a5
1 488 1703312068326962126 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
488 522 1703312068362961701 gl_doc_generator 7126d327cf7747a5
1 481 1703312136238157131 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
481 516 1703312136270156751 gl_doc_generator 7126d327cf7747a5
0 486 1703312190901506099 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
486 521 1703312190937505669 gl_doc_generator 7126d327cf7747a5
1 487 1703312215757209248 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
487 523 1703312215793208818 gl_doc_generator 7126d327cf7747a5
1 504 1703312277440470542 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
504 538 1703312277476470111 gl_doc_generator 7126d327cf7747a5
1 469 1703312387731143303 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
469 503 1703312387763142918 gl_doc_generator 7126d327cf7747a5
0 463 1703312412602843024 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
463 496 1703312412634842636 gl_doc_generator 7126d327cf7747a5
1 497 1703312444138461824 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
497 532 1703312444170461437 gl_doc_generator 7126d327cf7747a5
1 475 1703312462394240923 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
475 510 1703312462430240488 gl_doc_generator 7126d327cf7747a5
1 502 1703312506333708595 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
502 537 1703312506365708207 gl_doc_generator 7126d327cf7747a5

View File

@ -1,3 +1,3 @@
Start testing: Dec 22 21:53 EST Start testing: Dec 23 01:22 EST
---------------------------------------------------------- ----------------------------------------------------------
End testing: Dec 22 21:53 EST End testing: Dec 23 01:22 EST

Binary file not shown.

View File

@ -59,7 +59,7 @@ namespace blt
continue; continue;
} }
BLT_TRACE("We have '%c' with '%s' at index %d state %d", c, data.c_str(), index, state); //BLT_TRACE("We have '%c' with '%s' at index %d state %d", c, data.c_str(), index, state);
switch (state) switch (state)
{ {
@ -74,14 +74,14 @@ namespace blt
auto s3 = full_data.find(' ', s2); auto s3 = full_data.find(' ', s2);
if (s3 == std::string_view::npos) if (s3 == std::string_view::npos)
s3 = full_data.size(); s3 = full_data.size();
if (blt::string::starts_with(full_data, "#define")) if (blt::string::starts_with(full_data, "#define gl"))
process_gl_func(std::string_view(&full_data[s1], s3 - s1)); process_gl_func(std::string_view(&full_data[s1], s3 - s1));
reset(); reset();
} else if (c == '\n') } else if (c == '\n')
last = false; last = false;
else if (c == '\\') else if (c == '\\')
last = true; last = true;
else if (!(std::isalpha(c) || c == '_' || std::isspace(c))) else if (!(is_ident(c) || std::isspace(c)))
reset(); reset();
break; break;
case state_type::IDENTIFIER: case state_type::IDENTIFIER:
@ -89,35 +89,51 @@ namespace blt
state = state_type::FUNCTION; state = state_type::FUNCTION;
else if (std::isspace(c)) else if (std::isspace(c))
state = state_type::POSSIBLE_FUNC; state = state_type::POSSIBLE_FUNC;
else if (!(std::isalnum(c) || c == '_')) else if (!is_ident(c))
reset(); reset();
break; break;
case state_type::POSSIBLE_FUNC: case state_type::POSSIBLE_FUNC:
if (c == '(') if (c == '(')
state = state_type::POSSIBLE_FUNC; state = state_type::FUNCTION;
else if (!std::isspace(c)) else if (!std::isspace(c))
{
if (is_ident(c))
state = state_type::FUNCTION;
else
reset(); reset();
}
break; break;
case state_type::FUNCTION: case state_type::FUNCTION:
if (c == '{') if (c == ')')
{ {
// state = state_type::OTHER; // Jacob if you're actually reading this, this is all ugly & hacky code :3
// state_container con; // please dm that you've read to here <3
// con.type = state_type::FUNCTION; // enjoy trying to understand it.
// con.full_data = data; auto end = data.find('(') - 1;
// data = ""; // gotta remove whitespace
// con.data = std::string_view(con.full_data.data(), con.full_data.find('(')); while (end > 0 && std::isspace(data[end]))
BLT_DEBUG(data); end--;
// end isn't inclusive
end+=1;
// begin is
auto begin = end - 1;
while (begin > 0 && is_ident(data[begin]))
begin--;
// skip the ws
begin += 1;
auto sv = std::string_view(&data[begin], end - begin);
if (blt::string::starts_with(sv, "gl"))
process_gl_func(sv);
reset(); reset();
} else if (!(c == ')' || std::isalnum(c) || c == ',' || std::isblank(c))) } else if (!(c == '(' || is_ident(c) || c == ',' || std::isspace(c)))
reset(); reset();
break; break;
case state_type::OTHER: case state_type::OTHER:
if (c == '#') if (c == '#')
state = state_type::PREPROCESSOR_DEFINE; state = state_type::PREPROCESSOR_DEFINE;
else if (c == '\n') else if (std::isspace(c))
reset(); reset();
else if (data.size() <= 1 && (std::isalpha(c) || c == '_')) else if (data.size() <= 1 && is_ident_b(c))
state = state_type::IDENTIFIER; state = state_type::IDENTIFIER;
break; break;
} }

View File

@ -22,6 +22,7 @@
#include <string> #include <string>
#include <string_view> #include <string_view>
#include <blt/std/logging.h> #include <blt/std/logging.h>
#include <cctype>
namespace blt namespace blt
{ {
@ -59,6 +60,16 @@ namespace blt
data.clear(); data.clear();
} }
inline static bool is_ident_b(char c)
{
return std::isalpha(c) || c == '_';
}
inline static bool is_ident(char c)
{
return std::isalnum(c) || c == '_';
}
void process_gl_func(std::string_view func_name); void process_gl_func(std::string_view func_name);
public: public:

18
test.h
View File

@ -25,17 +25,29 @@
int ident = 0; int ident = 0;
void func1(){ void glDrawTransformFeedbackStream()
{
} }
void func2() void func1()
{
}
void
func2
()
{ {
} }
void func3 void func3
() { ()
{
} }