coan 4.2.4
The Report component interface
Collaboration diagram for The Report component interface:

Modules

 Macro-generated code

Files

file  report.c
file  report.h

Enumerations

enum  reason_code_t {
  MSGCLASS_SHIFT = 11, ISSUE_MASK = (1 << MSGCLASS_SHIFT) - 1, MSGCLASS_NONE = 0 << MSGCLASS_SHIFT, MSGCLASS_PROGRESS = 1 << MSGCLASS_SHIFT,
  MSGCLASS_INFO = 2 << MSGCLASS_SHIFT, MSGCLASS_WARNING = 4 << MSGCLASS_SHIFT, MSGCLASS_ERROR = 8 << MSGCLASS_SHIFT, MSGCLASS_ABEND = 16 << MSGCLASS_SHIFT,
  MSGCLASS_SUMMARY = 32 << MSGCLASS_SHIFT, MSGCLASS_MASK = 255 << MSGCLASS_SHIFT, MSGSEVERITY_MASK = MSGCLASS_MASK & ~MSGCLASS_SUMMARY, MSGEVENT_MASK = MSGSEVERITY_MASK & ~MSGCLASS_PROGRESS,
  EVENT_SUMMARY_MIN = 1, EVENT_SUMMARY_DROPPED_LINES = 1 | MSGCLASS_INFO | MSGCLASS_SUMMARY, EVENT_SUMMARY_CHANGED_LINES = 2 | MSGCLASS_INFO | MSGCLASS_SUMMARY, EVENT_SUMMARY_ERRORED_LINES = 4 | MSGCLASS_WARNING | MSGCLASS_SUMMARY,
  EVENT_SUMMARY_ERROR_OUTPUT = 8 | MSGCLASS_WARNING | MSGCLASS_SUMMARY, EVENT_SUMMARY_MAX = 16, EVENT_SUMMARY_MASK = EVENT_SUMMARY_MAX - 1, PROGRESS_SHIFT = 4,
  PROGRESS_PROCESSING_FILE = (45 << PROGRESS_SHIFT) | MSGCLASS_PROGRESS, PROGRESS_ENTERING_DIR = (46 << PROGRESS_SHIFT) | MSGCLASS_PROGRESS, PROGRESS_LEAVING_DIR = (47 << PROGRESS_SHIFT) | MSGCLASS_PROGRESS, PROGRESS_BUILDING_TREE = (49 << PROGRESS_SHIFT) | MSGCLASS_PROGRESS,
  PROGRESS_SEARCHING_DIR = (50 << PROGRESS_SHIFT) | MSGCLASS_PROGRESS, PROGRESS_ADDED_FILE = (51 << PROGRESS_SHIFT) | MSGCLASS_PROGRESS, PROGRESS_ADDED_DIR = (52 << PROGRESS_SHIFT) | MSGCLASS_PROGRESS, PROGRESS_FILE_TALLY = (53 << PROGRESS_SHIFT) | MSGCLASS_PROGRESS,
  PROGRESS_GOT_OPTIONS = (54 << PROGRESS_SHIFT) | MSGCLASS_PROGRESS, PROGRESS_SUMMARY_SHIFT = 4, PROGRESS_SUMMARY_FILES_REACHED, PROGRESS_SUMMARY_FILES_DROPPED,
  PROGRESS_SUMMARY_ALL_DONE, GRIPE_SHIFT = 4, GRIPE_DUPLICATE_MASK = (27 << GRIPE_SHIFT) | MSGCLASS_INFO, GRIPE_SYMLINK = (48 << GRIPE_SHIFT) | MSGCLASS_INFO,
  GRIPE_STRAIGHTENED_LINE = (12 << GRIPE_SHIFT) | MSGCLASS_INFO, GRIPE_REDUNDANT_OPTION = (49 << GRIPE_SHIFT) | MSGCLASS_WARNING, GRIPE_DUPLICATE_ARGS = (1 << GRIPE_SHIFT) | MSGCLASS_WARNING, GRIPE_DELETED_CONTRADICTION = (2 << GRIPE_SHIFT) | MSGCLASS_WARNING,
  GRIPE_COMMENTED_CONTRADICTION = (3 << GRIPE_SHIFT) | MSGCLASS_WARNING, GRIPE_ERRORED_CONTRADICTION = (4 << GRIPE_SHIFT) | MSGCLASS_WARNING, GRIPE_DIFFERING_REDEF = (76 << GRIPE_SHIFT) | MSGCLASS_WARNING, GRIPE_UNDEFING_DEFINED = (77 << GRIPE_SHIFT) | MSGCLASS_WARNING,
  GRIPE_UNCONDITIONAL_ERROR_INPUT = (5 << GRIPE_SHIFT) | MSGCLASS_WARNING, GRIPE_UNCONDITIONAL_ERROR_OUTPUT = (6 << GRIPE_SHIFT) | MSGCLASS_WARNING, GRIPE_GARBAGE_AFTER_DIRECTIVE = (7 << GRIPE_SHIFT) | MSGCLASS_WARNING, GRIPE_MISSING_EOF_NEWLINE = (18 << GRIPE_SHIFT) | MSGCLASS_WARNING,
  GRIPE_CIRCULAR_SYM_DEF = (28 << GRIPE_SHIFT) | MSGCLASS_WARNING, GRIPE_VERBOSE_ONLY = (29 << GRIPE_SHIFT) | MSGCLASS_WARNING, GRIPE_ZERO_DIVIDE = (38 << GRIPE_SHIFT) | MSGCLASS_WARNING, GRIPE_DIR_IGNORED = (41 << GRIPE_SHIFT) | MSGCLASS_WARNING,
  GRIPE_EMPTY_SYMBOL = (58 << GRIPE_SHIFT) | MSGCLASS_WARNING, GRIPE_UNKNOWN_DIRECTIVE = (60 << GRIPE_SHIFT) | MSGCLASS_WARNING, GRIPE_INVALID_INCLUDE = (61 << GRIPE_SHIFT) | MSGCLASS_WARNING, GRIPE_STRAY_ESCAPE = (62 << GRIPE_SHIFT) | MSGCLASS_WARNING,
  GRIPE_FUNCTION_LIKE_MACRO_EXPANSION = (63 << GRIPE_SHIFT) | MSGCLASS_WARNING, GRIPE_INT_OVERFLOW = (64 << GRIPE_SHIFT | MSGCLASS_WARNING), GRIPE_UNCLOSED_QUOTE = (65 << GRIPE_SHIFT) | MSGCLASS_WARNING, GRIPE_NEGATIVE_SHIFT = (66 << GRIPE_SHIFT) | MSGCLASS_WARNING,
  GRIPE_FORCED_UNSIGNED = (67 << GRIPE_SHIFT) | MSGCLASS_WARNING, GRIPE_SIGN_CHANGED = (68 << GRIPE_SHIFT) | MSGCLASS_WARNING, GRIPE_SHIFT_OVERFLOW = (69 << GRIPE_SHIFT) | MSGCLASS_WARNING, GRIPE_CHAR_CONSTANT_TOO_LONG = (70 << GRIPE_SHIFT) | MSGCLASS_WARNING,
  GRIPE_MULITBYTE_CHAR_CONSTANT = (71 << GRIPE_SHIFT) | MSGCLASS_WARNING, GRIPE_TRANSIENT_SYMBOL_ADDED = (73 << GRIPE_SHIFT) | MSGCLASS_WARNING, GRIPE_INSOURCE_FUNCTION_LIKE_MACRO_DEFINITION = (74 << GRIPE_SHIFT) | MSGCLASS_WARNING, GRIPE_NO_SYMS = (75 << GRIPE_SHIFT) | MSGCLASS_WARNING,
  GRIPE_BROKEN_SYMLINK = (79 << GRIPE_SHIFT) | MSGCLASS_WARNING, GRIPE_ORPHAN_ELIF = (8 << GRIPE_SHIFT) | MSGCLASS_ERROR, GRIPE_ORPHAN_ELSE = (9 << GRIPE_SHIFT) | MSGCLASS_ERROR, GRIPE_ORPHAN_ENDIF = (10 << GRIPE_SHIFT) | MSGCLASS_ERROR,
  GRIPE_EOF_TOO_SOON = (11 << GRIPE_SHIFT) | MSGCLASS_ERROR, GRIPE_EOF_IN_COMMENT = (13 << GRIPE_SHIFT) | MSGCLASS_ERROR, GRIPE_EOF_IN_QUOTE = (14 << GRIPE_SHIFT) | MSGCLASS_ERROR, GRIPE_NOTHING_TO_DO = (15 << GRIPE_SHIFT) | MSGCLASS_ERROR,
  GRIPE_ONE_FILE_ONLY = (16 << GRIPE_SHIFT) | MSGCLASS_ERROR, GRIPE_NEWLINE_IN_QUOTE = (17 << GRIPE_SHIFT) | MSGCLASS_ERROR, GRIPE_INVALID_ARGS = (19 << GRIPE_SHIFT) | MSGCLASS_ERROR, GRIPE_USAGE_ERROR = (20 << GRIPE_SHIFT) | MSGCLASS_ERROR,
  GRIPE_TOO_DEEP = (21 << GRIPE_SHIFT) | MSGCLASS_ERROR, GRIPE_MULTIPLE_ARGFILES = (31 << GRIPE_SHIFT) | MSGCLASS_ERROR, GRIPE_GARBAGE_ARG = (32 << GRIPE_SHIFT) | MSGCLASS_ERROR, GRIPE_NOT_IDENTIFIER = (33 << GRIPE_SHIFT) | MSGCLASS_ERROR,
  GRIPE_UNBALANCED_PAREN = (59 << GRIPE_SHIFT) | MSGCLASS_ERROR, GRIPE_GLOBAL_FUNCTION_LIKE_MACRO_DEFINITION = (72 << GRIPE_SHIFT) | MSGCLASS_ERROR, GRIPE_IF_WITHOUT_COND = (78 << GRIPE_SHIFT) | MSGCLASS_ERROR, GRIPE_CANT_OPEN_INPUT = (22 << GRIPE_SHIFT) | MSGCLASS_ABEND,
  GRIPE_OUT_OF_MEMORY = (23 << GRIPE_SHIFT) | MSGCLASS_ABEND, GRIPE_FILENAME_TOO_LONG = (24 << GRIPE_SHIFT) | MSGCLASS_ABEND, GRIPE_EOF_IN_FILENAME = (25 << GRIPE_SHIFT) | MSGCLASS_ABEND, GRIPE_CONFUSED = (26 << GRIPE_SHIFT) | MSGCLASS_ABEND,
  GRIPE_CANT_READ_INPUT = (30 << GRIPE_SHIFT) | MSGCLASS_ABEND, GRIPE_CANT_WRITE_FILE = (39 << GRIPE_SHIFT) | MSGCLASS_ABEND, GRIPE_NO_FILE = (40 << GRIPE_SHIFT) | MSGCLASS_ABEND, GRIPE_ILLEGAL_FILENAME = (34 << GRIPE_SHIFT) | MSGCLASS_ABEND,
  GRIPE_CANT_DELETE_FILE = (35 << GRIPE_SHIFT) | MSGCLASS_ABEND, GRIPE_CANT_RENAME_FILE = (36 << GRIPE_SHIFT) | MSGCLASS_ABEND, GRIPE_NO_TEMPFILE = (37 << GRIPE_SHIFT) | MSGCLASS_ABEND, GRIPE_CANT_OPEN_DIR = (42 << GRIPE_SHIFT) | MSGCLASS_ABEND,
  GRIPE_CANT_READ_DIR = (43 << GRIPE_SHIFT) | MSGCLASS_ABEND
}
enum  dbg_code_t {
  DBG_1 = 1, DBG_2, DBG_3, DBG_4,
  DBG_5, DBG_6, DBG_8, DBG_7,
  DBG_9, DBG_10, DBG_11, DBG_12,
  DBG_13, DBG_14, DBG_15, DBG_16,
  DBG_17, DBG_18, DBG_19, DBG_20,
  DBG_21, DBG_22
}

