diff --git a/deps/ox/src/ox/CMakeLists.txt b/deps/ox/src/ox/CMakeLists.txt index 76ce7f7a..a5004de0 100644 --- a/deps/ox/src/ox/CMakeLists.txt +++ b/deps/ox/src/ox/CMakeLists.txt @@ -1,11 +1,7 @@ -cmake_minimum_required(VERSION 2.8) - -add_subdirectory(__buildinfo) if(OX_USE_STDLIB STREQUAL "ON") add_subdirectory(clargs) endif(OX_USE_STDLIB STREQUAL "ON") add_subdirectory(fs) -add_subdirectory(trace) add_subdirectory(mc) add_subdirectory(ptrarith) add_subdirectory(std) diff --git a/deps/ox/src/ox/__buildinfo/CMakeLists.txt b/deps/ox/src/ox/__buildinfo/CMakeLists.txt deleted file mode 100644 index 4529e1b1..00000000 --- a/deps/ox/src/ox/__buildinfo/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -install( - FILES - defines.hpp - DESTINATION - include/ox/__buildinfo -) diff --git a/deps/ox/src/ox/fs/CMakeLists.txt b/deps/ox/src/ox/fs/CMakeLists.txt index dd51dd6f..c9f391e0 100644 --- a/deps/ox/src/ox/fs/CMakeLists.txt +++ b/deps/ox/src/ox/fs/CMakeLists.txt @@ -9,12 +9,16 @@ add_library( filesystem/passthroughfs.cpp ) +if(OX_USE_STDLIB) + target_link_libraries( + OxFS PUBLIC + c++fs + ) +endif() + target_link_libraries( OxFS PUBLIC - c++fs OxMetalClaw - OxStd - OxTrace ) set_property( @@ -34,7 +38,6 @@ if(OX_BUILD_EXEC STREQUAL "ON") #target_link_libraries( # oxfstool # OxFS - # OxTrace # OxMetalClaw # OxStd #) diff --git a/deps/ox/src/ox/fs/test/CMakeLists.txt b/deps/ox/src/ox/fs/test/CMakeLists.txt index de654453..1587076d 100644 --- a/deps/ox/src/ox/fs/test/CMakeLists.txt +++ b/deps/ox/src/ox/fs/test/CMakeLists.txt @@ -9,7 +9,6 @@ target_link_libraries( FSTests OxFS OxStd - OxTrace OxMetalClaw ) diff --git a/deps/ox/src/ox/mc/CMakeLists.txt b/deps/ox/src/ox/mc/CMakeLists.txt index d4fdfe8e..7aff415d 100644 --- a/deps/ox/src/ox/mc/CMakeLists.txt +++ b/deps/ox/src/ox/mc/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 2.8) - add_library( OxMetalClaw defwriter.cpp @@ -11,7 +9,6 @@ add_library( target_link_libraries( OxMetalClaw PUBLIC OxStd - OxTrace ) set_property( @@ -23,10 +20,13 @@ set_property( install( FILES + deftypes.hpp defwriter.hpp err.hpp + optype.hpp presencemask.hpp read.hpp + types.hpp write.hpp DESTINATION include/ox/mc diff --git a/deps/ox/src/ox/mc/defwriter.hpp b/deps/ox/src/ox/mc/defwriter.hpp index 39e1619b..e0835462 100644 --- a/deps/ox/src/ox/mc/defwriter.hpp +++ b/deps/ox/src/ox/mc/defwriter.hpp @@ -11,9 +11,9 @@ #include #include #include +#include #include #include -#include #include "deftypes.hpp" #include "err.hpp" diff --git a/deps/ox/src/ox/mc/read.cpp b/deps/ox/src/ox/mc/read.cpp index 1a117145..3a3dcc31 100644 --- a/deps/ox/src/ox/mc/read.cpp +++ b/deps/ox/src/ox/mc/read.cpp @@ -119,4 +119,16 @@ void MetalClawReader::setTypeInfo(const char*, int fields) { m_fieldPresence.setMaxLen(m_buffIt); } +MetalClawReader MetalClawReader::child() { + return MetalClawReader(m_buff + m_buffIt, m_buffLen - m_buffIt); +} + +bool MetalClawReader::fieldPresent() { + return m_fieldPresence.get(m_field); +} + +bool MetalClawReader::fieldPresent(int fieldNo) { + return m_fieldPresence.get(fieldNo); +} + } diff --git a/deps/ox/src/ox/mc/read.hpp b/deps/ox/src/ox/mc/read.hpp index 09d5035a..0b12134c 100644 --- a/deps/ox/src/ox/mc/read.hpp +++ b/deps/ox/src/ox/mc/read.hpp @@ -11,6 +11,7 @@ #include #include #include + #include "err.hpp" #include "optype.hpp" #include "presencemask.hpp" @@ -21,9 +22,6 @@ namespace ox { class MetalClawReader { private: - using ArrayLength = uint32_t; - using StringLength = uint32_t; - FieldPresenseMask m_fieldPresence; int m_fields = 0; int m_field = 0; @@ -69,7 +67,27 @@ class MetalClawReader { void setTypeInfo(const char *name, int fields); - constexpr OpType opType() { + /** + * Returns a MetalClawReader to parse a child object. + */ + MetalClawReader child(); + + /** + * Indicates whether or not the next field to be read is present. + */ + bool fieldPresent(); + + /** + * Indicates whether or not the given field is present. + */ + bool fieldPresent(int fieldNo); + + /** + * @return the number of fields in this struct or list + */ + bool fields(); + + static constexpr OpType opType() { return OpType::Read; } @@ -127,7 +145,7 @@ int MetalClawReader::op(const char*, T *val, std::size_t valLen) { // read the list if (valLen >= len) { - MetalClawReader reader(m_buff + m_buffIt, m_buffLen - m_buffIt); + auto reader = child(); reader.setTypeInfo("List", len); for (std::size_t i = 0; i < len; i++) { err |= reader.op("", &val[i]); diff --git a/deps/ox/src/ox/mc/test/CMakeLists.txt b/deps/ox/src/ox/mc/test/CMakeLists.txt index 8a47812c..ca5a06fd 100644 --- a/deps/ox/src/ox/mc/test/CMakeLists.txt +++ b/deps/ox/src/ox/mc/test/CMakeLists.txt @@ -8,8 +8,6 @@ add_executable( target_link_libraries( McTest OxMetalClaw - OxStd - OxTrace ) add_test("Test\\ McTest\\ Writer" McTest MetalClawWriter) diff --git a/deps/ox/src/ox/mc/types.hpp b/deps/ox/src/ox/mc/types.hpp index cccc2cd0..2848c2bb 100644 --- a/deps/ox/src/ox/mc/types.hpp +++ b/deps/ox/src/ox/mc/types.hpp @@ -13,6 +13,9 @@ namespace ox { +using StringLength = uint32_t; +using ArrayLength = uint32_t; + class McStr { protected: diff --git a/deps/ox/src/ox/mc/write.cpp b/deps/ox/src/ox/mc/write.cpp index cbafb184..8ae92f8f 100644 --- a/deps/ox/src/ox/mc/write.cpp +++ b/deps/ox/src/ox/mc/write.cpp @@ -65,7 +65,6 @@ Error MetalClawWriter::op(const char*, McStr val) { bool fieldSet = false; if (val.cap()) { // write the length - typedef uint32_t StringLength; if (m_buffIt + sizeof(StringLength) + val.bytes() < m_buffLen) { *reinterpret_cast*>(&m_buff[m_buffIt]) = static_cast(val.bytes()); m_buffIt += sizeof(StringLength); diff --git a/deps/ox/src/ox/mc/write.hpp b/deps/ox/src/ox/mc/write.hpp index 25003c2a..84a4e47c 100644 --- a/deps/ox/src/ox/mc/write.hpp +++ b/deps/ox/src/ox/mc/write.hpp @@ -12,6 +12,7 @@ #include #include #include + #include "err.hpp" #include "optype.hpp" #include "presencemask.hpp" @@ -64,7 +65,7 @@ class MetalClawWriter { std::size_t size(); - constexpr OpType opType() { + static constexpr OpType opType() { return OpType::Write; } @@ -125,7 +126,6 @@ Error MetalClawWriter::op(const char*, T *val, std::size_t len) { if (len) { // write the length - typedef uint32_t ArrayLength; if (m_buffIt + sizeof(ArrayLength) < m_buffLen) { *reinterpret_cast*>(&m_buff[m_buffIt]) = static_cast(len); m_buffIt += sizeof(ArrayLength); diff --git a/deps/ox/src/ox/ptrarith/nodebuffer.hpp b/deps/ox/src/ox/ptrarith/nodebuffer.hpp index 925bc023..8b0720df 100644 --- a/deps/ox/src/ox/ptrarith/nodebuffer.hpp +++ b/deps/ox/src/ox/ptrarith/nodebuffer.hpp @@ -8,7 +8,7 @@ #pragma once -#include +#include #include "ptr.hpp" diff --git a/deps/ox/src/ox/std/CMakeLists.txt b/deps/ox/src/ox/std/CMakeLists.txt index b65c1405..a7f45143 100644 --- a/deps/ox/src/ox/std/CMakeLists.txt +++ b/deps/ox/src/ox/std/CMakeLists.txt @@ -1,13 +1,13 @@ -cmake_minimum_required(VERSION 2.8) - add_library( OxStd assert.cpp + buildinfo.cpp byteswap.cpp memops.cpp random.cpp stacktrace.cpp strops.cpp + trace.cpp ) set_property( @@ -17,14 +17,15 @@ set_property( POSITION_INDEPENDENT_CODE ON ) -target_link_libraries(OxStd PUBLIC OxTrace) - install( FILES assert.hpp bitops.hpp + buildinfo.hpp byteswap.hpp + defines.hpp error.hpp + hashmap.hpp math.hpp memops.hpp new.hpp @@ -34,6 +35,7 @@ install( strops.hpp std.hpp stddef.hpp + trace.hpp types.hpp typetraits.hpp vector.hpp diff --git a/deps/ox/src/ox/std/assert.cpp b/deps/ox/src/ox/std/assert.cpp index b52f8fba..cdbaaae8 100644 --- a/deps/ox/src/ox/std/assert.cpp +++ b/deps/ox/src/ox/std/assert.cpp @@ -11,8 +11,7 @@ #include #endif -#include - +#include "defines.hpp" #include "stacktrace.hpp" #include "assert.hpp" diff --git a/deps/ox/src/ox/std/assert.hpp b/deps/ox/src/ox/std/assert.hpp index 2eb35087..291333ef 100644 --- a/deps/ox/src/ox/std/assert.hpp +++ b/deps/ox/src/ox/std/assert.hpp @@ -8,8 +8,7 @@ #pragma once -#include - +#include "defines.hpp" #include "error.hpp" namespace ox { diff --git a/deps/ox/src/ox/__buildinfo/buildinfo.cpp b/deps/ox/src/ox/std/buildinfo.cpp similarity index 51% rename from deps/ox/src/ox/__buildinfo/buildinfo.cpp rename to deps/ox/src/ox/std/buildinfo.cpp index eb25069f..57f529ba 100644 --- a/deps/ox/src/ox/__buildinfo/buildinfo.cpp +++ b/deps/ox/src/ox/std/buildinfo.cpp @@ -8,30 +8,35 @@ namespace ox::buildinfo { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-const-variable" + #if defined(OX_USE_STDLIB) -const auto UseStdLib = true; +const bool UseStdLib = true; #else -const auto UseStdLib = false; +const bool UseStdLib = false; #endif #if defined(DEBUG) -const auto Debug = true; +const bool Debug = true; #else -const auto Debug = false; +const bool Debug = false; #endif #if defined(NDEBUG) -const auto NDebug = true; +const bool NDebug = true; #else -const auto NDebug = false; +const bool NDebug = false; #endif #if defined(__BIG_ENDIAN__) -const auto BigEndian = true; -const auto LittleEndian = false; +const bool BigEndian = true; +const bool LittleEndian = false; #else -const auto BigEndian = false; -const auto LittleEndian = true; +const bool BigEndian = false; +const bool LittleEndian = true; #endif +#pragma clang diagnostic pop + } diff --git a/deps/ox/src/ox/__buildinfo/buildinfo.hpp b/deps/ox/src/ox/std/buildinfo.hpp similarity index 100% rename from deps/ox/src/ox/__buildinfo/buildinfo.hpp rename to deps/ox/src/ox/std/buildinfo.hpp diff --git a/deps/ox/src/ox/std/byteswap.hpp b/deps/ox/src/ox/std/byteswap.hpp index d28ed840..ec25eacc 100644 --- a/deps/ox/src/ox/std/byteswap.hpp +++ b/deps/ox/src/ox/std/byteswap.hpp @@ -8,8 +8,7 @@ #pragma once -#include - +#include "defines.hpp" #include "types.hpp" #include "typetraits.hpp" diff --git a/deps/ox/src/ox/__buildinfo/defines.hpp b/deps/ox/src/ox/std/defines.hpp similarity index 100% rename from deps/ox/src/ox/__buildinfo/defines.hpp rename to deps/ox/src/ox/std/defines.hpp diff --git a/deps/ox/src/ox/std/new.hpp b/deps/ox/src/ox/std/new.hpp index 0595b3e0..b52e8d69 100644 --- a/deps/ox/src/ox/std/new.hpp +++ b/deps/ox/src/ox/std/new.hpp @@ -8,8 +8,7 @@ #pragma once -#include - +#include "defines.hpp" #include "types.hpp" #if defined(_MSC_VER) diff --git a/deps/ox/src/ox/std/test/CMakeLists.txt b/deps/ox/src/ox/std/test/CMakeLists.txt index a541eaa4..ad9eccb7 100644 --- a/deps/ox/src/ox/std/test/CMakeLists.txt +++ b/deps/ox/src/ox/std/test/CMakeLists.txt @@ -5,7 +5,7 @@ add_executable( tests.cpp ) -target_link_libraries(StdTest OxTrace OxStd) +target_link_libraries(StdTest OxStd) add_test("Test\\ ox_memcmp\\ ABCDEFG\\ !=\\ HIJKLMN" StdTest "ABCDEFG != HIJKLMN") add_test("Test\\ ox_memcmp\\ HIJKLMN\\ !=\\ ABCDEFG" StdTest "HIJKLMN != ABCDEFG") diff --git a/deps/ox/src/ox/trace/trace.cpp b/deps/ox/src/ox/std/trace.cpp similarity index 100% rename from deps/ox/src/ox/trace/trace.cpp rename to deps/ox/src/ox/std/trace.cpp diff --git a/deps/ox/src/ox/trace/trace.hpp b/deps/ox/src/ox/std/trace.hpp similarity index 100% rename from deps/ox/src/ox/trace/trace.hpp rename to deps/ox/src/ox/std/trace.hpp diff --git a/deps/ox/src/ox/trace/CMakeLists.txt b/deps/ox/src/ox/trace/CMakeLists.txt deleted file mode 100644 index c56a05a6..00000000 --- a/deps/ox/src/ox/trace/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -cmake_minimum_required(VERSION 2.8) - -add_library( - OxTrace - trace.cpp -) - -set_property( - TARGET - OxTrace - PROPERTY - POSITION_INDEPENDENT_CODE ON -) - -install( - FILES - trace.hpp - DESTINATION - include/ox/mc -) - -install(TARGETS OxTrace - LIBRARY DESTINATION lib/ox - ARCHIVE DESTINATION lib/ox -)