diff --git a/.claude/settings.local.json b/.claude/settings.local.json deleted file mode 100644 index 1dbecc56..00000000 --- a/.claude/settings.local.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "permissions": { - "allow": [ - "WebFetch(domain:dev.epicgames.com)", - "WebFetch(domain:github.com)", - "Bash(grep:*)", - "WebSearch", - "Bash(clangd:*)", - "Bash(clangd-16:*)", - "Bash(ssh jyelon-office \"clangd --version 2>/dev/null || clangd-16 --version 2>/dev/null || clangd-18 --version 2>/dev/null || ls /usr/bin/clangd*\")", - "Bash(git check-ignore:*)", - "Bash(ls:*)", - "WebFetch(domain:ikrima.dev)", - "WebFetch(domain:indxzero.github.io)" - ], - "deny": [ - "Bash(git commit *)", - "Bash(git push *)", - "Bash(rm -rf *)" - ], - "defaultMode": "acceptEdits" - } -} diff --git a/luprex/cpp/core/drivenengine.cpp b/luprex/cpp/core/drivenengine.cpp index 5e2d7b00..f7f86e42 100644 --- a/luprex/cpp/core/drivenengine.cpp +++ b/luprex/cpp/core/drivenengine.cpp @@ -110,22 +110,20 @@ static DrivenEngine *make_engine(std::string_view kind) { ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// -Channel::Channel(DrivenEngine *de, int chid, int port, const eng::string &target, bool stop) { +Channel::Channel(int chid, int port, const eng::string &target, bool stop) { chid_ = chid; port_ = port; closed_ = false; target_ = target; stop_driver_ = stop; - sb_in_ = eng::make_shared(); - sb_out_ = eng::make_shared(); } std::string_view Channel::peek_outgoing() const { - return sb_out_->view(); + return sb_out_.view(); } void Channel::sent_outgoing(int nbytes) { - sb_out_->read_bytes(nbytes); + sb_out_.read_bytes(nbytes); } ////////////////////////////////////////////////////////////////////////////// @@ -148,7 +146,7 @@ double DrivenEngine::get_clock() { SharedChannel DrivenEngine::new_outgoing_channel(const eng::string &target) { int chid = find_unused_chid(); new_outgoing_.push_back(chid); - SharedChannel result = eng::make_shared(this, chid, 0, target, stop_driver_); + SharedChannel result = eng::make_shared(chid, 0, target, stop_driver_); channels_[chid] = result; return result; } @@ -441,7 +439,7 @@ void DrivenEngine::drv_recv_incoming(uint32_t chid, uint32_t nbytes, const char if (nbytes > 0) { std::string_view sbytes(bytes, nbytes); Channel *ch = get_chid(chid); - ch->sb_in_->write_bytes(sbytes); + ch->sb_in_.write_bytes(sbytes); } } @@ -454,7 +452,7 @@ void DrivenEngine::drv_notify_close(uint32_t chid, uint32_t len, const char *dat uint32_t DrivenEngine::drv_notify_accept(uint32_t port) { int chid = find_unused_chid(); - channels_[chid] = eng::make_shared(this, chid, port, "", stop_driver_); + channels_[chid] = eng::make_shared(chid, port, "", stop_driver_); accepted_channels_.push_back(channels_[chid]); return chid; } diff --git a/luprex/cpp/core/drivenengine.hpp b/luprex/cpp/core/drivenengine.hpp index 502bef0c..cd724b61 100644 --- a/luprex/cpp/core/drivenengine.hpp +++ b/luprex/cpp/core/drivenengine.hpp @@ -65,8 +65,8 @@ class Channel : public eng::opnew { public: // Get the buffers associated with this channel. // - StreamBuffer *out() { return sb_out_.get(); } - StreamBuffer *in() { return sb_in_.get(); } + StreamBuffer *out() { return &sb_out_; } + StreamBuffer *in() { return &sb_in_; } // The channel ID. These are reused. // @@ -96,7 +96,7 @@ public: // Channels are referenced by shared_ptr. You can // release your shared_ptr at any time. // - Channel(DrivenEngine *de, int chid, int port, const eng::string &target, bool stop); + Channel(int chid, int port, const eng::string &target, bool stop); ~Channel() {}; private: @@ -110,8 +110,8 @@ private: int chid_; // These are the in/out buffers presented to the user. - std::shared_ptr sb_in_; - std::shared_ptr sb_out_; + StreamBuffer sb_in_; + StreamBuffer sb_out_; int port_; bool closed_;