Commit Graph

66 Commits

Author SHA1 Message Date
Wouter van Oortmerssen f2908b7787 Made the assert in the verifier optional
Change-Id: Ie6b0a8e137a0743bbf18531f29712cf5f11bf34f
Tested: on Linux
2014-08-13 11:44:20 -07:00
Wouter van Oortmerssen 0b47e69d4d Parser now allows empty tables in JSON
Bug: 16870719
Change-Id: Ia5fdce49a67b1aa621ab1e37a815e2a3293257b6
Tested: on Linux
2014-08-13 11:44:20 -07:00
Wouter van Oortmerssen 620d8d6f7c Fixed compile warning related to file identification feature.
Change-Id: Id33cf778caa818c7d3988edee82058e63bfecbf0
Tested: on Linux
2014-08-12 16:29:20 -07:00
Bob Potter 39d4b7e2bf Fix vector of strings for Java
Change-Id: If032b450230b15224b2661836c8a740398d207c5
2014-08-12 15:12:51 -07:00
Wouter van Oortmerssen 5da7bda826 File identifier feature.
Allows you to add, and test for the presence of a magic 4-char
string in a FlatBuffer.

Tested: on OS X.

Change-Id: I090692a9e4fb53bed3543279a28563e67132cba0
2014-08-12 14:37:06 -07:00
Wouter van Oortmerssen be3c874258 Fixed bugs that could cause struct values not to be stored or misaligned
Change-Id: Ie36fe581c000fa4571c96fafd39a9e12fa29e1ca
Tested: on Linux
2014-08-11 17:42:55 -07:00
Wouter van Oortmerssen d8a173ddc7 A few document clarifications for Java & Internals.
Change-Id: I770b53cf7d82c860422c1fe6193fb597d9c9495c
2014-07-31 14:58:19 -07:00
Wouter van Oortmerssen 8f80fecc44 Made FlatBuffers compile correctly with -pedantic
Change-Id: I88b5993219e10e2dfb60ff98d6594d19871988fc
Tested: on Linux
2014-07-29 13:51:22 -07:00
Wouter van Oortmerssen 7057033116 Enum definitions are generated without a trailing comma (-pedantic).
Change-Id: I07cd28e5915a0526614db85f894f27a5bd27f3bb
Tested: on Windows.
2014-07-28 17:03:08 -07:00
Stefan Eilemann 15b10dd9f3 Add CMake finder for downstream projects
Change-Id: Ife37f7ead18ee28f8f4fd5e29caeee5e825defd4
2014-07-28 16:17:46 -07:00
Stefan Eilemann 52f4f4573e Fix OS X build
Change-Id: If0465b73843ad1a489fa66318a689801def3f0f0
2014-07-28 10:36:40 -07:00
Daniel Nachbaur 7a99b3c7cb Add install step
Change-Id: Ie863ddcf73653d1404a1e84109ebdf66af5dff26
2014-07-25 16:08:20 -07:00
rw 0477a54f65 Tweak Go test.
Add more comments explaining the tests. Remove the extraneous 'superFuzz'
functionality. By default, do not compare to generated Java files.

Change-Id: Icb0aa8262e10035958639f9a88ca666694a2ce73
2014-07-25 15:26:00 -07:00
Wouter van Oortmerssen 9c3de1e2a0 Extended symbolic enum parsing in JSON for integers and OR-ing.
Change-Id: Iedbd9914a1ca3897776fb92aa9a1fdfc4603da3c
Tested: on Windows and Linux
2014-07-25 15:20:24 -07:00
Wouter van Oortmerssen bba042d723 Fixed possible compile error in CreateVector* functions.
Change-Id: I3b1fca2ea536349240b7bee35eff360f3acbb539
Tested: on Windows and Linux.
2014-07-24 16:58:30 -07:00
Stewart Miles 63f21cb2a5 Merge "Terminate the output directory argument of flatc." into ub-games-master 2014-07-20 04:41:30 +00:00
Stewart Miles 60acef94e1 Terminate the output directory argument of flatc.
Given the command

flatc -o . -c test.fbs

it would generate header file

.test_generated.h

rather than

./test_generated.h

This fixes this issue.

Tested:
Manually verified that flatc generates the correct output files given output
paths ending with and without '/' on Linux and Windows.

Bug: 16464827
Change-Id: I854cb881286f22690f1885f942cf3fd2fc59ca8d
2014-07-21 18:00:18 -07:00
Alex Ames 3f53f73c63 Corrected the order of the comments on namespace close parens
Also removed the semicolon on the bracket. It makes -pedanic unhappy.

Bug: 16399323
Change-Id: I16ec0d67af13c3ca0bc6285741f5a95658d262bd
2014-07-21 17:14:34 -07:00
Wouter van Oortmerssen d03ba640be Updated benchmark chart with stats for pugixml.
Change-Id: I23d7db5b62ca52fee49e1bedcf7d7d8d74957cf8
Tested: on Windows.
2014-07-21 16:40:39 -07:00
Wouter van Oortmerssen 127d35085a Added a `bit_flags` attribute to enum declarations that 1<<N every value.
Change-Id: Ib9ec0cb3ddec60b1ca124eaf815fb1ae0cc53e1c
Tested: on Windows and Linux
Bug: 16186562
2014-07-21 16:40:39 -07:00
Wouter van Oortmerssen bd86bf60ec Made sure tests.cpp is testing the new vector iterator functionality.
Also fixes a potential big-endian bug, and makes iterators work
correctly with pointer types.

