nostrdb

an unfairly fast embedded nostr database backed by lmdb
git clone git://jb55.com/nostrdb
Log | Files | Refs | Submodules | README | LICENSE

flatcc-help.md (5273B)


      1 ```
      2 flatcc FlatBuffers schema compiler for C by dvide.com
      3 version: 0.5.2-pre
      4 usage: flatcc [options] file [...]
      5 options:
      6   --reader                   (default) Generate reader
      7   -c, --common               Generate common include header(s)
      8   --common_reader            Generate common reader include header(s)
      9   --common_builder           Generate common builder include header(s)
     10   -w, --builder              Generate builders (writable buffers)
     11   -v, --verifier             Generate verifier
     12   -r, --recursive            Recursively generate included schema files
     13   -a                         Generate all (like -cwvr)
     14   -g                         Use _get suffix only to avoid conflicts
     15   -d                         Dependency file like gcc -MMD
     16   -I<inpath>                 Search path for include files (multiple allowed)
     17   -o<outpath>                Write files relative to this path (dir must exist)
     18   --stdout                   Concatenate all output to stdout
     19   --outfile=<file>           Like --stdout, but to a file.
     20   --depfile=<file>           Dependency file like gcc -MF.
     21   --deptarget=<file>         Override --depfile target like gcc -MT.
     22   --prefix=<prefix>          Add prefix to all generated names (no _ added)
     23   --common-prefix=<prefix>   Replace 'flatbuffers' prefix in common files
     24   --schema                   Generate binary schema (.bfbs)
     25   --schema-length=no         Add length prefix to binary schema
     26   --verifier                 Generate verifier for schema
     27   --json-parser              Generate json parser for schema
     28   --json-printer             Generate json printer for schema
     29   --json                     Generate both json parser and printer for schema
     30   --version                  Show version
     31   -h | --help                Help message
     32 
     33 This is a flatbuffer compatible compiler implemented in C generating C
     34 source. It is largely compatible with the flatc compiler provided by
     35 Google Fun Propulsion Lab but does not support JSON objects or binary
     36 schema.
     37 
     38 By example 'flatcc monster.fbs' generates a 'monster.h' file which
     39 provides functions to read a flatbuffer. A common include header is also
     40 required. The common file is generated with the -c option. The reader
     41 has no external dependencies.
     42 
     43 The -w (--builder) option enables code generation to build buffers:
     44 `flatbuffers -w monster.fbs` will generate `monster.h` and
     45 `monster_builder.h`, and also a builder specific common file with the
     46 -cw option. The builder must link with the extern `flatbuilder` library.
     47 
     48 -v (--verifier) generates a verifier file per schema. It depends on the
     49 runtime library but not on other generated files, except other included
     50 verifiers.
     51 
     52 -r (--recursive) generates all schema included recursively.
     53 
     54 --reader is the default option to generate reader output but can be used
     55 explicitly together with other options that would otherwise disable it.
     56 
     57 All C output can be concated to a single file using --stdout or
     58 --outfile with content produced in dependency order. The outfile is
     59 relative to cwd.
     60 
     61 -g Only add '_get' suffix to read accessors such that, for example,
     62 only 'Monster_name_get(monster)` will be generated and not also
     63 'Monster_name(monster)'. This avoids potential conflicts with
     64 other generated symbols when a schema change is impractical.
     65 
     66 -d generates a dependency file, e.g. 'monster.fbs.d' in the output dir.
     67 
     68 --depfile implies -d but accepts an explicit filename with a path
     69 relative to cwd. The dependency files content is a gnu make rule with a
     70 target followed by the included schema files The target must match how
     71 it is seen by the rest of the build system and defaults to e.g.
     72 'monster_reader.h' or 'monster.bfbs' paths relative to the working
     73 directory.
     74 
     75 --deptarget overrides the default target for --depfile, simiar to gcc -MT.
     76 
     77 --schema will generate a binary .bfbs file for each top-level schema file.
     78 Can be used with --stdout if no C output is specified. When used with multiple
     79 files --schema-length=yes is recommend.
     80 
     81 --schema-length adds a length prefix of type uoffset_t to binary schema so
     82 they can be concatenated - the aligned buffer starts after the prefix.
     83 
     84 --json-parser generates a file that implements a fast typed json parser for
     85 the schema. It depends on some flatcc headers and the runtime library but
     86 not on other generated files except other parsers from included schema.
     87 
     88 --json-printer generates a file that implements json printers for the schema
     89 and has dependencies similar to --json-parser.
     90 
     91 --json is generates both printer and parser.
     92 
     93 The generated source can redefine offset sizes by including a modified
     94 `flatcc_types.h` file. The flatbuilder library must then be compiled with the
     95 same `flatcc_types.h` file. In this case --prefix and --common-prefix options
     96 may be helpful to avoid conflict with standard offset sizes.
     97 
     98 The output size may seem bulky, but most content is rarely used inline
     99 functions and macros. The compiled binary need not be large.
    100 
    101 The generated source assumes C11 functionality for alignment, compile
    102 time assertions and inline functions but an optional set of portability
    103 headers can be included to work with most any compiler. The portability
    104 layer is not throughly tested so a platform specific test is required
    105 before production use. Upstream patches are welcome.
    106 ```