<!DOCTYPE LINUXDOC SYSTEM>

<!-- This SGML file generated by cxref. -->
<!-- cxref program (c) Andrew M. Bishop 1995,96,97,98. -->

<article>

<title>Cross reference for comment.c of cxref.
<author>cxref

<sect>File comment.c
<bf>RCS Header: /home/amb/cxref/RCS/comment.c 1.20 1998/12/22 14:26:26 amb Exp </bf>
<p>

  C Cross Referencing &amp; Documentation tool. Version 1.5.
<newline>
  Collects the comments from the parser.
<p>

<sect1>Included Files

<p>
<itemize>
<item><tt>#include &lt;stdlib.h&gt;</tt>
</itemize>
<itemize>
<item><tt>#include &lt;stdio.h&gt;</tt>
</itemize>
<itemize>
<item><tt>#include &lt;string.h&gt;</tt>
</itemize>
<itemize>
<item><tt>#include &quot;memory.h&quot;</tt>
</itemize>
<itemize>
<item><tt>#include &quot;datatype.h&quot;</tt>
</itemize>
<itemize>
<item><tt>#include &quot;cxref.h&quot;</tt>
<itemize>
<item><tt>#include &quot;datatype.h&quot;</tt>
</itemize>
</itemize>

<sect1>Preprocessor definitions

<p>
 Turn on the debugging in this file. 
<p>
<tt>#define DEBUG 0</tt><newline>

<sect1>External Variables

<p>
<bf>option_verbatim_comments</bf><newline>
 The option to insert the comments verbatim into the output. 
<p>
<tt>extern int option_verbatim_comments</tt><newline>
<descrip>
<tag>Defined in:</tag>
<itemize>
<item>option_verbatim_comments</itemize>
</descrip>
<p>
<bf>CurFile</bf><newline>
 The file that is currently being processed. 
<p>
<tt>extern File CurFile</tt><newline>
<descrip>
<tag>Defined in:</tag>
<itemize>
<item>CurFile</itemize>
</descrip>
<p>
<bf>parse_file</bf><newline>
 The name of the current file. 
<p>
<tt>extern char* parse_file</tt><newline>
<descrip>
<tag>Defined in:</tag>
<itemize>
<item>parse_file</itemize>
</descrip>

<sect1>Local Variables

<p>
<bf>current_comment</bf><newline>
 The current (latest) comment. 
<p>
<tt>static char* current_comment</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>DeleteComment()
<item>GetCurrentComment()
<item>SeenComment()
<item>SetCurrentComment()
</itemize>
</descrip>
<p>
<bf>malloc_comment</bf><newline>
 The malloced string for the current comment. 
<p>
<tt>static char* malloc_comment</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>DeleteComment()
<item>SeenComment()
<item>SetCurrentComment()
</itemize>
</descrip>
<p>
<bf>comment_ended</bf><newline>
 The status of the current comment. 
<p>
<tt>static int comment_ended</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>DeleteComment()
<item>SeenComment()
</itemize>
</descrip>

<sect1>Global Function DeleteComment()

<p>  Delete the malloced string for the comment
<p>
<tt>void DeleteComment ( void )</tt><newline>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>SafeFree()  :  memory.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>main()  :  cxref.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>comment_ended  :  comment.c
<item>current_comment  :  comment.c
<item>malloc_comment  :  comment.c
</itemize>
</descrip>

<sect1>Global Function GetCurrentComment()

<p>  Provide the current (latest) comment.
<p>
<tt>char* GetCurrentComment ( void )</tt><newline>
<descrip>
<tag><tt>char* GetCurrentComment</tt></tag>
Returns the current (latest) comment.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Called by:</tag>
<itemize>
<item>SeenDefine()  :  preproc.c
<item>SeenDefineComment()  :  preproc.c
<item>SeenDefineFuncArgComment()  :  preproc.c
<item>SeenFunctionArg()  :  func.c
<item>SeenFunctionDeclaration()  :  func.c
<item>SeenFunctionDefinition()  :  func.c
<item>SeenInclude()  :  preproc.c
<item>SeenIncludeComment()  :  preproc.c
<item>SeenStructUnionComp()  :  type.c
<item>SeenStructUnionStart()  :  type.c
<item>SeenTypedef()  :  type.c
<item>SeenVariableDefinition()  :  var.c
<item>yylex()  :  parse-lex.c
<item>yyparse()  :  parse-yacc.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>current_comment  :  comment.c
</itemize>
</descrip>

<sect1>Global Function SeenComment()

<p>  Function that is called when a comment or part of one is seen. The comment is built up until an end of comment is signaled.
<p>
<tt>void SeenComment ( char* c )</tt><newline>
<descrip>
<tag><tt>char* c</tt></tag>
The comment text. If c==0 then it is a file (/ * * comment * * /) comment
                            if c==1 then it is the other special comment (/ * + comment + * /).
                            if c==2 then it is a normal comment (/ * comment * /).
                            if c==3 then it is not a comment.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>SafeMalloc()  :  memory.c
<item>SafeRealloc()  :  memory.c
<item>SeenFileComment()  :  file.c
<item>SeenFuncIntComment()  :  func.c
<item>TidyCommentString()  :  comment.c
<item>strcat(), strcmp(), strcpy(), strlen()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>yylex()  :  parse-lex.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>CurFile  :  cxref.c
<item>comment_ended  :  comment.c
<item>current_comment  :  comment.c
<item>malloc_comment  :  comment.c
<item>option_verbatim_comments  :  cxref.c
<item>parse_file  :  parse-lex.c
</itemize>
</descrip>

<sect1>Global Function SetCurrentComment()

<p>  Set the current (latest) comment.
<p>
<tt>void SetCurrentComment ( char* comment )</tt><newline>
<descrip>
<tag><tt>char* comment</tt></tag>
The comment.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>SafeRealloc()  :  memory.c
<item>strcpy(), strlen()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>SeenFileChange()  :  preproc.c
<item>yyparse()  :  parse-yacc.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>current_comment  :  comment.c
<item>malloc_comment  :  comment.c
</itemize>
</descrip>

<sect1>Global Function SplitComment()

<p>  A function to split out the arguments etc from a comment,
  for example the function argument comments are separated using this.
<p>
<tt>char* SplitComment ( char** original, char* name )</tt><newline>
<descrip>
<tag><tt>char* SplitComment</tt></tag>
Returns the required comment.
<tag><tt>char** original</tt></tag>
A pointer to the original comment, this is altered in the process.
<tag><tt>char* name</tt></tag>
The name that is to be cut out from the comment.
</descrip>
  A most clever function that ignores spaces so that 'char* b' and 'char *b' match.
<p>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>ConcatStrings()  :  memory.c
<item>CopyString()  :  memory.c
<item>SafeFree()  :  memory.c
<item>SafeMallocString()  :  memory.c
<item>TidyCommentString()  :  comment.c
<item>strlen(), strstr()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>SeenDefineFunctionArg()  :  preproc.c
<item>SeenFunctionArg()  :  func.c
<item>SeenFunctionDefinition()  :  func.c
</itemize>
</descrip>

<sect1>Local Function TidyCommentString()

<p>  Tidy up the current comment string by snipping off trailing and leading junk.
<p>
<tt>static void TidyCommentString ( char** string, int spaces )</tt><newline>
<descrip>
<tag><tt>char** string</tt></tag>
The string that is to be tidied.
<tag><tt>int spaces</tt></tag>
Indicates that leading and trailing whitespace are to be removed as well.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>comment.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>strlen()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>SeenComment()  :  comment.c
<item>SplitComment()  :  comment.c
</itemize>
</descrip>

</article>
