Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions inkcpp/list_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,23 @@ namespace ink::runtime::internal
bool list_impl::contains(const char* flag_name) const
{
auto flag = _list_table->toFlag(flag_name);
inkAssert(flag.has_value(), "No flag with name found! '%s'", flag_name);
inkAssert(flag.has_value(), "No flag with name found! " FORMAT_STRING_STR "'", flag_name);
return _list_table->has(list_table::list{_list}, *flag);
}

void list_impl::add(const char* flag_name)
{
auto flag = _list_table->toFlag(flag_name);
inkAssert(flag.has_value(), "No flag with name found to add! '%s'", flag_name);
inkAssert(flag.has_value(), "No flag with name found to add! '" FORMAT_STRING_STR "'", flag_name);
_list = _list_table->add(list_table::list{_list}, *flag).lid;
}

void list_impl::remove(const char* flag_name)
{
auto flag = _list_table->toFlag(flag_name);
inkAssert(flag.has_value(), "No flag with name found to remove! '%s'", flag_name);
inkAssert(
flag.has_value(), "No flag with name found to remove! '" FORMAT_STRING_STR "'", flag_name
);
_list = _list_table->sub(list_table::list{_list}, *flag).lid;
}

Expand Down
2 changes: 1 addition & 1 deletion inkcpp_compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ list(APPEND SOURCES
list_data.h list_data.cpp
command.cpp
)
add_definitions(-DINK_COMPILER -DINK_EXPOSE_JSON)
add_definitions(-DINK_EXPOSE_JSON)
add_library(inkcpp_compiler_o OBJECT ${SOURCES})
add_library(inkcpp_compiler $<TARGET_OBJECTS:inkcpp_compiler_o>)

Expand Down
2 changes: 1 addition & 1 deletion inkcpp_compiler/binary_emitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ void binary_emitter::process_paths()
// Otherwise, write container address
if (container == nullptr) {
_containers.set(position, 0);
inkAssert(optional, "Was not able to resolve a not optional path! '%s'", path.c_str());
inkAssert(optional, "Was not able to resolve a not optional path! '%hs'", path.c_str());
} else {
_containers.set(position, container->offset);
}
Expand Down
4 changes: 1 addition & 3 deletions shared/private/command.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,5 @@ namespace ink
template<typename PayloadType>
constexpr unsigned int CommandSize = sizeof(Command) + sizeof(CommandFlag) + sizeof(PayloadType);

#ifdef INK_COMPILER
extern const char* CommandStrings[];
#endif
extern const char* CommandStrings[];
}
42 changes: 15 additions & 27 deletions shared/public/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@
# include <cstdarg>
#endif

// Platform specific defines //

#ifdef INK_ENABLE_UNREAL
# define inkZeroMemory(buff, len) FMemory::Memset(buff, 0, len)
# define inkAssert(condition, text, ...) checkf(condition, TEXT(text), ##__VA_ARGS__)
# define inkFail(text, ...) checkf(false, TEXT(text), ##__VA_ARGS__)
# define FORMAT_STRING_STR "%hs"
#else
# define inkZeroMemory ink::internal::zero_memory
# define inkAssert ink::ink_assert
# define inkFail(...) ink::ink_assert(false, __VA_ARGS__)
# define FORMAT_STRING_STR "%s"
#endif

namespace ink
{
/** define basic numeric type
Expand Down Expand Up @@ -168,20 +182,6 @@ template<typename... Args>
ink_assert(false, msg, args...);
exit(EXIT_FAILURE);
}
#else
/** platform indipendent assert(false) with message.
* @param msg formatting string
* @param args arguments to format string
*/
template<typename... Args>
inline void ink_fail(const char* msg, Args... args)
{
if (sizeof...(args) > 0) {
checkf(false, UTF8_TO_TCHAR(msg), args...)
} else {
checkf(false, UTF8_TO_TCHAR(msg));
}
}
#endif

namespace runtime::internal
Expand Down Expand Up @@ -295,7 +295,7 @@ class optional
void test_value() const
{
if (! _has_value) {
ink_fail("Can't access empty optional!");
inkFail("Can't access empty optional!");
}
}

Expand All @@ -304,15 +304,3 @@ class optional
};
#endif
} // namespace ink

// Platform specific defines //

#ifdef INK_ENABLE_UNREAL
# define inkZeroMemory(buff, len) FMemory::Memset(buff, 0, len)
# define inkAssert(condition, text, ...) checkf(condition, TEXT(text), ##__VA_ARGS__)
# define inkFail ink::ink_fail
#else
# define inkZeroMemory ink::internal::zero_memory
# define inkAssert ink::ink_assert
# define inkFail(...) ink::ink_assert(false, __VA_ARGS__)
#endif
1 change: 1 addition & 0 deletions unreal/inkcpp/Source/inkcpp/Private/InkList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "InkList.h"
#include <string>
#include "ink/list.h"

bool UInkList::ContainsFlag(const FString& flag_name) const
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#pragma once

#include "Kismet/GameplayStatics.h"
#include "string"

inline std::string get_inklecate_cmd() {
FString platform = UGameplayStatics::GetPlatformName();
Expand Down