/usr/bin/cppo-json is in libatdgen-ocaml-dev 1.9.1-2+b2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | #! /bin/sh
usage () {
echo "\
Usage: cppo-json [cppo arguments]
cppo-json processes an OCaml file written with embedded type definitions
directives and replaces them by OCaml type definitions and JSON
serialization/deserialization code.
Sample input:
\$ cat example.ml
#ext json
type mytype = string list
#endext
let data = [ \"Hello\"; \"world\" ]
let () = print_endline (J.string_of_mytype data)
How to view the OCaml code produced by cppo-json:
\$ cppo-json < example.ml | less
How to compile an OCaml program:
\$ ocamlfind opt -o example \\
-pp cppo-json \\
-package atdgen -linkpkg \\
example.ml
cppo-json ships with atdgen-cppo and is shorthand for the following command:
cppo -x \"json:atdgen-cppo t j v\"
where 't' stands for 'type definitions', 'j' stands for 'JSON', and
'v' stands for \"validators\".
See also:
atdgen-cppo --help
cppo --help
" >&2
}
case "$1" in
--help|-help) usage; exit 0 ;;
*)
esac
cppo -x "json:atdgen-cppo t j v" "$@"
case $? in
0) ;;
*)
echo "cppo-json failed" >&2
exit 2
esac
|