Skip to content
This repository has been archived by the owner on Sep 25, 2018. It is now read-only.

Commit

Permalink
Merged 2.0.0 and expresscion branch into master.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbeard4 committed Jun 24, 2015
2 parents 363490b + b2416f4 commit 42e75a4
Show file tree
Hide file tree
Showing 58 changed files with 11,221 additions and 351 deletions.
13 changes: 2 additions & 11 deletions .gitignore
@@ -1,12 +1,3 @@
*.pyc
*.sw*
Session.vim
target
node_modules
build
src/demo/node-repl/build/
src/demo/nodejs/build/
scion-browser.js
scion-browser-min.js
TODO
log
components
out*
6 changes: 4 additions & 2 deletions .travis.yml
@@ -1,6 +1,8 @@
language: node_js
node_js:
- 0.8
- 0.12
- 0.11
- 0.10
- 0.8
before_install:
- git submodule update --init --recursive
- npm install -g npm
20 changes: 12 additions & 8 deletions Makefile
@@ -1,14 +1,18 @@
js = $(shell find lib/ -name "*.js")

all : dist/scion.js dist/scion-min.js
all : dist/scxml.js dist/scxml.min.js

dist/scion.js : $(js)
mkdir -p dist && node lib/browser/build/stitch.js dist/scion.js
dist/scxml.js : $(js)
component build -o dist -n scxml -s scxml

dist/scion-min.js : dist/scion.js
uglifyjs dist/scion.js > dist/scion-min.js
dist/scxml.min.js : dist/scxml.js
uglifyjs dist/scxml.js > dist/scxml.min.js

clean :
rm -rf dist
get-deps :
npm install -g component uglifyjs
component install

.PHONY : clean all
clean :
rm dist/*

.PHONY : get-deps all clean
337 changes: 69 additions & 268 deletions README.md

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions bin/repl.js
@@ -0,0 +1,40 @@
#!/usr/bin/env node
//A simple scxml interactive simulation environment
var scxml = require('..'),
repl = require('repl');

var pathToScxml = process.argv[2];

if(!pathToScxml){
console.log('Usage: scxml foo.scxml');
process.exit(1);
}

//1 - 2. get the xml file and convert it to jsonml
scxml.pathToModel(pathToScxml,function(err,model){

if(err){
throw err;
}

//Use the statechart object model to instantiate an instance of the statechart interpreter. Optionally, we can pass to the construct an object to be used as the context object (the 'this' object) in script evaluation. Lots of other parameters are available.
var interpreter = new scxml.scion.Statechart(model);

interpreter.start();

console.log(interpreter.getConfiguration());

var parseRE = /\((.*)\n\)/;

function processEvent(cmd,dontKnow,alsoDontKnow,callback){
var e = cmd.match(parseRE)[1];
interpreter.gen({name : e});
var conf = interpreter.getConfiguration();
callback(null,conf);
}

//start
repl.start('#',process.stdin,processEvent);

});

33 changes: 33 additions & 0 deletions component.json
@@ -0,0 +1,33 @@
{
"name": "scxml",
"repo": "jbeard4/scxml.js",
"description": "An implementation of SCXML in portable ECMAScript.",
"version": "0.0.4",
"keywords": [
"scxml",
"statecharts",
"w3c",
"javascript"
],
"dependencies": {
"jbeard4/scion-ng": "*",
"isaacs/sax-js": "*"
},
"development": {},
"license": "Apache-2.0",
"main" : "lib/runtime/platform-bootstrap/browser/index.js",
"scripts": [
"lib/compiler/scxml-to-scjson.js",
"lib/compiler/scjson-to-module.js",
"lib/runtime/transform/util.js",
"lib/runtime/transform/inline-srcs.js",
"lib/runtime/platform-bootstrap/browser/path.js",
"lib/runtime/platform-bootstrap/browser/url.js",
"lib/runtime/platform-bootstrap/browser/platform.js",
"lib/runtime/platform-bootstrap/browser/index.js",
"lib/runtime/platform-bootstrap/platform.js",
"lib/runtime/document-string-to-model.js",
"lib/runtime/facade.js"
]
}

0 comments on commit 42e75a4

Please sign in to comment.