Commit Graph

395 Commits

Author SHA1 Message Date
rw e5c21ec666 invoke many fewer growth events 2015-05-09 16:32:26 -07:00
rw e11da87a24 gofmt 2015-05-09 16:10:03 -07:00
rw 3dd54424c0 remove remaining allocs during build 2015-05-09 16:07:11 -07:00
rw 5d68493df4 update CheckClash for string accesses 2015-05-09 15:37:13 -07:00
pjulien d322eec3c3 Issue #188
When accessing the array directly of a byte buffer, need to offset
by ``arrayOffset``
2015-05-09 14:08:28 -04:00
Mormegil 221193eaa2 Union accessors in C# should use generic type for the table
When accessing a union field, we should return the same object type
as was given to the method, i.e. the parameter should have a generic
type for any Table-derived type. This way, we do not need to make
superfluous casts (which also reduce type safety) like

var myUnionType = (MyUnionType)buff.GetUnionField(new MyUnionType());

when we can do just
var myUnionType = buff.GetUnionField(new MyUnionType());

Change-Id: Idac1b638e46cc50b1f2dc19f10741481202b1515
2015-05-08 16:21:54 -07:00
pjulien f7d24f60a2 set version for next dev cycle
Change-Id: I17a7896e257c0ab7e4cd1b22c928d4cee21fbf11
2015-05-08 16:21:54 -07:00
pjulien e5a1a3129d Initially discussed in #178.
Allows adding an already encoded UTF-8 string directly without
having to convert to a ``String`` first.

Change-Id: I23f9c738eec18fd35f4c14f58dbd0f6cf0970dc7
2015-05-08 16:21:54 -07:00
Wouter van Oortmerssen 39833d7cf0 Added namespaced way to refer to types in schemas.
Also made proper namespacing work for enums.

You can now say namespace.MyTable as the type when declaring
a field that refers to a type in a different namespace.

Previously, it would work just referring to MyTable, however
with the recent commit fixing namespaced types this now
is ambiguous.

Change-Id: Ieaa3f4ac1662b8c4dc1f16e1898ea3cdb02e10fd
Tested: on Linux.
2015-05-08 16:21:53 -07:00
Brett Cooley ecb27817ca Merge "Initial support for propagating namespaces from schema files to generated code" into ub-games-master 2015-05-08 19:52:54 +00:00
Jason Sanmiya f59bfdd084 Add missing newline in help text for flatc.
Tested: Help text displays correctly now.
Change-Id: Ibbdc810ae41e24321860879064bdc64f78a67cb9
2015-05-07 10:30:34 -07:00
Mormegil 0ee1b99c5d [BREAKING CHANGE] Field accessors should use property getters in C#
In C#, plain field accessors should not be nonparametric methods
but should be standard property getters.

The accessor methods with parameters were renamed to `GetXxx`
because a method cannot be named identically to a property.

Also, `ByteBuffer.Position`, `FlatBufferBuilder.Offset` and
`FlatBufferBuilder.DataBuffer` are now properties instead
of nonparametric accessor methods, for more idiomatic C# style.

This is a breaking change, all client C# code accessing these
fields needs to be changed (i.e. remove those `()` or add the
`Get` prefix).

Issue: #77
Change-Id: Iaabe9ada076e5ea2c69911cf6170fdda2df3487e
2015-05-06 11:55:07 -07:00
yinlei a50711ad13 Fix u_int8_t to uint8_t
Change-Id: I475ef9454f51f1b7ec2a7f9086d711359456677a
2015-05-06 11:29:07 -07:00
Brett Cooley 249f71a12b Initial support for propagating namespaces from schema files to generated code
Change-Id: Ifc10c54845ea7553586d1896d509314d68e9ab0f
2015-05-05 17:10:53 -07:00
Wouter van Oortmerssen 1d138fbe07 Merge "Added extra checks for reading binaries in flatc" into ub-games-master 2015-05-04 21:02:00 +00:00
Wouter van Oortmerssen a0bf238b09 Merge changes I2de7d14d,I56392340 into ub-games-master
* changes:
  Added accessor for file_extension in generated code.
  Added missing --gen-mutable to CMakeLists.txt
2015-05-04 21:00:43 +00:00
Wouter van Oortmerssen c49c6da803 Added extra checks for reading binaries in flatc
By default, disallow reading binaries that do not correspond to
the schema file_identifier. Override with --raw-binary

Change-Id: I24822c0e4c80dab4e5a238ae2b6e601a09025c27
Tested: on Linux.
2015-05-04 13:38:20 -07:00
Wouter van Oortmerssen 37e6efe1f9 Added accessor for file_extension in generated code.
Change-Id: I2de7d14dbb1f7b8f81022dd2c9da65060ae49300
Tested: on Linux.
2015-05-04 13:38:20 -07:00
Wouter van Oortmerssen d4d7a84e11 Added missing --gen-mutable to CMakeLists.txt
Change-Id: I56392340de4439d05fa8f06a7336ff72c6f9346d
Tested: on Linux
2015-05-04 13:38:19 -07:00
Jason Sanmiya fc7e8af55e Merge "Fix bug on flathash compilation option." into ub-games-master 2015-04-29 21:12:07 +00:00
Wouter van Oortmerssen 3ec5dddb00 Mutable FlatBuffers: in-place updates.
This commit contains the first step in providing mutable FlatBuffers,
non-const accessors and mutation functions for existing fields generated
from --gen-mutable.

