Please note that this project is replaced by
GLUEscript

What is wxJavaScript?

wxJavaScript started as a project for porting wxWidgets to JavaScript. But now, wxJavaScript is a lot more. It has bindings for curl, sqlite, mysql, ... With mod_wxjs it can be used as an Apache module to write dynamic (x)html pages in JavaScript. It also contains a FastCGI program.

With wxJavaScript, you can write server-side scripts for generating (x)html pages, system scripts, GUI applications, ... in one of the most used programming languages: JavaScript.

wxJavaScript uses SpiderMonkey. SpiderMonkey is the JavaScript engine of Mozilla. E4X is activated in wxJavaScript. E4X is a programming language extension that adds native XML support to JavaScript.

The wxJavaScript Team

wxJavaScript is developed by a one-person team. Everything is developed during spare-time. wxWidgets and other libraries are not ported by generators (like SWIG) because they don't have the flexibility of a human being. There would be to much hacking on the generator to get the a good result. This also means that adding new libraries and features to wxJavaScript are expensive in time. If you need a feature and you can't add it yourself, you can always donate to the project to get me convinced to add that feature.

A Quick Start

Install

Windows

Before you can use wxJavaScript on Windows (when you don't compile wxJavaScript yourself), you have to be sure that the VC++ redistributable files (msvcr90.dll, ...) are installed. wxJavaScript for Windows is compiled with Visual Studio 2008 Express. You can download these files here.

Unarchive the windows package in a directory of your choice. Now you should be able to run the wxJavaScript console program wxjs.exe. When it doesn't start, you probably forgot to install the VC++ dll's (see above).

Linux (Ubuntu)

wxJavaScript runs on Linux. At the moment you need to build wxJavaScript yourself. Download the source from the project website (or get it using subversion). Read build.txt, which is located in the source directory. It contains information about what you need to install/build before you can start to build wxJavaScript.

Apache

wxJavaScript has an Apache module which allows you to use JavaScript with the ported classes to create dynamic web pages. This Apache module is called mod_wxjs.

Running Scripts

Before you write scripts it's important to know how the JavaScript runtime is constructed. Read this introduction before writing scripts.

Use wxjs.exe to run your JavaScript files.

wxJS
Usage: wxjs [/s] [/h] [/v] [/c <num>] [/o <str>] 
            [/m <str>] [/cfg <str>] [/r <num>] [/utf16] [Scriptfile...]
  /s, --silent                  Don't show the status information
  /h, --help                    Shows this help.
  /v, --version                 Show the version of wxJavaScript.
  /c, --contextsize=<num>       Set the context stack size for the
                                JavaScript engine. Default is 8192.
  /o, --output=<str>            Redirect the output to the file.
  /m, --modules=<str>           A script that loads the necessary modules.
  /b, --branchlimit=<num>       Sets the branchlimit (used for stopping endless loops for example)
  /r, --runtimesize=<num>       Sets the runtime size. The default is 1MB.
  /i, --interactive             Run in interactive mode
  /e, --encoding=<enc>          The encoding of the scriptfile 
                                (default is UTF-8)

Modules

wxJavaScript uses modules (shared libraries) for extending JavaScript. wxJavaScript needs to know where to find these extension modules. Modules can be loaded using the Module class. An example:

wxjs.modules.gui = new Module("wxjs_gui.dll");
wxjs.modules.gui.load();

wxjs.modules.tpl = new Module("wxjs_tpl.dll");
wxjs.modules.tpl.load();

wxjs.modules.sqlite = new Module("wxjs_sqlite.dll");
wxjs.modules.sqlite.load();

wxjs.modules.io = new Module("wxjs_io.dll");
wxjs.modules.io.load();

When no /m argument is used, wxJavaScript looks for the environment variable WXJS_STARTUP. When WXJS_STARTUP is not set, wxJavaScript tries to load "modules.js" file from the application directory.

Read more about the modules. You can find all the docs of the ported classes there.

Embed wxJavaScript

It's possible to use wxJavaScript from your C++ applications. Look at the console program on how to use the Engine code.



SourceForge.net Logo Support This Project

Search

Google

Download

Latest version: 0.9.75 released on 07-12-2008
You can download wxJavaScript from the sourceforge project website.

If you wish you can browse the subversion repository.

Support

Need help? Ask your question in this group

Google Groups
wxJavaScript
Find a bug? Report bugs
Need a feature? Feature requests
Support this project? Donate



Thank You

The donors of wxJavaScript:
  • swaxi: Thanks for your work
  • wittend (twice!): Great work - Keep it up!
Brendan Eich: helped me a lot when I had questions about SpiderMonkey.

Software used

Windows
Linux (Ubuntu)
  • Eclipse with CDT, a very good and free IDE for C/C++
  • SmartSVN, A smart SubVersion client
Cross Platform
  • Premake, a tool for generating makefiles

Design downloaded from Zeroweb.org: Free website templates, layouts, and tools.