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
2 changes: 2 additions & 0 deletions inkcpp/include/runner.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ namespace ink::runtime
class runner_interface
{
public:
virtual ~runner_interface(){};

#pragma region Interface Methods

/**
Expand Down
14 changes: 14 additions & 0 deletions inkcpp/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ namespace ink
case data_type::allocated_string_pointer:
case data_type::newline:
return true;
default:
break;
}

i++;
Expand Down Expand Up @@ -206,6 +208,8 @@ namespace ink
case data_type::newline:
str << std::endl;
break;
default:
break;
}
}

Expand Down Expand Up @@ -248,6 +252,8 @@ namespace ink
case data_type::newline:
str += "\n";
break;
default:
break;
}
}

Expand Down Expand Up @@ -307,6 +313,8 @@ namespace ink
case data_type::newline:
*(ptr++) = _data[i];
break;
default:
break;
}
}

Expand Down Expand Up @@ -398,6 +406,8 @@ namespace ink
case data_type::newline:
length += 1;
break;
default:
break;
}
}

Expand Down Expand Up @@ -433,6 +443,8 @@ namespace ink
case data_type::newline:
*ptr = '\n'; ptr++;
break;
default:
break;
}
}

Expand Down Expand Up @@ -486,6 +498,8 @@ namespace ink
case data_type::glue:
hasGlue = true;
break;
default:
break;
}

return false;
Expand Down
6 changes: 6 additions & 0 deletions inkcpp/runner_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ namespace ink::runtime::internal
case Command::MAX:
result = lhs > rhs ? lhs : rhs;
break;
default:
break;
}

// Push result onto the stack
Expand All @@ -212,6 +214,8 @@ namespace ink::runtime::internal
case Command::NOT:
result = !v;
break;
default:
break;
}

// Push to the stack
Expand Down Expand Up @@ -475,6 +479,8 @@ namespace ink::runtime::internal
// Newline was removed. Proceed as if we never hit it
forget();
break;
default:
break;
}
}

Expand Down
22 changes: 22 additions & 0 deletions inkcpp/value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ namespace ink
if (new_type == value_type::integer)
val = value((int)val._first.float_value);
return;
default:
break;
}

inkAssert(false, "Invalid value cast");
Expand Down Expand Up @@ -131,6 +133,8 @@ namespace ink
break;
case data_type::none:
return;
default:
break;
}
}
}
Expand All @@ -150,6 +154,8 @@ namespace ink
case data_type::string_table_pointer:
case data_type::allocated_string_pointer:
return _first.string_val[0] != '\0';
default:
break;
}

inkFail("Invalid type to check for truthy");
Expand Down Expand Up @@ -232,6 +238,8 @@ namespace ink

return new_value;
}
default:
break;
}

inkFail("Invalid type for add");
Expand All @@ -250,6 +258,8 @@ namespace ink
return left.as_int() - right.as_int();
case value_type::decimal:
return left.as_float() - right.as_float();
default:
break;
}

inkFail("Invalid type for subtract");
Expand All @@ -266,6 +276,8 @@ namespace ink
return left.as_int() * right.as_int();
case value_type::decimal:
return left.as_float() * right.as_float();
default:
break;
}

inkFail("Invalid type for multiply");
Expand All @@ -282,6 +294,8 @@ namespace ink
return left.as_int() / right.as_int();
case value_type::decimal:
return left.as_float() / right.as_float();
default:
break;
}

inkFail("Invalid type for divide");
Expand All @@ -296,6 +310,8 @@ namespace ink
{
case value_type::integer:
return left.as_int() % right.as_int();
default:
break;
}

inkFail("Invalid type for mod");
Expand Down Expand Up @@ -485,6 +501,8 @@ namespace ink
return compare_string(left, right);
case value_type::divert:
return left.as_divert() == right.as_divert();
default:
break;
}

inkFail("Invalid type for is_equal");
Expand All @@ -501,6 +519,8 @@ namespace ink
return left.as_int() < right.as_int();
case value_type::decimal:
return left.as_float() < right.as_float();
default:
break;
}

inkFail("Invalid type for less_than");
Expand All @@ -516,6 +536,8 @@ namespace ink
return -val._first.integer_value;
case data_type::float32:
return -val._first.float_value;
default:
break;
}

inkFail("Invalid type for negate");
Expand Down
2 changes: 1 addition & 1 deletion shared/public/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ namespace ink
// assert
#ifndef INK_ENABLE_UNREAL
void ink_assert(bool condition, const char* msg = nullptr);
[[ noreturn ]] inline void ink_assert(const char* msg = nullptr) { ink_assert(false, msg); }
[[ noreturn ]] inline void ink_assert(const char* msg = nullptr) { ink_assert(false, msg); exit(EXIT_FAILURE);}
#else
[[ noreturn ]] inline void ink_fail(const char*) { check(false); throw nullptr; }
#endif
Expand Down