From:  "sveinb" <>
Date:  26 Aug 2006 20:20:12 Hong Kong Time



To anyone interested in server-side JavaScript scripting: This is
another project which aims at it, and its strong point is that it makes
inclusion of C libraries stupidly simple:

C("#include ");
printf("hello, world!\n");

Yes, the above is a javascript program and printf was defined on the
fly as a native function. Any header file conforming to ANSI C should
be processable by the `C' function and therefore its functions, enums,
structs and #defines can be automatically exposed as javascript
functions, classes and properties. That means that you can access just
about any kind of library:

C("#include ");

It is also possible to mix C code rather seamlessly into javascript for
time-critical tasks:

C(" \
double mul(double a, double b) { \
  return a*b; \
} \

You may not want the C parts to be compiled every time your program
runs, which is why it is possible to cache the compiled C code:

C("#include ","");

The project also conains a number of modules, written in javascript,
encapsulating the C function calls in a more object-oriented fashion
which is seems more natural and convenient to a javascript programmer.
The set of modules can be expanded infinitely. Have a look at the
documentation. Try help('file') and help('os') for a start.

The lastest release of jsext can be found at:

Thanks to Ralph Engelshall for the autoconf tarball version of
SpiderMonkey! Check it out (it's a prerequisite for jsext):

It is a bit early to start using jsext for anything serious, since it
is only in version 0.9, and will change in backwards incompatible ways.
However, if you wish to contribute, don't hesitate to sign up!

Svein Berge