Skip to content

Commit

Permalink
Merge: hsxの一部の型定義を変更 (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
vain0x committed Jul 10, 2024
2 parents 0b0e439 + 436d95a commit eb1f68d
Show file tree
Hide file tree
Showing 33 changed files with 587 additions and 762 deletions.
2 changes: 1 addition & 1 deletion src/knowbug_client/mod_child_process.hsp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
;
; child_process_wait 命令によってサブプロセスの終了を待機できます。
;
; そのサブプロセスを利用しなくなったとき、child_proecss_close 命令を使って、この命令が確保したリソースを解放してください。
; そのサブプロセスを利用しなくなったとき、child_process_close 命令を使って、この命令が確保したリソースを解放してください。
#deffunc child_process_spawn array inner, str cmdline, \
local os_cmdline, local startup_info, local proc_info

Expand Down
34 changes: 17 additions & 17 deletions src/knowbug_core/hsp_object_path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ auto HspObjectPath::as_static_var() const -> HspObjectPath::StaticVar const& {
// 配列要素
// -----------------------------------------------

auto HspObjectPath::new_element(hsx::HspDimIndex const& indexes) const -> std::shared_ptr<HspObjectPath const> {
auto HspObjectPath::new_element(HsxIndexes indexes) const -> std::shared_ptr<HspObjectPath const> {
return std::make_shared<HspObjectPath::Element>(self(), indexes);
}

Expand All @@ -235,7 +235,7 @@ auto HspObjectPath::as_element() const -> HspObjectPath::Element const& {
// 引数
// -----------------------------------------------

auto HspObjectPath::new_param(hsx::HspParamType param_type, std::size_t param_index) const -> std::shared_ptr<HspObjectPath const> {
auto HspObjectPath::new_param(HsxMptype param_type, std::size_t param_index) const -> std::shared_ptr<HspObjectPath const> {
return std::make_shared<HspObjectPath::Param>(self(), param_type, param_index);
}

Expand Down Expand Up @@ -353,19 +353,19 @@ auto HspObjectPath::as_unknown() const -> HspObjectPath::Unknown const& {
// システム変数リスト
// -----------------------------------------------

static auto const s_system_var_list = std::array<hsx::HspSystemVarKind, 12>{ {
hsx::HspSystemVarKind::Cnt,
hsx::HspSystemVarKind::Err,
hsx::HspSystemVarKind::IParam,
hsx::HspSystemVarKind::WParam,
hsx::HspSystemVarKind::LParam,
hsx::HspSystemVarKind::LoopLev,
hsx::HspSystemVarKind::SubLev,
hsx::HspSystemVarKind::Refstr,
hsx::HspSystemVarKind::Refdval,
hsx::HspSystemVarKind::Stat,
hsx::HspSystemVarKind::StrSize,
hsx::HspSystemVarKind::Thismod,
static auto const s_system_var_list = std::array<HsxSysvarKind, 12>{ {
HSX_SYSVAR_CNT,
HSX_SYSVAR_ERR,
HSX_SYSVAR_IPARAM,
HSX_SYSVAR_WPARAM,
HSX_SYSVAR_LPARAM,
HSX_SYSVAR_LOOPLEV,
HSX_SYSVAR_SUBLEV,
HSX_SYSVAR_REFSTR,
HSX_SYSVAR_REFDVAL,
HSX_SYSVAR_STAT,
HSX_SYSVAR_STRSIZE,
HSX_SYSVAR_THISMOD,
}};

auto HspObjectPath::new_system_var_list() const -> std::shared_ptr<HspObjectPath const> {
Expand All @@ -381,7 +381,7 @@ auto HspObjectPath::as_system_var_list() const -> HspObjectPath::SystemVarList c
}

auto HspObjectPath::SystemVarList::child_count(HspObjects& objects) const -> std::size_t {
assert(s_system_var_list.back() == hsx::HspSystemVarKind::Thismod);
assert(s_system_var_list.back() == HSX_SYSVAR_THISMOD);
return s_system_var_list.size();
}

Expand All @@ -396,7 +396,7 @@ auto HspObjectPath::SystemVarList::child_at(std::size_t child_index, HspObjects&
// システム変数
// -----------------------------------------------

auto HspObjectPath::new_system_var(hsx::HspSystemVarKind system_var_kind) const -> std::shared_ptr<HspObjectPath const> {
auto HspObjectPath::new_system_var(HsxSysvarKind system_var_kind) const -> std::shared_ptr<HspObjectPath const> {
return std::make_shared<HspObjectPath::SystemVar>(self(), system_var_kind);
}

Expand Down
38 changes: 17 additions & 21 deletions src/knowbug_core/hsp_object_path.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,19 +289,15 @@ class HspObjectPath::StaticVar final
return static_var_id_;
}

auto type(HspObjects& objects) const -> hsx::HspType {
auto type(HspObjects& objects) const -> HsxVartype {
return objects.static_var_path_to_type(*this);
}

auto type_name(HspObjects& objects) const -> std::u8string_view {
return objects.type_to_name(type(objects));
}

auto lengths(HspObjects& objects) const -> hsx::HspDimIndex {
return metadata(objects).lengths();
}

auto metadata(HspObjects& objects) const -> hsx::HspVarMetadata {
auto metadata(HspObjects& objects) const -> std::optional<HsxVarMetadata> {
return objects.static_var_path_to_metadata(*this);
}
};
Expand All @@ -315,7 +311,7 @@ class HspObjectPath::Element final
{
std::shared_ptr<HspObjectPath const> parent_;

hsx::HspDimIndex indexes_;
HsxIndexes indexes_;

public:
using HspObjectPath::new_label;
Expand All @@ -325,7 +321,7 @@ class HspObjectPath::Element final
using HspObjectPath::new_flex;
using HspObjectPath::new_unknown;

Element(std::shared_ptr<HspObjectPath const> parent, hsx::HspDimIndex const& indexes)
Element(std::shared_ptr<HspObjectPath const> parent, HsxIndexes indexes)
: parent_(std::move(parent))
, indexes_(indexes)
{
Expand All @@ -336,11 +332,11 @@ class HspObjectPath::Element final
}

bool does_equal(HspObjectPath const& other) const override {
return indexes() == other.as_element().indexes();
return hsx_indexes_equals(indexes(), other.as_element().indexes());
}

auto do_hash() const -> std::size_t override {
return indexes().hash();
return hsx_indexes_hash(indexes());
}

auto is_alive(HspObjects& objects) const -> bool override {
Expand All @@ -363,7 +359,7 @@ class HspObjectPath::Element final
return objects.element_path_to_name(*this);
}

auto indexes() const -> hsx::HspDimIndex const& {
auto indexes() const -> HsxIndexes {
return indexes_;
}
};
Expand All @@ -377,7 +373,7 @@ class HspObjectPath::Param final
{
std::shared_ptr<HspObjectPath const> parent_;

hsx::HspParamType param_type_;
HsxMptype param_type_;
std::size_t param_index_;

public:
Expand All @@ -387,7 +383,7 @@ class HspObjectPath::Param final
using HspObjectPath::new_double;
using HspObjectPath::new_int;

Param(std::shared_ptr<HspObjectPath const> parent, hsx::HspParamType param_type, std::size_t param_index)
Param(std::shared_ptr<HspObjectPath const> parent, HsxMptype param_type, std::size_t param_index)
: parent_(std::move(parent))
, param_type_(param_type)
, param_index_(param_index)
Expand Down Expand Up @@ -423,15 +419,15 @@ class HspObjectPath::Param final
return objects.param_path_to_name(*this);
}

auto param_type() const -> hsx::HspParamType {
auto param_type() const -> HsxMptype {
return param_type_;
}

auto param_index() const -> std::size_t {
return param_index_;
}

auto var_metadata(HspObjects& objects) const->std::optional<hsx::HspVarMetadata> {
auto var_metadata(HspObjects& objects) const->std::optional<HsxVarMetadata> {
return objects.param_path_to_var_metadata(*this);
}
};
Expand Down Expand Up @@ -538,7 +534,7 @@ class HspObjectPath::Str final
return to_owned(u8"str");
}

auto value(HspObjects& objects) const -> hsx::HspStr {
auto value(HspObjects& objects) const -> HsxStrSpan {
return objects.str_path_to_value(*this);
}
};
Expand Down Expand Up @@ -587,7 +583,7 @@ class HspObjectPath::Double final
return to_owned(u8"double");
}

auto value(HspObjects& objects) const -> hsx::HspDouble {
auto value(HspObjects& objects) const -> HsxDouble {
return objects.double_path_to_value(*this);
}
};
Expand Down Expand Up @@ -636,7 +632,7 @@ class HspObjectPath::Int final
return to_owned(u8"int");
}

auto value(HspObjects& objects) const -> hsx::HspInt {
auto value(HspObjects& objects) const -> HsxInt {
return objects.int_path_to_value(*this);
}
};
Expand Down Expand Up @@ -798,15 +794,15 @@ class HspObjectPath::SystemVar final
{
std::shared_ptr<HspObjectPath const> parent_;

hsx::HspSystemVarKind system_var_kind_;
HsxSysvarKind system_var_kind_;

public:
using HspObjectPath::new_str;
using HspObjectPath::new_double;
using HspObjectPath::new_int;
using HspObjectPath::new_flex;

SystemVar(std::shared_ptr<HspObjectPath const> parent, hsx::HspSystemVarKind system_var_kind)
SystemVar(std::shared_ptr<HspObjectPath const> parent, HsxSysvarKind system_var_kind)
: parent_(std::move(parent))
, system_var_kind_(system_var_kind)
{
Expand Down Expand Up @@ -844,7 +840,7 @@ class HspObjectPath::SystemVar final
return objects.system_var_path_to_name(*this);
}

auto system_var_kind() const -> hsx::HspSystemVarKind {
auto system_var_kind() const -> HsxSysvarKind {
return system_var_kind_;
}
};
Expand Down
6 changes: 3 additions & 3 deletions src/knowbug_core/hsp_object_path_fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,11 @@ class HspObjectPath
auto new_static_var(std::size_t static_var_id) const->std::shared_ptr<HspObjectPath const>;

public:
auto new_element(hsx::HspDimIndex const& indexes) const->std::shared_ptr<HspObjectPath const>;
auto new_element(HsxIndexes indexes) const->std::shared_ptr<HspObjectPath const>;

protected:
// param_index: 親要素の何番目の引数か
auto new_param(hsx::HspParamType param_type, std::size_t param_index) const->std::shared_ptr<HspObjectPath const>;
auto new_param(HsxMptype param_type, std::size_t param_index) const->std::shared_ptr<HspObjectPath const>;

public:
auto new_label() const->std::shared_ptr<HspObjectPath const>;
Expand All @@ -242,7 +242,7 @@ class HspObjectPath
protected:
auto new_system_var_list() const->std::shared_ptr<HspObjectPath const>;

auto new_system_var(hsx::HspSystemVarKind system_var_kind) const->std::shared_ptr<HspObjectPath const>;
auto new_system_var(HsxSysvarKind system_var_kind) const->std::shared_ptr<HspObjectPath const>;

public:
auto new_call_stack() const->std::shared_ptr<HspObjectPath const>;
Expand Down
Loading

0 comments on commit eb1f68d

Please sign in to comment.