Functions

void set_exit_flags (int bits, bool set)
int get_exit_flags (int bits)
int exitcode (void)
size_t line_len (char const *str)
void flatten_line (char *line)
void report (reason_code_t reason, heap_str *buf, const char *format,...)
void parse_error (int reason, const char *format,...)
void give_up_confused (void)
void vbail (int reason, const char *msg, va_list argp)
void bail (int retcode, const char *format,...)
void debugging (bool on)
void debug (dbg_code_t how,...)
void exit_diagnostics (void)
void orphan_elif (void)
void orphan_else (void)
void orphan_endif (void)
void early_eof (void)
void processing_file (char const *filename)
void entering_dir (char const *dirname)
void leaving_dir (char const *dirname)
size_t format_output (void *dest, int *buflen, int *startoff, char const *format,...)
heap_str concatenate (size_t count, char *strs[], int punctch)
void report_symbol (symbol_h sym)
void report_include (hash_include_const_h inc_arg)
void report_directive (canonical_string_const_h cl, directive_type_t directive_type)
char * format_int (int_spec_t const *int_spec)

Detailed Description

interface


Enumeration Type Documentation

enum dbg_code_t

Arbitary codes to select the behaviour of the debug() function

Definition at line 321 of file report.h.

Enumeration of all diagnostic reason codes and auxiliary bit masks and offsets. A complete reason code consists or an or-combination of a message class code and an issue code. A range of issue codes are event summary codes, representing significant diagnostics accrued in the course of processing all inputs. Another range of issue codes are gripes, representing complaints specific to input fragments.

