CPPO(1)

πŸ’– CPPO β€” the manual, but make it cute πŸ’–

okay bestie, welcome to the cppo page from the User Manuals section, like a little corner of the manual universe that is entirely about making your OCaml life easier. grab a snack, we're doing this πŸ’…


✨ NAME ✨

cppo β€” the lightweight, cpp-like preprocessor for OCaml. yes that's her whole government name 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

cppo [Options...] files...

that's it. that's the whole vibe. options, then files, no cap ✨


🌸 DESCRIPTION 🌸

so basically cppo is the C preprocessor but for OCaml, and it understood the assignment πŸ’… It lets you define and expand simple macros β€” "simple" compared to camlp4, which is doing the absolute most β€” plus file inclusion. so iconic.

and she doesn't stop there. cppo supports functional macros, conditionals, boolean and arithmetic expressions, stringification, and even calling different, external preprocessors. she's multifaceted, she contains multitudes, main character energy fr fr πŸ‘‘

for the precise, granular, every-last-detail description of all the features, go read /usr/share/doc/cppo/README.gz. that's the deep lore bestie πŸ“–


πŸ’œ OPTIONS πŸ’œ

  • -D IDENT β€” define IDENT. give it a name, she'll remember it πŸ’–
  • -U IDENT β€” undefine IDENT. it's giving "we don't know her" πŸ™ˆ
  • -I DIR β€” add DIR to the search path for included files. she needs to know where to look πŸ”
  • -o FILE β€” write output to FILE. otherwise she just says it out loud to stdout, which is also valid
  • -q β€” Identify and preserve camlp4 quotations. leave them exactly as you found them, respect ✨
  • -s β€” Output line directives pointing to the exact source location of each token, including those coming from the body of macro definitions. This behavior is off by default. turn it on if you want receipts 🧾
  • -n β€” Do not output any line directive other than those found in the input. heads up: this overrides -s πŸ‘€
  • -version β€” print version and exit. quick little hello and goodbye πŸŽ€
  • -x NAME:CMD_TEMPLATE β€” Define a custom preprocessor target section. it starts with:
#ext "NAME"

and ends with:

#endext

NAME must be a lowercase identifier of the form [a-z][A-Za-z0-9_]* β€” no uppercase debuts, she has rules πŸ’…

CMD_TEMPLATE is a command template supporting the following special sequences:

  • %F β€” file name (unescaped; beware of potential scripting attacks 😭 yes this is the scary one, please be careful)
  • %B β€” number of the first line
  • %E β€” number of the last line
  • %% β€” a single percent sign

The filename, the first line number and the last line number are available to the external preprocessor via the environment variables CPPO_FILE, CPPO_FIRST_LINE, CPPO_LAST_LINE 🌈

The command is expected to read from stdin and to write to stdout. that's the whole contract, periodt 🫢

  • -help | --help β€” Display options and exit. when in doubt, ask her directly πŸ’–

πŸŽ€ SEE ALSO πŸŽ€

  • the cppo web page, http://mjambon.com/cppo.html β€” go say hi ✨
  • the text manual in /usr/share/doc/cppo/README.gz β€” the full dissertation, as promised πŸ“š

πŸ‘‘ AUTHOR πŸ‘‘

This manual page was written by Sylvain Le Gall <gildor@debian.org> and Hendrik Tews <hendrik@askra.de>, specifically for the Debian project (and may be used by others). legends, honestly, we thank them for their service πŸ«ΆπŸ’–


and that's the whole page bestie!! this was CPPO in the CPPO(1) era, version vibes from June 2013 🌸 you ate that, now go preprocess something iconic πŸ’…βœ¨