Change-Id: Iebee3975f05c1001f8e22824725edeaa6d85fbee
Tested: on Linux.
Bug: 15777024
2015-04-29 10:58:45 -07:00
Jason Sanmiya f47660f510 Fix bug on flathash compilation option.
Change-Id: Ib9d31d08daba7ce54b864417ae93bf479702861b
2015-04-28 15:44:10 -07:00
Mormegil a8d6962ac2 Tolerate DOS-style EOL in IDL line comments
If an IDL file uses DOS-style EOLs (CR+LF), line comments need to
ignore the second linebreak character, otherwise, as is currently
the case, the parsed documentation comment includes a trailing `\r`
character, which is then output verbatim into the output source
code by flatc.

Change-Id: I39591631995a980622d20a4a32315178b33f18f6
2015-04-15 13:44:54 -07:00
franchuti688 23f75f598e added .travis.yml file (build with original and biicode building);
added bii-travis.sh and readme.md files; added build status section with travis and biicode build
systems

Change-Id: I93acd1ca9497416ade6293d63b5311c4c31b880f
2015-04-15 13:43:25 -07:00
Mormegil e3b432cba8 Enums use native enums in C#
Enums should not be (badly) emulated with classes in C# but should
use native C# enums instead. Java implementation made an explicit
choice not to use the (more complex) Java enums, but C# enums are
just light-weight syntactic coating over integral types.

Fixes issue #171.

Change-Id: I9f4d6ba5324400a1e52982e49b58603cb7d7cca7
2015-04-13 10:40:30 -07:00
Advay Mengle 557c57eb9d Seal all classes in Java/C#
Makes enums/structs/tables unsubclassable (final or sealed) and
prevents instantiation of enum classes (which are solely static
constants).

Tested (Mac OS 10.10.2):
1. run flattests
2. cd tests && ../flatc -c monster_test.fbs && ../flatc -j
monster_test.fbs && ../flatc -g monster_test.fbs && ../flatc -n
monster_test.fbs  # Note deltas for C# and Java.
3. ./JavaTest.sh

**Breaking api change**

Change-Id: Ie008c941c36d212690da58ddc72c9b228eb7a093
2015-04-10 11:20:19 -07:00
Joël Lamotte 9d368deb05 Fixed: Readme version is not up to date
Change-Id: Ie44419026eca94bce0a2857abef95a82e78cfc3e
2015-04-06 11:44:22 -07:00
Ben Harper 8b99bf614c Add byte slice accessor to Go code
Change-Id: I15cc8924d6607bd93068c762fd67e6088cfd9789
2015-04-06 11:44:22 -07:00
Kyle Jones c4a3e2f6bd Always add additional space if no more is available
Change-Id: If08b2d839489d40e977de794b13584fa66ff32c1
2015-04-06 11:44:22 -07:00
INADA Naoki 803f9bba27 Fix typo in Benchmarks.md
Change-Id: I1c5fbd019cc233e1d551887ff5fb740420c18c2b
2015-04-06 11:44:21 -07:00
rw d756efbf76 Reduce allocations when reusing a Builder.
Add the function `Reset` to the Builder, which facilitates reuse of the
underlying byte slice.
2015-04-02 19:33:00 -07:00
rw ace7fa8094 Reduce allocations when building strings.
Builder has a new CreateByteString function that writes a
null-terimnated byte slice to the buffer. This results in zero
allocations for writing strings.
2015-04-02 18:22:13 -07:00
rw f02646e357 Remove all string allocations during parsing.
Change the signature for 'string' getters and settings to use byte
slices instead of strings.
2015-04-02 11:56:55 -07:00
rw 0a3a09aaf3 Merge branch 'go-bytevector-getter' of github.com:benharper123/flatbuffers into go-faster 2015-04-02 11:47:17 -07:00
rw 796be3282c Benchmarks for building and parsing 'gold' data.
Identifies alloc-heavy codepaths.
2015-04-02 11:26:00 -07:00
rw 468124fb9b chmod GoTest.sh +x 2015-04-02 11:25:48 -07:00
Advay Mengle 3ad853630c Generate appropriate schema doc comments from .proto files
- Add parse handling of .proto struct and field doc comments (enums and
their values were already handled)
- Add FBS generation handling of doc comments for structs, their
fields, enums, and their values (requires linking idl_gen_general in
the test binary build)
- Tested using test.proto|golden with doc comments added.  Xcode run of
flattest passes.

Change-Id: Idff64dd8064afba227174ab77d2c7be22d006628
2015-04-01 17:17:39 -07:00
Advay Mengle b8708beeec Generate Java doc comments in JavaDoc style
Tested by regenerating all tests/ generated sources; note that only
Monster.java changes.  Ran flattests as well.