Enumerator:
MSGCLASS_SHIFT 

TODO Simplify diagnostic encoding

The message class bitfield is offset this amount

ISSUE_MASK 

&-ed with code strips off message class

MSGCLASS_NONE 

No message class

MSGCLASS_PROGRESS 

Progress message

MSGCLASS_INFO 

Informational diagnositic

MSGCLASS_WARNING 

Warning diagnostic

MSGCLASS_ERROR 

User error diagnostic

MSGCLASS_ABEND 

Fatal internal or environment error diagnostic

MSGCLASS_SUMMARY 

Summary message.

MSGCLASS_MASK 

&-ed with code extracts message class

MSGSEVERITY_MASK 

&-ed with code extracts message severity, i.e. message class other than summary

MSGEVENT_MASK 

&-ed with code extracts any event message class, i.e. message class other than progress and summary.

EVENT_SUMMARY_MIN 

Min value of event summaries

EVENT_SUMMARY_DROPPED_LINES 

Summary diagnostic - input lines were dropped

EVENT_SUMMARY_CHANGED_LINES 

Summary diagnostic - input lines were changed

EVENT_SUMMARY_ERRORED_LINES 

Summary diagnostic - input lines were converted to hash-errors

EVENT_SUMMARY_ERROR_OUTPUT 

