FSM之SMC使用总结
来源:互联网 发布:淘宝详情自动生成鲁班 编辑:程序博客网 时间:2024/06/05 04:41
FSM之SMC使用总结
Part1: Smc.jar state machine compiler usage
Reference:
http://smc.sourceforge.net/
(Updated February 16, 2015)
Downloads:
http://sourceforge.net/projects/smc/files/
1) show help:
$ java -jar ./Smc.jar -help
2) generate java (c, cpp, js, python, object-c ...) classes from user_defined.sm file:
$ java -jar Smc.jar -c++ user_defined.sm$ java -jar Smc.jar -graph -glevel 1 user_defined.sm
A Filename.dot file also generated (Filename should replaced by actural dot filename).
$ java -jar ./Smc.jar -java7 user_defined.sm
3) generate a workflow map
You need graphviz installed first, and add path to .../bin/dot.exe into system environments. in my pc, that is:
C:\DEVPACK\graphviz-2.38\release\bin
Now enter folder of Filename.dot generated in step 2), and type:
$ dot Filename.dot -Tpng -o Filename.png
Enjoy it!
Part2: Example
1) user_defined.sm. The only file we should created by hands
///////////////////////////////////////////////////////////////////////// ColorTable.sm// -- ColorTable State Map for C++ classes auto-generation//// 1) generate c++ classes:// $ java -jar Smc.jar -c++ ColorTable.sm//// 2) generate graphviz dot graph:// $ java -jar Smc.jar -graph -glevel 1 ColorTable.sm//// see also:// http://graphviz.org///// Author: cheungmine// Copyright 2015-?, All rights reserved./////////////////////////////////////////////////////////////////////////%class ColorTable%header ColorTable.h%start ColorTableMap::Shuffle%map ColorTableMap%%/*** State {* Transition [Guard Condition]* EndState {* Action(s)* }** Transition [context.getOwner().is_valid()]* EndState {* Action(s)* }* ...* }*/ShuffleEntry { enterShuffle();}Exit { leaveShuffle();}{ Next [ context.getOwner().shuffleDone() ] Swappable {//=>user swap actions }}SwappableEntry { enterSwappable();}Exit { leaveSwappable();}{Next [context.getOwner().swapDone() && context.getOwner().canErase()] Erasable { }Next [context.getOwner().swapDone()]Shuffle {}}ErasableEntry { enterErasable();}Exit { leaveErasable();}{Next [ context.getOwner().eraseDone() ] Collapse { }}CollapseEntry { enterCollapse();}Exit { leaveCollapse();}{Next [context.getOwner().collapseDone() && context.getOwner().canErase()]Erasable {}Next [context.getOwner().collapseDone()]Crash {}}CrashEntry { enterCrash();}Exit { leaveCrash();}{ Next [ context.getOwner().crashDone() && context.getOwner().canErase() ] Erasable { } Next [ context.getOwner().crashDone() ] Swappable {//=>user swap actions }}%%
2) generate all derived files(default is c++):
$ java -jar Smc.jar -graph -glevel 1 ColorTable.sm
3) generate flow map using graphviz:
$ dot ColorTable.dot -Tpng -o ColorTable.png
没图你说个毛! 下面上图:
Game Over!
0 0
- FSM之SMC使用总结
- Unity3D架构系列之- FSM有限状态机设计六(总结)
- SMC之抛砖引玉(VC++6.0)
- ptrace之SMC,反调试
- erlang fsm 使用
- 有限状态机(FSM)学习总结
- 有限状态机(FSM)学习总结
- ZEBRA中FSM编写总结
- FSM
- FSM
- FSM
- FSM
- FSM
- Unity3D架构系列之- FSM有限状态机设计(六)(总结篇)
- U3D架构系列之- FSM有限状态机设计六(总结篇)
- 防反编译之SMC(自修改代码)
- 泛洪法与SMC算法的综合使用
- Raw-OS源码分析之fsm(有限状态机)
- CColorStatic 改变颜色
- Myeclipse 2014 破解方法
- 开始博客记录
- [置顶] 数据库分库分表(sharding)系列(五) 一种支持自由规划无须数据迁移和修改路由代码的Sharding扩容方案
- Linux使用定时器消抖
- FSM之SMC使用总结
- android ndk
- 说说JSON和JSONP 也许你会豁然开朗
- 关于Hadoop学习的感悟(一)
- win7 64位操作系统 配置pl\sql dev
- nginx源码分析—模块及其初始化
- Merkle Tree(HashTree)
- 保留用于局域网的地址
- Oracle 进程结构