// This file is part of PUMA. // Copyright (C) 1999-2003 The PUMA developer team. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as // published by the Free Software Foundation; either version 2 of // the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free // Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, // MA 02111-1307 USA #ifndef __ext_ac_syntax_h_ah__ #define __ext_ac_syntax_h_ah__ #include "Puma/CTokens.h" // ************************* // C and CC-Syntax extension // ************************* // new C and CC Syntax member functions slice class ExtACSyntax { protected: void skip_pointcut_expr (); CTree * rule_order_decl (); virtual bool order_decl (); CTree * rule_order_list (); virtual bool order_list (); CTree * rule_advice_decl (); virtual bool advice_decl (); CTree * rule_pointcut_decl (); virtual bool pointcut_decl (); CTree * rule_slice_ref (); virtual bool slice_ref (); CTree * rule_class_slice_decl (); virtual bool class_slice_decl (); CTree * rule_class_slice_member_decl (); virtual bool class_slice_member_decl (); CTree * rule_class_slice_member_list (); virtual bool class_slice_member_list (); CTree * rule_pointcut_expr (); virtual bool pointcut_expr (); CTree * rule_pointcut_member_decl (); virtual bool pointcut_member_decl (); CTree * rule_advice_member_decl (); virtual bool advice_member_decl (); CTree * rule_intro (); virtual bool intro (); }; slice class ExtACCSyntax { protected: CTree * rule_slice_ref (); virtual bool slice_ref (); CTree * rule_class_slice_decl (); virtual bool class_slice_decl (); CTree * rule_class_slice_name (); virtual bool class_slice_name (); CTree * rule_class_slice_base_clause (); virtual bool class_slice_base_clause (); // FIXME tagging CTree * rule_tag_expr (); virtual bool tag_expr (); CTree * rule_intro (); virtual bool intro (); // FIXME tagging }; // ************************* // C and CC-Syntax extension // ************************* aspect ExtACSyntaxCoupling { // relevant pointcuts pointcut csyntax () = "Puma::CSyntax"; pointcut ccsyntax () = "Puma::CCSyntax"; // structural extensions advice csyntax () : slice ExtACSyntax; advice ccsyntax () : slice ExtACCSyntax; // behavioral extensions advice within (derived (csyntax ())) && execution ("% ...::init_class_key ()") : after () { tjp->that ()->_class_key_1.set (Puma::TOK_ASPECT); } // FIXME tagging advice within (derived (csyntax ())) && execution ("bool ...::CmpdStmt::parse(...)") && that("Puma::CCSyntax") : around () { JoinPoint::template Arg<0>::ReferredType &s = *tjp->arg<0> (); if (s.tag_spec_seq ()) { tjp->proceed (); } else { tjp->proceed (); } } // TagExpression for pce building advice execution ("bool Puma::CCSyntax::PostfixExpr2::parse(...)") : around () { JoinPoint::template Arg<0>::ReferredType &s = *tjp->arg<0> (); if (s.tag_expr ()) { *tjp->result () = true; } else tjp->proceed (); } advice execution ("bool Puma::CCSyntax::TagSpecSeq::parse(...)") : around () { JoinPoint::template Arg<0>::ReferredType &s = *tjp->arg<0> (); if (s.semantic().in_pointcut_expr()) { *tjp->result () = false; } else tjp->proceed(); } // FIXME tagging advice execution ("bool Puma::CCSyntax::BlockDecl::parse(...)") || execution ("bool Puma::CSyntax::BlockDecl::parse(...)") : after () { // 1: pointcut_decl // 1: advice_decl // 1: class_slice_decl JoinPoint::template Arg<0>::ReferredType &s = *tjp->arg<0>(); bool &result = *tjp->result (); if (!result) { if (s.pointcut_decl () || s.advice_decl () || s.class_slice_decl () || s.class_slice_member_decl ()) result = true; } } advice within (derived (csyntax ())) && execution ("% ...::rule_member_decl ()") : around () { // 1: pointcut_member_decl // 1: advice_member_decl if (tjp->that ()->pointcut_member_decl () || tjp->that ()->advice_member_decl () || tjp->that ()->class_slice_decl ()) *tjp->result () = tjp->that ()->builder ().member_decl (); else tjp->proceed (); } }; #endif /* __ext_ac_syntax_h_ah__ */