Change-Id: Ib7f88fe9e6053d1a9afa7895fba0695627c158b1
Tested: on Windows and Linux
2014-07-21 16:40:39 -07:00
Wouter van Oortmerssen 3e201a99b2 A feature that officially supports nested FlatBuffers.
Generates convenient accessors for the nested root.

Change-Id: Ic0b1531de7ace475ff2a7b1f430d27f41c838430
Tested: on Windows.
2014-07-21 16:40:39 -07:00
Wouter van Oortmerssen 9143a93312 Small fixes to the core C++ FlatBuffers implementation.
- Ensured weak linkage with the version string is not used on Windows,
  especially cygwin (which throws a linker error).
- Avoided a VS debug error for taking the address of the first element
  of an empty vector.
- Made copy/assignment constructors for downward_vector and
  FlatBufferBuilder private, to avoid people unintentionally making
  expensive copies.
- Using the more correct _WIN32 instead of WIN32

Change-Id: I801b5c8b159e3721af6d1ef0978a3247ba168bab
Tested: on Windows (VS + Cygwin) and Linux.
2014-07-21 16:40:39 -07:00
rw 74d5f3701f Port FlatBuffers to Go.
Implement code generation and runtime library for Go, derived from the
Java implementation. Additionally, the test suite verifies:

 - the exact bytes in the Builder buffer during object construction,
 - vtable deduplication, and
 - table construction, via a fuzzer derived from the C++ implementation.

Change-Id: Ib95a019c684891def2b50281e570b4843fea7baa
2014-07-21 16:40:39 -07:00
Wouter van Oortmerssen 3fb6a86d02 JSON parsing & text generation is now enum-identifier aware.
When Parsing JSON, it will read enums either as int values, identifiers
specific to the enum type, or strings containing those identifiers.

When generating text, it will output enum identifiers by default
(this can be turned off in favor of integers, like before).

Change-Id: If28b0a1f8f27de79aff3e626f40c0c0b271c325a
Tested: on Windows and Linux
Bug: 16214968
2014-07-15 11:45:00 -07:00
Bas Zalmstra 2811a3eac8 Added an iterator to Vector so you can use range based for loops on them.
Change-Id: I6310edd554fba494a76e47b03d3c2bc07b90795d
2014-07-14 12:07:31 -07:00
Matthew Endsley b632f8129f Add support for the Xbox360 platform (PPC+msvc)
This includes generic big endian support for msvc by mapping the
Microsoft byte swap instrinsics _bytes_swap_* to the gcc counterpart
names.
2014-07-14 10:43:56 -07:00
Wouter van Oortmerssen df2e0db63d flatc can now convert flatbuffer binary files into json.
Also removed it appending _wire to filenames, renamed the json golden
file to .golden to not clash with generated files.

Bug: 15781201
Change-Id: I8322861e50d1e5b6a5ab5e4b5e5d8ae13c356eb2
Tested: on Windows and Linux
2014-07-11 14:49:43 -07:00
Wouter van Oortmerssen cc112ce96f Made Java argument names help remind the user when something is an offset.
Bug: 15856217
Change-Id: I9163d13ca26c2d53064f5289c993692be711685f
Tested: on Windows
2014-07-10 17:46:45 -07:00
Wouter van Oortmerssen d1efa95369 The generated CreateX() calls now come with default values for args.
bug: 15777627
Change-Id: I9389de46ea883ab0ef1beab9370e5c8e96b4d0b5
Tested: on Windows and Linux
2014-07-10 17:26:28 -07:00
Wouter van Oortmerssen 362268d2df Changed the tracking token implementation to be more robust.
The previous version only was included for users of FlatBufferBuilder,
this one should also work for programs that only ever read
FlatBuffers.

Bug: 15762139
Change-Id: Ifceb337ffc1dd9dd09d77c3848cad8707e5c3726
Tested: on Linux.
2014-07-10 14:39:11 -07:00
Wouter van Oortmerssen 93df5697a0 Parser now correctly reads floats in scientific notation.
Change-Id: I7abb14a4b6c596674d6aff2b9de6e63603c0d2dc
Tested: on Windows and Linux.
2014-07-10 14:19:46 -07:00
Wouter van Oortmerssen 2208de0676 Fixed namespace declaration not being cleared between files.
Change-Id: Ie9fedf894d82a403d0b6b4848d221d6bbee58984
Tested: on OS X.
2014-07-09 17:13:03 -07:00
Wouter van Oortmerssen 75349ae8c3 Fixed incorrect verifier code for nested tables.
It was outputting the type instead of the field name, and didn't deal
with NULL fields. Added test case.

Also fixed token enums having the wrong value, resulting in
unreadable error messages.