Summary diagnostic - unconditional hash-error lines were output

EVENT_SUMMARY_MAX 

All valid summary values are less than this

EVENT_SUMMARY_MASK 

&-ed with code extracts summary diagnostics

PROGRESS_SHIFT 

The progress messages bitfield is offset this amount

PROGRESS_PROCESSING_FILE 

Report file being processed

PROGRESS_ENTERING_DIR 

Report entering directory

PROGRESS_LEAVING_DIR 

Report leaving directory

PROGRESS_BUILDING_TREE 

Report building the input tree

PROGRESS_SEARCHING_DIR 

Report searching a directory for input files

PROGRESS_ADDED_FILE 

Report added a file to input

PROGRESS_ADDED_DIR 

Report added files from a directory

PROGRESS_FILE_TALLY 

Report total input files found

PROGRESS_GOT_OPTIONS 

Report a commandline argument parsed

PROGRESS_SUMMARY_SHIFT 

The progress summaries bitfield is offset this amount.

PROGRESS_SUMMARY_FILES_REACHED 

Report total files reached & not reached

PROGRESS_SUMMARY_FILES_DROPPED 

Report total files abandoned due to errors

GRIPE_SHIFT 

The gripes bitfield is offset this amount

GRIPE_DUPLICATE_MASK 

Duplicate diagnoistic filters are specified with the --gag option

GRIPE_SYMLINK 

Input file or directory is symbolic link.

GRIPE_STRAIGHTENED_LINE 

Obfuscating line-continuation(s) deleted

GRIPE_REDUNDANT_OPTION 

--replace option is redundant with --symbols

GRIPE_DUPLICATE_ARGS 

The same argument occurs for multiple --define or --undefine options

GRIPE_DELETED_CONTRADICTION 

An input hash-define or hash-undef directive was deleted on output because it contradicts a --define or --undefine option together with --contradict delete

GRIPE_COMMENTED_CONTRADICTION 

An input hash-define or hash-undef directive was commented out on output because it contradicts a --define or --undefine option togther with --contradict comment

GRIPE_ERRORED_CONTRADICTION 

An input hash-define or hash-undef directive was converted to a hash-error on output because it contradicts a --define or --undefine option together with --contradict error

GRIPE_DIFFERING_REDEF 

An in-source #define defines a symbol differently from a prior one.

GRIPE_UNDEFING_DEFINED 

An in-source #undef undefines a symbol previously defined by an in-source #define.

GRIPE_UNCONDITIONAL_ERROR_INPUT 

A hash-error directive was input unconditionally, i.e. not in the scope of any hash-if

GRIPE_UNCONDITIONAL_ERROR_OUTPUT 

A hash-error directive was output unconditionally, i.e. not in the scope of any hash-if

GRIPE_GARBAGE_AFTER_DIRECTIVE 

Garbage text was input following a directive

GRIPE_MISSING_EOF_NEWLINE 

A newline is missing at end of input

GRIPE_CIRCULAR_SYM_DEF 

A symbol has a circular definition.

GRIPE_VERBOSE_ONLY 

The --verbose option is mixed with the --gag option

GRIPE_ZERO_DIVIDE 

A divide by zero was found in an expression

GRIPE_DIR_IGNORED 

Directory name ignored on input when --recurse not not specified

GRIPE_EMPTY_SYMBOL 

A symbol that evaluates to an empty string is an operand in an expression

GRIPE_UNKNOWN_DIRECTIVE 

Unknown preprocessor directive

GRIPE_INVALID_INCLUDE 

Problematic argument to a hash-include directive

GRIPE_STRAY_ESCAPE 

Misplaced escape character '\'

GRIPE_FUNCTION_LIKE_MACRO_EXPANSION 

We don't do macro function-like expansion

GRIPE_INT_OVERFLOW 

An integer constant evaluates > INT_MAX

GRIPE_UNCLOSED_QUOTE 

Unclosed quotation

GRIPE_NEGATIVE_SHIFT 

Negative shift count

GRIPE_FORCED_UNSIGNED 

Huge integer constant forced to be unsigned

