Skip to content

Commit

Permalink
feat(*): add more function call tracing statements
Browse files Browse the repository at this point in the history
  • Loading branch information
lmichaelis committed Dec 24, 2023
1 parent 9ce7ad7 commit 2129c61
Show file tree
Hide file tree
Showing 17 changed files with 569 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Font.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
// SPDX-License-Identifier: MIT
#include "zenkit-capi/Font.h"

#include "Internal.hh"

ZkFont* ZkFont_load(ZkRead* buf) {
ZKC_TRACE_FN();
if (buf == nullptr) {
ZKC_LOG_WARN_NULL("ZkFont_load");
return nullptr;
Expand All @@ -19,6 +22,7 @@ ZkFont* ZkFont_load(ZkRead* buf) {
}

ZkFont* ZkFont_loadPath(ZkString path) {
ZKC_TRACE_FN();
if (path == nullptr) {
ZKC_LOG_WARN_NULL("ZkFont_loadPath");
return nullptr;
Expand All @@ -37,6 +41,7 @@ ZkFont* ZkFont_loadPath(ZkString path) {
}

ZkFont* ZkFont_loadVfs(ZkVfs* vfs, ZkString name) {
ZKC_TRACE_FN();
if (vfs == nullptr || name == nullptr) {
ZKC_LOG_WARN_NULL("ZkFont_loadVfs");
return nullptr;
Expand All @@ -50,10 +55,12 @@ ZkFont* ZkFont_loadVfs(ZkVfs* vfs, ZkString name) {
}

void ZkFont_del(ZkFont* slf) {
ZKC_TRACE_FN();
delete slf;
}

ZkString ZkFont_getName(ZkFont const* slf) {
ZKC_TRACE_FN();
if (slf == nullptr) {
ZKC_LOG_WARN_NULL("ZkFont_getName");
return nullptr;
Expand All @@ -63,6 +70,7 @@ ZkString ZkFont_getName(ZkFont const* slf) {
}

uint32_t ZkFont_getHeight(ZkFont const* slf) {
ZKC_TRACE_FN();
if (slf == nullptr) {
ZKC_LOG_WARN_NULL("ZkFont_getHeight");
return 0;
Expand All @@ -72,6 +80,7 @@ uint32_t ZkFont_getHeight(ZkFont const* slf) {
}

ZkSize ZkFont_getGlyphCount(ZkFont const* slf) {
ZKC_TRACE_FN();
if (slf == nullptr) {
ZKC_LOG_WARN_NULL("ZkFont_getGlyphCount");
return 0;
Expand All @@ -81,6 +90,7 @@ ZkSize ZkFont_getGlyphCount(ZkFont const* slf) {
}

ZkFontGlyph ZkFont_getGlyph(ZkFont const* slf, ZkSize i) {
ZKC_TRACE_FN();
if (slf == nullptr) {
ZKC_LOG_WARN_NULL("ZkFont_getGlyph");
return {0, ZkVec2f {0, 0}, ZkVec2f {0, 0}};
Expand All @@ -96,6 +106,7 @@ ZkFontGlyph ZkFont_getGlyph(ZkFont const* slf, ZkSize i) {
}

void ZkFont_enumerateGlyphs(ZkFont const* slf, ZkFontGlyphEnumerator cb, void* ctx) {
ZKC_TRACE_FN();
if (slf == nullptr || cb == nullptr) {
ZKC_LOG_WARN_NULL("ZkFont_enumerateGlyphs");
return;
Expand Down
3 changes: 3 additions & 0 deletions src/Internal.hh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@

#define ZKC_DELETER(cls) \
void cls##_del(cls* slf) { \
ZKC_TRACE_FN(); \
delete slf; \
}

Expand All @@ -80,6 +81,7 @@

#define ZKC_VOB_LOADER(cls) \
cls* cls##_load(ZkRead* buf, ZkGameVersion version) { \
ZKC_TRACE_FN(); \
if (buf == nullptr) { \
ZKC_LOG_WARN_NULL(#cls "_load"); \
return nullptr; \
Expand All @@ -102,6 +104,7 @@

#define ZKC_VOB_PATH_LOADER(cls) \
cls* cls##_loadPath(ZkString path, ZkGameVersion version) { \
ZKC_TRACE_FN(); \
if (path == nullptr) { \
ZKC_LOG_WARN_NULL(#cls "_loadPath"); \
return nullptr; \
Expand Down
15 changes: 15 additions & 0 deletions src/ModelHierarchy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
// SPDX-License-Identifier: MIT
#include "zenkit-capi/ModelHierarchy.h"

#include "Internal.hh"

ZkModelHierarchy* ZkModelHierarchy_load(ZkRead* buf) {
ZKC_TRACE_FN();
if (buf == nullptr) {
ZKC_LOG_WARN_NULL("ZkModelHierarchy_load");
return nullptr;
Expand All @@ -19,6 +22,7 @@ ZkModelHierarchy* ZkModelHierarchy_load(ZkRead* buf) {
}

ZkModelHierarchy* ZkModelHierarchy_loadPath(ZkString path) {
ZKC_TRACE_FN();
if (path == nullptr) {
ZKC_LOG_WARN_NULL("ZkModelHierarchy_loadPath");
return nullptr;
Expand All @@ -37,6 +41,7 @@ ZkModelHierarchy* ZkModelHierarchy_loadPath(ZkString path) {
}

ZkModelHierarchy* ZkModelHierarchy_loadVfs(ZkVfs* vfs, ZkString name) {
ZKC_TRACE_FN();
if (vfs == nullptr || name == nullptr) {
ZKC_LOG_WARN_NULL("ZkModelHierarchy_loadVfs");
return nullptr;
Expand All @@ -50,10 +55,12 @@ ZkModelHierarchy* ZkModelHierarchy_loadVfs(ZkVfs* vfs, ZkString name) {
}

void ZkModelHierarchy_del(ZkModelHierarchy* slf) {
ZKC_TRACE_FN();
delete slf;
}

ZkSize ZkModelHierarchy_getNodeCount(ZkModelHierarchy const* slf) {
ZKC_TRACE_FN();
if (slf == nullptr) {
ZKC_LOG_WARN_NULL("ZkModelHierarchy_getNodeCount");
return 0;
Expand All @@ -63,6 +70,7 @@ ZkSize ZkModelHierarchy_getNodeCount(ZkModelHierarchy const* slf) {
}

ZkModelHierarchyNode ZkModelHierarchy_getNode(ZkModelHierarchy const* slf, ZkSize i) {
ZKC_TRACE_FN();
if (slf == nullptr) {
ZKC_LOG_WARN_NULL("ZkModelHierarchy_getNode");
return {};
Expand All @@ -81,6 +89,7 @@ ZkModelHierarchyNode ZkModelHierarchy_getNode(ZkModelHierarchy const* slf, ZkSiz
}

ZkAxisAlignedBoundingBox ZkModelHierarchy_getBbox(ZkModelHierarchy const* slf) {
ZKC_TRACE_FN();
if (slf == nullptr) {
ZKC_LOG_WARN_NULL("ZkModelHierarchy_getBbox");
return {};
Expand All @@ -90,6 +99,7 @@ ZkAxisAlignedBoundingBox ZkModelHierarchy_getBbox(ZkModelHierarchy const* slf) {
}

ZkAxisAlignedBoundingBox ZkModelHierarchy_getCollisionBbox(ZkModelHierarchy const* slf) {
ZKC_TRACE_FN();
if (slf == nullptr) {
ZKC_LOG_WARN_NULL("ZkModelHierarchy_getCollisionBbox");
return {};
Expand All @@ -99,6 +109,7 @@ ZkAxisAlignedBoundingBox ZkModelHierarchy_getCollisionBbox(ZkModelHierarchy cons
}

ZkVec3f ZkModelHierarchy_getRootTranslation(ZkModelHierarchy const* slf) {
ZKC_TRACE_FN();
if (slf == nullptr) {
ZKC_LOG_WARN_NULL("ZkModelHierarchy_getRootTranslation");
return {};
Expand All @@ -108,6 +119,7 @@ ZkVec3f ZkModelHierarchy_getRootTranslation(ZkModelHierarchy const* slf) {
}

uint32_t ZkModelHierarchy_getChecksum(ZkModelHierarchy const* slf) {
ZKC_TRACE_FN();
if (slf == nullptr) {
ZKC_LOG_WARN_NULL("ZkModelHierarchy_getChecksum");
return {};
Expand All @@ -117,6 +129,7 @@ uint32_t ZkModelHierarchy_getChecksum(ZkModelHierarchy const* slf) {
}

ZkDate ZkModelHierarchy_getSourceDate(ZkModelHierarchy const* slf) {
ZKC_TRACE_FN();
if (slf == nullptr) {
ZKC_LOG_WARN_NULL("ZkModelHierarchy_getSourceDate");
return {};
Expand All @@ -126,6 +139,7 @@ ZkDate ZkModelHierarchy_getSourceDate(ZkModelHierarchy const* slf) {
}

ZkString ZkModelHierarchy_getSourcePath(ZkModelHierarchy const* slf) {
ZKC_TRACE_FN();
if (slf == nullptr) {
ZKC_LOG_WARN_NULL("ZkModelHierarchy_getSourcePath");
return {};
Expand All @@ -135,6 +149,7 @@ ZkString ZkModelHierarchy_getSourcePath(ZkModelHierarchy const* slf) {
}

void ZkModelHierarchy_enumerateNodes(ZkModelHierarchy const* slf, ZkModelHierarchyNodeEnumerator cb, void* ctx) {
ZKC_TRACE_FN();
if (slf == nullptr || cb == nullptr) {
ZKC_LOG_WARN_NULL("ZkModelHierarchy_enumerateNodes");
return;
Expand Down
13 changes: 13 additions & 0 deletions src/ModelMesh.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
// SPDX-License-Identifier: MIT
#include "zenkit-capi/ModelMesh.h"

#include "Internal.hh"

ZkModelMesh* ZkModelMesh_load(ZkRead* buf) {
ZKC_TRACE_FN();
if (buf == nullptr) {
ZKC_LOG_WARN_NULL("ZkModelMesh_load");
return nullptr;
Expand All @@ -19,6 +22,7 @@ ZkModelMesh* ZkModelMesh_load(ZkRead* buf) {
}

ZkModelMesh* ZkModelMesh_loadPath(ZkString path) {
ZKC_TRACE_FN();
if (path == nullptr) {
ZKC_LOG_WARN_NULL("ZkModelMesh_loadPath");
return nullptr;
Expand All @@ -37,6 +41,7 @@ ZkModelMesh* ZkModelMesh_loadPath(ZkString path) {
}

ZkModelMesh* ZkModelMesh_loadVfs(ZkVfs* vfs, ZkString name) {
ZKC_TRACE_FN();
if (vfs == nullptr || name == nullptr) {
ZKC_LOG_WARN_NULL("ZkModelMesh_loadVfs");
return nullptr;
Expand All @@ -50,10 +55,12 @@ ZkModelMesh* ZkModelMesh_loadVfs(ZkVfs* vfs, ZkString name) {
}

void ZkModelMesh_del(ZkModelMesh* slf) {
ZKC_TRACE_FN();
delete slf;
}

ZkSize ZkModelMesh_getMeshCount(ZkModelMesh const* slf) {
ZKC_TRACE_FN();
if (slf == nullptr) {
ZKC_LOG_WARN_NULL("ZkModelMesh_getMeshCount");
return 0;
Expand All @@ -63,6 +70,7 @@ ZkSize ZkModelMesh_getMeshCount(ZkModelMesh const* slf) {
}

ZkSoftSkinMesh const* ZkModelMesh_getMesh(ZkModelMesh const* slf, ZkSize i) {
ZKC_TRACE_FN();
if (slf == nullptr) {
ZKC_LOG_WARN_NULL("ZkModelMesh_getMesh");
return nullptr;
Expand All @@ -77,6 +85,7 @@ ZkSoftSkinMesh const* ZkModelMesh_getMesh(ZkModelMesh const* slf, ZkSize i) {
}

void ZkModelMesh_enumerateMeshes(ZkModelMesh const* slf, ZkSoftSkinMeshEnumerator cb, void* ctx) {
ZKC_TRACE_FN();
if (slf == nullptr || cb == nullptr) {
ZKC_LOG_WARN_NULL("ZkModelMesh_enumerateMeshes");
return;
Expand All @@ -88,6 +97,7 @@ void ZkModelMesh_enumerateMeshes(ZkModelMesh const* slf, ZkSoftSkinMeshEnumerato
}

ZkSize ZkModelMesh_getAttachmentCount(ZkModelMesh const* slf) {
ZKC_TRACE_FN();
if (slf == nullptr) {
ZKC_LOG_WARN_NULL("ZkModelMesh_getAttachmentCount");
return 0;
Expand All @@ -97,6 +107,7 @@ ZkSize ZkModelMesh_getAttachmentCount(ZkModelMesh const* slf) {
}

ZkMultiResolutionMesh const* ZkModelMesh_getAttachment(ZkModelMesh const* slf, ZkString name) {
ZKC_TRACE_FN();
if (slf == nullptr || name == nullptr) {
ZKC_LOG_WARN_NULL("ZkModelMesh_getAttachment");
return nullptr;
Expand All @@ -108,6 +119,7 @@ ZkMultiResolutionMesh const* ZkModelMesh_getAttachment(ZkModelMesh const* slf, Z
}

void ZkModelMesh_enumerateAttachments(ZkModelMesh const* slf, ZkAttachmentEnumerator cb, void* ctx) {
ZKC_TRACE_FN();
if (slf == nullptr || cb == nullptr) {
ZKC_LOG_WARN_NULL("ZkModelMesh_enumerateAttachments");
return;
Expand All @@ -119,6 +131,7 @@ void ZkModelMesh_enumerateAttachments(ZkModelMesh const* slf, ZkAttachmentEnumer
}

uint32_t ZkModelMesh_getChecksum(ZkModelMesh const* slf) {
ZKC_TRACE_FN();
if (slf == nullptr) {
ZKC_LOG_WARN_NULL("ZkModelMesh_getChecksum");
return 0;
Expand Down
Loading

0 comments on commit 2129c61

Please sign in to comment.