diff --git a/cmake-build-release/.ninja_deps b/cmake-build-release/.ninja_deps index 415ea96..0276b50 100644 Binary files a/cmake-build-release/.ninja_deps and b/cmake-build-release/.ninja_deps differ diff --git a/cmake-build-release/.ninja_log b/cmake-build-release/.ninja_log index baeb4a1..c7eada0 100644 --- a/cmake-build-release/.ninja_log +++ b/cmake-build-release/.ninja_log @@ -27,3 +27,68 @@ 523 565 1703299995223475188 gl_doc_generator 7126d327cf7747a5 1 528 1703300016059800637 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25 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 diff --git a/cmake-build-release/CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o b/cmake-build-release/CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o index 37be44a..490669a 100644 Binary files a/cmake-build-release/CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o and b/cmake-build-release/CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o differ diff --git a/cmake-build-release/Testing/Temporary/LastTest.log b/cmake-build-release/Testing/Temporary/LastTest.log index 2bcb01c..5e4398c 100644 --- a/cmake-build-release/Testing/Temporary/LastTest.log +++ b/cmake-build-release/Testing/Temporary/LastTest.log @@ -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 diff --git a/cmake-build-release/gl_doc_generator b/cmake-build-release/gl_doc_generator index dcc901b..5a32753 100755 Binary files a/cmake-build-release/gl_doc_generator and b/cmake-build-release/gl_doc_generator differ diff --git a/src/load_file.cpp b/src/load_file.cpp index d7f6565..bca05b9 100644 --- a/src/load_file.cpp +++ b/src/load_file.cpp @@ -59,7 +59,7 @@ namespace blt 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) { @@ -74,14 +74,14 @@ namespace blt auto s3 = full_data.find(' ', s2); if (s3 == std::string_view::npos) 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)); reset(); } else if (c == '\n') last = false; else if (c == '\\') last = true; - else if (!(std::isalpha(c) || c == '_' || std::isspace(c))) + else if (!(is_ident(c) || std::isspace(c))) reset(); break; case state_type::IDENTIFIER: @@ -89,35 +89,51 @@ namespace blt state = state_type::FUNCTION; else if (std::isspace(c)) state = state_type::POSSIBLE_FUNC; - else if (!(std::isalnum(c) || c == '_')) + else if (!is_ident(c)) reset(); break; case state_type::POSSIBLE_FUNC: if (c == '(') - state = state_type::POSSIBLE_FUNC; + state = state_type::FUNCTION; else if (!std::isspace(c)) - reset(); + { + if (is_ident(c)) + state = state_type::FUNCTION; + else + reset(); + } break; case state_type::FUNCTION: - if (c == '{') + if (c == ')') { -// state = state_type::OTHER; -// state_container con; -// con.type = state_type::FUNCTION; -// con.full_data = data; -// data = ""; -// con.data = std::string_view(con.full_data.data(), con.full_data.find('(')); - BLT_DEBUG(data); + // Jacob if you're actually reading this, this is all ugly & hacky code :3 + // please dm that you've read to here <3 + // enjoy trying to understand it. + auto end = data.find('(') - 1; + // gotta remove whitespace + while (end > 0 && std::isspace(data[end])) + 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(); - } else if (!(c == ')' || std::isalnum(c) || c == ',' || std::isblank(c))) + } else if (!(c == '(' || is_ident(c) || c == ',' || std::isspace(c))) reset(); break; case state_type::OTHER: if (c == '#') state = state_type::PREPROCESSOR_DEFINE; - else if (c == '\n') + else if (std::isspace(c)) reset(); - else if (data.size() <= 1 && (std::isalpha(c) || c == '_')) + else if (data.size() <= 1 && is_ident_b(c)) state = state_type::IDENTIFIER; break; } diff --git a/src/load_file.h b/src/load_file.h index 0051b8f..445432b 100644 --- a/src/load_file.h +++ b/src/load_file.h @@ -22,6 +22,7 @@ #include #include #include +#include namespace blt { @@ -59,6 +60,16 @@ namespace blt 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); public: diff --git a/test.h b/test.h index 2753389..2967dd9 100644 --- a/test.h +++ b/test.h @@ -25,17 +25,29 @@ int ident = 0; -void func1(){ +void glDrawTransformFeedbackStream() +{ } -void func2() +void func1() +{ + +} + +void + + +func2 + + () { } void func3 -() { + () +{ }