GRIPE_SIGN_CHANGED 

Integer sign changed by promotion

GRIPE_SHIFT_OVERFLOW 

Shift count is >= the width of the shifted quantity

GRIPE_CHAR_CONSTANT_TOO_LONG 

Character constant too long for current locale

GRIPE_MULITBYTE_CHAR_CONSTANT 

Character constant goes multi-byte

GRIPE_TRANSIENT_SYMBOL_ADDED 

A symbol has been transiently defined or undefined for the duration of the current source file

GRIPE_INSOURCE_FUNCTION_LIKE_MACRO_DEFINITION 

An in-source function-like macro definition (unsupported) has ignored

GRIPE_NO_SYMS 

The commandline does not specify any --define or --undef

GRIPE_BROKEN_SYMLINK 

An orphan hash-elif was found in input

GRIPE_ORPHAN_ELSE 

An orphan hash-else was found in input

GRIPE_ORPHAN_ENDIF 

An orphan hash-endif was found in input

GRIPE_EOF_TOO_SOON 

Unexpected end of input

GRIPE_EOF_IN_COMMENT 

Input ends within a comment

GRIPE_EOF_IN_QUOTE 

Input ends within quotation

GRIPE_NOTHING_TO_DO 

The commandline does not specify anything to do

GRIPE_ONE_FILE_ONLY 

The commandline invalidly specifies multiple input files without the --replace option

GRIPE_NEWLINE_IN_QUOTE 

A newline occurs within quotation in input

GRIPE_INVALID_ARGS 

The commandline options are not a valid combination

GRIPE_USAGE_ERROR 

The commandline is syntactically invalid

GRIPE_TOO_DEEP 

hash-if nesting exceeds MAXDEPTH in input

GRIPE_MULTIPLE_ARGFILES 

The --file option occurs more than once

GRIPE_GARBAGE_ARG 

The argument to a --define or --undefine option contains mysterious characters.

GRIPE_NOT_IDENTIFIER 

A valid preprocessor identifier was not found where required

GRIPE_UNBALANCED_PAREN 

Unbalanced parenthesis

GRIPE_GLOBAL_FUNCTION_LIKE_MACRO_DEFINITION 

Cannot --define function-like macros

GRIPE_IF_WITHOUT_COND 

#if or #elif has no argument

GRIPE_CANT_OPEN_INPUT 

Cannot open an input file

GRIPE_OUT_OF_MEMORY 

Out of memory

GRIPE_FILENAME_TOO_LONG 

A filename exceeds the maximum length for the environment

GRIPE_EOF_IN_FILENAME 

End of input encountered while reading a quoted filename. A closing quotation was not found

GRIPE_CONFUSED 

Internal logic error

GRIPE_CANT_READ_INPUT 

Read error on input

GRIPE_CANT_WRITE_FILE 

Write error on output

GRIPE_NO_FILE 

Can't identify file or directory

GRIPE_ILLEGAL_FILENAME 

Invalid filename input

GRIPE_CANT_DELETE_FILE 

Failure to delete a file

GRIPE_CANT_RENAME_FILE 

Failure to rename a file

GRIPE_NO_TEMPFILE 

Cannot create a temporary file

GRIPE_CANT_OPEN_DIR 

Cannot open directory

GRIPE_CANT_READ_DIR 

Read error on directory

Definition at line 66 of file report.h.


Function Documentation

void bail ( int  retcode,
const char *  format,
  ... 
)

Exit the program out with a specified return code and diagnostic message.

Parameters:
retcodeThe code to be returned by exit().
formatA printf format from which to compose the diagnostic together with subsequent arguments.

Definition at line 412 of file report.c.

References vbail().

Referenced by backup_infile(), configured_symbol_seek_const(), delete_infile(), eval_if(), eval_line(), eval_unary(), finish_args(), fs_file_or_dir(), fs_read_dir(), give_up_confused(), make_backup_name(), make_tempfile(), nest(), no_alloc_fail(), open_file(), parse_args_file(), read_filename(), readon(), replace_infile(), and report_symbol_configuration().

Here is the call graph for this function:

heap_str concatenate ( size_t  count,
char *  strs[],
int  punctch 
)

Concatenate strings.

Parameters:
countThe number of strings to concatenate,
strsThe array of strings to concatenate.
punctchOptional character with which to punctuate the concatenated strings, -1 == none.
Returns:
Pointer to heap storage in which the concatenation is stored. It is the caller's responsibility to free this storage.

Definition at line 626 of file report.c.

References callocate(), ptr_vector::count, and zallocate().

Referenced by parse_command_args().

Here is the call graph for this function:

void debug ( dbg_code_t  how,
  ... 
)

Write debugging info on stderr.

Parameters:
howA code that selects how the function will compose debugging output from the subsequent arguments.

Definition at line 427 of file report.c.

