|
QP/C++
|
00001 00002 // Product: QEP/C++ 00003 // Last Updated for Version: 4.5.04 00004 // Date of the Last Update: Feb 09, 2013 00005 // 00006 // Q u a n t u m L e a P s 00007 // --------------------------- 00008 // innovating embedded systems 00009 // 00010 // Copyright (C) 2002-2013 Quantum Leaps, LLC. All rights reserved. 00011 // 00012 // This program is open source software: you can redistribute it and/or 00013 // modify it under the terms of the GNU General Public License as published 00014 // by the Free Software Foundation, either version 2 of the License, or 00015 // (at your option) any later version. 00016 // 00017 // Alternatively, this program may be distributed and modified under the 00018 // terms of Quantum Leaps commercial licenses, which expressly supersede 00019 // the GNU General Public License and are specifically designed for 00020 // licensees interested in retaining the proprietary status of their code. 00021 // 00022 // This program is distributed in the hope that it will be useful, 00023 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00024 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00025 // GNU General Public License for more details. 00026 // 00027 // You should have received a copy of the GNU General Public License 00028 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00029 // 00030 // Contact information: 00031 // Quantum Leaps Web sites: http://www.quantum-leaps.com 00032 // http://www.state-machine.com 00033 // e-mail: info@quantum-leaps.com 00035 #ifndef qep_pkg_h 00036 #define qep_pkg_h 00037 00041 00042 #include "qep_port.h" // QEP port 00043 00044 #ifdef Q_SPY // QS software tracing enabled? 00045 #include "qs_port.h" // include QS port 00046 #else 00047 #include "qs_dummy.h" // disable the QS software tracing 00048 #endif // Q_SPY 00049 00050 QP_BEGIN_ 00051 00054 extern QEvt const QEP_reservedEvt_[4]; 00055 00057 QSignal const QEP_EMPTY_SIG_ = static_cast<QSignal>(0); 00058 00060 int8_t const QEP_MAX_NEST_DEPTH_ = static_cast<int8_t>(6); 00061 00062 uint8_t const u8_0 = static_cast<uint8_t>(0); 00063 uint8_t const u8_1 = static_cast<uint8_t>(1); 00064 int8_t const s8_0 = static_cast<int8_t>(0); 00065 int8_t const s8_1 = static_cast<int8_t>(1); 00066 int8_t const s8_n1 = static_cast<int8_t>(-1); 00067 00068 QP_END_ 00069 00071 #define QEP_TRIG_(state_, sig_) \ 00072 ((*(state_))(this, &QEP_reservedEvt_[sig_])) 00073 00075 #define QEP_EXIT_(state_) do { \ 00076 if (QEP_TRIG_(state_, Q_EXIT_SIG) == Q_RET_HANDLED) { \ 00077 QS_BEGIN_(QS_QEP_STATE_EXIT, QS::smObj_, this) \ 00078 QS_OBJ_(this); \ 00079 QS_FUN_(state_); \ 00080 QS_END_() \ 00081 } \ 00082 } while (false) 00083 00085 #define QEP_ENTER_(state_) do { \ 00086 if (QEP_TRIG_(state_, Q_ENTRY_SIG) == Q_RET_HANDLED) { \ 00087 QS_BEGIN_(QS_QEP_STATE_ENTRY, QS::smObj_, this) \ 00088 QS_OBJ_(this); \ 00089 QS_FUN_(state_); \ 00090 QS_END_() \ 00091 } \ 00092 } while (false) 00093 00094 #endif // qep_pkg_h 00095 00096
1.7.6.1