Change-Id: Icd9b4d22f417bfad5824c0f58e067ce3f2e2dc6f
Tested: on Windows and Linux.
2014-07-09 17:13:03 -07:00
Wouter van Oortmerssen b3ee52c0a7 Fixed vectors reserving wrong amount of space in Java.
In the generated code, the type of the vector was used for
the element size, instead of the vector element type.

Change-Id: Ie16d5221a61474365292c948fd3af99e2a7716c7
Tested: on Windows.
2014-07-09 11:43:30 -07:00
Wouter van Oortmerssen 7fcbe723fc Added a "strict JSON" mode to the text generator and compiler
This will add quotes around field names, as required by the official
standard. By default it will leave quotes out, as it is more readable,
more compact, and is accepted by almost all JSON parsers.
The -S switch to flatc turns on strict mode.

As per rfc 7159.

Change-Id: Ibabe9c8162c47339d00ec581d18721a2ba40c6d0
Tested: on Windows.
2014-07-09 11:43:30 -07:00
Wouter van Oortmerssen 9140144d51 Added functionality to assign field ids manually in a schema
New attribute:

-   `id: n` (on a table field): manually set the field identifier to `n`.
    If you use this attribute, you must use it on ALL fields of this table,
    and the numbers must be a contiguous range from 0 onwards.
    Additionally, since a union type effectively adds two fields, its
    id must be that of the second field (the first field is the type
    field and not explicitly declared in the schema).
    For example, if the last field before the union field had id 6,
    the union field should have id 8, and the unions type field will
    implicitly be 7.
    IDs allow the fields to be placed in any order in the schema.
    When a new field is added to the schema is must use the next available ID.

Change-Id: I8690f105f3a2d31fdcb75a4fab4130692b12c62f
Tested: on Windows
2014-07-08 11:12:33 -07:00
Wouter van Oortmerssen a5f50019bc Made declaring the underlying type of an enum mandatory.
This is a breaking change, anyone having schema files with enums
that do not specify a type will get a specialized error:

must specify the underlying integer type for this
enum (e.g. ': short', which was the default).

All of the samples and docs already had a type specified,
so hopefully this will affect very few people.

Bug: 15777205
Change-Id: I9b8d7c0827867f7efb6c217346db7e402695eff0
Tested: on Windows
2014-07-02 14:39:59 -07:00
Wouter van Oortmerssen b863ac0171 Fixed helper function CreateVectorOfStructs calling wrong variant.
Change-Id: I4fd2a309276590227921ede467503f56b65ac689
Tested: on Windows and Linux
2014-07-02 14:39:59 -07:00
Wouter van Oortmerssen f0b3c75779 Fixed flatc not stripping the path from the base filename.
This caused two bugs when used with a path: not being able to save
the generated files, and preprocessor defines with / characters in
them.

Bug: 15676771

Tested: on Windows

Change-Id: I62a3c45d22e2545fdaad83728d83a42a6efa37f9
2014-07-02 14:39:59 -07:00
Wouter van Oortmerssen 350011f581 Fixed a bugs in the Java runtime that could cause an index out of bounds exception.
Tested: on Windows.

Change-Id: I0d4cdafc21690eb9a509ba31f21e80dacfb602ff
2014-07-02 14:39:58 -07:00
Wouter van Oortmerssen 1256307a38 Switched VS build to -W4, and fixed all resulting warnings.
Change-Id: I654217cbd01a3a449503d95753e19b672ec7ec23
Tested: on Windows, Linux
2014-07-02 14:39:58 -07:00
Wouter van Oortmerssen a0b6ffc25b Add buffer verification functionality to FlatBuffers
Bug: 15732628
Change-Id: I0b7cb65982d6b8957d5a899cca7d2b5d2ef53206
Tested: On Windows, OS X and Linux
2014-07-01 17:52:16 -07:00
Wouter van Oortmerssen 59043114ac Generated C++ headers now have include guards.
Bug: 15700355
Change-Id: Iceccb5b344e394e399092ffaa81f9cad2f0418ab
Tested: on Windows
2014-06-23 17:06:16 -07:00
Wouter van Oortmerssen d58da1db14 Merge "license is a comment, not an echo" into ub-games-master 2014-06-23 21:56:00 +00:00
Wouter van Oortmerssen 5b4c39250f Merge "show absolute path to user when aborting" into ub-games-master 2014-06-23 21:56:00 +00:00
Wouter van Oortmerssen 82ef4ae2e1 Merge "sh script for JavaTest" into ub-games-master 2014-06-23 21:50:10 +00:00
Wouter van Oortmerssen 76227f201d JSON text output now optionally doesn't output linefeeds either.
Change-Id: Iedac80ee00b27a97c21c7b4ac7c9792e5bafbcc8
Tested: On Windows
2014-06-23 14:14:31 -07:00
Wouter van Oortmerssen ff0d7a89d8 Doc clarifications (Java vectors, test working dir, benchmark fix).
Change-Id: If8cc05669d82df892e1d4e11f7fbbd68b2dc05bf
2014-06-23 14:00:58 -07:00
rw e2c02b833e license is a comment, not an echo 2014-06-23 13:37:32 -07:00