* starting Lua port of python implmention. Syncing commit
* Bulk of Lua module port from Python done. Not tested, only static analysis. Need to work on binary strings. Started work on flatc lua code generation
* Fixed all the basic errors to produced a binary output from the builder, don't know if it is generated correctly, but it contains data, so that must be good
* fixed binary set command that was extending the array improperly
* continued improvement
* Moved lua submodules down a directory so their names don't clash with potential other modules. Added compat module to provide Lua versioning logic
* Successful sample port from Python
* working on testing Lua code with formal tests
* continued to work on tests and fixes to code to make tests pass
* Added reading buffer test
* Changed binaryarray implmentation to use a temporary table for storing data, and then serialize it to a string when requested. This double the rate of building flatbuffers compared to the string approach.
* Didn't need encode module as it just added another layer of indirection that isn't need
* profiled reading buffers, optimizations to increase read performance of monster data to ~7 monster / millisecond
* Writing profiler improvments. Get about
~2 monsters/millisecond building rate
* removed Numpy generation from Lua (came from the Python port)
* math.pow is deprecated in Lua 5.3, so changed to ^ notation. Also added .bat script for starting Lua tests
* adding results of generate_code.bat
* simple edits for code review in PR.
* There was a buffer overflow in inserting the keywords into the unorder set for both the Lua and Python code gens. Changed insertion to use iterators.
* fixed spacing issue
* basic documenation/tutorial updates. Updated sample_binary.lua to reflect the tutorial better
* removed windows-specific build step in Lua tests
* Eclipse ignore
* TypeScript support
* Prefixing enums
* Test results
* Merged JS and TS generators
* Fixed AppVeyor build problems
* Fixed more AppVeyor build problems
* Fixed more AppVeyor build problems
* Changed TS flag to options struct
* Storing options by value
* Removed unneeded const
* Re-export support for unions
* Uint support
* Casting bools to numbers for mutation
* TS shell tests
* Reverted generates js test file to original version
* Backing up js tests and properly generating test data
* Not importing flatbuffers for TS test generation
* Not overwriting generated js for tests
* AppVeyor test fixes
* Generating the most strict TS code possible
* Not returning null when creating vectors
* Not returning null from struct contructors
* Vector of unions for ts/js
* Sanity check for languages
* Indentation fix + output test files
* Vectors of unions for php
* Fixes to union vector handling + tests
* Fix for strictPropertyInitialization
* Fix for new aligned operator new for gcc >= 7.1
* grpc bindings generator for Java and a few minor supporting changes in improvements
* restored formatting before my previous changes for ease of review
* Fixed grpc java code generation bug resulting in duplicate extractor declarations in case the same is used in more than a single RPC method
* updateed cpp_generator.cc to be compatible with the latest grpc version
* preserved the original license
* synchronized grpc cpp_generator with latest version as of today: GRPC 1.8.1. Regenerated test/monster_test.grpc.fb.* files and verified that grpctest is nicely passing
* fixed merge glitch
* Added internal - limited - implementation of flatbuffers::unique_ptr
for STLs that don't ship with std::unique_ptr. In C++11 and beyond
this is just an alias for std::unique_ptr.
* Aliased used type traits structs is_scalar is_floating_point is_unsigned
into flatbuffers namespace so they can be replaced in C++98 implementations.
Right now these point at stlport's TR1 implementations.
* Wrapped vector::data() in vector_data().
* Wrapped vector::emplace_back() in vector_emplace_back().
* Wrapper string::back() in string_back().
* Added variants of FlatBufferBuilder::CreateVector() and
FlatBufferBuilder::CreateVectorOfStructs() that allow the use of plain
function pointers.
Generated code has also been modified to use plain functions to build objects
rather than std::function() so all generated code will work in C++98
applications.
* Added flexbuffers::Builder::Vector(), flexbuffers::Builder::TypedVector()
and flexbuffers::Builder::Map() methods that allow the use of plain function
pointers.
* Changed Parser to internally use plain function pointers when parsing table
and vector delimiters.
* Added specializations of NumToString() for 64-bit types that aren't supported
by stringstream in stlport.
* Overloaded numeric_limits for 64-bit types not supported by stlport.
* Replaced build_apk.sh (which was broken by deprecation of the
"android" tool in the Android SDK) with build.gradle and the
appropriate gradle wrapper to build an APK.
* Switched Android build to build against all STL variants.
* Updated travis configuration to build Android test and sample.
Tested:
* Verified all tests continue to work on Linux, OSX and Android.
* Verified Travis build is green.
Change-Id: I9e634363793f85b9f141d21454b10686020a2065
* Added empty generator for json schema (idl_gen_json_schema.cpp)
#4360
* JsonSchemaGenerator: output of tables implemented
current problems:
- typenames are not correct
- array types need to be deduced
#4360
* JsonSchemaGenerator: Corrected generation of typenames
Current problems: enum types not written correctly
#4360
* JsonSchemaGenerator: Added generation of enum types
#4360
* idl_gen_json_schema.cpp: Write required properties to schema
#4360
* idl_gen_json_schema.cpp: Export Types including namespace
#4360
* idl_gen_json_schema.cpp: Fixed Json format
#4360
* idl_gen_json_schema.cpp: Formatted according to google code style
#4360
* Checked in monster_test.bfbs with changes from master
* Added idl_gen_json_schema.cpp in CMakeLists.txt
* generate_code.bat: Added generation of json schema
* Added todo.md
* generate_code.sh: Added generation of json schema
* Addressed some review issues
- removed command line arg -S
- removed new lines
- fixed codestyle in template functions
- removed usage of stringstream
- idented json schema
#4360
* removed auto in idl_gen_json_schema.cpp
* idl_gen_json_schema.cpp: changed iterator declarations to auto
#4360
* deleted todo.md
* idl_gen_json_schema.cpp: Removed keyword "override" so that vs2010 can compile
* idl_gen_json_schema.cpp: switch statement in GenType handeles all enum-members
* idl_gen_json_schema.cpp: Removed cerr output
* idl_gen_json_schema.cpp: Avoid vector copying
* idl_gen_json_schema.cpp: Fixed identation of json schema output
* idl_gen_json_schema.cpp: Do not output empty descriptions
* Rework flatbuffers + gRPC integration
- Introduce `flatbuffers::grpc::Message<T>`, a `grpc_slice`-backed
message buffer that handles refcounting and allows flatbuffers to
transfer ownership to gRPC efficiently. This replaces
`flatbuffers::BufferRef<T>`, which required a copy call and was also
unsafe w.r.t. buffer lifetime.
- Introduce `flatbuffers::grpc::MessageBuilder`, a gRPC-specific builder
that forces a `grpc_slice`-backed allocator and also adds some helpful
`Message<T>`-related methods.
- Update serializers accordingly (now zero-copy between flatbuffers and
gRPC).
* gRPC: verify messages by default, but allow user to override
* gRPC: fix some formatting issues
* Disable verification by default, but add helper method
* Make FlatBufferBuilder fields protected + remove vec accessor
* Use bool add_ref parameter to toggle refcount incr
* Remove unnecessary inline specifiers
* Fix formatting
* Use auto
* Remove empty lines
* Use grpc_slice helper macros
* Simplify reset code
* Disable Message copy ctor and assignment by default
* Remove unused member
* Enable gRPC verification by default
* Use auto
* Bake in message verification (remove template specialization)
* Add RoundUp func
* Consolidate gRPC message copy flag
* Make vector_downward allocations fully lazy
* Test message verification failure code/message
* Add grpctest verification test comments
* Simplify reallocate implementation
* Make initial_size a size_t
* Use ternary op for growth_policy
* Use truthiness rather than dont explicit nullptr check
* Indent preprocessor directives
* Remove grpc message copy/assignment
* Fix a few bugs
* Add gRPC example
* Add basic gRPC docs
* Use doxygen EXAMPLE_PATH + @include
* Reference example fbs in grpc docs
* Move gRPC examples into grpc/samples
* Fix pointer/reference formatting
* Use std::function rather than templated callback func
* Create fresh message builder for each request
* Use Clear() in Reset() impl
* Use FLATBUFFERS_CONSTEXPR
Changing to keep include prefixes had two side effects: the main
file being parsed wasn't filtered out anymore, and include directory
paths would be added to the path in the include statement.
Also moved the include_test*.fbs files to sub directories so we
can actually test the handling of -I etc.
tested: on Linux.
Change-Id: Ibae095cea7ab0cccbac15cfb5171719f6b5cad8c
* Don't fail the build on unused parameters
gRPC headers have unused parameters so this breaks the test build.
* Pull in updated compiler files from gRPC
There have been some API breaks in gRPC lately. This commit
pulls in the most recent version of the files in this repo
that are just copied from gRPC.
* Modify the gRPC files so that they can work with Flatbuffers
The files taken from gRPC do not work out-of-the-box with Flatbuffers.
This commit modifies them so that they work. Hopefully this commit
will be able to serve as a guide or maybe even be cherry-picked on
top of new versions of those files as newer versions from gRPC are
pulled in.
* Adjust the rest of Flatbuffers to work with the new gRPC
* Change idl_gen_grpc.cpp to work with the new API
* Add missing #include in flatbuffers/grpc.h
* Run tests/generate_code.sh and check in the results
* Don't link with grpc++_unsecure and (secure) grpc. That's just weird
* Revert unrelated JS/TS test changes
* Simplify compiler/config.h
There is no need to import this file from gRPC. In fact, it probably
makes sense to not do so, since it seems to be intended to have
project specific configuration in it.
* Don't emit C++ types in the Go gRPC code generator
* Don't emit C++ #includes in generated gRPC code
Before this PR, there was a Go-specific additional_includes method
in schema_interface.h, which is shared with the gRPC repo. The
additional parameter to FlatBufFile in idl_gen_grpc.cpp makes that
unnecessary, which means we need less Flatbuffer-specific changes
in gRPC.
* Pedantic Visual Studio build (/W4 /WX)
* Pedantic Visual Studio build (/W4 /WX)
* Pedantic Visual Studio build (/W4 /WX)
* Remove /wd4512 from CMakeLists.txt
* Suppress Visual Studio 4512 warning ('class' : assignment operator could not be generated)
Helps simplify code generation code. Instead of this:
code += "inline const " + cpp_qualified_name + " *Get";
code += name;
code += "(const void *buf) {\n return flatbuffers::GetRoot<";
code += cpp_qualified_name + ">(buf);\n}\n\n";
You do this:
code.SetValue("NAME", struct_def.name);
code.SetValue("CPP_NAME", cpp_qualified_name);
code += "inline const {{CPP_NAME}} *Get{{NAME}}(const void *buf) {";
code += " return flatbuffers::GetRoot<{{CPP_NAME}}>(buf);";
code += "}";
code += "";
Updated the CPP code generator to use the CodeWriter class. Most of the
changes in the generated code are white-space changes, esp. around new
lines (since the code generator class automatically appends new lines
when appending a string). Actual code changes include:
* Renamed "rehasher" to "_rehasher" for consistency with other args in
Pack function.
* Renamed "union_obj" to "obj: in UnPack function.
* Always do "(void)_o;" to prevent unused variable warning in Create
function (instead of only doing it if there are no fields) in order
to avoid two-passes.
* Renamed padding variables from __paddingX to paddingX__.
"Each name that contains a double underscore (_ _) [...] is reserved
to the implementation for any use." C++ standards 17.4.3.1.2.
* Add braces around switch cases.
* Calculate index as a separate statement in EnumName function, eg.
const size_t index = ...;
return EnumNamesX()[index];
vs.
return EnumNamesX()[...];
* Stored end table offset in variable in Finish() functions, eg.
const auto end = fbb_.EndTable(start_, ...);
auto o = flatbuffers::Offset<T>(end);
vs.
auto o = flatbuffers::Offset<T>(fbb_.EndTable(start, ...));
* Separate reinterpret_cast calls from function calls in Union
functions, eg.
auto ptr = reinterpret_cast<const T *>(obj);
return ptr->UnPack(resolver);
vs.
return reinterpret_cast<const T *>(obj)->UnPack(resolver);
* Removed unecessary (void)(padding__X) no-ops from constructors, eg.
Test(int16_t a, int8_t b) : ... {
(void)__padding0; // <-- Removed this line.
}
In the idl_gen_cpp.cpp file itself, I refactored some code generation into
new functions: GenParam, GenNativeTable, GenVerifyCall, GenBuilders,
GenUnpackFieldStatement, and GenCreateParam.
Change-Id: I727b1bd8719d05b7ce33cbce00eb58fda817b25d
* Changes for verifying a buffer dynamically using reflection.
* Fixing build issues on linux and applied code reformatting.
* Fixing the file order in cmake file that was messing up the macro based code inclusion.
Added tests for reflection based verification.
* Changes for verifying a buffer dynamically using reflection.
Fixing build issues on linux and applied code reformatting.
Fixing the file order in cmake file that was messing up the macro based code inclusion.
Added tests for reflection based verification.
* Incorporated the code review changes that were requested:
1. Changed the Verify function signature.
2. Changed the variable names to use snake_case.
3. Added better comments.
4. Refactored duplicate code.
5. Changed the verifier class so that it has the same size when compiled with or without FLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE macro.
* Setting FLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE and FLATBUFFERS_DEBUG_VERIFICATION_FAILURE through cmake for flattests so that it gets propagted to all translation units of flattests.
* Making the Verifier struct fields the same in all cases. Also reverting the target_compile_definitions change in cmake file because build machine on travis does not have cmake version 3.0 or higher which was the version when target_compile_definitions was added in cmake.
* Defining macros through cmake in a portable way using functions that are available in cmake 2.8.
* support for grpc golang
* refactored grpc go generator
* added grpc-go test and refactored
* refactored idl_gen_grpc.cpp
* fixed grpc generate method name
* refactored flatc and fixed line length issue
* added codec to go lib and fixed formatting issues
* fixed spacing issues
Cmake issued a warning when the variable is in quotation marks
in an if statement.
Visual Studio upgrades constants to int and issues a truncation
warning, so inserted a cast.
Change-Id: I60cdcb5c2565cd5e97f80b9c2ff1e6abc32b1deb
Tested: Builds without warning on VS2015.
The new line in the set(CMAKE_CXX_FLAGS...) line was getting insert
verbatim into the Makefile. Makefiles don't like new lines in their
assignment operators.
The newline escape fix works for CMake 3.0 and above, but since
we support 2.x, we need to use the legacy solution, which is to
split into two separate statements.
Tested: cmake -G"Unix Makefiles" works now on Mac.
Change-Id: I6f4655981b85087c4760c3d26ed0c97c4469ba93