Giter Club home page Giter Club logo

emtcl's Introduction

emtcl

The imaginatively named emtcl lets you compile tcl or jimtcl with emscripten. It's pretty easy so there's not much here. The small amount there is is available under the 3-clause BSD license (see "LICENSE").

Rather than trying to compile tclsh/jimsh and get stdin working, it instead compiles the tcl library and exposes some C api calls. See js/postJs.js for how this is done.

Current supported interpreters (and their versions) are:

  • tcl - core_8_6_1
  • jimtcl - 0.75

Tcl comes with a toy DOM library as a demo. See EXTRAS.

BUILD

Pretty easy (assuming you've got the emscripten sdk on your path):

$ make tclprep # One off prep - hacks.patch application and configure
$ make emtcl   # Build emtcl.js

or for jimtcl:

$ make jimtclprep # One off prep - tweaks appropriate #defines and configure
$ make emjimtcl   # Build emjimtcl.js

If you want to totally reset all build files in ./tcl/ and ./jimtcl/ and start again:

$ make reset

This removes all changes and untracked files in there, so be careful!

EXTRAS

EmTcl (not EmJimTcl) comes with a toy DOM library compiled into it by default as a demonstration of how one could do interesting things.

It currently is a command of the form dom attr|css selector key val. It sets the appropriate key in either the attribute or style dictionary of each element returned by the selector. It will return the number of elements modified. Note that style keys are in their camelcase form (backgroundColor vs background-color) as the styles are changed in the element style dictionary.

You can see the code in opt/dom.c. If you really want to compile without it, do make emtcl EMTCLDOM=0.

TODO

There are a number of broken things with each of these Tcl implementations.

tcl:

  • clock command isn't present. Caused by not calling Tcl_Init, would require embedding the library directory. Entirely possible, just not put the effort in.
  • after 2000 {set ::cond_var 0}; vwait ::cond_var doesn't work. This seems to be an emscripten problem, not sure how easy it is to solve.

jimtcl:

  • package command isn't present. Not sure of cause.
  • Jim_InitStaticExtensions isn't called. Not sure what the implications are.

emtcl's People

Contributors

aidanhs avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.