xo-umbrella2/xo-interpreter2/include/xo/interpreter2/DVsmEvalArgsFrame.hpp
Roland Conybeare 7f4b4e7cbd git subrepo clone (merge) git@github.com:Rconybea/xo-interpreter2.git xo-interpreter2
subrepo:
  subdir:   "xo-interpreter2"
  merged:   "e4c6ff57"
upstream:
  origin:   "git@github.com:Rconybea/xo-interpreter2.git"
  branch:   "main"
  commit:   "e4c6ff57"
git-subrepo:
  version:  "0.4.9"
  origin:   "???"
  commit:   "???"
2026-06-06 22:13:05 -04:00

67 lines
2.3 KiB
C++

/** @file DVsmEvalArgsFrame.hpp
*
* @author Roland Conybeare, Feb 2026
**/
#pragma once
#include "VsmApplyFrame.hpp"
#include <xo/expression2/DApplyExpr.hpp>
namespace xo {
namespace scm {
/** frame for executing an apply expression **/
class DVsmEvalArgsFrame {
public:
using AGCObject = xo::mm::AGCObject;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using AAllocator = xo::mm::AAllocator;
using ppindentinfo = xo::print::ppindentinfo;
public:
/** see picture in VirtualSchematikaMachine._do_eval_apply_op()
*
* old_parent = [apply frame]
* old_cont = [xfer to called function]
*
**/
DVsmEvalArgsFrame(DVsmApplyFrame * parent,
VsmInstr cont,
DApplyExpr * apply_expr);
static DVsmEvalArgsFrame * make(obj<AAllocator> mm,
DVsmApplyFrame * apply_frame,
VsmInstr old_cont,
DApplyExpr * apply_expr);
DVsmApplyFrame * parent() const noexcept { return parent_; }
VsmInstr cont() const noexcept { return cont_; }
const DApplyExpr * apply_expr() const noexcept { return apply_expr_; }
int32_t i_arg() const noexcept { return i_arg_; }
int32_t increment_arg() { return ++i_arg_; }
DVsmEvalArgsFrame * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept;
bool pretty(const ppindentinfo & ppii) const;
protected:
/** parent stack frame **/
DVsmApplyFrame * parent_ = nullptr;
/** continuation after eval args completed (always VsmInstr::c_apply) **/
VsmInstr cont_;
/** expression being evaluated **/
DApplyExpr * apply_expr_ = nullptr;
/** next argument to be evaluated. -1 means function head **/
int32_t i_arg_ = -1;
};
} /*namespace scm*/
} /*namespace xo*/
/* end DVsmEvalArgsFrame.hpp */