File html.c

RCS Header: /home/amb/cxref/RCS/html.c 1.40 2004/01/24 19:20:25 amb Exp

C Cross Referencing & Documentation tool. Version 1.5f.
Writes the HTML output.


Included Files


Preprocessor definitions

The file extension to use for the output files.

#define HTML_FILE ".html"

#define HTML_FILE_BACKUP ".html~"

The file extension to use for the output source files.

#define HTML_SRC_FILE ".src.html"

The name of the output tex file that contains the appendix.

#define HTML_APDX ".apdx"

A macro to determine the HTML version we should produce.

#define HTML20

#define HTML32

#define HTMLSRC


External Variables

option_verbatim_comments
The comments are to be inserted verbatim.

extern int option_verbatim_comments
Defined in: cxref.c

option_html
The type of HTML output to produce.

extern int option_html
Defined in: cxref.c

option_odir
The name of the directory for the output.

extern char* option_odir
Defined in: cxref.c

option_name
The base name of the file for the output.

extern char* option_name
Defined in: cxref.c

run_command
The information about the cxref run, the command line options.

extern char* run_command
Defined in: cxref.c

run_cpp_command
The information about the cxref run, the cpp command and options.

extern char* run_cpp_command
Defined in: cxref.c


Local Variables

goback
The directories to go back to get to the base output directory.

static char* goback
Used in: WriteHTMLDefine()
  WriteHTMLFile()
  WriteHTMLFilePart()
  WriteHTMLFunction()
  WriteHTMLInclude()
  WriteHTMLSubInclude()
  WriteHTMLTypedef()
  WriteHTMLVariable()

of
The output file for the HTML.

static FILE* of
Used in: WriteHTMLAppendix()
  WriteHTMLDefine()
  WriteHTMLFile()
  WriteHTMLFilePart()
  WriteHTMLFunction()
  WriteHTMLInclude()
  WriteHTMLStructUnion()
  WriteHTMLSubInclude()
  WriteHTMLTypedef()
  WriteHTMLVariable()

filename
The name of the file.

static char* filename
Used in: WriteHTMLAppendix()
  WriteHTMLDefine()
  WriteHTMLFile()
  WriteHTMLFunction()
  WriteHTMLPreamble()
  WriteHTMLTypedef()
  WriteHTMLVariable()


Global Function WriteHTMLAppendix()

Write out the appendix information.

void WriteHTMLAppendix ( StringList files, StringList2 funcs, StringList2 vars, StringList2 types )

StringList files
The list of files to write.
StringList2 funcs
The list of functions to write.
StringList2 vars
The list of variables to write.
StringList2 types
The list of types to write.
Prototyped in: cxref.h
Calls: ConcatStrings()memory.c
  WriteHTMLDocument()html.c
  WriteHTMLPostamble()html.c
  WriteHTMLPreamble()html.c
  html()html.c
  exit(), fclose(), fopen(), fprintf(), strncmp()
Called by: main()cxref.c
References Variables: filenamehtml.c
  ofhtml.c
  option_namecxref.c
  option_odircxref.c

Global Function WriteHTMLFile()

Write an html file for a complete File structure and all components.

void WriteHTMLFile ( File file )

File file
The File structure to output.
The file structure is broken into its components and they are each written out.

Prototyped in: cxref.h
Calls: ConcatStrings()memory.c
  WriteHTMLDefine()html.c
  WriteHTMLDocument()html.c
  WriteHTMLFilePart()html.c
  WriteHTMLFunction()html.c
  WriteHTMLInclude()html.c
  WriteHTMLPostamble()html.c
  WriteHTMLPreamble()html.c
  WriteHTMLSource()html.c
  WriteHTMLTypedef()html.c
  WriteHTMLVariable()html.c
  html()html.c
  exit(), fclose(), fopen(), fprintf(), mkdir(), stat(), strlen()
Called by: main()cxref.c
References Variables: filenamehtml.c
  gobackhtml.c
  ofhtml.c
  option_htmlcxref.c
  option_namecxref.c
  option_odircxref.c


Global Function WriteHTMLFileDelete()

Delete the HTML file and main file reference that belong to the named file.

void WriteHTMLFileDelete ( char* name )

char* name
The name of the file to delete.
Prototyped in: cxref.h
Calls: ConcatStrings()memory.c
  fclose(), fgets(), fopen(), fprintf(), fputs(), rename(), strcmp(), strlen(), strncmp(), unlink()
Called by: main()cxref.c
References Variables: option_namecxref.c
  option_odircxref.c

Global Function WriteHTMLSource()

Write out the source file.

void WriteHTMLSource ( char* name )

char* name
The name of the source file.
Prototyped in: html.c
Calls: ConcatStrings()memory.c
  WriteHTMLPostamble()html.c
  WriteHTMLPreamble()html.c
  html()html.c
  exit(), fclose(), fgets(), fopen(), fprintf(), fputs(), strcpy()
Called by: WriteHTMLFile()html.c
References Variables: option_odircxref.c

Local Function WriteHTMLDefine()

Write a Define structure out.

static void WriteHTMLDefine ( Define def )

Define def
The Define structure to output.
Prototyped in: html.c
Calls: html()html.c
  fprintf()
Called by: WriteHTMLFile()html.c
References Variables: filenamehtml.c
  gobackhtml.c
  ofhtml.c
  option_htmlcxref.c

Local Function WriteHTMLDocument()

Write out a file that will include the current information.

static void WriteHTMLDocument ( char* name, int appendix )

