File sgml.c

RCS Header: /home/amb/CVS/cxref/src/sgml.c,v 1.10 2004-06-26 18:50:36 amb Exp

C Cross Referencing & Documentation tool. Version 1.6.
Writes the SGML output.


Included Files


Preprocessor definitions

The name of the output tex file that includes each of the others.

#define SGML_FILE ".sgml"

#define SGML_FILE_BACKUP ".sgml~"

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

#define SGML_APDX ".apdx"


External Variables

option_verbatim_comments
The comments are to be inserted verbatim.

extern int option_verbatim_comments

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: WriteSGMLFile()  

of
The output file for the SGML.

static FILE* of

Used in: WriteSGMLAppendix()  
  WriteSGMLDefine()  
  WriteSGMLFile()  
  WriteSGMLFilePart()  
  WriteSGMLFunction()  
  WriteSGMLInclude()  
  WriteSGMLStructUnion()  
  WriteSGMLSubInclude()  
  WriteSGMLTypedef()  
  WriteSGMLVariable()  

filename
The name of the file.

static char* filename

Used in: WriteSGMLAppendix()  
  WriteSGMLFile()  
  WriteSGMLPreamble()  

Global Function WriteSGMLAppendix()

Write out the appendix information.

void WriteSGMLAppendix ( 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
  WriteSGMLPostamble() sgml.c
  WriteSGMLPreamble() sgml.c
  sgml() sgml.c
  exit(), fclose(), fopen(), fprintf(), strncmp()
Called by: main() cxref.c
References Variables: filename sgml.c
  of sgml.c
  option_name cxref.c
  option_odir cxref.c

Global Function WriteSGMLFile()

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

void WriteSGMLFile ( 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
  WriteSGMLDefine() sgml.c
  WriteSGMLFilePart() sgml.c
  WriteSGMLFunction() sgml.c
  WriteSGMLInclude() sgml.c
  WriteSGMLPostamble() sgml.c
  WriteSGMLPreamble() sgml.c
  WriteSGMLTypedef() sgml.c
  WriteSGMLVariable() sgml.c
  sgml() sgml.c
  exit(), fclose(), fopen(), fprintf(), mkdir(), stat(), strlen()
Called by: main() cxref.c
References Variables: filename sgml.c
  goback sgml.c
  of sgml.c
  option_name cxref.c
  option_odir cxref.c

Global Function WriteSGMLFileDelete()

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

void WriteSGMLFileDelete ( char* name )

char* name
The name of the file to delete.
Prototyped in: cxref.h
Calls: ConcatStrings() memory.c
  unlink()
Called by: main() cxref.c
References Variables: option_odir cxref.c

Local Function WriteSGMLDefine()

Write a Define structure out.

static void WriteSGMLDefine ( Define def )

Define def
The Define structure to output.
Prototyped in: sgml.c
Calls: sgml() sgml.c
  fprintf()
Called by: WriteSGMLFile() sgml.c
References Variables: of sgml.c

Local Function WriteSGMLFilePart()

Write a File structure out.

static void WriteSGMLFilePart ( File file )

File file
The File to output.
Prototyped in: sgml.c
Calls: sgml() sgml.c
  fprintf(), strstr()
Called by: WriteSGMLFile() sgml.c
References Variables: of sgml.c
  option_verbatim_comments cxref.c

Local Function WriteSGMLFunction()

Write a Function structure out.

static void WriteSGMLFunction ( Function func )

Function func
The Function structure to output.
Prototyped in: sgml.c
Calls: sgml() sgml.c
  fprintf(), strcmp(), strncmp(), strstr()
Called by: WriteSGMLFile() sgml.c
References Variables: of sgml.c
  option_verbatim_comments cxref.c

Local Function WriteSGMLInclude()

Write an Include structure out.

static void WriteSGMLInclude ( Include inc )

Include inc
The Include structure to output.
Prototyped in: sgml.c
Calls: WriteSGMLSubInclude() sgml.c
  sgml() sgml.c
  fprintf()
Called by: WriteSGMLFile() sgml.c
References Variables: of sgml.c

Local Function WriteSGMLPostamble()

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

static void WriteSGMLPostamble ( FILE* f )

FILE* f
The file to write the post amble to.
Prototyped in: sgml.c
Calls: fputs()
Called by: WriteSGMLAppendix() sgml.c
  WriteSGMLFile() sgml.c

Local Function WriteSGMLPreamble()

Write out a standard pre-amble.

static void WriteSGMLPreamble ( FILE* f, char* title )

FILE* f
The file to write the pre amble to.
char* title
The title of the file.
Prototyped in: sgml.c
Calls: fprintf(), fputs()
Called by: WriteSGMLAppendix() sgml.c
  WriteSGMLFile() sgml.c
References Variables: filename sgml.c
  run_command cxref.c
  run_cpp_command cxref.c

Local Function WriteSGMLStructUnion()

Write a structure / union structure out.

static void WriteSGMLStructUnion ( StructUnion su, int depth )

StructUnion su
The structure / union to write.
int depth
The current depth within the structure.
Prototyped in: sgml.c
Calls: WriteSGMLStructUnion() sgml.c
  sgml() sgml.c
  fprintf(), strstr()
Called by: WriteSGMLStructUnion() sgml.c
  WriteSGMLTypedef() sgml.c
References Variables: of sgml.c

Local Function WriteSGMLSubInclude()

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

static void WriteSGMLSubInclude ( Include inc, int depth )

Include inc
The Include structure to output.
int depth
The depth of the include hierarchy.
Prototyped in: sgml.c
Calls: WriteSGMLSubInclude() sgml.c
  sgml() sgml.c
  fprintf()
Called by: WriteSGMLInclude() sgml.c
  WriteSGMLSubInclude() sgml.c
References Variables: of sgml.c

Local Function WriteSGMLTypedef()

Write a Typedef structure out.

static void WriteSGMLTypedef ( Typedef type )

Typedef type
The Typedef structure to output.
Prototyped in: sgml.c
Calls: WriteSGMLStructUnion() sgml.c
  sgml() sgml.c
  fprintf(), strncmp()
Called by: WriteSGMLFile() sgml.c
References Variables: of sgml.c

Local Function WriteSGMLVariable()

Write a Variable structure out.

static void WriteSGMLVariable ( Variable var )

Variable var
The Variable structure to output.
Prototyped in: sgml.c
Calls: sgml() sgml.c
  fprintf()
Called by: WriteSGMLFile() sgml.c
References Variables: of sgml.c

Local Function sgml()

Make the input string safe to output as SGML ( not <, >, &, ", $, #, % or ~ ).

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

char* sgml
Returns a safe SGML string.
char* c
A non-safe SGML string.
int verbatim
Set to true inside a verbatim environment.
The function can only be called four times in each fprintf() since it returns one of only four static strings.

Prototyped in: sgml.c
Calls: CopyOrSkip() warn-raw.c
  SafeFree() memory.c
  SafeMalloc() memory.c
  SafeRealloc() memory.c
  strcpy(), strncpy()
Called by: WriteSGMLAppendix() sgml.c
  WriteSGMLDefine() sgml.c
  WriteSGMLFile() sgml.c
  WriteSGMLFilePart() sgml.c
  WriteSGMLFunction() sgml.c
  WriteSGMLInclude() sgml.c
  WriteSGMLStructUnion() sgml.c
  WriteSGMLSubInclude() sgml.c
  WriteSGMLTypedef() sgml.c
  WriteSGMLVariable() sgml.c