futhark-0.9.1: An optimising compiler for a functional, array-oriented language.

Safe HaskellNone
LanguageHaskell2010

Futhark.CodeGen.Backends.GenericC.Options

Description

This module defines a generator for getopt_long based command line argument parsing. Each option is associated with arbitrary C code that will perform side effects, usually by setting some global variables.

Synopsis

Documentation

data Option Source #

Specification if a single command line option. The option must have a long name, and may also have a short name.

In the action, the option argument (if any) is stored as in the char*-typed variable optarg.

data OptionArgument Source #

Whether an option accepts an argument.

generateOptionParser :: String -> [Option] -> Func Source #

Generate an option parser as a function of the given name, that accepts the given command line options. The result is a function that should be called with argc and argv. The function returns the number of argv elements that have been processed.

If option parsing fails for any reason, the entire process will terminate with error code 1.