char* name
The name of the file.
int appendix
set to non-zero if the appendix file is to be added, else a normal source file.
Prototyped in: html.c
Calls: ConcatStrings()memory.c
  WriteHTMLPostamble()html.c
  WriteHTMLPreamble()html.c
  exit(), fclose(), fgets(), fopen(), fprintf(), fputs(), rename(), strcmp(), strlen(), strncmp(), unlink()
Called by: WriteHTMLAppendix()html.c
  WriteHTMLFile()html.c
References Variables: option_namecxref.c
  option_odircxref.c

Local Function WriteHTMLFilePart()

Write a File structure out.

static void WriteHTMLFilePart ( File file )

File file
The File to output.
Prototyped in: html.c
Calls: html()html.c
  fprintf(), strstr()
Called by: WriteHTMLFile()html.c
References Variables: gobackhtml.c
  ofhtml.c
  option_htmlcxref.c
  option_verbatim_commentscxref.c

Local Function WriteHTMLFunction()

Write a Function structure out.

static void WriteHTMLFunction ( Function func )

Function func
The Function structure to output.
Prototyped in: html.c
Calls: html()html.c
  fprintf(), strcmp(), strncmp(), strstr()
Called by: WriteHTMLFile()html.c
References Variables: filenamehtml.c
  gobackhtml.c
  ofhtml.c
  option_htmlcxref.c
  option_verbatim_commentscxref.c

Local Function WriteHTMLInclude()

Write an Include structure out.

static void WriteHTMLInclude ( Include inc )

Include inc
The Include structure to output.
Prototyped in: html.c
Calls: WriteHTMLSubInclude()html.c
  html()html.c
  fprintf()
Called by: WriteHTMLFile()html.c
References Variables: gobackhtml.c
  ofhtml.c

Local Function WriteHTMLPostamble()

Write out a standard post-amble. This includes the end of document marker.

static void WriteHTMLPostamble ( FILE* f, int sourcefile )

FILE* f
The file to write the post amble to.
int sourcefile
True if the Source-Files line is to be included.
Prototyped in: html.c
Calls: fputs()
Called by: WriteHTMLAppendix()html.c
  WriteHTMLDocument()html.c
  WriteHTMLFile()html.c
  WriteHTMLSource()html.c

Local Function WriteHTMLPreamble()

Write out a standard pre-amble.

static void WriteHTMLPreamble ( FILE* f, char* title, int sourcefile )

FILE* f
The file to write the pre amble to.
char* title
The title of the file.
int sourcefile
True if the Source-Files line is to be included.
Prototyped in: html.c
Calls: fprintf(), fputs()
Called by: WriteHTMLAppendix()html.c
  WriteHTMLDocument()html.c
  WriteHTMLFile()html.c
  WriteHTMLSource()html.c
References Variables: filenamehtml.c
  option_htmlcxref.c
  run_commandcxref.c
  run_cpp_commandcxref.c

Local Function WriteHTMLStructUnion()

Write a structure / union structure out.

static void WriteHTMLStructUnion ( StructUnion su, int depth )

StructUnion su
The structure / union to write.
int depth
The current depth within the structure.
Prototyped in: html.c
Calls: WriteHTMLStructUnion()html.c
  html()html.c
  fprintf(), strstr()
Called by: WriteHTMLStructUnion()html.c
  WriteHTMLTypedef()html.c
References Variables: ofhtml.c
  option_htmlcxref.c

Local Function WriteHTMLSubInclude()

Write an Sub Include structure out. (An include structure that is included from another file.)

static void WriteHTMLSubInclude ( Include inc, int depth )

Include inc
The Include structure to output.
int depth
The depth of the include hierarchy.
Prototyped in: html.c
Calls: WriteHTMLSubInclude()html.c
  html()html.c
  fprintf()
Called by: WriteHTMLInclude()html.c
  WriteHTMLSubInclude()html.c
References Variables: gobackhtml.c
  ofhtml.c

Local Function WriteHTMLTypedef()

Write a Typedef structure out.

static void WriteHTMLTypedef ( Typedef type )

Typedef type
The Typedef structure to output.
Prototyped in: html.c
Calls: WriteHTMLStructUnion()html.c
  html()html.c
  fprintf(), strncmp()
Called by: WriteHTMLFile()html.c
References Variables: filenamehtml.c
  gobackhtml.c
  ofhtml.c
  option_htmlcxref.c

Local Function WriteHTMLVariable()

Write a Variable structure out.

static void WriteHTMLVariable ( Variable var )

Variable var
The Variable structure to output.
Prototyped in: html.c
Calls: html()html.c
  fprintf()
Called by: WriteHTMLFile()html.c
References Variables: filenamehtml.c
  gobackhtml.c
  ofhtml.c
  option_htmlcxref.c

Local Function html()

Make the input string safe to output as HTML ( not <, >, & or " ).

static char* html ( char* c, int verbatim )

char* html
Returns a safe HTML string.
char* c
A non-safe HTML string.
int verbatim
Set to true if the text is to be output verbatim ignoring the comment +html+ directives.
The function can only be called four times in each fprintf() since it returns one of only four static strings.

Prototyped in: html.c
Calls: CopyOrSkip()warn-raw.c
  SafeFree()memory.c
  SafeMalloc()memory.c
  SafeRealloc()memory.c
  strcpy(), strncpy()
Called by: WriteHTMLAppendix()html.c
  WriteHTMLDefine()html.c
  WriteHTMLFile()html.c
  WriteHTMLFilePart()html.c
  WriteHTMLFunction()html.c
  WriteHTMLInclude()html.c
  WriteHTMLSource()html.c
  WriteHTMLStructUnion()html.c
  WriteHTMLSubInclude()html.c
  WriteHTMLTypedef()html.c
  WriteHTMLVariable()html.c