The killer feature of this version is "shttpd support"(http://shttpd.sourceforge.net/).
Run the httpd by JavaScript!
v8ext.LoadBinary("org.coderepos.shttpd");
var SHTTPD = org.coderepos.shttpd.SHTTPD;var httpd = new SHTTPD(8080);
httpd.RegisterURI("/", function (r) {
r.Print("HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n");
r.Print("<html><body>Hello, v8 world</body></html>");
r.SetFlags(SHTTPD.END_OF_OUTPUT);
});
httpd.StartLoop();
llv8call is a good solution for server side javascript.It is composed of three parts.
1. Core
- builtin functions
- ARGV support
- ENV support
- better interactive mode based on libreadline
v8ext is extension library library for v8. This module makes "easy to extend your application, uses v8".
This module provides 2 methods and 1 property
- v8ext.LoadScript()
- v8ext.LoadBinary()
- v8ext.LibraryPath
3.extension libraries
llv8call respects "batteries included" style.
current version provides:
- sqlite3
- libfcgi
- nspr(NetScape Portable Runtime), this module exports File, TCPSocket, UDPSocket, Process Management, Dir, etc.
- libmemcached
- curl
http://code.google.com/p/llv8call/
http://svn.coderepos.org/share/lang/cplusplus/llv8call/trunk/NEWS
I've released 0.02 and 0.03 =)
Socket and Process are enhanced.
2008-09-23 tokuhirom <tokuhirom atooooo gmail dototettetetete com>
* 0.03 alpha:
better process support release
- added Sys.executable
- added attr support for Process()
-- modify stdio
-- set inherit fd
- added Process.GetInheritedFD()
2008-09-22 tokuhirom <tokuhirom atooooo gmail dototettetetete com>
* 0.02 alpha:
INCOMPATIBLE CHANGES
- Sys.version() => Sys.v8version
FEATURE ENHANCEMENTS
- added Sys.nsprversion
- added Sys.llv8callversion
- added IO.CreatePipe()
- added Sock.GetPeerName()
- added Sock.GetSockName()
- added Sock.ntohl()
- added new UDPSocket()
- added sock.RecvFrom()
- added sock.SendTo()
- added sock.Send()
- added sock.Recv()
- added sock.GetOption()
- added sock.SetOption()
- added file.GetFileInfo()
- added Memcached.stats()
BUG FIXES
- fixed memory leaks: new Process()
llv8call is an library for call OS from v8.
http://code.google.com/p/llv8call/
You can easy to inject a lot of classes by follow code:
v8::HandleScope handle_scope;
v8::Handle global = v8::ObjectTemplate::New();
v8::Handle context = v8::Context::New(NULL, global);
v8::Context::Scope context_scope(context);
LLV8::Init(argc, argv, context->Global());
currently, llv8call supports follow things. This is based on
NSPR(NetScape Portable Runtime).
* File()
* Dir()
* System vars
* STDIN/STDOUT/STDERR
* Process Management
* Load Dynamic Library
* require()
* TCPSocket
regards.
I've wrote fcgi-v8, yesterday.
#!/home/tokuhiro/project/v8/llv8call var count = 0; while (fcgi_accept() >= 0) { print("Content-type: text/html¥r¥n¥r¥n", ++count, "¥nQuery: ", getenv("QUERY_STRING")); }