* Handle keywords in C#
C# should handle keywords similarly to other languages by appending an underscore after the keyword.
* Fix clang-format for idl_gen_csharp.cpp
* Fix spacing clang-format issue
Causes generated code to check for existing pointers in an object (when using the object based api) and use UnPackTo(existingPointer) rather than just using UnPack() to replace the pointer. This is a performance issue when unpacking to existing objects when using large buffer fields (e.g. image frames)
Co-authored-by: RobWauson <robwauson@gmail.com>
* benchmark many vtables
* Rust: Store written_table rev-positions sorted.
The previous implementation was slow if there were too many tables.
Asymototically when inserting the n^th vtable: The old implementation
took O(n) lookup steps and O(1) insertion. The new implementation is
O(log n) lookup and O(n) insertion. This might be improved further by
using a balanced btree.
Benchmarking, create_many_tables is 7.5x faster (on my laptop):
// Simple vector cache
test create_many_tables ... bench: 728,875 ns/iter (+/- 12,279) = 44 MB/s
// Sorted vector cache
test create_many_tables ... bench: 97,843 ns/iter (+/- 4,430) = 334 MB/s
* Fix lints
Co-authored-by: Casper Neo <cneo@google.com>
* [C#] add union constructor utility.
* add union utility test.
* std::tolower -> CharToLower
* use std::transform instead
* rebase to master. and regenerate test code
* Refactored Rust Generated code into a module directory.
Each symbol will be generated into one file and then
imported into a module. This breaks the "out_dir"
pattern where some users would generate code in their
target/ directory. Also, these objects are best used
in their own module. It will be hard for users to share
their own module structure with flatbuffers namespaces.
There may be solutions to these drawbacks but that should
be discussed. I don't want to overengineer here.
* shadow error
* try fix .bat file
* fix .bat 2
* Restore accidentally deleted files
* Fixed some DONOTSUBMITs and made Rust outdir pattern use symlinks.
* fixed binary files
* git clang format
* make generated onefiles not public and fix .bat
* reduced diff with master in generate_code.sh
* fix shadowed variable
* add object api flags to .bat
* space
* Removed extern crate and extra &
* use statement
* more clippy lints
* format
* Undo extern crate -> use change, it actually matters to our tests
Co-authored-by: Casper Neo <cneo@google.com>
* Dart - change Builder "lowFinish()" to "buffer" and "finish()" to not void return
Aligning the API with other languages, e.g. c++ and allowing custom use-cases to avoid creating a Uint8List
* Dart - change builder.buffer to check that finish() was already called
* Dart - builder - move !finished assertion to _prepare() which is run from all other functions
* Make --bfbs-filenames default to location of first schema file.
Make RelativeToProjectRoot always work, applying "../" where needed. This is
needed for backwards compatibility. The first input file may be deeper in some
directory than the other files. Now, there will always be a declaration
file.
* documentation
* clang format
Co-authored-by: Casper Neo <cneo@google.com>
* Add comments for properties
* regenerated test files
* Reverted changes in testfiles generated with generate_code.bat on windows
* fixed formatting in util.cpp because of failed .travis/format_check.sh
* removed the use of tuple
* util.cpp: Fixed format
* idl_gen_json_schema.cpp: removed extra comma in deprecated fields
* Corrected monster_test.schema.json
* idl_gen_json_schema: Inlined Trim function
* Fixed format
* PrepareDescription(): Avoid unnecessary string copy
* fixed formatting
* Improve generated comparisons for tables
Previously, the generated code called std::unique_ptr<>::operator== on
non-scalar members, which would be correct only if the member was null
on both sides. After this CL, comparison is done on the pointed-to
values (including using a default-constructed value if the pointer is
null).
* Don't equate null Tables with all defaults
Also removes the cost of default-constructing tables for comparisons.
* Regenerate code
* fix formatting
* Replace filenames in reflection with filenames+includes.
This is needed for some use cases and may be just useful metadata.
* deser files_included_per_file_
* check project_root
* fix bazel
* git clang format
Co-authored-by: Casper Neo <cneo@google.com>
* Add the file a symbol is declared in to Reflection
If we move a code-generator to depend on Reflection,
it may need to know which file something was declared in
to properly name generated files.
* Doc comments in reflection, and more precise tests
* Add --project-root flag to flatc, normalize declaraion_file to this root
* fix --project-root stuff
* posixpath
* fix scripts
* format
* rename --project-root to --bfbs-filenames
Also, make it optional, rather than defaulting to `./`, if its not
specified, then don't serialize the filenames.
* bfbs generation
* fix some tests
* uncomment a thing
* add to project root directory conditionally
* fix
* git clang format
* Added help description and removed != nullptr
* "
* Remove accidental change to docs
* Remove accidental change to docs
* Pool strings
Co-authored-by: Casper Neo <cneo@google.com>
* dart test scripts - generate with `--gen-object-api`
* Dart object API, pack and unpack methods (WIP)
* Dart flatc - extract Builder code to separate functions to reuse it in Pack()
* Dart flatc - use builder field-building implementation in pack()
* Dart flatc - add pack() as an intance method of the "T" class
* Dart object API - make inner fields unpacked as well
* Dart object API - use pack() when collecting field offsets
* Dart object API - use packOnce() for fields that are structs or vectors of structs
* Dart object API - remove obsolete union support TODO
* Dart object API - minor review changes, test and fixes
* Dart object API - revert packOnce() - not supported by other object API implementations
* Dart object API - update docs
* update dart generated code in tests/ to fix CI failure on ./scripts/check-generated-code.sh
* Dart flatc - fix compilation for old MSVC and c++0x
* [C++] Removed most heap allocations in builder
* Updated API docs to indicate heap usage
* Override assertion for heap allocation in parser
* Cleaned up implemenations, enable heap alloc for tests
* Generalized CreateVectorOfStrings
* remove cmake option for heap alloc. reverted two heap removals
* Only use scratch space for vector of strings
* Override Windows SCL warning
* Changed std::transform to for loop to avoid MSCV warnings
* switched to const iterators
* Replaced iterator with for loop
* remove std::to_string in test to be compatible
* [idl_parser] Check structs and enums do not clash in a namespace
Uses fully qualified names to check for clashes within a given namespace whether explicitly defined or in the global namespace.
* [idl_parser] Move type name clash check to ParseEnum and ParseDecl
Change point at which parsing error is returned to ensure error is caught more generally. This change means that the error is returned after parsing the entirety of the offending duplicate rather than at the start when parsing it's name.
* [idl_parser] Add single and multi file type name clash tests
Adds a selection of tests for valid single file schemas with types that have the same name but are in different namespaces.
Adds a test for an a valid schema that spans two files with two types that have the same name but are in different namespaces.
Adds a test for an an invalid schema that spans two files with two types that have the same name and are in the same namespace.
* Implement Serialize for flexbuffer::Reader
* bump version
* Remove use of experimantal or-patterns
* Remove more use of experimantal or-patterns
Co-authored-by: Casper Neo <cneo@google.com>
This commit fixes two serious issues connected with reverse iterators:
1. Vector's rbegin/rend was incompatible with std::reverse_iterator::base();
2. Array's rend() was incorrect, it based on end() instead of begin().
This adds basic support for different Lua versions.
For Lua 5.2 and Lua 5.3, both the Bit32 and Compat53 Lua modules must be
installed for it to work. You can typically get these on Linux using
apt install lua-compat53 lua-bit32
For Lua 5.4, it should work as is, as it is a clean superset of Lua 5.3,
which is what the original Lua Flatbuffers supported.
LuaJIT as installed by apt doesn't include the COMPAT mode for using
Lua5.2 features. So this change just makes the flatbuffer code use a
common implementation.
* [Lua] Add LuaJIT support
Here is the output of LuaTest.sh:
Run with LuaJIT:
built 100 512-byte flatbuffers in 0.16sec: 0.63/msec, 0.31MB/sec
built 1000 512-byte flatbuffers in 0.08sec: 12.06/msec, 5.89MB/sec
built 10000 512-byte flatbuffers in 0.80sec: 12.44/msec, 6.07MB/sec
built 10000 512-byte flatbuffers in 0.33sec: 30.58/msec, 14.93MB/sec
traversed 100 592-byte flatbuffers in 0.04sec: 2.51/msec, 1.42MB/sec
traversed 1000 592-byte flatbuffers in 0.03sec: 31.52/msec, 17.79MB/sec
traversed 10000 592-byte flatbuffers in 0.21sec: 48.77/msec, 27.53MB/sec
Run with Lua 5.3:
built 100 512-byte flatbuffers in 0.02sec: 5.44/msec, 2.66MB/sec
built 1000 512-byte flatbuffers in 0.17sec: 5.74/msec, 2.80MB/sec
built 10000 512-byte flatbuffers in 1.75sec: 5.72/msec, 2.79MB/sec
built 10000 512-byte flatbuffers in 1.38sec: 7.26/msec, 3.55MB/sec
traversed 100 592-byte flatbuffers in 0.00sec: 27.64/msec, 15.60MB/sec
traversed 1000 592-byte flatbuffers in 0.03sec: 30.46/msec, 17.20MB/sec
traversed 10000 592-byte flatbuffers in 0.34sec: 29.62/msec, 16.72MB/sec
* [Lua] Better usage description
* update according to the review