References get_comment_type_name(), get_linestate_name(), get_linetype_name(), GET_STATE, if_depth(), if_state_name(), linetype_name, MSGCLASS_NONE, report(), and vreport().

Referenced by configured_symbol_match_const(), eval_hash_define(), eval_hash_undef(), eval_if(), eval_line(), eval_table(), eval_unary(), and node_proc().

Here is the call graph for this function:

void debugging ( bool  on)

Turn debugging output on or off

Parameters:
onIf true, debugging output is enabled; otherwise disabled.

Definition at line 421 of file report.c.

References report(), and SET_STATE.

Referenced by parse_command_args().

Here is the call graph for this function:

void early_eof ( void  )

Diagnose unexpected end of input on stderr

Definition at line 602 of file report.c.

References GRIPE_EOF_TOO_SOON, and parse_error().

Referenced by read_more().

Here is the call graph for this function:

void entering_dir ( char const *  dirname)

Report entering a directory file stderr

Definition at line 614 of file report.c.

References PROGRESS_ENTERING_DIR, and report().

Referenced by node_proc().

Here is the call graph for this function:

void exit_diagnostics ( void  )

Write summary diagnostics on stderr at exit. The summary diagnostics will be output unless --gag summary is in force, which it is by default.

Definition at line 525 of file report.c.

References EVENT_SUMMARY_CHANGED_LINES, EVENT_SUMMARY_DROPPED_LINES, EVENT_SUMMARY_ERROR_OUTPUT, EVENT_SUMMARY_ERRORED_LINES, exitcode(), file_tree_count(), FT_COUNT_FILES, GET_PUBLIC, GET_STATE, if_control_toplevel(), io_toplevel(), ISSUE_MASK, MSGCLASS_ABEND, MSGCLASS_ERROR, MSGCLASS_INFO, MSGCLASS_WARNING, PROGRESS_SUMMARY_FILES_DROPPED, PROGRESS_SUMMARY_FILES_REACHED, and report().

Referenced by main().

Here is the call graph for this function:

int exitcode ( void  )

Convert the internal exit status to an exit code for exit(), manipulating the bits so that the exit diagnostic bits are returned in the low order byte.

Returns:
RC such that:
  • RC = 0: MSGCLASS_NONE: No diagnostics accrued.
  • RC & 0x2: MSGCLASS_INFO: At worst info diagnostics accrued.
  • RC & 0x4: MSGCLASS_WARNING: At worst warnings accrued.
  • RC & 0x8: MSGCLASS_ERROR: At worst errors accrued.
  • RC & 0x16: MSGCLASS_ABEND: Execution was aborted.
  • RC & 0x12: EVENT_SUMMARY_DROPPED_LINES (INFO): Input lines were dropped on output.
  • RC & 0x22: EVENT_SUMMARY_CHANGED_LINES (INFO): Input lines were changed on output.
  • RC & 0x44: EVENT_SUMMARY_ERRORED_LINES (WARNING): Lines were changed to hash-errors on output.
  • RC & 0x84: EVENT_SUMMARY_ERROR_OUPUT (WARNING): Unconditional hash-errors were output.

Definition at line 323 of file report.c.

References EVENT_SUMMARY_CHANGED_LINES, EVENT_SUMMARY_DROPPED_LINES, EVENT_SUMMARY_MASK, GET_PUBLIC, GET_STATE, GRIPE_SHIFT, MSGCLASS_SHIFT, MSGCLASS_SUMMARY, report(), and SET_STATE.

Referenced by close_io(), exit_diagnostics(), process(), and vbail().

Here is the call graph for this function:

void flatten_line ( char *  line)

Convert embedded linefeeds and tabs in string line to spaces for tidy printing in diagnostics.

Parameters:
lineString putatively containing embedded linefeeds or tabs.

Definition at line 290 of file report.c.

References line_len().

Referenced by save_contradiction().

Here is the call graph for this function:

char* format_int ( int_spec_t const *  int_spec)

Format an integer value as a numeral appropriately to its type.

Parameters:
int_specA pointer to an int_spec that represents the the value to be formatted.
Returns:
A pointer to the resulting 0-terminated numeral in a heap block, which the caller must free.

Definition at line 710 of file report.c.

References clone(), INT_CHAR, INT_INT, INT_LLONG, INT_LONG, INT_SHORT, INT_UCHAR, INT_UINT, INT_ULLONG, INT_ULONG, INT_USHORT, int_spec::type, and int_spec::val.

Referenced by do_usual_conversions().

Here is the call graph for this function:

size_t format_output ( void *  dest,
int *  buflen,
int *  startoff,
char const *  format,
  ... 
)

Compose an output message.

