atdgen1
Atd compiler and code generator
Usage
atdgen [options ...]
[atd-file]
Overview
atdgen reads ATD type definitions and generates OCaml code (both ml and mli files) for
—
|
type definitions (option -t) |
|---|---|
—
|
serializers and deserializers for Biniou (option -b) |
—
|
serializers and deserializers for JSON (option -j) |
—
|
record-creating functions supporting default fields (option -v) |
—
|
user-specified data validators (option -v) |
If no mode option (-t, -b, -j or -v) is given, then -t -b is assumed. Unless -o is present, the <prefix> for the generated files is derived from the atd-file argument. If the atd-file argument is omitted, atdgen reads ATD sources from standard input, if additionally -o is missing, it behaves as if -o - was given.
Options
-
-t -
Produce files <prefix>_t.mli and <prefix>_t.ml containing OCaml type definitions for the ATD input
-
-b -
Produce files <prefix>_b.mli and <prefix>_b.ml containing
OCamlserializers and deserializers for theBinioudata format
-
-j -
produce files <prefix>_j.mli and <prefix>_j.ml containing
OCamlserializers and deserializers for the JSON data format
-
-v -
Produce files <prefix>_v.mli and <prefix>_v.ml containing OCaml functions for creating records and validators, see also option -validate.
-
-dep -
Output dependencies in makefile-format for all possible
atdgenoutput files and exit
-
-list -
Output a space-separated list of all possible
atdgenoutput files and exit
-
-o <prefix> -
set the <prefix> for the options -t, -b and -j. If <prefix> is -,
atdgenwrites code in the form ofstruct ... end : sig ... end
to standard output.
-
-biniou -
[deprecated] same as -t -b, i.e., produce serializers and deserializers for Biniou and
OCamltype definitions (default)
-
-json -
[deprecated] same as -t -j, i.e., produce serializers and deserializers for JSON and
OCamltype definitions.
-
-j-std -
standard JSON: Convert tuples and variants into standard JSON and refuse to print NaN and infinities. This option implies -json unless another mode is specified.
-
-std-json -
[deprecated] same as -j-std
-
-j-pp <func> -
Apply the
OCamlfunction <func> of type (string -> string) to the input of each *_of_string function generated by atdgen (JSON mode). (This was intended for UTF-8 validation of the input which is not performed by atdgen.)
-
-j-defaults -
Output JSON record fields even if their value is known to be the default.
-
-j-strict-fields -
Call !Ag_util.Json.unknown_field_handler for every unknown JSON field found in the input instead of simply skipping them. The initial value of this reference prints a message and raises a Failure exception.
-
-j-custom-fields <func> -
Call function <func> of type (string -> unit) for every unknown JSON field found in the input instead of simply skipping them. See also -j-strict-fields.
-
-validate -
[deprecated] same as -t -v, Produce data validators from <ocaml validator="x"> annotations where x is a user-written validator to be applied on a specific node. This is typically used in conjunction with -extend because user-written validators depend on the type definitions.
-
-extend MODULE -
Assume that all type definitions are provided by the specified module unless otherwise annotated. Type aliases are created for each type, e.g. type t = Module.t
-
-open MODULE1,MODULE2,... -
List of modules to open (comma-separated or space-separated)
-
-nfd -
Do not dump
OCamlfunction definitions
-
-ntd -
Do not dump
OCamltype definitions
-
-pos-fname FILENAME -
Source file name to use for error messages (default: input name)
-
-pos-lnum LINENUM -
Source line number of the first line of the input (default: 1)
-
-rec -
Keep
OCamltype definitions mutually recursive
-
-version -
print version and exit
-
-help | --help -
Display this list of options
Releases
7 releases since Debian 7 (Wheezy); the text changed 1 time.
--help since Debian 8 (Jessie);
-b since Debian 8 (Jessie);
-dep since Debian 8 (Jessie);
-extend since Debian 8 (Jessie);
-help since Debian 8 (Jessie);
-j since Debian 8 (Jessie);
-j-custom-fields since Debian 8 (Jessie);
-j-defaults since Debian 8 (Jessie);
-j-pp since Debian 8 (Jessie);
-j-std since Debian 8 (Jessie);
-j-strict-fields since Debian 8 (Jessie);
-list since Debian 8 (Jessie);
-pos-fname since Debian 8 (Jessie);
-pos-lnum since Debian 8 (Jessie);
-t since Debian 8 (Jessie);
-v since Debian 8 (Jessie);
-validate since Debian 8 (Jessie).