coan 4.2.4
The Directives Tally component interface.
Collaboration diagram for The Directives Tally component interface.:

Modules

 Macro-generated code

Files

file  directives_tally.c
file  directives_tally.h

Enumerations

enum  directive_type_t {
  HASH_UNKNOWN, HASH_IF, HASH_IFDEF, HASH_IFNDEF,
  HASH_ELSE, HASH_ELIF, HASH_ENDIF, HASH_DEFINE,
  HASH_UNDEF, HASH_INCLUDE, HASH_PRAGMA, HASH_ERROR,
  HASH_COUNT
}

Functions

void directive_tally (canonical_string_const_h cl, directive_type_t directive_type)
directive_type_t get_directive_type (char const **keyword)
char const * get_directive_keyword (directive_type_t directive_type)

Enumeration Type Documentation

Symbolic constants for types of directives

Enumerator:
HASH_UNKNOWN 

An unknown directive

HASH_IF 

A hash-if directive

HASH_IFDEF 

An hash-ifdef directive

HASH_IFNDEF 

An hash-ifndef directive

HASH_ELSE 

An hash-else directive

HASH_ELIF 

An hash-elif directive

HASH_ENDIF 

An hash-endif directive

HASH_DEFINE 

An hash-define directive

HASH_UNDEF 

An hash-undef directive

HASH_INCLUDE 

An hash-include directive

HASH_PRAGMA 

A hash-pragma directive

HASH_ERROR 

An #error directive

HASH_COUNT 

Number of previous members of this enum

Definition at line 50 of file directives_tally.h.


Function Documentation

void directive_tally ( canonical_string_const_h  cl,
directive_type_t  directive_type 
)

Tally an occurrence of a preprocessor directive argument.

Parameters:
clA canonical string containg the directive argument.
directive_typeThe type of directive found with arg.
Returns:
The terminal address of the argument parsed at arg.

Arguments of directives are stored, differentiated by directive type, in the lookup tables in canonical_string_h form. arg is looked up by forming a canonical_string_h from arg and searching the table associated with directive_type for that cleaned line.

If no argument matching arg exists in in the lookup table for directive_type then the new canonical_string_h is added to the table.

The occurrence of the arg is reported on stdout if the same argument has not already been recorded for directive_type or if --once is not in effect.

Definition at line 179 of file directives_tally.c.

References directive_text_add(), directive_text_lookup(), GET_PUBLIC, and report_directive().

Referenced by eval_free_form_directive(), eval_hash_define(), and eval_hash_undef().

Here is the call graph for this function:

char const* get_directive_keyword ( directive_type_t  directive_type)

Get the preprocessor keyword associated with a given directive type.

Parameters:
directive_typeType of directive for which the keyword is required.
Returns:
Pointer to the keyword for this directive type.

Definition at line 167 of file directives_tally.c.

References directives_dict, HASH_UNKNOWN, directive::keyword, and directive::type.

Referenced by report_directive().

directive_type_t get_directive_type ( char const **  keyword)

Determine the type of a putative directive.

Parameters:
keywordOn entry, a pointer to the address of the putative directve. On return, stores the address of the character just passed the matched directive, if any is matched; otherwise unchanged.
Returns:
A directive_type_t indicating the type of the directive, or HASH_UNKOWN if no legal directive is unambigously identified.

Definition at line 155 of file directives_tally.c.

References directives_dict, HASH_UNKNOWN, directive::keyword, match_keyword(), and directive::type.

Referenced by eval_line().

Here is the call graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines