actually find the parser bug (not handling lines that end in \r\n). formatting changes. comment out functions b/c clang can't be bothered to generate generic function defs if the function that uses it isn't actually part of the main program

This commit is contained in:
2025-08-19 08:50:10 -05:00
parent cad3849f28
commit d4d4a236e9
8 changed files with 79 additions and 70 deletions

View File

@@ -71,7 +71,7 @@
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LibraryPath>$(SolutionDir)ext\pthreads4w-code\build\Debug;$(SolutionDir)ext\glfw\build\src\Debug;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath> <LibraryPath>$(SolutionDir)lib;$(SolutionDir)ext\pthreads4w-code\build\Debug;$(SolutionDir)ext\glfw\build\src\Debug;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
<IncludePath>$(SolutionDir)ext\pthreads4w-code;$(SolutionDir)ext\glm;$(SolutionDir)ext\glfw\include;$(SolutionDir)inc;$(IncludePath)</IncludePath> <IncludePath>$(SolutionDir)ext\pthreads4w-code;$(SolutionDir)ext\glm;$(SolutionDir)ext\glfw\include;$(SolutionDir)inc;$(IncludePath)</IncludePath>
<OutDir>$(SolutionDir)bin\$(Platform)\$(Configuration)\</OutDir> <OutDir>$(SolutionDir)bin\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)obj\$(Platform)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)obj\$(Platform)\$(Configuration)\</IntDir>
@@ -146,4 +146,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@@ -30,5 +30,8 @@
<ClCompile Include="src\body.cpp"> <ClCompile Include="src\body.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\tcp_server.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -1,37 +1,37 @@
[ [
{ {
"directory": "C:/Users/sethh/Documents/repos/LivePlotter/", "directory": "C:/Users/seth/Documents/repos/LivePlotter/",
"command": "\"C:/Users/sethh/AppData/Roaming/ClangPowerTools/LLVM_Lite/Bin/clang++.exe\" -x c++ \"C:/Users/sethh/Documents/repos/LivePlotter/src/shaders.cpp\" -std=c++20 -Wall -fms-compatibility-version=19.10 -Wmicrosoft -Wno-invalid-token-paste -Wno-unknown-pragmas -Wno-unused-value -fsyntax-only \"-DUNICODE\" \"-D_UNICODE\" \"-D_MT\" \"-D_DLL\" \"-D_DEBUG\" \"-D_CONSOLE\" \"-D_DEBUG_FUNCTIONAL_MACHINERY\" -isystem\"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/include\" -isystem\"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/atlmfc/include\" -isystem\"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/VS/include\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/ucrt\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/um\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/shared\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/winrt\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/cppwinrt\" -isystem\"C:/Users/sethh/Documents/repos/LivePlotter/ext/pthreads4w-code\" -isystem\"C:/Users/sethh/Documents/repos/LivePlotter/ext/glm\" -isystem\"C:/Users/sethh/Documents/repos/LivePlotter/ext/glfw/include\" -isystem\"C:/Users/sethh/Documents/repos/LivePlotter/inc\"", "command": "\"C:/Users/seth/AppData/Roaming/ClangPowerTools/LLVM_Lite/Bin/clang++.exe\" -x c++ \"C:/Users/seth/Documents/repos/LivePlotter/src/util.cpp\" -std=c++20 -Wall -fms-compatibility-version=19.10 -Wmicrosoft -Wno-invalid-token-paste -Wno-unknown-pragmas -Wno-unused-value -fsyntax-only \"-DUNICODE\" \"-D_UNICODE\" \"-D_MT\" \"-D_DLL\" \"-D_DEBUG\" \"-D_CONSOLE\" \"-D_DEBUG_FUNCTIONAL_MACHINERY\" -isystem\"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/include\" -isystem\"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/atlmfc/include\" -isystem\"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Auxiliary/VS/include\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/ucrt\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/um\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/shared\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/winrt\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/cppwinrt\" -isystem\"C:/Users/seth/Documents/repos/LivePlotter/ext/pthreads4w-code\" -isystem\"C:/Users/seth/Documents/repos/LivePlotter/ext/glm\" -isystem\"C:/Users/seth/Documents/repos/LivePlotter/ext/glfw/include\" -isystem\"C:/Users/seth/Documents/repos/LivePlotter/inc\"",
"file": "C:/Users/sethh/Documents/repos/LivePlotter/src/shaders.cpp" "file": "C:/Users/seth/Documents/repos/LivePlotter/src/util.cpp"
} }
, ,
{ {
"directory": "C:/Users/sethh/Documents/repos/LivePlotter/", "directory": "C:/Users/seth/Documents/repos/LivePlotter/",
"command": "\"C:/Users/sethh/AppData/Roaming/ClangPowerTools/LLVM_Lite/Bin/clang++.exe\" -x c++ \"C:/Users/sethh/Documents/repos/LivePlotter/src/main.cpp\" -std=c++20 -Wall -fms-compatibility-version=19.10 -Wmicrosoft -Wno-invalid-token-paste -Wno-unknown-pragmas -Wno-unused-value -fsyntax-only \"-DUNICODE\" \"-D_UNICODE\" \"-D_MT\" \"-D_DLL\" \"-D_DEBUG\" \"-D_CONSOLE\" \"-D_DEBUG_FUNCTIONAL_MACHINERY\" -isystem\"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/include\" -isystem\"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/atlmfc/include\" -isystem\"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/VS/include\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/ucrt\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/um\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/shared\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/winrt\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/cppwinrt\" -isystem\"C:/Users/sethh/Documents/repos/LivePlotter/ext/pthreads4w-code\" -isystem\"C:/Users/sethh/Documents/repos/LivePlotter/ext/glm\" -isystem\"C:/Users/sethh/Documents/repos/LivePlotter/ext/glfw/include\" -isystem\"C:/Users/sethh/Documents/repos/LivePlotter/inc\"", "command": "\"C:/Users/seth/AppData/Roaming/ClangPowerTools/LLVM_Lite/Bin/clang++.exe\" -x c++ \"C:/Users/seth/Documents/repos/LivePlotter/src/shaders.cpp\" -std=c++20 -Wall -fms-compatibility-version=19.10 -Wmicrosoft -Wno-invalid-token-paste -Wno-unknown-pragmas -Wno-unused-value -fsyntax-only \"-DUNICODE\" \"-D_UNICODE\" \"-D_MT\" \"-D_DLL\" \"-D_DEBUG\" \"-D_CONSOLE\" \"-D_DEBUG_FUNCTIONAL_MACHINERY\" -isystem\"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/include\" -isystem\"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/atlmfc/include\" -isystem\"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Auxiliary/VS/include\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/ucrt\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/um\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/shared\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/winrt\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/cppwinrt\" -isystem\"C:/Users/seth/Documents/repos/LivePlotter/ext/pthreads4w-code\" -isystem\"C:/Users/seth/Documents/repos/LivePlotter/ext/glm\" -isystem\"C:/Users/seth/Documents/repos/LivePlotter/ext/glfw/include\" -isystem\"C:/Users/seth/Documents/repos/LivePlotter/inc\"",
"file": "C:/Users/sethh/Documents/repos/LivePlotter/src/main.cpp" "file": "C:/Users/seth/Documents/repos/LivePlotter/src/shaders.cpp"
} }
, ,
{ {
"directory": "C:/Users/sethh/Documents/repos/LivePlotter/", "directory": "C:/Users/seth/Documents/repos/LivePlotter/",
"command": "\"C:/Users/sethh/AppData/Roaming/ClangPowerTools/LLVM_Lite/Bin/clang++.exe\" -x c++ \"C:/Users/sethh/Documents/repos/LivePlotter/src/util.cpp\" -std=c++20 -Wall -fms-compatibility-version=19.10 -Wmicrosoft -Wno-invalid-token-paste -Wno-unknown-pragmas -Wno-unused-value -fsyntax-only \"-DUNICODE\" \"-D_UNICODE\" \"-D_MT\" \"-D_DLL\" \"-D_DEBUG\" \"-D_CONSOLE\" \"-D_DEBUG_FUNCTIONAL_MACHINERY\" -isystem\"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/include\" -isystem\"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/atlmfc/include\" -isystem\"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/VS/include\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/ucrt\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/um\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/shared\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/winrt\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/cppwinrt\" -isystem\"C:/Users/sethh/Documents/repos/LivePlotter/ext/pthreads4w-code\" -isystem\"C:/Users/sethh/Documents/repos/LivePlotter/ext/glm\" -isystem\"C:/Users/sethh/Documents/repos/LivePlotter/ext/glfw/include\" -isystem\"C:/Users/sethh/Documents/repos/LivePlotter/inc\"", "command": "\"C:/Users/seth/AppData/Roaming/ClangPowerTools/LLVM_Lite/Bin/clang++.exe\" -x c++ \"C:/Users/seth/Documents/repos/LivePlotter/src/tcp_server.cpp\" -std=c++20 -Wall -fms-compatibility-version=19.10 -Wmicrosoft -Wno-invalid-token-paste -Wno-unknown-pragmas -Wno-unused-value -fsyntax-only \"-DUNICODE\" \"-D_UNICODE\" \"-D_MT\" \"-D_DLL\" \"-D_DEBUG\" \"-D_CONSOLE\" \"-D_DEBUG_FUNCTIONAL_MACHINERY\" -isystem\"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/include\" -isystem\"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/atlmfc/include\" -isystem\"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Auxiliary/VS/include\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/ucrt\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/um\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/shared\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/winrt\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/cppwinrt\" -isystem\"C:/Users/seth/Documents/repos/LivePlotter/ext/pthreads4w-code\" -isystem\"C:/Users/seth/Documents/repos/LivePlotter/ext/glm\" -isystem\"C:/Users/seth/Documents/repos/LivePlotter/ext/glfw/include\" -isystem\"C:/Users/seth/Documents/repos/LivePlotter/inc\"",
"file": "C:/Users/sethh/Documents/repos/LivePlotter/src/util.cpp" "file": "C:/Users/seth/Documents/repos/LivePlotter/src/tcp_server.cpp"
} }
, ,
{ {
"directory": "C:/Users/sethh/Documents/repos/LivePlotter/", "directory": "C:/Users/seth/Documents/repos/LivePlotter/",
"command": "\"C:/Users/sethh/AppData/Roaming/ClangPowerTools/LLVM_Lite/Bin/clang++.exe\" -x c++ \"C:/Users/sethh/Documents/repos/LivePlotter/src/tcp_server.cpp\" -std=c++20 -Wall -fms-compatibility-version=19.10 -Wmicrosoft -Wno-invalid-token-paste -Wno-unknown-pragmas -Wno-unused-value -fsyntax-only \"-DUNICODE\" \"-D_UNICODE\" \"-D_MT\" \"-D_DLL\" \"-D_DEBUG\" \"-D_CONSOLE\" \"-D_DEBUG_FUNCTIONAL_MACHINERY\" -isystem\"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/include\" -isystem\"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/atlmfc/include\" -isystem\"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/VS/include\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/ucrt\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/um\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/shared\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/winrt\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/cppwinrt\" -isystem\"C:/Users/sethh/Documents/repos/LivePlotter/ext/pthreads4w-code\" -isystem\"C:/Users/sethh/Documents/repos/LivePlotter/ext/glm\" -isystem\"C:/Users/sethh/Documents/repos/LivePlotter/ext/glfw/include\" -isystem\"C:/Users/sethh/Documents/repos/LivePlotter/inc\"", "command": "\"C:/Users/seth/AppData/Roaming/ClangPowerTools/LLVM_Lite/Bin/clang++.exe\" -x c++ \"C:/Users/seth/Documents/repos/LivePlotter/src/body.cpp\" -std=c++20 -Wall -fms-compatibility-version=19.10 -Wmicrosoft -Wno-invalid-token-paste -Wno-unknown-pragmas -Wno-unused-value -fsyntax-only \"-DUNICODE\" \"-D_UNICODE\" \"-D_MT\" \"-D_DLL\" \"-D_DEBUG\" \"-D_CONSOLE\" \"-D_DEBUG_FUNCTIONAL_MACHINERY\" -isystem\"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/include\" -isystem\"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/atlmfc/include\" -isystem\"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Auxiliary/VS/include\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/ucrt\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/um\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/shared\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/winrt\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/cppwinrt\" -isystem\"C:/Users/seth/Documents/repos/LivePlotter/ext/pthreads4w-code\" -isystem\"C:/Users/seth/Documents/repos/LivePlotter/ext/glm\" -isystem\"C:/Users/seth/Documents/repos/LivePlotter/ext/glfw/include\" -isystem\"C:/Users/seth/Documents/repos/LivePlotter/inc\"",
"file": "C:/Users/sethh/Documents/repos/LivePlotter/src/tcp_server.cpp" "file": "C:/Users/seth/Documents/repos/LivePlotter/src/body.cpp"
} }
, ,
{ {
"directory": "C:/Users/sethh/Documents/repos/LivePlotter/", "directory": "C:/Users/seth/Documents/repos/LivePlotter/",
"command": "\"C:/Users/sethh/AppData/Roaming/ClangPowerTools/LLVM_Lite/Bin/clang++.exe\" -x c \"C:/Users/sethh/Documents/repos/LivePlotter/src/glad.c\" -Wall -fms-compatibility-version=19.10 -Wmicrosoft -Wno-invalid-token-paste -Wno-unknown-pragmas -Wno-unused-value -fsyntax-only \"-DUNICODE\" \"-D_UNICODE\" \"-D_MT\" \"-D_DLL\" \"-D_DEBUG\" \"-D_CONSOLE\" \"-D_DEBUG_FUNCTIONAL_MACHINERY\" -isystem\"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/include\" -isystem\"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/atlmfc/include\" -isystem\"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/VS/include\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/ucrt\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/um\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/shared\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/winrt\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/cppwinrt\" -isystem\"C:/Users/sethh/Documents/repos/LivePlotter/ext/pthreads4w-code\" -isystem\"C:/Users/sethh/Documents/repos/LivePlotter/ext/glm\" -isystem\"C:/Users/sethh/Documents/repos/LivePlotter/ext/glfw/include\" -isystem\"C:/Users/sethh/Documents/repos/LivePlotter/inc\"", "command": "\"C:/Users/seth/AppData/Roaming/ClangPowerTools/LLVM_Lite/Bin/clang++.exe\" -x c++ \"C:/Users/seth/Documents/repos/LivePlotter/src/main.cpp\" -std=c++20 -Wall -fms-compatibility-version=19.10 -Wmicrosoft -Wno-invalid-token-paste -Wno-unknown-pragmas -Wno-unused-value -fsyntax-only \"-DUNICODE\" \"-D_UNICODE\" \"-D_MT\" \"-D_DLL\" \"-D_DEBUG\" \"-D_CONSOLE\" \"-D_DEBUG_FUNCTIONAL_MACHINERY\" -isystem\"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/include\" -isystem\"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/atlmfc/include\" -isystem\"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Auxiliary/VS/include\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/ucrt\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/um\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/shared\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/winrt\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/cppwinrt\" -isystem\"C:/Users/seth/Documents/repos/LivePlotter/ext/pthreads4w-code\" -isystem\"C:/Users/seth/Documents/repos/LivePlotter/ext/glm\" -isystem\"C:/Users/seth/Documents/repos/LivePlotter/ext/glfw/include\" -isystem\"C:/Users/seth/Documents/repos/LivePlotter/inc\"",
"file": "C:/Users/sethh/Documents/repos/LivePlotter/src/glad.c" "file": "C:/Users/seth/Documents/repos/LivePlotter/src/main.cpp"
} }
, ,
{ {
"directory": "C:/Users/sethh/Documents/repos/LivePlotter/", "directory": "C:/Users/seth/Documents/repos/LivePlotter/",
"command": "\"C:/Users/sethh/AppData/Roaming/ClangPowerTools/LLVM_Lite/Bin/clang++.exe\" -x c++ \"C:/Users/sethh/Documents/repos/LivePlotter/src/body.cpp\" -std=c++20 -Wall -fms-compatibility-version=19.10 -Wmicrosoft -Wno-invalid-token-paste -Wno-unknown-pragmas -Wno-unused-value -fsyntax-only \"-DUNICODE\" \"-D_UNICODE\" \"-D_MT\" \"-D_DLL\" \"-D_DEBUG\" \"-D_CONSOLE\" \"-D_DEBUG_FUNCTIONAL_MACHINERY\" -isystem\"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/include\" -isystem\"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/atlmfc/include\" -isystem\"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/VS/include\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/ucrt\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/um\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/shared\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/winrt\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/cppwinrt\" -isystem\"C:/Users/sethh/Documents/repos/LivePlotter/ext/pthreads4w-code\" -isystem\"C:/Users/sethh/Documents/repos/LivePlotter/ext/glm\" -isystem\"C:/Users/sethh/Documents/repos/LivePlotter/ext/glfw/include\" -isystem\"C:/Users/sethh/Documents/repos/LivePlotter/inc\"", "command": "\"C:/Users/seth/AppData/Roaming/ClangPowerTools/LLVM_Lite/Bin/clang++.exe\" -x c \"C:/Users/seth/Documents/repos/LivePlotter/src/glad.c\" -Wall -fms-compatibility-version=19.10 -Wmicrosoft -Wno-invalid-token-paste -Wno-unknown-pragmas -Wno-unused-value -fsyntax-only \"-DUNICODE\" \"-D_UNICODE\" \"-D_MT\" \"-D_DLL\" \"-D_DEBUG\" \"-D_CONSOLE\" \"-D_DEBUG_FUNCTIONAL_MACHINERY\" -isystem\"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/include\" -isystem\"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/atlmfc/include\" -isystem\"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Auxiliary/VS/include\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/ucrt\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/um\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/shared\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/winrt\" -isystem\"C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/cppwinrt\" -isystem\"C:/Users/seth/Documents/repos/LivePlotter/ext/pthreads4w-code\" -isystem\"C:/Users/seth/Documents/repos/LivePlotter/ext/glm\" -isystem\"C:/Users/seth/Documents/repos/LivePlotter/ext/glfw/include\" -isystem\"C:/Users/seth/Documents/repos/LivePlotter/inc\"",
"file": "C:/Users/sethh/Documents/repos/LivePlotter/src/body.cpp" "file": "C:/Users/seth/Documents/repos/LivePlotter/src/glad.c"
} }
] ]

View File

@@ -10,7 +10,7 @@ struct tcpserver {
SOCKET sock; SOCKET sock;
array<SOCKET> client_socks; array<SOCKET> client_socks;
int max_connections; int max_connections;
addrinfo *addr; addrinfo* addr;
array<data_received_cb_t> cbs; array<data_received_cb_t> cbs;
pthread_mutex_t lock; pthread_mutex_t lock;
@@ -18,8 +18,8 @@ struct tcpserver {
pthread_cond_t stop_requested; pthread_cond_t stop_requested;
}; };
bool create_server(tcpserver *server_out, const char* hostname, int port); bool create_server(tcpserver* server_out, const char* hostname, int port, int max_connections);
void start_server(tcpserver &s); void start_server(tcpserver& s);
void stop_server(tcpserver &s); void stop_server(tcpserver& s);
void send_data(tcpserver &s, SOCKET client, array<char> data); void send_data(tcpserver& s, SOCKET client, array<char> data);
void register_recv_cb(tcpserver &s, data_received_cb_t cb); void register_recv_cb(tcpserver& s, data_received_cb_t cb);

View File

@@ -14,5 +14,5 @@ template<class T> struct array {
template<class T> void append(array<T>& a, T el); template<class T> void append(array<T>& a, T el);
template<class T> T pop(array<T>& a); template<class T> T pop(array<T>& a);
template<class T> void resize(array<T>& a, size_t new_size); template<class T> void resize(array<T>& a, size_t new_cap);
bool read_file(array<char>* out, const char* filepath); bool read_file(array<char>* out, const char* filepath);

View File

@@ -67,7 +67,7 @@ bool load_body(body* out_body, const char* obj_filepath) {
start = i + 1; start = i + 1;
} }
} }
if (source[i] == '\n') { if (source[i] == '\n' || source[i] == '\r') {
state = ParserState::PREFIX; state = ParserState::PREFIX;
continue; continue;
} }

View File

@@ -8,11 +8,12 @@
#include "util.hpp" #include "util.hpp"
#include "shaders.hpp" #include "shaders.hpp"
#include "body.hpp" #include "body.hpp"
#include "tcp_server.hpp"
static GLFWwindow* window; static GLFWwindow* window;
static float width, height; static float width, height;
void framebuffer_size_callback(GLFWwindow* window, int w, int h) { void framebuffer_size_callback(GLFWwindow* window, int w, int h) {
width = w; width = w;
height = h; height = h;
glViewport(0, 0, width, height); glViewport(0, 0, width, height);
@@ -21,7 +22,6 @@ void framebuffer_size_callback(GLFWwindow* window, int w, int h) {
void process_input() { void process_input() {
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
glfwSetWindowShouldClose(window, true); glfwSetWindowShouldClose(window, true);
} }
static bool mouse_pressed = false; static bool mouse_pressed = false;
@@ -50,7 +50,7 @@ static void cursor_position_callback(GLFWwindow* window, double xpos, double ypo
} }
if (scroll_pressed) { if (scroll_pressed) {
focal_point += strafe_x * (dx/300) + strafe_y * (dy/300); focal_point += strafe_x * (dx / 300) + strafe_y * (dy / 300);
} }
double len = glm::length(camera_loc); double len = glm::length(camera_loc);
@@ -75,12 +75,11 @@ void mouse_button_callback(GLFWwindow* window, int button, int action, int mods)
glfwGetCursorPos(window, &prev_cursor_x, &prev_cursor_y); glfwGetCursorPos(window, &prev_cursor_x, &prev_cursor_y);
} }
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) {
{
glm::vec4 k = camera_t[2]; glm::vec4 k = camera_t[2];
float d = yoffset; float d = yoffset;
camera_loc += k * (d/10 * glm::max(glm::length(camera_loc), 1.0f)); camera_loc += k * (d / 10 * max(glm::length(camera_loc), 1.0f));
camera_t = glm::lookAt(camera_loc, focal_point, up); camera_t = glm::lookAt(camera_loc, focal_point, up);
} }
@@ -107,8 +106,12 @@ bool glfw_setup() {
return true; return true;
} }
int main() { int main() {
//tcpserver server;
//if (!create_server(&server, "127.0.0.1", 5000, 1)) {
// //return -1;
//}
if (!glfw_setup()) if (!glfw_setup())
return -1; return -1;
@@ -126,7 +129,7 @@ int main() {
if (!load_shader(&shader, vertex_filepath, fragment_filepath)) if (!load_shader(&shader, vertex_filepath, fragment_filepath))
return -1; return -1;
//glClearColor(0.2f, 0.3f, 0.3f, 1.0f); // glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
glClearColor(0, 0, 0, 0); glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT); // Write to back buffer glClear(GL_COLOR_BUFFER_BIT); // Write to back buffer
@@ -147,9 +150,9 @@ int main() {
b2.pose = glm::translate(b.pose, glm::vec3(2, 0, 0)); b2.pose = glm::translate(b.pose, glm::vec3(2, 0, 0));
b2.color = glm::vec4(0, 0.5, 0, 1); b2.color = glm::vec4(0, 0.5, 0, 1);
//glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); // glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
//set_uniform(shader, "color", glm::vec4 { sin(time), sin(time + glm::radians(45.0f)), sin(time + glm::radians(90.0f)), 1.0 } / 2.0f); // set_uniform(shader, "color", glm::vec4 { sin(time), sin(time + glm::radians(45.0f)), sin(time +
//time = glfwGetTime(); // glm::radians(90.0f)), 1.0 } / 2.0f); time = glfwGetTime();
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);

View File

@@ -1,6 +1,7 @@
#include <WS2tcpip.h> #include <WS2tcpip.h>
#include <cstring> #include <cstring>
#pragma comment(lib, "pthreadVC3d.lib") #pragma comment(lib, "pthreadVC3d.lib")
#pragma comment(lib, "WS2_32.Lib")
// I hate windows. I hate windows. I hate windows. // I hate windows. I hate windows. I hate windows.
@@ -26,20 +27,21 @@ bool create_server(tcpserver* server_out, const char* hostname, int port, int ma
winsock_initialized = true; winsock_initialized = true;
return false; return false;
} }
SOCKET sock;
// ********** Addr Info Creation ********** // ********** Addr Info Creation **********
addrinfo *result, *ptr, hints; addrinfo *result, hints;
char port_str[16]; char port_str[16];
_itoa_s(port, port_str, 10); _itoa_s(port, port_str, 10);
// TODO: Ensure hostname is null-terminated // TODO: Ensure hostname is null-terminated
int status = getaddrinfo(hostname, port_str, &hints, result); int status = getaddrinfo(hostname, port_str, &hints, &result);
if (status != 0) { if (status != 0) {
printf("Error at getaddrinfo(): %d\n", status); printf("Error at getaddrinfo(): %d\n", status);
goto fail_cleanup; goto fail_cleanup;
} }
// *********** Socket Creation ************ // *********** Socket Creation ************
SOCKET sock = socket(result->ai_family, result->ai_socktype, result->ai_protocol); sock = socket(result->ai_family, result->ai_socktype, result->ai_protocol);
if (sock == INVALID_SOCKET) { if (sock == INVALID_SOCKET) {
printf("Error at socket(): %d\n", WSAGetLastError()); printf("Error at socket(): %d\n", WSAGetLastError());
freeaddrinfo(result); freeaddrinfo(result);
@@ -65,35 +67,36 @@ fail_cleanup:
void start_server(tcpserver& s) { } void start_server(tcpserver& s) { }
void stop_server(tcpserver& s) { } void stop_server(tcpserver& s) { }
void send_data(tcpserver& s, SOCKET client, array<char> data) { } void send_data(tcpserver& s, SOCKET client, array<char> data) { }
void register_cb(tcpserver& s, data_received_cb_t cb) { append(s.cbs, cb); } //void register_recv_cb(tcpserver& s, data_received_cb_t cb) { append(s.cbs, cb); }
void _server_loop(void* args) { //void _server_loop(void* args) {
tcpserver* s = static_cast<tcpserver*>(args); // tcpserver* s = static_cast<tcpserver*>(args);
//
int num_connections = 0; // int num_connections = 0;
int slots[s->max_connections]; // int mc = s->max_connections;
array<int> open_slots // array<int> open_slots = {
= { .data = slots, .len = (size_t)s->max_connections, .cap = (size_t)s->max_connections }; // .data = (int*)malloc(sizeof(int)*mc), .len = (size_t)mc, .cap = (size_t)mc
for (int i = 0; i < open_slots.len; i++) { // };
open_slots[i] = open_slots.len - (i + 1); // for (int i = 0; i < open_slots.len; i++) {
} // open_slots[i] = open_slots.len - (i + 1);
// }
SOCKET clients[s->max_connections]; //
memset(clients, INVALID_SOCKET, sizeof(SOCKET)); // array<SOCKET> clients = { (SOCKET*)malloc(sizeof(SOCKET) * mc), (size_t)mc, (size_t)mc };
while (true) { // memset(clients.data, INVALID_SOCKET, sizeof(SOCKET)*mc);
while (num_connections < s->max_connections) { // while (true) {
int slot = pop(open_slots); // while (num_connections < s->max_connections) {
clients[slot] = accept(s->sock, NULL, NULL); // int slot = pop(open_slots);
// TODO: More robust handling of bad client sockets // clients[slot] = accept(s->sock, NULL, NULL);
if (clients[slot] == INVALID_SOCKET) { // // TODO: More robust handling of bad client sockets
printf("Error at accept(): %d\n", WSAGetLastError()); // if (clients[slot] == INVALID_SOCKET) {
stop_server(*s); // printf("Error at accept(): %d\n", WSAGetLastError());
return; // stop_server(*s);
} // return;
_start_conn_loop(clients[slot]); // }
} // _start_conn_loop(clients[slot]);
} // }
} // }
//}
void _start_conn_loop(SOCKET client_s) { void _start_conn_loop(SOCKET client_s) {