File rtf.c

RCS Header: /home/amb/cxref/RCS/rtf.c 1.3 1999/01/11 19:34:07 amb Exp

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


Included Files


Preprocessor definitions

The name of the output rtf file.

#define RTF_FILE ".rtf"

#define RTF_FILE_BACKUP ".rtf~"

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

#define RTF_APDX ".apdx"

#define STYLE_NORM "\\s0\\f0\\fs24"

#define STYLE_H1 "\\s1\\f0\\fs40\\b\\sb400\\sa200\\keepn\\keep"

#define STYLE_H2 "\\s2\\f0\\fs32\\b\\sb200\\sa100\\keepn\\keep"

#define STYLE_H3 "\\s3\\f0\\fs28\\b\\sb100\\sa100\\keepn\\keep"

#define STYLE_H4 "\\s4\\f0\\fs24\\b\\sb100\\sa50\\keepn\\keep"

#define STYLE_TT "\\s5\\f1\\fs20\\ql\\sb50\\sa50"

#define STYLE_IND "\\s6\\f0\\fs24\\ql\\li720"


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


Local Variables

of
The output file for the RTF.

static FILE* of
Used in: WriteRTFAppendix()
  WriteRTFDefine()
  WriteRTFFile()
  WriteRTFFilePart()
  WriteRTFFunction()
  WriteRTFInclude()
  WriteRTFStructUnion()
  WriteRTFSubInclude()
  WriteRTFTypedef()
  WriteRTFVariable()


Global Function WriteRTFAppendix()

Write out the appendix information.

void WriteRTFAppendix ( 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
  WriteRTFPostamble()rtf.c
  WriteRTFPreamble()rtf.c
  rtf()rtf.c
  exit(), fclose(), fopen(), fprintf(), strncmp()
Called by: main()cxref.c
References Variables: ofrtf.c
  option_namecxref.c
  option_odircxref.c

Global Function WriteRTFFile()

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

void WriteRTFFile ( 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
  WriteRTFDefine()rtf.c
  WriteRTFFilePart()rtf.c
  WriteRTFFunction()rtf.c
  WriteRTFInclude()rtf.c
  WriteRTFPostamble()rtf.c
  WriteRTFPreamble()rtf.c
  WriteRTFTypedef()rtf.c
  WriteRTFVariable()rtf.c
  rtf()rtf.c
  exit(), fclose(), fopen(), fprintf(), mkdir(), stat(), strlen()
Called by: main()cxref.c
References Variables: ofrtf.c
  option_odircxref.c


Global Function WriteRTFFileDelete()

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

void WriteRTFFileDelete ( 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_odircxref.c

Local Function WriteRTFDefine()

Write a Define structure out.

static void WriteRTFDefine ( Define def )

Define def
The Define structure to output.
Prototyped in: rtf.c
Calls: rtf()rtf.c
  fprintf()
Called by: WriteRTFFile()rtf.c
References Variables: ofrtf.c

Local Function WriteRTFFilePart()

Write a File structure out.

static void WriteRTFFilePart ( File file )

File file
The File to output.
Prototyped in: rtf.c
Calls: rtf()rtf.c
  fprintf(), strstr()
Called by: WriteRTFFile()rtf.c
References Variables: ofrtf.c
  option_verbatim_commentscxref.c

Local Function WriteRTFFunction()

Write a Function structure out.

static void WriteRTFFunction ( Function func, char* filename )

Function func
The Function structure to output.
char* filename
The name of the file that is being processed (required for the cross reference label).
Prototyped in: rtf.c
Calls: rtf()rtf.c
  fprintf(), strcmp(), strncmp(), strstr()
Called by: WriteRTFFile()rtf.c
References Variables: ofrtf.c
  option_verbatim_commentscxref.c

Local Function WriteRTFInclude()

Write an Include structure out.

static void WriteRTFInclude ( Include inc )

Include inc
The Include structure to output.
Prototyped in: rtf.c
Calls: WriteRTFSubInclude()rtf.c
  rtf()rtf.c
  fprintf()
Called by: WriteRTFFile()rtf.c
References Variables: ofrtf.c

Local Function WriteRTFPostamble()

Write out the tail of an RTF file.

static void WriteRTFPostamble ( FILE* f )

FILE* f
The file to write to.
Prototyped in: rtf.c
Calls: fputs()
Called by: WriteRTFAppendix()rtf.c
  WriteRTFFile()rtf.c

Local Function WriteRTFPreamble()

Write out the head of an RTF file.

static void WriteRTFPreamble ( FILE* f )

FILE* f
The file to write to.
Prototyped in: rtf.c
Calls: fputs(), strcmp()
Called by: WriteRTFAppendix()rtf.c
  WriteRTFFile()rtf.c

Local Function WriteRTFStructUnion()

Write a structure / union structure out.

static void WriteRTFStructUnion ( StructUnion su, int depth )

StructUnion su
The structure / union to write.
int depth
The current depth within the structure.
Prototyped in: rtf.c
Calls: WriteRTFStructUnion()rtf.c
  rtf()rtf.c
  fprintf(), strstr()
Called by: WriteRTFStructUnion()rtf.c
  WriteRTFTypedef()rtf.c
References Variables: ofrtf.c

Local Function WriteRTFSubInclude()

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

static void WriteRTFSubInclude ( Include inc, int depth )

Include inc
The Include structure to output.
int depth
The depth of the include hierarchy.
Prototyped in: rtf.c
Calls: WriteRTFSubInclude()rtf.c
  rtf()rtf.c
  fprintf()
Called by: WriteRTFInclude()rtf.c
  WriteRTFSubInclude()rtf.c
References Variables: ofrtf.c

Local Function WriteRTFTypedef()

Write a Typedef structure out.

static void WriteRTFTypedef ( Typedef type, char* filename )

Typedef type
The Typedef structure to output.
char* filename
The name of the file that is being processed (required for the cross reference label).
Prototyped in: rtf.c
Calls: WriteRTFStructUnion()rtf.c
  rtf()rtf.c
  fprintf(), strncmp()
Called by: WriteRTFFile()rtf.c
References Variables: ofrtf.c

Local Function WriteRTFVariable()

Write a Variable structure out.

static void WriteRTFVariable ( Variable var, char* filename )

Variable var
The Variable structure to output.
char* filename
The name of the file that is being processed (required for the cross reference label).
Prototyped in: rtf.c
Calls: rtf()rtf.c
  fprintf()
Called by: WriteRTFFile()rtf.c
References Variables: ofrtf.c

Local Function rtf()

Make the input string safe to output as RTF ( not \, { or } ).

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

char* rtf
Returns a safe RTF string.
char* c
A non-safe RTF 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: rtf.c
Calls: CopyOrSkip()warn-raw.c
  SafeFree()memory.c
  SafeMalloc()memory.c
  SafeRealloc()memory.c
  strncpy()
Called by: WriteRTFAppendix()rtf.c
  WriteRTFDefine()rtf.c
  WriteRTFFile()rtf.c
  WriteRTFFilePart()rtf.c
  WriteRTFFunction()rtf.c
  WriteRTFInclude()rtf.c
  WriteRTFStructUnion()rtf.c
  WriteRTFSubInclude()rtf.c
  WriteRTFTypedef()rtf.c
  WriteRTFVariable()rtf.c