diff --git a/README.md b/README.md index 065c13d..06b67ba 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,8 @@ This is an experimental pure Java implementation of Cap'n Proto. -It doesn't do much yet. \ No newline at end of file +It doesn't do much yet. + +``` +make +``` \ No newline at end of file diff --git a/src/capnp/WireHelpers.java b/src/capnp/WireHelpers.java index cd7cb6c..55a3ab8 100644 --- a/src/capnp/WireHelpers.java +++ b/src/capnp/WireHelpers.java @@ -29,6 +29,9 @@ class WireHelpers { int nestingLimit) { // TODO check for null, follow fars, nestingLimit + if (ref.isNull()) { + return new ListReader(); + } ListPointer listPtr = new ListPointer(ref); diff --git a/src/capnp/WirePointer.java b/src/capnp/WirePointer.java index 8f00400..fab1af2 100644 --- a/src/capnp/WirePointer.java +++ b/src/capnp/WirePointer.java @@ -21,6 +21,10 @@ class WirePointer { this.buffer_offset = word.offset; } + public boolean isNull() { + return this.buffer.getLong(this.buffer_offset * 8) == 0; + } + public int offset_and_kind() { return this.buffer.getInt(this.buffer_offset * 8); } diff --git a/src/compiler/capnpc-java.c++ b/src/compiler/capnpc-java.c++ index f467b14..efe7117 100644 --- a/src/compiler/capnpc-java.c++ +++ b/src/compiler/capnpc-java.c++ @@ -21,7 +21,10 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + // This program is a code generator plugin for `capnp compile` which generates java code. +// It is a modified version of the C++ code generator plugin, capnpc-c++. + #include #include "capnp/serialize.h"