Parameters:
destDepending on buflen, either a pointer to a FILE to which the formatted output shall be written, or else a pointer to the address of a heap buffer in which to format the output.
buflenIf *buflen < 0 then dest is a FILE*. Otherwise *buflen is current length of the buffer at *dest.
startoffIf *buflen >= 0, *startoff is the offset into the buffer at which to format the message; otherwise ignored.
formatThe printf() format with which to compose the message using subsequent arguments.
Returns:
The length of the formatted message, excluding any terminal nul.

If *buflen < 0 then the function writes output to the FILE at dest composed from format and subsequent arguments.

Otherwise function attempts to compose output within the spare *buflen - *startoff bytes of the buffer. As long as the output will not fit the function reallocates the buffer to twice its current size and tries again. The final address of the buffer will be stored at dest. The final length of the buffer will be stored at buflen, and the address of the terminal nul of the formatted message with be stored at startoff.

It is the caller's responsibility to free storage allocated at *dest.

Definition at line 360 of file report.c.

References vformat_output().

Referenced by compose_contradiction_insert_format(), save_contradiction(), and vreport().

Here is the call graph for this function:

int get_exit_flags ( int  bits)

Query the current event summary and severity flags.

Parameters:
bitsThe bits to be queried.
Returns:
A bit mask consisting of those bits that are set in bits and also in the exit status.

Definition at line 342 of file report.c.

References EVENT_SUMMARY_MASK, GET_STATE, MSGSEVERITY_MASK, and report().

Referenced by save_contradiction().

Here is the call graph for this function:

void give_up_confused ( void  )

Exit the program on an internal logic error with an aplogetic message. The function is called if the program recognises that it it has lost its bearings.

Definition at line 390 of file report.c.

References bail(), and GRIPE_CONFUSED.

Referenced by main().

Here is the call graph for this function:

void leaving_dir ( char const *  dirname)

Report leaving a directory file stderr

Definition at line 620 of file report.c.

References PROGRESS_LEAVING_DIR, and report().

Referenced by node_proc().

Here is the call graph for this function:

size_t line_len ( char const *  str)

Get the length of a string excluding any final newline.

Parameters:
strThe string to be measured.
Returns:
The length of str excluding any final newline.

Definition at line 305 of file report.c.

References eol().

Referenced by ensure_buf(), eval_hash_define(), eval_hash_undef(), eval_line(), eval_unary(), flatten_line(), get_line(), PUBLIC_STATE_DEF(), readon(), save_contradiction(), and truncate_line().

Here is the call graph for this function:

void orphan_elif ( void  )

Diagnose an input orphan hash-elif on stderr

Definition at line 584 of file report.c.

References parse_error().

Here is the call graph for this function:

void orphan_else ( void  )

Diagnose an input orphan hash-else on stderr

Definition at line 590 of file report.c.

References GRIPE_ORPHAN_ELSE, and parse_error().

Here is the call graph for this function:

void orphan_endif ( void  )

Diagnose an input orphan hash-endif on stderr

Definition at line 596 of file report.c.

References GRIPE_ORPHAN_ENDIF, and parse_error().

Here is the call graph for this function:

void parse_error ( int  reason,
const char *  format,
  ... 
)

Exit the program on a fatal parsing error with a diagnostic message.

Parameters:
reasonThe reason code for the error.
formatA printf format from which to compose the diagnostic together with subsequent arguments.

Definition at line 381 of file report.c.

References vbail().

Referenced by chew_on(), done_file(), early_eof(), orphan_elif(), orphan_else(), and orphan_endif().

Here is the call graph for this function:

void processing_file ( char const *  filename)

Report processing an input file stderr

Definition at line 608 of file report.c.

References PROGRESS_PROCESSING_FILE, and report().

Referenced by node_proc().

Here is the call graph for this function:

void report ( reason_code_t  reason,
heap_str buf,
const char *  format,
  ... 
)

Produce a diagnostic message.

Parameters:
reasonThe reason code of the diagnostic
bufEither NULL or the address of a pointer at which storage shall be allocated to store the diagnostic.
formatEither NULL or a printf format from which the diagnostic may be composed together with the ensuing unspecified arguments.

The diagnostic is prefixed with the program name, and then the current input filename and line number, if any, that provoke the diagnostic.

Then follows one of:

  • progress reason
  • info reason
  • warning reason
  • error reason
  • abend reason

depending on the message class of reason.

Then follows the body of diagnostic composed from format and subsequent args.

Finally, if the diagnostic refers to an output line that is within the scope of a true hash-if condition from input line N at nesting depth D, a parenthesis is written of the form:

(if-line N, depth D)

The way in which production of the diagnostic is determined as follows:

If format is NULL then buf is assumed to be the address of a pointer to storage in which a previous call to the function has composed a diagnostic that is now to be output. In this case the diagnostic at that pointer is written to stderr, the pointer at buf is freed and set == NULL.

