C bindings: Implement _Validate(), and some pre-requisites

This patchset passes the conformance & bounds checking validation tests,
the same ones that the C++ version goes through.

Pre-req to accomodate getting validation to work:
- For structs, code-generate version->expected struct size mapping, used
  for validation.
- For arrays, code-generate size of a single element, in bits. Used for
  array size validation.
- For maps, have a separate type descriptor type, just so we can check
  that the 2 contained arrays are the same size.

Validation involves maintaining a ValidationContext struct, which
throughout validation is updated to containing the expected next handle
offset and next pointer offset.

This CL also factors out some common validation data/golden file reading code between C/C++.

[email protected]

Review URL: https://codereview.chromium.org/2163793002 .

Cr-Mirrored-From: https://github.com/domokit/mojo
Cr-Mirrored-Commit: 15fbc30f08a51f9ead881822c9572fbe013aecba
22 files changed
tree: 9502c9c2e6a523c70d490e70d25fbd0fe6c8454c
  1. build/
  2. c/
  3. cpp/
  4. dart/
  5. go/
  6. interfaces/
  7. java/
  8. js/
  9. platform/
  10. python/
  11. rust/
  12. third_party/
  13. tools/
  14. .gitignore
  15. BUILD.gn
  16. LICENSE
  17. mojo.gni
  18. mojo_application.gni
  19. mojo_sdk.gni
  20. README.md
README.md

Mojo Public API

The Mojo Public API is a binary stable API to the Mojo system.

It consists of support for a number of programming languages (with a directory for each support language), some “build” tools and build-time requirements, and interface definitions for Mojo services (specified using an IDL).

Note that there are various subdirectories named tests/. These contain tests of the code in the enclosing directory, and are not meant for use by Mojo applications.

C/CPP/JS

The c/, cpp/, js/ subdirectories define the API for C, C++, and JavaScript, respectively.

The basic principle for these directories is that they consist of the source files that one needs at build/deployment/run time (as appropriate for the language), organized in a natural way for the particular language.

Interfaces

The interfaces/ subdirectory contains Mojo IDL (a.k.a. .mojom) descriptions of standard Mojo services.

Platform

The platform/ subdirectory contains any build-time requirements (e.g., static libraries) that may be needed to produce a Mojo application for certain platforms, such as a native shared library or as a NaCl binary.

Tools

The tools/ subdirectory contains tools that are useful/necessary at build/deployment time. These tools may be needed (as a practical necessity) to use the API in any given language, e.g., to generate bindings from Mojo IDL files.