File preproc.c

RCS Header: /home/amb/cxref/src/RCS/preproc.c 1.22 2004/01/18 11:38:35 amb Exp

C Cross Referencing & Documentation tool. Version 1.5f.
Collects the pre-processing instruction stuff.


Included Files


Preprocessor definitions

Control the output of debugging information for this file.

#define DEBUG 0


Global Variable in_header

When in a header file, this is set to 1, to allow most of the stuff to be skipped.

int in_header

Visible in:   func.c
    parse-lex.c
    parse-yacc.c
    preproc.c
    var.c
Used in: ResetPreProcAnalyser() preproc.c
  SeenFileChange() preproc.c
  SeenFunctionDeclaration() func.c
  SeenVariableDefinition() var.c
  yylex() parse-lex.c
  yyparse() parse-yacc.c

External Variables

CurFile
The file that is currently being processed.

extern File CurFile

Defined in: cxref.c

option_incdirs
The name of the include directories specified on the command line.

extern char** option_incdirs

Defined in: cxref.c

option_nincdirs
The number of include directories on the command line.

extern int option_nincdirs

Defined in: cxref.c

Local Variables

cur_inc
The current #include we are looking at.

static Include cur_inc

Used in: ResetPreProcAnalyser()  
  SeenFileChange()  
  SeenInclude()  
  SeenIncludeComment()  

cur_def
The current #define we are looking at.

static Define cur_def

Used in: ResetPreProcAnalyser()  
  SeenDefine()  
  SeenDefineComment()  
  SeenDefineFuncArgComment()  
  SeenDefineFunctionArg()  
  SeenDefineValue()  

inc_depth
The depth of includes.

static int inc_depth

Used in: ResetPreProcAnalyser()  
  SeenFileChange()  
  SeenInclude()  

inc_type
The type of include at this depth.

static char* inc_type

Used in: ResetPreProcAnalyser()  
  SeenFileChange()  
  SeenInclude()  

inc_name
The name of the include file at this depth.

static char** inc_name

Used in: ResetPreProcAnalyser()  
  SeenFileChange()  

cwd
The working directory.

static char* cwd

Used in: ResetPreProcAnalyser()  
  SeenFileChange()  

Global Function DeleteDefineType()

Delete the specified Define type.

void DeleteDefineType ( Define def )

Define def
The Define type to be deleted.
Prototyped in: cxref.h
Calls: DeleteStringList2() slist.c
  SafeFree() memory.c
Called by: DeleteFile() file.c

Global Function DeleteIncludeType()

Delete the specified Include type.

void DeleteIncludeType ( Include inc )

Include inc
The Include type to be deleted.
Prototyped in: cxref.h
Calls: DeleteIncludeType() preproc.c
  SafeFree() memory.c
Called by: DeleteFile() file.c
  DeleteIncludeType() preproc.c

Global Function ResetPreProcAnalyser()

Tidy up all of the local variables in case of a problem and abnormal parser termination.

void ResetPreProcAnalyser ( void )

Prototyped in: cxref.h
Calls: SafeFree() memory.c
Called by: main() cxref.c
References Variables: cur_def preproc.c
  cur_inc preproc.c
  cwd preproc.c
  in_header preproc.c
  inc_depth preproc.c
  inc_name preproc.c
  inc_type preproc.c

Global Function SeenDefine()

Function that is called when a #define is seen in the current file.

void SeenDefine ( char* name )

char* name
The name of the #defined symbol.
Prototyped in: cxref.h
Calls: GetCurrentComment() comment.c
  NewDefineType() preproc.c
  SafeMallocString() memory.c
Called by: yylex() parse-lex.c
References Variables: CurFile cxref.c
  cur_def preproc.c
  parse_line parse-lex.c

Global Function SeenDefineComment()

Function that is called when a comment is seen in a #define definition.

void SeenDefineComment ( void )

Prototyped in: cxref.h
Calls: GetCurrentComment() comment.c
  SafeMallocString() memory.c
Called by: yylex() parse-lex.c
References Variables: cur_def preproc.c

Global Function SeenDefineFuncArgComment()

Function that is called when a comment is seen in a #define function definition.

void SeenDefineFuncArgComment ( void )

Prototyped in: cxref.h
Calls: GetCurrentComment() comment.c
  SafeMallocString() memory.c
Called by: yylex() parse-lex.c
References Variables: cur_def preproc.c

Global Function SeenDefineFunctionArg()

Function that is called when a #define function argument is seen in the current definition.

void SeenDefineFunctionArg ( char* name )

char* name
The argument.
Prototyped in: cxref.h
Calls: AddToStringList2() slist.c
  SplitComment() comment.c
Called by: yylex() parse-lex.c
References Variables: cur_def preproc.c

Global Function SeenDefineValue()

Function that is called when a #define value is seen in the current file.

void SeenDefineValue ( char* value )

char* value
The value of the #defined symbol.
Prototyped in: cxref.h
Calls: SafeMallocString() memory.c
Called by: yylex() parse-lex.c
References Variables: cur_def preproc.c

Global Function SeenFileChange()

Function that is called when a change in current file is seen.

char* SeenFileChange ( char* name, int flag )

char* SeenFileChange
Returns the filename that we are now in.
char* name
The pathname of the included file as determined by gcc.
int flag
The flags that GCC leaves in the file
Prototyped in: cxref.h
Calls: CanonicaliseName() cxref.c
  ConcatStrings() memory.c
  CopyString() memory.c
  SafeFree() memory.c
  SafeMalloc() memory.c
  SafeMallocString() memory.c
  SafeRealloc() memory.c
  SeenInclude() preproc.c
  SetCurrentComment() comment.c
  getcwd(), strcmp(), strlen(), strncmp()
Called by: yylex() parse-lex.c
References Variables: CurFile cxref.c
  cur_inc preproc.c
  cwd preproc.c
  in_header preproc.c
  inc_depth preproc.c
  inc_name preproc.c
  inc_type preproc.c

Global Function SeenInclude()

Function that is called when an included file is seen in the current file.

void SeenInclude ( char* name )

char* name
The name of the file from the source code.
Prototyped in: cxref.h
Calls: CanonicaliseName() cxref.c
  ConcatStrings() memory.c
  GetCurrentComment() comment.c
  NewIncludeType() preproc.c
  SafeMallocString() memory.c
  lstat(), strlen()
Called by: SeenFileChange() preproc.c
  yylex() parse-lex.c
References Variables: CurFile cxref.c
  cur_inc preproc.c
  inc_depth preproc.c
  inc_type preproc.c
  option_incdirs cxref.c
  option_nincdirs cxref.c

Global Function SeenIncludeComment()

Function that is called when a comment is seen following a #include.

void SeenIncludeComment ( void )

Prototyped in: cxref.h
Calls: GetCurrentComment() comment.c
  SafeMallocString() memory.c
Called by: yylex() parse-lex.c
References Variables: cur_inc preproc.c

Local Function NewDefineType()

Create a new Define datatype.

static Define NewDefineType ( char* name )

Define NewDefineType
Return the new Define type.
char* name
The name of the new define.
Prototyped in: preproc.c
Calls: NewStringList2() slist.c
  SafeCalloc() memory.c
  SafeMallocString() memory.c
Called by: SeenDefine() preproc.c

Local Function NewIncludeType()

Create a new Include datatype.

static Include NewIncludeType ( char* name )

Include NewIncludeType
Return the new Include type.
char* name
The name of the new include.
Prototyped in: preproc.c
Calls: SafeCalloc() memory.c
  SafeMallocString() memory.c
Called by: SeenInclude() preproc.c