.. _stdlib_macro_boost: ====================================================== 用于错误宏操作的 Boost 软件包 ====================================================== .. include:: detail/macro_boost.rst Apply 模块实现了各种基础结构,简化了宏的编写。 所有函数和符号都在 “macro_boost ”模块中,使用 require 可以访问该模块。 :: require daslib/macro_boost .. _struct-macro_boost-CapturedVariable: .. das:attribute:: CapturedVariable CapturedVariable 字段是 +----------+---------------------------------------------+ +variable + :ref:`ast::Variable ` ?+ +----------+---------------------------------------------+ +expression+ :ref:`ast::ExprVar ` ? + +----------+---------------------------------------------+ +eref +bool + +----------+---------------------------------------------+ 将捕获的变量与使用该变量的 `ExprVar` 一起存储 ++++++++++++++++++++ 功能注释 ++++++++++++++++++++ .. _handle-macro_boost-MacroVerifyMacro: .. das:attribute:: MacroVerifyMacro 该宏将 macro_verify(expr,message,prog,at)转换为以下代码:: if !expr macro_error(prog,at,message) return [[ExpressionPtr]] +++++++++++ 调用宏 +++++++++++ .. _call-macro-macro_boost-return_skip_lockcheck: .. das:attribute:: return_skip_lockcheck 与常规 return <- 类似,但不检查锁 ++++++++++++++++++++++ 实现细节 ++++++++++++++++++++++ * :ref:`macro_verify (expr:bool const;prog:smart_ptr\ const;at:rtti::LineInfo const;message:string const) : void ` .. _function-_at_macro_boost_c__c_macro_verify_Cb_CY_ls_ProgramPtr_gr_1_ls_H_ls_rtti_c__c_Program_gr__gr__qm_M_CH_ls_rtti_c__c_LineInfo_gr__Cs: .. das:function:: macro_verify(expr: bool const; prog: ProgramPtr; at: LineInfo const; message: string const) +--------+----------------------------------------------------+ +argument+argument type + +========+====================================================+ +expr +bool const + +--------+----------------------------------------------------+ +prog + :ref:`ProgramPtr ` + +--------+----------------------------------------------------+ +at + :ref:`rtti::LineInfo ` const+ +--------+----------------------------------------------------+ +message +string const + +--------+----------------------------------------------------+ 与校验相同,只是校验会产生宏错误,然后返回 [[ExpressionPtr]] +++++++++++++ 未分类 +++++++++++++ .. _function-_at_macro_boost_c__c_capture_block_CY_ls_ExpressionPtr_gr_1_ls_H_ls_ast_c__c_Expression_gr__gr__qm_M: .. das:function:: capture_block(expr: ExpressionPtr) capture_block returns array< :ref:`macro_boost::CapturedVariable ` > +--------+--------------------------------------------+ +argument+argument type + +========+============================================+ +expr + :ref:`ExpressionPtr ` + +--------+--------------------------------------------+ 收集表达式中所有捕获的变量。 .. _function-_at_macro_boost_c__c_collect_finally_CY_ls_ExpressionPtr_gr_1_ls_H_ls_ast_c__c_Expression_gr__gr__qm_M_Cb: .. das:function:: collect_finally(expr: ExpressionPtr; alwaysFor: bool const) collect_finally returns array< :ref:`ast::ExprBlock ` ?> +---------+--------------------------------------------+ +argument +argument type + +=========+============================================+ +expr + :ref:`ExpressionPtr ` + +---------+--------------------------------------------+ +alwaysFor+bool const + +---------+--------------------------------------------+ 收集表达式中的所有最后代码块。 返回 ExprBlock? 的数组,其中包含所有带有 `finally` 部分的块 不进入 “make_block ”表达式,如 `lambda` 或 “block ”表达式。 .. _function-_at_macro_boost_c__c_collect_labels_CY_ls_ExpressionPtr_gr_1_ls_H_ls_ast_c__c_Expression_gr__gr__qm_M: .. das:function:: collect_labels(expr: ExpressionPtr) collect_labels returns array +--------+--------------------------------------------+ +argument+argument type + +========+============================================+ +expr + :ref:`ExpressionPtr ` + +--------+--------------------------------------------+ 收集表达式中的所有标签。返回包含标签索引的整数数组 不用于 “make_block ”表达式,如 `lambda` 或 “block ”表达式。