Otherwise, if buf == NULL then a diagnostic composed from format and subsequent arguments is written to stderr.

Otherwise, if the pointer addressed by buf is not NULL, it is freed. Then a diagnostic composed from format and subsequent arguments is composed in heap storage and the address of this storage is stored at buf. If is the responsibility of the caller to ensure that this storage is freed.

Definition at line 372 of file report.c.

References vreport().

Referenced by add_files(), build_proc(), check_shift_validity(), chew_on(), chew_string(), chew_unbroken_string(), config_diagnostics(), debug(), debugging(), do_usual_conversions(), entering_dir(), eval_character_constant(), eval_hash_include(), eval_line(), eval_numeral(), eval_possible_symbol(), exit_diagnostics(), exitcode(), file_tree_add_symlink(), finish_args(), get_exit_flags(), get_line(), insert_pending_contradiction(), leaving_dir(), op_divide(), op_mod(), parse_command_args(), processing_file(), ready(), report_directive(), report_symbol_configuration(), save_contradiction(), set_exit_flags(), symbol_resolve(), vbail(), and vreport().

Here is the call graph for this function:

void report_directive ( canonical_string_const_h  cl,
directive_type_t  directive_type 
)

Record an occurrence of a directive in accordance with the options of the ifs defs, errors or pragmas command.

Parameters:
clThe argument object of the directive in canonical_string_h form.
directive_typeThe type of the directive in whih the argument was found.

The directive is listed in clean form on the standard outout. If --locate is in force then the input filename and line number of the listed occurrence are appended.

Definition at line 693 of file report.c.

References canonical_string_text(), get_directive_keyword(), GET_PUBLIC, GET_STATE, HASH_COUNT, HASH_IF, HASH_UNKNOWN, and report().

Referenced by directive_tally().

Here is the call graph for this function:

void report_include ( hash_include_const_h  inc_arg)

Record an occurrence of a hash-include directive. in accordance with the options of the includes command.

Parameters:
inc_argThe hash-include argument object of which an occurrence is to be reported.

If this occurrence of the hash-include argument is eligible to be output it will be written on If --active is in force then hash-includes will be reported only from active hash-includes.

If --inactive is in force then hash-includes will be reported only from inactive hash-includes.

If --once is in force then a hash-include will be reported only once for each distinct value of its argument. The argument can have different evaluations at different occurrences if it is a preprocessor symbol, which may for instance be defined at once ocurrence and not defined or differently defined at another occurrence.

If --locate is in force then the input filename and line number is given with each reported occurrence.

Definition at line 678 of file report.c.

References canonical_string_text(), GET_PUBLIC, hash_include_definition, and hash_include_str.

Referenced by hash_include_tally().

Here is the call graph for this function:

void report_symbol ( symbol_h  sym)

Report an occurrence of a preprocessor symbol in accordance with the options of the symbols command.

Parameters:
symThe symbol to be reported.

If this occurrence of the symbol is eligible for reporting it will be listed on the standard output.

If --active is in force then symbols will be reported only from active directives.

If --inactive is in force then symbols will be reported only from inactive directives.

If --once is in force then a symbol will be reported only once.

If --locate is in force then the input filename and line number is given with each reported occurrence.

If --ifs is in force then symbols will be listed from hash-if[[n][def]] and hash-elif directives.

If --defs is in force then symbols will be listed from hash-define directives.

If --udefs is in force then symbols will be listed from hash-undef directives.

Definition at line 655 of file report.c.

References canonical_string_text(), GET_PUBLIC, SET_REPORTED, symbol_name(), symbol_reported(), and symbol_resolve().

Referenced by eval_line(), eval_possible_symbol(), eval_unary(), symbol_evaluate_status(), and unconfigured_symbol_tally().

Here is the call graph for this function:

void set_exit_flags ( int  bits,
bool  set 
)

Set or clear event summary or severity flags in the exit status.

Parameters:
bitsThe bits to be set or cleared
setIf true, then bits are set in the exit status; otherwise they are cleared.

Definition at line 349 of file report.c.

References EVENT_SUMMARY_MASK, MSGSEVERITY_MASK, report(), and SET_STATE.

Referenced by eval_line(), forget_contradiction(), and insert_pending_contradiction().

Here is the call graph for this function:

void vbail ( int  reason,
const char *  msg,
va_list  argp 
)

Exit the program with a specified return code and diagnostic message. The function interface is the same as that of bail(), with the exception that the parameter va_list argp is a pointer that the caller has initialised with va_start() to address a list of unspecified arguments.

All functions that terminate the program do so by calling this function

Definition at line 396 of file report.c.

References exceptions_enabled, exitcode(), MSGCLASS_ABEND, MSGEVENT_MASK, report(), SET_STATE, and vreport().

Referenced by bail(), parse_error(), and usage_error().

Here is the call graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines