Commit 01a7d789 authored by Kenton Varda's avatar Kenton Varda

Merge branch 'master' of github.com:kentonv/capnproto

parents 773fffd6 20ff3003
......@@ -295,7 +295,7 @@ inline SegmentReader::SegmentReader(Arena* arena, SegmentId id, kj::ArrayPtr<con
: arena(arena), id(id), ptr(ptr), readLimiter(readLimiter) {}
inline bool SegmentReader::containsInterval(const void* from, const void* to) {
return from >= this->ptr.begin() && to <= this->ptr.end() &&
return from >= this->ptr.begin() && to <= this->ptr.end() && from <= to &&
readLimiter->canRead(
intervalLength(reinterpret_cast<const byte*>(from),
reinterpret_cast<const byte*>(to)) / BYTES_PER_WORD,
......
......@@ -347,7 +347,7 @@ public:
virtual VoidPromiseAndPipeline call(uint64_t interfaceId, uint16_t methodId,
kj::Own<CallContextHook>&& context) = 0;
// Call the object, but the caller controls allocation of the request/response objects. If the
// callee insists on allocating this objects itself, it must make a copy. This version is used
// callee insists on allocating these objects itself, it must make a copy. This version is used
// when calls come in over the network via an RPC system. During the call, the context object
// may be used from any thread so long as it is only used from one thread at a time. Note that
// even if the returned `Promise<void>` is discarded, the call may continue executing if any
......
......@@ -416,7 +416,8 @@ private:
proto.getName(), " :", genType(slot.getType(), interface),
isEmptyValue(slot.getDefaultValue()) ? kj::strTree("") :
kj::strTree(" = ", genValue(
slot.getType(), slot.getDefaultValue(), interface)));
slot.getType(), slot.getDefaultValue(), interface)),
genAnnotations(proto.getAnnotations(), interface));
}, ", "), ")");
} else {
return nodeName(schema, interface);
......@@ -472,7 +473,8 @@ private:
auto results = schemaLoader.get(methodProto.getResultStructType()).asStruct();
return kj::strTree(
indent.next(), methodProto.getName(), " @", method.getIndex(), " ",
genParamList(interface, params), " -> ", genParamList(interface, results), ";\n");
genParamList(interface, params), " -> ", genParamList(interface, results),
genAnnotations(methodProto.getAnnotations(), interface), ";\n");
},
genNestedDecls(schema, indent.next()),
indent, "}\n");
......@@ -482,7 +484,8 @@ private:
return kj::strTree(
indent, "const ", name, " @0x", kj::hex(proto.getId()), " :",
genType(constProto.getType(), schema), " = ",
genValue(constProto.getType(), constProto.getValue(), schema), ";\n");
genValue(constProto.getType(), constProto.getValue(), schema),
genAnnotations(schema), ";\n");
}
case schema::Node::ANNOTATION: {
auto annotationProto = proto.getAnnotation();
......
......@@ -1295,7 +1295,7 @@ private:
}
}
builder.adoptAnnotations(translator.compileAnnotationApplications(
member->getSchema().adoptAnnotations(translator.compileAnnotationApplications(
member->declAnnotations, targetsFlagName));
}
......
......@@ -297,7 +297,7 @@ public:
bool isNull();
StructBuilder getStruct(StructSize size, const word* defaultValue);
ListBuilder getList(FieldSize elementSize, const word* defaultValzue);
ListBuilder getList(FieldSize elementSize, const word* defaultValue);
ListBuilder getStructList(StructSize elementSize, const word* defaultValue);
template <typename T> typename T::Builder getBlob(const void* defaultValue,ByteCount defaultSize);
kj::Own<ClientHook> getCapability();
......
......@@ -22,7 +22,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@0xa184c7885cdaf2a1;
# This file defines the "network-specific parameters" in rpc.proto to support a network consisting
# This file defines the "network-specific parameters" in rpc.capnp to support a network consisting
# of two vats. Each of these vats may in fact be in communication with other vats, but any
# capabilities they forward must be proxied. Thus, to each end of the connection, all capabilities
# received from the other end appear to live in a single vat.
......
......@@ -425,7 +425,7 @@ struct Finish {
# 3) If the call has not returned yet, the caller no longer cares about the result. If nothing
# else cares about the result either (e.g. there are to other outstanding calls pipelined on
# the result of this one) then the callee may wish to immediately cancel the operation and
# send back a Return message with "canceled" set. However, implementations are not requried
# send back a Return message with "canceled" set. However, implementations are not required
# to support premature cancellation -- instead, the implementation may wait until the call
# actually completes and send a normal `Return` message.
#
......@@ -935,9 +935,9 @@ struct PromisedAnswer {
# a SQL table join (not to be confused with the `Join` message type).
# - Maybe some ability to test a union.
# - Probably not a good idea: the ability to specify an arbitrary script to run on the
# result. We could define a little stack-based language where `PathPart` specifies one
# result. We could define a little stack-based language where `Op` specifies one
# "instruction" or transformation to apply. Although this is not a good idea
# (over-engineered), any narrower additions to `PathPart` should be designed as if this
# (over-engineered), any narrower additions to `Op` should be designed as if this
# were the eventual goal.
}
}
......
......@@ -98,7 +98,7 @@ public:
// `armBreadthFirst()`. (Promise::then() uses depth-first whereas evalLater() uses
// breadth-first.)
//
// To use breadth-first scheduling instead, use `armLater()`.
// To use breadth-first scheduling instead, use `armBreadthFirst()`.
void armBreadthFirst();
// Like `armDepthFirst()` except that the event is placed at the end of the queue.
......
......@@ -54,12 +54,12 @@ struct Id {
inline constexpr Id(): value(0) {}
inline constexpr explicit Id(int value): value(value) {}
inline constexpr bool operator==(const Id& other) { return value == other.value; }
inline constexpr bool operator!=(const Id& other) { return value != other.value; }
inline constexpr bool operator<=(const Id& other) { return value <= other.value; }
inline constexpr bool operator>=(const Id& other) { return value >= other.value; }
inline constexpr bool operator< (const Id& other) { return value < other.value; }
inline constexpr bool operator> (const Id& other) { return value > other.value; }
inline constexpr bool operator==(const Id& other) const { return value == other.value; }
inline constexpr bool operator!=(const Id& other) const { return value != other.value; }
inline constexpr bool operator<=(const Id& other) const { return value <= other.value; }
inline constexpr bool operator>=(const Id& other) const { return value >= other.value; }
inline constexpr bool operator< (const Id& other) const { return value < other.value; }
inline constexpr bool operator> (const Id& other) const { return value > other.value; }
};
// =======================================================================================
......@@ -101,27 +101,27 @@ public:
template <typename OtherNumber>
inline constexpr UnitRatio<decltype(Number(1)+OtherNumber(1)), Unit1, Unit2>
operator+(UnitRatio<OtherNumber, Unit1, Unit2> other) {
operator+(UnitRatio<OtherNumber, Unit1, Unit2> other) const {
return UnitRatio<decltype(Number(1)+OtherNumber(1)), Unit1, Unit2>(
unit1PerUnit2 + other.unit1PerUnit2);
}
template <typename OtherNumber>
inline constexpr UnitRatio<decltype(Number(1)-OtherNumber(1)), Unit1, Unit2>
operator-(UnitRatio<OtherNumber, Unit1, Unit2> other) {
operator-(UnitRatio<OtherNumber, Unit1, Unit2> other) const {
return UnitRatio<decltype(Number(1)-OtherNumber(1)), Unit1, Unit2>(
unit1PerUnit2 - other.unit1PerUnit2);
}
template <typename OtherNumber, typename Unit3>
inline constexpr UnitRatio<decltype(Number(1)*OtherNumber(1)), Unit3, Unit2>
operator*(UnitRatio<OtherNumber, Unit3, Unit1> other) {
operator*(UnitRatio<OtherNumber, Unit3, Unit1> other) const {
// U1 / U2 * U3 / U1 = U3 / U2
return UnitRatio<decltype(Number(1)*OtherNumber(1)), Unit3, Unit2>(
unit1PerUnit2 * other.unit1PerUnit2);
}
template <typename OtherNumber, typename Unit3>
inline constexpr UnitRatio<decltype(Number(1)*OtherNumber(1)), Unit1, Unit3>
operator*(UnitRatio<OtherNumber, Unit2, Unit3> other) {
operator*(UnitRatio<OtherNumber, Unit2, Unit3> other) const {
// U1 / U2 * U2 / U3 = U1 / U3
return UnitRatio<decltype(Number(1)*OtherNumber(1)), Unit1, Unit3>(
unit1PerUnit2 * other.unit1PerUnit2);
......@@ -129,14 +129,14 @@ public:
template <typename OtherNumber, typename Unit3>
inline constexpr UnitRatio<decltype(Number(1)*OtherNumber(1)), Unit3, Unit2>
operator/(UnitRatio<OtherNumber, Unit1, Unit3> other) {
operator/(UnitRatio<OtherNumber, Unit1, Unit3> other) const {
// (U1 / U2) / (U1 / U3) = U3 / U2
return UnitRatio<decltype(Number(1)*OtherNumber(1)), Unit3, Unit2>(
unit1PerUnit2 / other.unit1PerUnit2);
}
template <typename OtherNumber, typename Unit3>
inline constexpr UnitRatio<decltype(Number(1)*OtherNumber(1)), Unit1, Unit3>
operator/(UnitRatio<OtherNumber, Unit3, Unit2> other) {
operator/(UnitRatio<OtherNumber, Unit3, Unit2> other) const {
// (U1 / U2) / (U3 / U2) = U1 / U3
return UnitRatio<decltype(Number(1)*OtherNumber(1)), Unit1, Unit3>(
unit1PerUnit2 / other.unit1PerUnit2);
......
......@@ -154,7 +154,7 @@ exception. The callback may abort the process, and is required to do so in cert
to continue by inventing "safe" values. This will lead to garbage output, but at least the program
will not crash. Your exception callback should set some sort of a flag indicating that an error
occurred, and somewhere up the stack you should check for that flag and cancel the operation.
See the header `capnp/exception.h` for details on how to register an exception callback.
See the header `kj/exception.h` for details on how to register an exception callback.
## KJ Library
......@@ -774,7 +774,7 @@ Here are some tips for using the C++ Cap'n Proto runtime most effectively:
excessively large symbol names caused by its use of template-based parser combinators. Stripping
the binary greatly reduces its size.
* The Cap'n Proto library has lots of debug-only asserts that are removed `#define NDEBUG`,
* The Cap'n Proto library has lots of debug-only asserts that are removed if you `#define NDEBUG`,
including in headers. If you care at all about performance, you should compile your production
binaries with the `-DNDEBUG` compiler flag. In fact, if Cap'n Proto detects that you have
optimization enabled but have not defined `NDEBUG`, it will define it for you (with a warning),
......
......@@ -481,7 +481,7 @@ $baz(1); # Annotate the file.
struct MyStruct $baz(2) {
myField @0 :Text = "default" $baz(3);
myUnion @1 union $baz(4) {
myUnion :union $baz(4) {
# ...
}
}
......@@ -491,7 +491,7 @@ enum MyEnum $baz(5) {
}
interface MyInterface $baz(7) {
myMethod(myParam :Text $baz(9)) :Void $baz(8);
myMethod @0 (myParam :Text $baz(9)) -> () $baz(8);
}
annotation myAnnotation(struct) :Int32 $baz(10);
......
......@@ -39,7 +39,7 @@ Provisionally, these are probably the things that will be worked on after 0.5.
## Before version 1.0
These things absolutely must happen before any 1.0 release. Note that it's not yet decided when
a 1.0 release would happen nor how many 0.x release might precede it.
a 1.0 release would happen nor how many 0.x releases might precede it.
* **Expand test coverage:** There are lots of tests now, but some important scenarios, such as
handling invalid of invalid input, need better testing.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment