当前位置: 首页>>代码示例>>C++>>正文


C++ OperationArgs::evaluate_changeables方法代码示例

本文整理汇总了C++中OperationArgs::evaluate_changeables方法的典型用法代码示例。如果您正苦于以下问题:C++ OperationArgs::evaluate_changeables方法的具体用法?C++ OperationArgs::evaluate_changeables怎么用?C++ OperationArgs::evaluate_changeables使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OperationArgs的用法示例。


在下文中一共展示了OperationArgs::evaluate_changeables方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

extern "C" closure builtin_function_reapply(OperationArgs& Args)
{
  int index1 = Args.reference(0).as_index_var();
  int R1 = Args.current_closure().lookup_in_env( index1 );

  int index2 = Args.reference(1).as_index_var();
  int R2 = Args.current_closure().lookup_in_env( index2 );

  expression_ref apply_E;
  {
    expression_ref fE = index_var(1);
    expression_ref argE = index_var(0);
    apply_E = (fE, argE);
  }

  // %1 %0 {R1,R2}
  int apply_reg = Args.allocate({apply_E,{R1, R2}});

  // FIXME - aren't we trying to eliminate general evaluation of regs that aren't children?  See below:

  // Evaluate the newly create application reg - and depend upon it!
  if (Args.evaluate_changeables())
    Args.evaluate_reg_to_object(apply_reg);

  return {index_var(0),{apply_reg}};
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例2: assert

extern "C" closure builtin_function_get_modifiable_for_index(OperationArgs& Args)
{
  assert(not Args.evaluate_changeables());

  int R1 = Args.evaluate(0).as_int();

  return {index_var(0),{R1}};
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例3: constructor

extern "C" closure builtin_function_is_changeable(OperationArgs& Args)
{
  assert(not Args.evaluate_changeables());

  int R1 = Args.evaluate_slot_to_reg(0);

  const reg_heap& M = Args.memory();
  if (M.reg_is_changeable(R1))
    return constructor("Prelude.True",0);
  else
    return constructor("Prelude.False",0);
}
开发者ID:,项目名称:,代码行数:12,代码来源:

示例4: E

extern "C" closure builtin_function_new_modifiable(OperationArgs& Args)
{
  assert(not Args.evaluate_changeables());

  reg_heap& M = Args.memory();

  int D = Args.reg_for_slot(0);

  // Allocate a reg, and fill it with a modifiable of the correct index
  expression_ref E(new expression(modifiable(),{index_var(0)}));
  closure C{E,{D}};
  int R1 = Args.allocate(std::move(C));
  M.make_reg_changeable(R1);

  // Return a reference to the new modifiable.
  return {index_var(0),{R1}};
}
开发者ID:,项目名称:,代码行数:17,代码来源:

示例5: myexception

extern "C" closure builtin_function_evaluate(OperationArgs& Args)
{
  auto& M = Args.memory();

  int c = Args.evaluate(0).as_int();

#ifndef NDEBUG
  if (Args.evaluate_changeables() and c >= 0)
    throw myexception()<<"Calling builtin_function_evaluate( ) when evaluate_changeables=true and c >= 0";
#endif

  int R1 = Args.reg_for_slot(1);

  int R2 = 0;

  if (c < 0)
    R2 = M.incremental_evaluate_unchangeable(R1);
  else
    R2 = M.incremental_evaluate_in_context(R1, c).first;

  assert( R2 );

  return {index_var(0),{R2}};
}
开发者ID:,项目名称:,代码行数:24,代码来源:


注:本文中的OperationArgs::evaluate_changeables方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。