#--------------------------------------------------------------------- # SVM (Statechart Virtual Machine) # -- an interpreter for an extended statechart formalism #--------------------------------------------------------------------- # # Copyright (C) 2003 Thomas Huining Feng # #--------------------------------------------------------------------- # Address: MSDL, SOCS, McGill Univ., Montreal, Canada # HomePage: http://msdl.cs.mcgill.ca/people/tfeng/ # SVM HomePage: http://msdl.cs.mcgill.ca/people/tfeng/?research=svm # Download: http://savannah.nongnu.org/files/?group=svm # CVS: :pserver:anoncvs@subversions.gnu.org:/cvsroot/svm # (projects "svm" and "jsvm") # Email: hfeng2@cs.mcgill.ca #--------------------------------------------------------------------- # # This file is part of SVM. # #--------------------------------------------------------------------- # SVM 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. # # SVM 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 SVM; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #--------------------------------------------------------------------- MACRO: INIT = 0 CURRENT = [INIT] OPTIONS: InnerTransitionFirst = 1 IMPORTATION: myself = Counter.des STATECHART: STABLE [DS] SMALLER [myself] [INIT = [INIT]] [CURRENT = [EVAL([CURRENT]-1)]] LARGER [myself] [INIT = [INIT]] [CURRENT = [EVAL([CURRENT]+1)]] TRANSITION: S:LARGER C:[CURRENT] >= [INIT] E:dec N:STABLE TRANSITION: S:STABLE C:[CURRENT] <= [INIT] E:dec N:SMALLER TRANSITION: S:SMALLER C:[CURRENT] <= [INIT] E:inc N:STABLE TRANSITION: S:STABLE C:[CURRENT] >= [INIT] E:inc N:LARGER TRANSITION: S:STABLE E:get N:STABLE O:[EVENT('CURRENT')] ENTER: N:STABLE O:[DUMP('Current value is [CURRENT].')]