Skip to content

Commit

Permalink
Initial import
Browse files Browse the repository at this point in the history
  • Loading branch information
jscheid committed Nov 18, 2013
0 parents commit 42e341a
Show file tree
Hide file tree
Showing 38 changed files with 14,338 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .dir-locals.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
((nil . ((indent-tabs-mode . nil)
(css-indent-offset . 2)
(js-indent-level . 2)
(c-basic-offset . 2)
(fill-column . 80))))

;; (defun my-indent-setup ()
;; (c-set-offset 'innamespace [0])
;; (c-set-offset 'statement-cont 0)
;; (c-set-offset 'case-label '+)
;; (c-set-offset 'arglist-intro '++))
23 changes: 23 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Copyright (c) 2013, Julian Scheid <julians37@gmail.com>
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

75 changes: 75 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
capnproto-js
============

A port of the [Cap'n Proto](http://kentonv.github.io/capnproto/) runtime to
JavaScript. Includes a schema compiler that generates JavaScript.

Status
------

This is work in progress. It is currently based on an [outdated
version](https://github.com/kentonv/capnproto/commit/798ff87b1b7e0a2da96355a34fa6e0aa10aaae85)
of Cap'n Proto, which means it doesn't include the recent object capability and
RPC additions or any recent bugfixes. Also, dynamic access (at runtime, based
on schemas) is not implemented and probably will never be, as JavaScript is
itself a dynamic language.

It includes a mostly complete port of the Cap'n Proto test suite with over 100
test cases passing.

There are a number of open issues, including the following:

* This isn't very optimized yet and might be terribly slow.

* Currently you need to use Google Closure Compiler to link your code.

* Functions are distributed over nested namespaces, which makes client code
(pre-link) somewhat verbose.

* Functions don't check their argument types and are mostly lacking Google
Closure parameter annotations, which means it's pretty easy to shoot yourself
in the foot.

* Generated code is overly verbose and in places uses inconsistent naming.

* Some of the code is a bit messy and redundant, in particular primitive
getter/setters and capnp_list.js.

* No support for Mozilla's int64 datatype or any of the common JavaScript bignum
libraries. int64 are currently represented as an array of two int32s.

Getting Started
---------------

The build isn't very straighforward at the moment. You will need:

* The capnproto source code, to be safe checkout the correct version (798ff87b1b7e0a2da96355a34fa6e0aa10aaae85)
* A corresponding capnproto installation or build tree
* [Google Closure Compiler](https://developers.google.com/closure/compiler/)
* [Google Closure Library](https://developers.google.com/closure/library/)

You need to edit the following files and adjust paths manually:

* javascript/build-tests.sh
* javascript/tests/all_tests.html

Then try this:

```
capnproto_js=/path/to/capnproto-js
capnproto=/path/to/capnproto
capnproto_build=/path/to/capnproto-build
$capnproto_js/c++/configure \
--with-capnp-source=$capnproto/c++ \
--with-capnp=$capnproto_build/capnp \
--with-capnp-libdir=$capnproto_build/.libs
make
$capnproto_js/javascript/build-tests.sh
open test/all_tests.html # in your browser
```

Compatibility
-------------

All tests pass in current versions of Chrome (31), Firefox (25) and Safari (7).
Other browsers have not been tested yet.
Loading

0 comments on commit 42e341a

Please sign in to comment.