registerListener and assumed transition target

41 views
Skip to first unread message

Matt O

unread,
Jun 8, 2012, 5:59:56 PM6/8/12
to scio...@googlegroups.com
Created a simple state chart that handles an input without transitioning to new target.

<state id="S1">
  <transition event="I1">
    <!-- do something -->
  </transition>
</state>

This works fine until I register a listener on the interpreter (registerListener):

[14:54:48.004] transition.targets is undefined @ http://jbeard4.github.com/SCION/builds/latest/scion.js:299

Also, I initially attempted to register onEntry, and onExit callbacks, but I got the following error:

[14:56:11.958] l.onTransition is not a function @ http://jbeard4.github.com/SCION/builds/latest/scion.js:299

I was able to work around this by defining an empty callback function, but it would be nice if the API allowed the callbacks to be optional.

Regards,
Matt

Jacob Beard

unread,
Jun 8, 2012, 6:05:53 PM6/8/12
to scio...@googlegroups.com
Thanks for the bug report and feature request! I'll look into it.

Jake

Jacob Beard

unread,
Jun 8, 2012, 6:15:38 PM6/8/12
to scio...@googlegroups.com
Should be fixed. Feel free to update from github and try it.

Jake

MattO

unread,
Jun 8, 2012, 8:50:17 PM6/8/12
to scio...@googlegroups.com
Jake,

Thanks for the quick fix. I'd like to try it out. Can you provide some
help on building scion from source?

1. I'm on Win7.
2. I cloned git://github.com/jbeard4/SCION.git to a local dir (e.g. c:\scion)
3. I installed node from http://nodejs.org via the .msi, and node is
now in my PATH.
4. In the local scion git dir, I ran "npm install stitch", and it
installed that module in c:\scion\node_modules
5. At some point I ran "npm update" and it installed xmldom in
c:\scion\node_modules
6. I have cygwin, and when I run "make" from c:\scion, I see:

node lib/browser/build/stitch.js
Compiled scion.js

But scion.js is 9 bytes and contains the text "undefined".

Have you seen this before? Got any tips?

Thanks.

Matt

Jacob Beard

unread,
Jun 8, 2012, 9:19:29 PM6/8/12
to scio...@googlegroups.com
Hi Matt,

I haven't tried building on Windows, only Linux.

In any case, I'd recommend using git clone --recursive, as there are
some dependencies which are included as git submodules (these are
dependencies for which an npm package does not exist and/or the
browser and rhino also depend). This might be causing the stitch
script to fail.

By the way, the makefile is only needed to build scion for the browser
(or for the Java bindings). For node and rhino 1.7R3, you should just
be able to install it via git "clone --recursive
git://github.com/jbeard4/SCION.git", or "npm install
git://github.com/jbeard4/SCION.git", and use it directly without
building it.

I'll look into building on Windows shortly.

Jake

Jacob Beard

unread,
Jun 8, 2012, 10:47:24 PM6/8/12
to scio...@googlegroups.com
Hi,

So, I think the issue might be with running stitch on Windows. I
probably won't drill down into it until next week, but in the
meantime, I've uploaded a nightly with the latest changes:

http://jbeard4.github.com/SCION/builds/nightly/scion.js
http://jbeard4.github.com/SCION/builds/nightly/scion-min.js

Please feel free to report any other issues you find. Cheers,

Jake

MattO

unread,
Jun 9, 2012, 12:56:15 AM6/9/12
to scio...@googlegroups.com
Hi, Jake,

Thanks for the link to the nightly. That resolves the issues I reported.

Thanks also for the clarification on the Makefile. I didn't
specifically mention it, but I'm using scion in the client browser, so
I'm happy to continue pursuing this with you if you have the time.

I tweaked lib/browser/build/stitch.js as follows:

diff --git a/lib/browser/build/stitch.js b/lib/browser/build/stitch.js
index 79f23ec..85c5d1e 100644
--- a/lib/browser/build/stitch.js
+++ b/lib/browser/build/stitch.js
@@ -7,6 +7,7 @@ var pkg = stitch.createPackage({
});

pkg.compile(function (err, source){
+ if (err) throw err;
fs.writeFile('scion.js', source, function (err) {
if (err) throw err;

That revealed the following:

lib\browser\build\stitch.js:10
if (err) throw err;
^
Error: lib\browser\SCXML.js isn't in the require path
at node_modules\stitch\lib\stitch.js:181:27

Haven't dug any deeper.

Matt

Jacob Beard

unread,
Jun 11, 2012, 11:25:16 AM6/11/12
to scio...@googlegroups.com
Hi Matt,

Windows build should be fixed. There was indeed a bug in stitch, which
I've patched.

Here's how I recommend building scion on Windows:
1. Get node
2. Get cygwin, and install make and git for cygwin
3. Open a cygwin terminal and get scion: git clone --recursive
git://github.com/jbeard4/SCION.git
4. Open a cmd.exe prompt, and use npm to install my patched version of
stitch (for some reason, npm doesn't work under cygwin): npm install
git://github.com/jbeard4/stitch.git
5. Under cygwin, in the SCION directory, run make: make scion.js

This should produce the unminified version. I'm still looking into
what is required to get uglify working on Windows to build
scion-min.js.

Cheers,

Jake

MattO

unread,
Jun 11, 2012, 1:56:51 PM6/11/12
to scio...@googlegroups.com
Hi, Jake,

Thanks for the stitch fix and the build instructions.

Directory of c:\scion
...
06/11/2012 10:51 AM 102,055 scion.js

Works great.

Regards,
Matt

Jacob Beard

unread,
Jun 11, 2012, 2:05:10 PM6/11/12
to scio...@googlegroups.com
Glad to hear it. Good luck, and happy hacking :)

Jake
Reply all
Reply to author
Forward
0 new messages