b-man
06-08-2009, 06:01 PM
This is a raw port of the Ejscript javascript application framework. This is an effort to port a powerful yet resource friendly javascript API to both maemo and mer. Ejscript is designed to function from inside OR outside of the browser. (It can function as a fully capable system-wide language (like python, bash, and perl), as a web language, or both) Ejscript is an extended version of javascript that fully supports and complies with the standardized version of JavaScript known as ECMAScript Edition 3 (ECMA-262-3).
Features:
* An environment for high performance web applications
* Fully capable of being a stand-alone programing language like python.
* Integrated SQLite database
* Object Relational Mapper (ORM)
* Ajax view controls
* Full support for jQuery
* A direct-threaded Virtual Machine
Core Features:
* Web Framework - Provides a large amount of Ajax functions when working on browser based applications
* High Performance Virtual Machine - Provides a resource friendly direct-threaded Virtual Machine for running byte compiled javascript code
* Compact Byte Code - for fast execution
* Enhanced Core Language - Ejscript enhances the ECMAScript core with powerful a set of features including: classes and modules for scalable programming, conditional compilation and an enhanced-language mode to detect common JavaScript language issues.
* Extended Language - Provides classes for Events, Timers, Files, Paths, Streams, Sockets and HTTP. There are also significant upgrades for the core system classes: Array, Object and String.
* Useful tools - Includes a fast, optimizing compiler, symbolic assembler listing generator and documentation generation tool.
More documentation on usage can be found here:
http://b-man.psykosis.net/projects/ejscript/documentation/
Source, development, and binary deb packages are available here (http://b-man.psykosis.net/projects/ejscript/).
NOTICE: if you are going to build this from source you must use this patch (http://b-man.psykosis.net/projects/ejscript/ejs-0.9.9-3-armv6.patch), this disables the '-mcpu' flag from getting used in make.gcc since gcc for armv6l doesn't support this option.
Examples:
Creating a program to use with the interpreter (ejs)
#!/usr/local/bin/ejs
/* Hello.es */
/* prints Hello World and displays the systems hostname */
testrun();
function testrun(){
print("Hello, World!!\n");
print("System Hostname:\n");
System.run("/bin/hostname");
}
App.exit(0)
Creating and building a program to use with the Virtual Machine (ejsvm)
/* Hello.es */
module Hello {
var x = "hello, world!!"
}
use module Test
print(x)
or
/* Hello.es */
module Hello {
print("Hello, World!!");
App.exit(0);
}
And then compile and run the program with the following:
ejsc Hello.es
ejsvm Hello.mod
Real-world example:
this program would take test.c and compile it using gcc, strip it, and then run the resulting program test:
/* Build.es */
module Build {
compile();
function compile() {
sys_make();
}
function sys_make() {
print("Compiling test.c...\n");
var compile = System.run("/usr/bin/gcc test.c -o test");
print("Done!\n\n");
sys_strip();
}
function sys_strip(){
print("striping file...\n\n")
var strip_file = System.run("/usr/bin/strip test");
sys_info();
}
function sys_info(){
var info = System.run("/usr/bin/file test");
print(info+"");
sys_run();
function sys_run(){
}
print("\nTesting program...\n\n");
var test = System.run("./test");
print(test+"");
print("\n");
}
App.exit(0);
}
Using Ejscript with a browser:
Assuming your app name is going to be web, run the following as root (i'm using my /root directory)
cd ~/
ejsweb -v generate app web
and to start the localised server run the following:
cd web
ejsweb run
and open Microb, or any other browser and go to http://localhost:4000/
You should see the following:
http://b-man.psykosis.net/projects/ejscript/screenshot.png
And you're done :)
Features:
* An environment for high performance web applications
* Fully capable of being a stand-alone programing language like python.
* Integrated SQLite database
* Object Relational Mapper (ORM)
* Ajax view controls
* Full support for jQuery
* A direct-threaded Virtual Machine
Core Features:
* Web Framework - Provides a large amount of Ajax functions when working on browser based applications
* High Performance Virtual Machine - Provides a resource friendly direct-threaded Virtual Machine for running byte compiled javascript code
* Compact Byte Code - for fast execution
* Enhanced Core Language - Ejscript enhances the ECMAScript core with powerful a set of features including: classes and modules for scalable programming, conditional compilation and an enhanced-language mode to detect common JavaScript language issues.
* Extended Language - Provides classes for Events, Timers, Files, Paths, Streams, Sockets and HTTP. There are also significant upgrades for the core system classes: Array, Object and String.
* Useful tools - Includes a fast, optimizing compiler, symbolic assembler listing generator and documentation generation tool.
More documentation on usage can be found here:
http://b-man.psykosis.net/projects/ejscript/documentation/
Source, development, and binary deb packages are available here (http://b-man.psykosis.net/projects/ejscript/).
NOTICE: if you are going to build this from source you must use this patch (http://b-man.psykosis.net/projects/ejscript/ejs-0.9.9-3-armv6.patch), this disables the '-mcpu' flag from getting used in make.gcc since gcc for armv6l doesn't support this option.
Examples:
Creating a program to use with the interpreter (ejs)
#!/usr/local/bin/ejs
/* Hello.es */
/* prints Hello World and displays the systems hostname */
testrun();
function testrun(){
print("Hello, World!!\n");
print("System Hostname:\n");
System.run("/bin/hostname");
}
App.exit(0)
Creating and building a program to use with the Virtual Machine (ejsvm)
/* Hello.es */
module Hello {
var x = "hello, world!!"
}
use module Test
print(x)
or
/* Hello.es */
module Hello {
print("Hello, World!!");
App.exit(0);
}
And then compile and run the program with the following:
ejsc Hello.es
ejsvm Hello.mod
Real-world example:
this program would take test.c and compile it using gcc, strip it, and then run the resulting program test:
/* Build.es */
module Build {
compile();
function compile() {
sys_make();
}
function sys_make() {
print("Compiling test.c...\n");
var compile = System.run("/usr/bin/gcc test.c -o test");
print("Done!\n\n");
sys_strip();
}
function sys_strip(){
print("striping file...\n\n")
var strip_file = System.run("/usr/bin/strip test");
sys_info();
}
function sys_info(){
var info = System.run("/usr/bin/file test");
print(info+"");
sys_run();
function sys_run(){
}
print("\nTesting program...\n\n");
var test = System.run("./test");
print(test+"");
print("\n");
}
App.exit(0);
}
Using Ejscript with a browser:
Assuming your app name is going to be web, run the following as root (i'm using my /root directory)
cd ~/
ejsweb -v generate app web
and to start the localised server run the following:
cd web
ejsweb run
and open Microb, or any other browser and go to http://localhost:4000/
You should see the following:
http://b-man.psykosis.net/projects/ejscript/screenshot.png
And you're done :)