Change-Id: I65b6ea7d208b0ccd6a0b34761162fed6ba391fc5
2015-04-01 17:10:52 -07:00
Ben Harper 8fb6c4f764 Add byte slice accessor to Go code 2015-04-01 16:47:10 +02:00
Wouter van Oortmerssen 75740c1374 Clarified Verifier options.
Change-Id: I04775dedc61f1c448eedb1883182af7b07239797
Tested: on Linux.
2015-03-30 15:38:36 -07:00
Jason Sanmiya e8598950fc Fix Mac ndk-build error on motive, pie_noon, pindrop.
We were looking for 'flatc' in motive/bin/Debug/flatc,
on Mac. It's actually built to flatbuffers/Debug/flatc.

Tested: OS X Yosemite, ndk-r10d. Also tested on Linux.
Change-Id: I9f1ecfe00c5f42fd9b6808b5a5da1c920487a4c2
2015-03-27 09:27:18 -07:00
Wouter van Oortmerssen ca5c9e7496 Unsigned types in Java now return bigger size signed types.
(Java doesn't support unsigned types).

ubyte/ushort return as int
uint returns as long
(all with correct masking)

ulong still returns as long, as before.

Tested: on Linux & Windows.
Bug 17521464

Change-Id: Id6bc8f38fc8c1a2f4e6733c6980dc6b6e322b452
2015-03-23 17:01:33 -07:00
Wouter van Oortmerssen f7818d83d7 Changed C# ByteBuffer to use bit shifts instead of BitConverter
BitConverter was excessively slow since it allocates a byte array
at each access.

Bug: 18702381
Change-Id: I47be9c38e1d04287ba4c10bc369848f3e13a2a2f
Tested: on Windows.
2015-03-13 16:59:29 -07:00
Wouter van Oortmerssen 7ef2fc2517 Regenerated test code + fixed typo in C# FlatBufferBuilder
Change-Id: Ifa6d9459c53ae60b9bf936d9468ec971ee282f14
Tested: on Linux and Windows.
2015-03-13 13:05:28 -07:00
reynolma2 6df9e1c537 Update idl_gen_general.cpp
There is a bug in creating a C# table when it includes a field of type 'BOOL'. The problem is that the generate C# code is as follows:
  "bool SampleValue = 0;"
This will fail to compile, because in C# this fails, it needs to be generated as:
 "bool SampleValue = false;"

The error is in line ~510

Change-Id: I77f6eea0f269b0540dbeb462602fc447cb69237d
2015-03-13 13:05:03 -07:00
Ben Harper 6a0126340a Add CreateByteVector function to Go's builder
This function gets around the inefficiency of populating a [ubyte] vector
byte by byte. Since ubyte vectors are probably the most commonly used type
of generic byte buffer, this seems like a worthwhile thing to create a
fast path for.

Benchmarks show a 6x improvement in throughput on x64.

There is a new test verifying the functionality of the function.

Change-Id: I82e0228ae0f815dd7ea89bf168b8c1925f3ce0d7
2015-03-11 17:27:39 -07:00
Max Galkin 4464405250 Make FuzzTest2 fuzzier.
1. Random table fields are now marked deprecated. The deprecation rate is adjustable, default is ~10% of fields.
2. Vector type previously produced a dummy field, now a trivial ubyte vector is generated instead.
3. The fuzzed "instances" were previously generated with identical data, now they are randomized: I suppose such was the intent from the beginning, just wasn't implemented.

I ran the new test with a few different settings and random seeds (but only on Windows + VS2015), and it always passed.

Change-Id: I2014686b6680aec24049ccda3f6deffe5205a83e
2015-03-11 17:27:39 -07:00
Max Galkin c3807fa39d Fix for VS 2015 stricter warnings about "shadowed" names.
This change renames a few variables to fix the build in VS 2015.

VS 2015 new warnings:
http://blogs.msdn.com/b/vcblog/archive/2014/11/12/improvements-to-warnings-in-the-c-compiler.aspx

Change-Id: Ic9c3f75ee717f0125960c813df442ed4fbcceb4a
2015-03-11 17:27:39 -07:00
gregoire-astruc a360958be3 Implementation of a buffer release strategy.
* Tests for Release feature.
* Check vector_downward.buf_ before passing to deallocator.
* Assertions.
* Shared test between unique_ptr and GetBufferPointer()
* Unnecessary using directives.
* Reallocate vector if released on clear operation.
* Use allocator attribute.
* Renamed `Release()` to `ReleaseBufferPointer()`
* For consistency with `GetBufferPointer()`
* Updated documentation for ReleaseBuffer.

Change-Id: I108527778e56ae5127abf9e5b1be6b445ad75cb7
2015-03-11 17:27:38 -07:00
loverszhaokai 432f3f26a4 Added Copyright headers
Change-Id: I106de8985cea572590d49c896b72c54f33e73bd2
2015-03-11 17:27:38 -07:00