6.11 Diagnostic Messages

Cows and Cows-mkgen share the same format for diagnostic messages so this section will cover both.

Diagnostic messages printed before or after parsing (e.g. an error occurs while trying to open input file) are prefixed by the invocation name for the program:

invocation name: error message

As an example:

$ ./cows dontexist.cws dontexist.html
./cows: unable to get infos about dontexist.cws; No such file or directory

Diagnostic messages printed while parsing are prefixed by file name and line number where reported event occurred:

source-file-name:lineno: message

As an example:

$ cows input.cws output.html
input.cws:7: parse error before `else'

If the file containing the error has been included from other files, the whole list is displayed. As an example, if status.cws includes top.cws, which in turn includes table_of_contents.cws you can see something like:

In file included from ./main/infos/status.cws:5,
                 from ./tools/top.cws:7:
./tools/table_of_contents.cws:15: parse error before `{'

Cows and Cows-mkgen can display four types of diagnostic messages:

Informational messages, prefixed by info:

Provide user with informations about program's activity. Execution goes on.

$ cows-mkgen
cows-mkgen: info: No source file found .. creating empty Makefile
Warnings, prefixed by warning:

Report an anomaly that may cause trouble. Execution goes on, unless -fatal-warnings (-E) command line option was used.

$ cows input.cws output.html
input.cws:4: warning: variable `foo' not defined
Errors, no prefix

Report an anomaly that makes it impossible to get a valuable output. Execution stops, unless -ignore-errors (-i) command line option was used.

$ cows input.cws output.html
input.cws:7: parse error before `else'
Fatal errors, prefixed by fatal:

Same as errors, but execution stops anyway, regardless of -ignore-errors options.

$ cows --ignore-errors input.cws output.html
cows: fatal: can't open input file input.cws; Permission denied

You can produce a more verbose diagnostic with the -verbose (-v) option or suppress all messages with the -quiet (-q) or -silent (-s) options.

Also, the -brief (-b) option will produce shorter messages, without changing their amount. Visually impaired users relying on a speech version of shell's output may find this flag useful since large amounts of output can slow down work. If this is your case, also remember that when building your site with Make, you can use make -s instead of make: the former won't print the commands as they are executed reducing the amount of output on your screen.

See Section 6.2 and Section 6.4 for details on command line options for Cows and Cows-mkgen.

This manual can be downloaded from http://www.g-cows.org/.