Table of Contents
FUNCTION.
ROBODoc is intended to be a replacement for the original AutoDocs program. ROBODoc will extract the comment headers from a source file, and put them into a separate documentation file. General Flow
Sourcecode ---> [ROBODoc] ---> Document.
The whole ROBODoc process consists of three steps: scanning, analysing, generating.
Scanning
ROBODoc scans the source directory tree. This collects the names of all the source files.
Analysing
ROBODOc analyses all the sourcefiles. This reads the content of all source files and collects all the headers.
Generating
In this step the headers are written to one or more documentation files. In addition
The data collected during scanning and analysing is stored in a number of structures.
RB_Directory, it stores the names of the sourcefiles and directories in the source direcory tree. File names are stored in a RB_Filename structure, directory names in a RB_Path structure. Each RB_Filename contains a pointer (path) to a RB_Path structure that tells in which directory a file is located. Each RB_Path has a pointer (parent) to another RB_Path structure that tells in which directory is a directory located (of which directory it is a subdirectory). The only exception is the root directory.
Besides the name of the sourcefile, the RB_Filename also stores the name of the documentation file.
For each sourcefile there is an RB_Part structure. It contains a pointer (filename) to the RB_Filename and a list (headers) of RB_Header structure containing the headers found in the sourcefile.
Every RB_Header structure contains a pointer (owner) to the RB_Part structure to which it belongs. Headers can form a hierarchy that is used to create sections and subsections in the documentation. To store this hierarchy every RB_header structure contains a pointer (parent) to its parent header. For instance, given the following two headers, SubModule is the parent of SubSubModule.
****h* TopModule/SubModule * ****
****h* SubModule/SubSubModule * ****
In the documentation this creates the sections
1.TopModule 1.1 SubModule 1.1.1 SubSubModule
The RB_Directory and the linked list of RB_Part structures are stored in a RB_Document structure.
During the generation of the documentation ROBODoc tries to create cross links between the mention of a header's name (an object) and the documentation generated from that header (the documentation for the object).
To aid this proces there is an array of RB_link structures. This array is sorted for quick searching. RB_link structures the name of a header and the name of the label under which the documentation can be found in the documentation file.
COPYRIGHT.
Copyright (C) 1994-2006 Frans Slothouber, Petteri Kettunen, and Jacco van Weert.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
AUTHOR.
See AUTHORS in the archive.
CREATION DATE.
20-Dec-94 Jacco van Weert.
MODIFICATION HISTORY.
See ChangeLog in the archive. Latest version can be found on:
http://www.xs4all.nl/~rfsber/Robo/
BUGS.
Other bugs? Catch them in a jar and send them to rfsber -(at)- xs4all.nl
NAME.
Analyser -- Functions to scan source and collect headers
FUNCTION.
This module provides the functions to scan a sourcefile and collect all the headers.
FUNCTION.
Try to determine the formatting of an item. An empty line generates a new paragraph Things that are indented more that the rest of the text are preformatted. Things that start with a '*' or '-' create list items unless they are indented more that the rest of the text. SYNPOPSIS
INPUTS.
arg_item -- the item to be analysed.
FUNCTION.
Parse the item text to see if there are any lists. A list is either case I:
ITEMNAME o bla bla o bla bla
or case II:
some text: <-- begin of a list o bla bla <-- list item bla bla bla <-- continuation of list item. o bla bla <-- list item <-- end of a list bla bla <-- this can also be the end of a list.
SYNPOPSIS
INPUTS.
arg_item -- the item to be parsed.
indent -- the indent of this item.
OUTPUT.
arg_item -- the itemlines will contain formatting information for all the lists that were found.
FUNCTION.
Analyse... (TODO) SYNPOPSIS
INPUTS.
arg_item -- the item to be analysed.
start_index --
arg_index --
FUNCTION.
Analyse preformatted text ... (TODO) SYNPOPSIS
INPUTS.
arg_item -- the item to be analysed.
indent --
FUNCTION.
Determine the type of the header.
INPUTS.
cur_char -- pointer to the header type character
OUTPUT.
is_internal -- indicates if it is an internal header or not.*
cur_char -- points to the header type character
RESULT.
pointer to a RB_HeaderType
INPUTS.
arg_header -- the header to be checked.
first -- the line on which the first item was found
RESULT.
A warning is given if the condition occured.
FUNCTION.
Scan and store all lines from a source file until an end marker is found.
INPUTS.
document -- a pointer to an opened source file.
OUTPUT.
new_header -- the lines of source code will be added here.
RESULT.
TRUE -- an end marker was found.
FALSE -- no end marker was found while scanning the source file.
FUNCTION.
A header name is consists of two parts. The module name and the function name. This returns a pointer to the function name. The name "function name" is a bit obsolete. It is really the name of any of objects that can be documented; classes, methods, variables, functions, projects, etc.
FUNCTION.
Grab a header from a source file, that is scan a source file until the start of a header is found. Then search for the end of a header and store all the lines in between. SYNPOPSIS
INPUTS.
sourcehandle -- an opened source file.
OUTPUT.
sourcehandle -- will point to the line following the end marker.
RESULT.
0 if no header was found, or a pointer to a new header otherwise.
FUNCTION.
Check if line is empty. This assumes that Copy_Lines_To_Item has been run on the item.
INPUTS.
line -- the string to be analysed.
FUNCTION.
Is it like the second line in something like:
* this is a list item that continues
SYNPOPSIS
INPUTS.
arg_line -- the current line
indent -- the indent of the current item.
RESULT.
TRUE -- it is.
FALSE -- it is not.
FUNCTION.
Test if a line starts with something that indicates a list item. List items start with '*', '-', or 'o'. SYNPOPSIS
INPUTS.
line -- the line
RESULT.
TRUE -- it did start with one of those characters
FALSE -- it did not.
NAME.
Is_Pipe_Marker
FUNCTION.
Check for "pipe" markers e.g. "|html ".
RESULT.
Pointer to the data to be piped to document or in case no pointers are found.
SEE ALSO.
RB_Check_Pipe
FUNCTION.
Get the module name from the header name. The header name will be something like
module/functionname.
SYNPOPSIS
INPUTS.
header_name -- a pointer to a nul terminated string.
RESULT.
Pointer to the modulename. You're responsible for freeing it.
SEE ALSO.
FUNCTION.
Process... (TODO) SYNPOPSIS
INPUTS.
arg_item -- the item to be pre-formatted.
source -- is it a source item ?
FUNCTION.
Scan all the sourcefiles of all parts of a document for headers. Store these headers in each part (RB_Part).
INPUTS.
document -- document to be analysed.
RESULT.
Each part will contain the headers that were found in the sourcefile of the part.
NAME.
RB_Find_Marker -- Search for header marker in document.
FUNCTION.
Read document file line by line, and search each line for any of the headers defined in the array header_markers (OR if using the -rh switch, robo_head)
INPUTS.
document - pointer to the file to be searched. the gobal buffer line_buffer.
OUTPUT.
document will point to the line after the line with the header marker.
is_internal will be TRUE if the header is an internal header.
RESULT.
header type
BUGS.
Bad use of feof(), fgets().
SEE ALSO.
NAME.
RB_Warning_Full
FUNCTION.
Print warning to stdout.
INPUTS.
arg_filename --
arg_line_number --
arg_format --
...
NAME.
ASCII_Generator -- Generator for ASCII output
FUNCTION.
Plain ascii output, no formatting.
MODIFICATION HISTORY.
2003-06-17 Frans Slothouber V1.0
FUNCTION.
Functions to access the ROBODoc configuration and configuration file (robodoc.rc) or the file specified with the --rc option.
The robodoc.rc file consists of a number of blocks. Each block starts with a line of the form
<block name>:
This is followed by a number of lines of data. Each line starts with at least one space followed by the actual data.
This module parses this data and stores it in the global configuration.
NOTES.
Is missing a lot of documentation.
You can not use RB_Say() in this module since the --tell flag won't be parsed until after this module has finished.
FUNCTION.
Allocates space for the keyword hash table.
The size of the table depends on the number of keywords rounded up to the next power of two.
FUNCTION.
This global stores all the configuration parameters specified on the command line and in the robodoc.rc file.
FUNCTION.
Defines the names of items that ROBODoc recognized as items by default if none are specified in the robodoc.rc file.
FUNCTION.
Find a keyword in the hash table
INPUTS.
keyword -- The keyword string
len -- The length of the keyword string
RETURN VALUE.
pointer to the found keyword string in hash table or
NULL if the keyword is not found
FUNCTION.
Parse a line of text and store the individual words in a Parameters structure. Words are seperated by spaces, the exception are words surrounded by quotes. So:
aap noot mies "back to the future"
contains four words.
INPUTS.
line -- the line of text.
parameters -- the set of parameters
FUNCTION.
Calculate the hash value for a string
The hash value is based on the CRC32 hash function. It is then reduced by an AND operation to the actual size of the hash table.
INPUTS.
keyword -- The keyword string
len -- The length of the keyword string
RETURN VALUE.
The hash value for the keyword.
FUNCTION.
Mask for keyword hash function. This mask reduces the hash value for the actual hash table size. Also the size of the hash table can be derived from this mask:
hash table size = keywords_hash_mask + 1
FUNCTION.
Structure for a keyword hash table row.
ATTRIBUTES.
keyword -- pointer to the keyword
next -- pointer to next entry in the row
FUNCTION.
Structure to store all the paramters found in a block in the robodoc configuation file.
ATTRIBUTES.
number -- the number of parameters found.
size -- the maximum size of the names array.
names -- an array with the values of the parameters.
NOTES.
Find a better name for the attribute 'names'
FUNCTION.
All the data from the robodoc.rc file is stored in this structure.
ATTRIBUTES.
items -- an array with names that robodoc recognizes as items. Alsways includes the name "SOURCE" as the first element.
ignore_items -- an array with the names of items that ROBODoc should ignore.
source_items -- an array with the names of items that work similar to the built-in SOURCE item.
preformatted_items -- item names that will be automatically preformatted
format_items -- item names that should be formatted by the browser
item_order -- an array with item names that indicates which items should be displayed first.
options -- Array with all options specified both on the commandline as well as in the robodoc.rc file.
custom_headertypes -- list with custom header types.
ignore_files -- list with wildcard expressions that specifies files and directories that robodoc should skip while scanning the source tree.
header_markers -- list with markers that mark the begin of a header.
remark_markers -- list with markers that mark a remark.
end_markers -- list with markers that markt the end of a header.
remark_begin_markers -- list of markers that mark the begin of a remark. For instance (*
remakr_end_markers -- list of markers that mark the end of a remark. For instance *)
keywords -- source keywords to recognise (and colorise)
source_line_comments -- comment markers that span until the end of line
header_ignore_chars -- characters for beginning of header remarks
header_separate_chars -- characters that separates header artifacts
FUNCTION.
Read the robodoc configuration file, and create a RB_Configuration structure.
INPUTS.
RESULT.
An initialized configuration (a global).
NAME.
This module contains function to scan a directory tree and to create a RB_Directory structure. Most of the OS dependend parts of ROBODoc can be found in this module..
This module currently works under:
Cygwin http://cygwin.com
Redhad 7.3 Linux
VC++ under Windows NT
MINGW http://www.mingw.org/
OS/X
AUTHOR.
Frans Slothouber
NAME.
RB_Directory -- the directory tree with the source files.
FUNCTION.
Stores information about files in a directory tree. The whole structure consist of two linked lists. One for directory paths, and one for filenames.
EXAMPLE.
The following show an example structure.
RB_Directory RB_Path +-------+ +------+ +-------+ +-----------+ | +-->| . |--->| ./sub |-->| ./sub/sub | | | +------+ +-------+ +-----------+ | | ^ ^ ^ | | | | | | | |-----------+ +------+ +------+ | | | | | | | | | | | | | | +------+ +------+ +------+ +-------+ | +-->| a.c |--->| b.c |-->| sa.c |-->| ssb.c | +-------+ +------+ +------+ +------+ +-------+ RB_Filename
ATTRIBUTES.
first -- first RB_Filename in the list of files
current -- the last file that was returned in RB_Get_Next_Filename.
last -- the last RB_Filename in the list of files used for the insert operation
first_path -- first RB_Path in the list of paths.
FUNCTION.
Insert an RB_File structure into a RB_Directory structure. The RB_File is added at the end of the list.
FUNCTION.
Determine the type of the file. This function is used for all compilers except VC++.
If _DIRENT_HAVE_D_TYPE is defined we can find the filetype directly in the a_direntry. If not we have to stat the file to find out.
INPUTS.
arg_pathname -- the path leading up to this file
a_direntry -- a directory entry read by readdir()
RESULT.
The type of the file.
NAME.
RB_Fill_Directory -- fill a RB_Directory structure
FUNCTION.
Walks through all the files in the directory pointed to by arg_path and adds all the files to arg_rb_directory. This is a recursive function.
INPUTS.
arg_rb_directory -- the result.
arg_path -- the current path that is scanned.
arg_doc_path -- the path to the documentation files.
RESULT.
a RB_Directory structure filled with all sourcefiles and subdirectories in arg_path.
NOTE.
This a is a recursive function.
FUNCTION.
Free all the memory use by the RB_Directory structure.
INPUTS.
arg_directory -- the thing to be freed.
NAME.
RB_Get_PathName -- extract the file name
FUNCTION.
Given a full path to a file, that is a filename, or a filename prefixed with a pathname, return the filename. So
"./filename" returns "filename" "/home/et/filename" returns "filename" "filename" return "filename"
INPUTS.
arg_fullpath -- a full path to a file, with or without a path.
RESULT.
0 -- The full path did not contain a filename pointer to the filename -- otherwise.
NOTES.
You are responsible for deallocating it.
NAME.
RB_Get_PathName -- extract the path name
FUNCTION.
Given a full path to a file, that is a filename, or a filename prefixed with a pathname, return the pathname. So
"./filename" returns "./" "/home/et/filename" returns "/home/et/" "filename" return ""
INPUTS.
arg_fullpath -- a full path to a file, with or without a path.
RESULT.
0 -- The full path did not contain a path pointer to the pathname -- otherwise.
NOTES.
You are responsible for deallocating it.
NAME.
RB_Get_RB_Directory -- get a RB_Directory structure
FUNCTION.
Returns a RB_Directory structure to the give directory, specified by the path. This structure can then be uses to walk through all the files in the directory and it's subdirectories.
INPUTS.
arg_rootpath -- the name a the directory to get,
a nul terminated string.
arg_docroot_name -- the name of the directory the documentation
file are stored in. This directory is skipped while scanning for sourcefiles. It can be NULL.
RESULT.
A freshly allocated RB_Directory filled with source files.
NAME.
RB_Get_RB_SingleFileDirectory -- get a RB_Directory structure
FUNCTION.
Returns a RB_Directory structure to the give directory, specified by the path that contains only a single file. This is used for the --singlefile option.
INPUT.
filename -- a filename. This may include the path.
RESULT.
a freshly allocated RB_Directory that contains only a single file.
FUNCTION.
Test if a character is part of the group of characters that you would normally find in a path.
INPUTS.
c -- the character to be tested.
RESULT.
TRUE -- it is a path character. FALSE -- it is not.
NAME.
RB_Is_Source_File -- Is a file a sourcefile?
FUNCTION.
This functions examines the content of a file to see whether or not it is a sourcefile.
Currently it checks if there are no nul characters in the first 8191 characters of the file.
FUNCTION.
Test if a file should be skipped, because it does not match a pattern in "accept files:"
This test is done based on the wildcard expressions specified in configuration.accept_files.
INPUTS.
filename -- the name of the file
FUNCTION.
Test if a file should not be included in the list of source files that are scanned for documentation.
This test is done based on the wildcard expressions specified in configuration.ignore_files.
INPUTS.
filename -- the name of the file
FUNCTION.
This module contains functions to manipulate the central data structure (RB_Document) that contains information about the source files, and documentation files, and headers.
The name is a bit confusing because it sort of implies that it contains the documentation extracted from the sourcefiles.
For each run a RB_Document structure is created, it is filled by the analyser and directory module and then used by the generator module to create the documentation.
MODIFICATION HISTORY.
????-??-?? Frans Slothouber V1.0
2003-02-03 Frans Slothouber Refactoring
2003-10-30 David White Removed unistd.h for Borland
NAME.
RB_Document -- Information store.
FUNCTION.
A document is a collection of source files and documentation files. Depending on the mode that is used there is either a single documentation file or there is one documentation file for each source file. This mapping is stored in RB_Document. For each source file there is an RB_Part. It points to the source file, the documentation file, and contains all the headers that were found in the source file.
ATTRIBUTES.
links -- linked list of all links.
parts -- linked list of all parts.
no_headers -- total number of headers
headers -- array of pointers to all the headers.
srctree -- the list of all sourcefiles in the srcroot.
doctype -- the kind of documentation to be generated.
actions -- what to de while analysing en generating.
srcroot -- root dir for the sourcecode.
docroot -- root dir for the documentation.
charset -- the character set used for HTML and XML documentation.
first_section_level -- level of the first section, Defaults to 1 so the first section will be 1. If set to 2 the first section will be 1.1
extension -- the extension used for the documentation files.
css -- the cascading style sheet to be used.
cur_part -- unused TODO remove.
FUNCTION.
Add a new part to the document.
INPUTS.
document -- the document the part is to be added to.
part -- the part to be added
FUNCTION.
Create a table of pointers to all headers. This is done to have easy access to all heades without having to scan all RB_Parts.
INPUTS.
document -- the document for which the table is created.
OUTPUT.
document->headers
document->no_headers
FUNCTION.
This function creates the whole document directory tree. It tests if the directories exist and if they do not the directory is created.
INPUTS.
document -- the document for which the tree is created.
FUNCTION.
Create all the parts of a document based on the sourcefiles in the source tree. This creates a new RB_Part for each file in the source tree.
INPUTS.
document -- the document for which the parts are generated.
FUNCTION.
Determine the path of each of the documentation files based on the path of the source file and the documentation root path and the source root path.
EXAMPLE.
srcpath = ./test/mysrc/sub1/sub2 srcroot = ./test/mysrc/ docroot = ./test/mydoc/
==>
docpath = ./test/mydoc/sub1/sub2
FUNCTION.
Fill the file_name attribute of all headers based either on the part or the singledoc name. The file_name tells in which file the documentation for the header is to be stored.
FUNCTION.
Allocate and initialize an RB_Document structure.
RESULT.
An initialized document structure.
NAME.
Functions to deal with keeping track of filenames and directory names.
NAME.
Get_Fullname --
FUNCTION.
Give the full name of the file, that is the name of the file including the extension and the path. The path can be relative or absolute.
NOTE.
The string returned is owned by this function so don't change it.
NAME.
RB_Filename --
ATTRIBUTES.
next pointer to the next RB_File.
name null terminated string with the name of the file, (Without the path, but including the extension).
fullname
path pointer to a RB_Path structure that holds the path for this file.
link The link used to represent this file while in multidoc mode.
NAME.
RB_Get_Extension --
FUNCTION.
Give the extension of this file. That is the part after the last '.' if there is any.
RESULT.
pointer to the extension pointer to a '\0' if no extension was found.
NOTE.
The string returned is owned by this function so don't change it.
NAME.
RB_Get_Filename --
FUNCTION.
Give the name of this file. That is the name of the file without its path but with the extension.
RESULT.
pointer to the extension pointer to a '\0' if no extension was found.
NOTE.
The string returned is owned by this function so don't change it.
FUNCTION.
Give the path for this file.
NOTE.
The string returned is owned by this function so don't change it.
NAME.
RB_Get_RB_Filename
INPUTS.
arg_rb_filename --
arg_rb_path --
FUNCTION.
Create a new RB_Filename structure based on arg_filename and arg_rb_path.
FUNCTION.
This contains routines to generate the documentation from the headers collected from the source code. It contains functionality common for all document types (HTML, RTF etc). The specifics are handled in the modules for each of the several document types.
The behaviour of many of the functions in this module are modified by the global output_mode.
The general call sequence is as follows:
RB_Generate_Documentation +> RB_Generate_SingleDoc +> RB_Generate_Part +> Generate_Header +> Generate_Item_Line +> Generate_Char
BUGS.
Confusing use of doctype and output mode.
NOTES.
Might be a good idea to replace all the switch statements with function pointers. So instead of:
switch (output_mode) { case HTML: RB_HTML_Generate_Doc_Start(dest_doc, src_name, name, toc); break; case LATEX: RB_LaTeX_Generate_Doc_Start(dest_doc, src_name, name, toc); break; case RTF: RB_RTF_Generate_Doc_Start(dest_doc, src_name, name, toc); break; case ASCII: RB_ASCII_Generate_Doc_Start(dest_doc, src_name, name, toc); break; case TROFF: RB_TROFF_Generate_Doc_Start(dest_doc, src_name, name, toc); break; default: break; }
we will have
(*rb_generate_doc_start)(dest_doc, src_name, name, toc);
were the function pointers are initialized at program start based on the output mode.
FUNCTION.
Generate a single character in the current output mode. The individual generators will make sure that special characters are escaped.
INPUTS.
dest_doc -- destination file.
cur_char -- character to be generated.
FUNCTION.
Generate the documentation for all the items found in a header except for any items specified in configuration.ignore_items.
INPUTS.
f -- destination file
header -- header to be searched.
srcname -- name of the source file the header was found in.
document -- name of the documentation file.
BUGS.
This skips the first item body if the first item name was not correctly spelled.
NAME.
Generate_Index -- generate index file based on xref files.
FUNCTION.
Create a master index file. It contains pointers to the documentation generated for each source file, as well as all "objects" found in the source files.
NAME.
Generate_Item_Name -- fast&easy
FUNCTION.
write the item's name to the doc
INPUTS.
FILE* dest_doc -- destination file
int item_type -- the type of item
AUTHOR.
Koessi
NOTES.
uses globals: output_mode
FUNCTION.
Generate a label that can be used for a link. For instance in HTML this is <a name="label">
INPUTS.
dest_doc -- file to be written to
name -- the label's name.
output_mode -- global with the current output mode
FUNCTION.
Generate a link to another headers documentation.
INPUTS.
dest_doc -- the output file
docname -- the name of the output file
file_name -- the name of the file that contains the link's body
label_name -- the label for the link
function_name -- the name that is shown for the link in the documentation
FUNCTION.
Add an extension to the filename base based on on the current output mode.
INPUTS.
doctype -- output mode
name -- the name of the file without extension and with enough room left to add the extension.
OUTPUT.
name -- the name of the file including the extension.
FUNCTION.
Generate a section of level depth in the current output mode. This is used for the --sections option. Where each header is placed in a section based on the header hierarchy.
INPUTS.
dest_doc -- the destination file.
doctype -- document type
depth -- the level of the section
name -- the name of the section
header -- pointer to the header structure
output_mode -- global with the current output mode.
NAME.
RB_Generate_Doc_End -- generate document trailer.
FUNCTION.
Generates for depending on the output_mode the text that will be at the end of a document.
INPUTS.
dest_doc - pointer to the file to which the output will be written.
name - the name of this file.
output_mode - global variable that indicates the output mode.
NOTES.
Doesn't do anything with its arguments, but that might change in the future.
BUGS.
NAME.
RB_Generate_Doc_Start -- Generate document header.
FUNCTION.
Generates for depending on the output_mode the text that will be at the start of a document. Including the table of contents.
INPUTS.
dest_doc - pointer to the file to which the output will be written.
src_name - the name of the source file or directory.
name - the name of this file.
output_mode - global variable that indicates the output mode.
toc - generate table of contens
SEE ALSO.
FUNCTION.
Generate the documentation for all the information contained in a RB_Document structure.
INPUTS.
document -- pointer to the RB_Document structure.
FUNCTION.
Generate the end of a section base on the current output mode. The functions is used for the --section option. It closes a section in the current output mode.
INPUTS.
dest_doc -- the destination file.
doctype --
depth -- the level of the section
name -- the name of the section
output_mode -- global with the current output mode.
NAME.
RB_Generate_Header_End
FUNCTION.
Generates for depending on the output_mode the text that will be at the end of a header. This function is used if the option --section is _not_ used.
INPUTS.
dest_doc - pointer to the file to which the output will be written.
cur_header - pointer to a RB_header structure.
SEE ALSO.
RB_Generate_Header_Start, RB_Generate_EndSection, RB_Generate_BeginSection
NAME.
RB_Generate_Header_Start -- generate header start text.
FUNCTION.
Generates depending on the output_mode the text that will be at the end of each header.
INPUTS.
dest_doc - pointer to the file to which the output will be written.
cur_header - pointer to a RB_header structure.
SEE ALSO.
FUNCTION.
Generate an entry for an auto generated index. This works only for output modes that support this, LaTeX for instance. This has nothting to do with the master index.
INPUTS.
dest_doc -- the destination file.
header -- pointer to the header the index entry is for.
output_mode -- global with the current output mode.
FUNCTION.
Generate the begin of an item. This should switch to some preformatted output mode, similar to HTML's <PRE>.
INPUTS.
dest_doc -- file to be written to output_mode -- global with the current output mode
FUNCTION.
Generate the end of an item. This should switch back from the preformatted mode. So in HTML it generates the </PRE> of a <PRE> </PRE> pair.
INPUTS.
dest_doc -- file to be written to
output_mode -- global with the current output mode
FUNCTION.
Create documentation by creating a file for each individual source file that was scanned.
INPUTS.
document -- pointer to the RB_Document structure.
FUNCTION.
Generate the documention for all the headers found in a single source file.
INPUTS.
document_file -- The file were it stored.
document -- All the documentation.
part -- pointer to a RB_Part that contains all the headers found in a single source file.
FUNCTION.
Generate the documentation for a header and all its childern.
INPUTS.
document_file -- destination file
parent -- the parent of the header for which the documentation is to be generated.
document -- pointer to the RB_Document structure.
depth -- level of sectioning ( 1 1.1 1.1.1 etc)
NOTE.
This is a recursive function.
SEE ALSO.
FUNCTION.
Creates the documentation for all headers found in all source files. The order in which they are generated depends on the header hierarchy. First the top level header's documentation is generated then, the documentation for all it's childern, then the next top level header's documentation is generated. This is a recursive proces. The idea is to create something like:
1. Parentheader1 1.1 Child1 1.2 Child2 1.2.1 Child's child1 2. Parentheader2
etc
INPUTS.
document_file -- destination file.
document -- pointer to the RB_Document structure.
FUNCTION.
Create documentation by creating a single file for all individual source file that were scanned.
This function is called when the option --singledoc is used. Based on whether the option --sections is used this function then calls RB_Generate_Sections or RB_Generate_Part
INPUTS.
document -- pointer to the RB_Document structure.
FUNCTION.
Create a Table of Contents based on the headers found in _all_ source files. There is also a function to create a table of contents based on the headers found in a single source file RB_Generate_TOC_1
INPUTS.
dest_doc -- the destination file.
headers -- an array of pointers to all the headers.
count -- the number of pointers in the array.
output_mode -- global with the current output mode.
owner -- The owner of the TOC. Only the headers that are owned by this owner are included in the TOC. Can be NULL, in which case all headers are included.
FUNCTION.
Get the name of the master index file for a specific header_type.
INPUTS.
docroot -- the path to the documentation directory.
extension -- the extension for the file
header_type -- the header type
RESULT.
a pointer to a freshly allocated string.
NOTES.
Has too many parameters.
FUNCTION.
Give all headers a unique name. This makes sure that if two headers have the same name linking to one of the headers still works.
FUNCTION.
Sort the items in all the headers according to the order specified in the 'item order' block in the robodoc.rc file.
FUNCTION.
Enumeration for the various output formats that are supported by ROBODoc.
NOTES.
These should be prefixed with RB_
FUNCTION.
A number of global variables.
TODO.
Documentation.
NAME.
documentat_title -- title for the documentation.
PURPOSE.
Used as the title for master index files or for latex documentation.
NAME.
line_buffer -- global line buffer
FUNCTION.
Temporary storage area for lines that are read from an input file.
NAME.
line_number -- global line counter
PURPOSE.
Keeps track of the number of lines that are read from the source file.
AUTHOR.
Koessi
NAME.
myLine -- dynamic buffer for current line
FUNCTION.
Temporary storage area for lines that are read from an input file.
FUNCTION.
This module contains a set of variables that define how headers start and how they end in various programming languages.
NOTES.
Added C++/ACM header option (David White) Enables documentation only comments (//!) to be extracted from C++ and ACM files, rather than all comments.
NAME.
end_markers -- strings that mark the end of a header.
FUNCTION.
These specify what robodoc recognizes as the end of a documentation header. In most cases this will be "***" or " ***". If the header contains a SOURCE item then the end of the source has to be marked, which is when the other strings in this array are used.
NOTE.
The numbers at the beginning of the lines make it easier to find a special index-number.
NAME.
end_remark_constants -- numerals for end_markers
NOTE.
Most of them seem to be unused at the moment. But it's better to keep it up to date for the eventuality of a later use by robohdrs.
NAME.
end_remark_markers -- strings that mark the end of a comment.
NOTE.
The numbers at the beginning of the lines make it easier to keep them in sync with the end_remark_constants
NAME.
header_markers -- strings that mark the begin of a header.
FUNCTION.
These specify what robodoc recognizes as the beginning
NOTE.
The numbers at the beginning of the lines make it easier to keep them in sync with the src_constants of a header.
FUNCTION.
Check if a line starts with a remark marker. This function assumes that the remark marker starts on the first character of the line.
INPUTS.
lline_buffer -- the line of text.
RESULT.
TRUE -- it starts with a remark marker
FALSE -- it does not.
FUNCTION.
This structure is used to store the headers that are extracted from the source files.
MODIFICATION HISTORY.
8. August 1995: Koessi changed int version to char *version
ATTRIBUTES.
next -- used to store RB_headers in a RB_Part as a linked list.
parent -- the parent of this header
name -- the full name of the header modulename/functionname [versioninfo]
owner -- the Part that owns this header.
htype -- the type of this header.
items -- pointers to the items in this header.
version -- unused
function_name -- the functionname ( a better name would be objectname or thingy name, it is the name of the thing that is being documented ).
module_name -- the modulename
unique_name -- unique name used for labels.
file_name -- documentation file of this header.
lines -- content of the header
no_lines -- number of lines in the content.
line_number -- the line number at which the header was found in the source file.
NAME.
RB_HeaderType -- Information about a header type
ATTRIBUTES.
typeCharacter -- The character used to indicate it
indexName -- The name used for the master index
fileName -- The name of the file use to store the master index for this type of headers.
priority -- The sorting priority of this header. Higher priorities appear first
FUNCTION.
Scan a line and see if any of the end of a header markers defined in header_markers can be found.
INPUTS.
cur_line -- line to be searched.
OUTPUT.
none
RESULT.
TRUE -- an end header was found FALSE -- none was found.
NAME.
RB_Skip_Remark_Marker
FUNCTION.
Scan and search for a recognized remark marker; skip past the marker to the body of the text
NAME.
remark_markers
FUNCTION.
These specify what robodoc recognizes as a comment marker.
TODO.
(1) All the markers that start with one or more spaces are never recognized, and should be removed. (2) The numbers at the beginning of the lines make it easier to keep them in sync with the src_remark_constants
NAME.
robo_end[] -- the distinct robodoc end marker -
alternative to using end_markers
FUNCTION.
This is an alternative to using end_markers - sometimes ROBODOC confuses asterisks commonly used in comments as an end marker. To use this footer instead of end_markers use the -rh switch.
NOTE.
Added by David Druffner.
NAME.
robo_header -- the distinct robodoc header -
alternative to using header_markers
FUNCTION.
This is an alternative to using header_markers - sometimes ROBODOC confuses asterisks commonly used in comments as a header. To use this header instead of header_markers use the -rh switch.
NOTE.
Added by David Druffner. OBSOLETE
NAME.
src_constants -- numerals for header_markers
NOTE.
Most of them seem to be unused at the moment. But it's better to keep it up to date for the eventuality of a later use by robohdrs.
NAME.
src_remark_constants -- numerals for remark_markers
NOTE.
Most of them seem to be unused at the moment. But it's better to keep it up to date for the eventuality of a later use by robohdrs.
FUNCTION.
Headers come in different types. This module defines what kind of headertypes ROBODoc recognizes, and contains functions to add new headertypes and to compare headertypes. All the headertypes are stored in an array, header_type_lookup_table.
FUNCTION.
A lookup table for all the header types that ROBODoc recognizes. At the moment is has about 127 entries. About as many as there are characters in the standard ASCII set. The first 32 entries can be used for special purposes.
Two of them are use:
HT_MASTERINDEXTYPE
and
HT_SOURCEHEADERTYPE
HT_MASTERINDEXTYPE is a wildcard type. All headertypes match this type. This is used to collect all the headers for the masterindex.
HT_SOURCEHEADERTYPE is used to pretend that the name of a sourcefile is a kind of header. This makes it possible to include the names of the source files in the master index.
FUNCTION.
Tells wether this item should be formatted by the browser SYNPOPSIS
INPUTS.
item_type -- Type of item (also the index to the item name)
RESULT.
TRUE -- Item should be formatted by the browser FALSE -- Item should be left alone
FUNCTION.
Tells wether this item should be automatically preformatted in the output. SYNPOPSIS
INPUTS.
item_type -- Type of item (also the index to the item name)
RESULT.
TRUE -- Item should be automatically preformatted FALSE -- Item should NOT be automatically preformatted
FUNCTION.
Add a new headertype to the list of header type that robodoc recognizes.
RESULT.
FALSE -- it is a new header type.
TRUE -- header type already existed.
FUNCTION.
Compare two header types and check if they are equal. If one of the header types is a HT_MASTERINDEXTYPE the comparison is always TRUE. (This to make sure that all headers appear in the Index.)
INPUTS.
ht1 and ht2 -- the header types to compare.
RESULT.
0 -- header types are not equal
!= 0 -- header type are equal
FUNCTION.
Return the header type that corresponds to the type character.
RESULT.
0 -- there is no such header type
pointer to the header type otherwise.
FUNCTION.
Given the typeCharacter is this an internal header?
RESULT.
TRUE -- yes it is
FALSE -- no it is not
FUNCTION.
Tells wether this item works similar to the source item, that is weather it copies it's content verbatim to the output document. SYNPOPSIS
INPUTS.
item_type -- Type of item (also the index to the item name)
RESULT.
TRUE -- Item works like a SOURCE item FALSE -- Item does NOT work like a SOURCE item
FUNCTION.
The generator for HTML output.
The generator supports sections upto 7 levels deep. It supports a Table of Contents based on all headers. A masterindex for all headertypes and seperate masterindexes for each headertype.
MODIFICATION HISTORY.
2003-02-03 Frans Slothouber Refactoring ????-??-?? Frans Slothouber V1.0
FUNCTION.
Create the .css file. Unless the user specified it's own css file robodoc creates a default one.
For multidoc mode the name of the .css file is
robodoc.css
For singledoc mode the name of the .css file is equal to the name of the documentation file.
INPUTS.
document -- the document for which to create the file.
NAME.
RB_HTML_Generate_Char -- generate a single character for an item.
FUNCTION.
This function is called for every character that goes into an item's body. This escapes all the reserved HTML characters such as '&', '<', '>', '"'.
NAME.
RB_HTML_Generate_Doc_Start --
FUNCTION.
Generate the first part of a HTML document. As far as ROBODoc is concerned a HTML document consists of three parts:
The start of a document
The body of a document
The end of a document
INPUTS.
dest_doc -- the output file.
src_name -- The file or directoryname from which this document is generated.
name -- The title for this document
dest_name -- the name of the output file.
charset -- the charset to be used for the file.
FUNCTION.
Do some additional processing to detect HTML extra's like file references and other kind of links for the documentation body of an item.
INPUTS.
dest_doc -- the file to write to.
item_type -- the kind of item the body belongs to.
cur_char -- pointer to a substring of the item's body
prev_char -- the character just before cur char (zero if none)
RESULTS.
Number of characters produced.
FUNCTION.
Generate a single file with a index table for headers of one specific type of headers
INPUTS.
document -- the document
header_type -- the type for which the table is to be generated.
FUNCTION.
Generates a menu to jump to the various master index files for the various header types. The menu is generated for each of the master index files. The current header type is highlighted.
INPUTS.
dest_doc -- the output file.
filename -- the name of the output file
document -- the gathered documention.
cur_headertype -- the header type that is to be highlighted.
FUNCTION.
Generate a label (name) that can be refered too. A label should consist of only alphanumeric characters so all 'odd' characters are replaced with their ASCII code in hex format.
INPUTS.
dest_doc -- the file to write it to.
name -- the name of the label.
FUNCTION.
Check if a line comment is active and generate ending sequence for it. Should be called at the end of each SOURCE line.
NAME.
RB_HTML_Generate_Link --
INPUTS.
cur_doc -- the file to which the text is written cur_name -- the name of the destination file
(the file from which we link)
filename -- the name of the file that contains the link
(the file we link to)
labelname-- the name of the unique label of the link. linkname -- the name of the link as shown to the user.
FUNCTION.
Create a table of contents based on the hierarchy of the headers starting for a particular point in this hierarchy (the parent).
INPUTS.
dest_doc -- the file to write to.
dest_name -- the name of this file.
parent -- the parent of the headers for which the the current level(depth) of TOC is created.
headers -- an array of headers for which the TOC is created
count -- the number of headers in this array
depth -- the current depth of the TOC
NOTES.
This is a recursive function and tricky stuff.
FUNCTION.
Link to 'that' from 'this' computing the relative path. Here 'this' and 'that' are both paths. This function is used to create links from one document to another document that might be in a completely different directory.
EXAMPLE.
The following two
this /sub1/sub2/sub3/f.html that /sub1/sub2/g.html
result in
../g.html
this /sub1/f.html that /sub1/sub2/g.html == ./sub2/g.html
this /sub1/f.html that /sub1/g.html == ./g.html
this /sub1/doc3/doc1/tt.html that /sub1/doc5/doc2/qq.html == ../../doc5/doc2/qq.html
NOTES.
Notice the execelent docmentation.
FUNCTION.
This module contains functions that deal with items. The documentation consists of headers, and headers contains one of more items. Each item has a name and a body. All possible items are listed in configuration.items. A uses can specify that certain items are not to be added to the documentation. These items are listed in configuration.ignore_items.
AUTHOR.
Frans Slothouber
NAME.
ItemTypes -- enumeration of item types
FUNCTION.
Defines a number of item types. There are two kind of items:
the SOURCE item which is always available,
and items defined by the user (or through the default items).
NOTES.
Never check an item type against SOURCECODE_ITEM directily! Use Works_Like_SourceItem() function instead.
FUNCTION.
return the item_type represented by the given string.
INPUTS.
char *cmp_name -- item_name to evaluate
RESULT.
int -- the right item_type or NO_ITEM
FUNCTION.
Is there an itemname in the line. Ignores leading spaces and remark markers.
INPUTS.
line -- line to be searched.
RESULT.
The kind of item that was found or NO_ITEM if no item could be found. The name of the item will be stored in item_name_buffer.
NOTES.
We used to check for misspelled items names by testing if the item name buffer consists of only upper case characters. However checking for a misspelled item name this way results in many false positives. For instance many warnings are given for FORTRAN code as all the keywords are in uppercase. We need to find a better method for this.
FUNCTION.
Keeps track of where items start end end in the header. The index numbers point to the lines array in RB_header.
FUNCTION.
Generator for LaTeX output. Supports singledoc mode.
NAME.
Generate_LaTeX_Includes -- generate include commands
FUNCTION.
Generates a series of \include commands to include the documentation generated for each source file into one big file.
FUNCTION.
Generate a single character. These characters are generated within a begin{verbatim} end{verbatim} block So no escaping is necessary.
FUNCTION.
Generate a single character. These characters are outside a begin{verbatim} end{verbatim} block. So we need to escape is special characters. These are
_ => \_ % => \% $ => \$ < => \textless > => \textgreater \ => $\backslash$
SEE ALSO.
NAME.
RB_LaTeX_Generate_Label --
INPUTS.
dest_doc -- the file to which the text is written name -- the unique name of the label to create
NAME.
RB_LaTeX_Generate_Link --
INPUTS.
cur_doc -- the file to which the text is written cur_name -- the name of the destination file (unused)
(the file from which we link)
filename -- the name of the file that contains the link
(the file we link to) (unused)
labelname-- the name of the unique label of the link. linkname -- the name of the link as shown to the user (unused).
FUNCTION.
This module contains functions to manipulate links. Links are derived from headers. They are used to create links in the documentation between a word and the part of the documentation that explains something about that word. (For instance a function name or variable name). In addition to the links derived from the headers links are also derived from the names of all the sourcefiles.
MODIFICATION HISTORY.
????-??-?? Frans Slothouber V1.0 2003-02-03 Frans Slothouber Refactoring
NAME.
Find_Link -- try to match word with a link
FUNCTION.
Searches for the given word in the list of links and headers. There are three passes (or four, when the C option is selected). Each pass uses a different definition of "word":
In the first pass it is any thing that ends with a 'space', a '.' or a ','.
In the second pass it is any string that consists of alpha numerics, '_', ':', '.', or '-'.
In the third pass (for C) it is any string that consists of alpha numerics or '_'.
INPUTS.
word_begin - pointer to a word (a string).
object_name - pointer to a pointer to a string
file_name - pointer to a pointer to a string
SIDE EFFECTS.
label_name & file_name are modified
RESULT.
object_name -- points to the object if a match was found, NULL otherwise.
file_name -- points to the file name if a match was found, NULL otherwise.
label_name -- points to the labelname if a match was found,
TRUE -- a match was found.
FALSE -- no match was found.
NOTES.
This is a rather sensitive algorithm. Don't mess with it too much.
NAME.
RB_Alloc_Link -- oop
FUNCTION.
allocate struct + strings
INPUTS.
char *label_name -- strings to copy into the link char *file_name
RESULT.
struct RB_link * -- ready-to-use
AUTHOR.
Koessi
SEE ALSO.
RB_StrDup(), RB_Free_Link()
FUNCTION.
Convert header information into link information.
RB_header -> RB_link conversion
INPUTS.
document --
headers -- the array with headers.
count -- number of headers in the array
OUTPUT.
link_index -- an array with links
link_index_size -- the number of links in the array.
NAME.
RB_Free_Link -- oop
FUNCTION.
free struct + strings
INPUTS.
struct RB_link *link
AUTHOR.
Koessi
SEE ALSO.
RB_Alloc_Link(), RB_Close_The_Shop()
FUNCTION.
Deallocate all the memory used to store the links.
INPUTS.
link_index_size
link_index[]
BUGS.
Should use RB_Free_Link instead of doing everything by it self.
NAME.
RB_link -- link data structure
PURPOSE.
Structure to store links to the documentation of an component.
ATTRIBUTES.
label_name -- the label under which the component can be found. this should be a unique name.
object_name -- the proper name of the object
file_name -- the file the component can be found in.
type -- the type of component (the header type).
is_internal -- is the header an internal header?
NAME.
makefile.mingw-cygwin -- Plain makefile that does not need autoconf
PURPOSE.
The makefile for MingW Minimalist GNU for Windows under the Cygwin environment, See:
http://www.mingw.org,
http://www.cygwin.com
You can use it if you are on a win32 system.
The following targets are the most useful for the user:
Developers might try:
EXAMPLES make -f makefile.mingw-cygwin robodoc make -f makefile.mingw-cygwin test make -f makefile.mingw-cygwin clean
FUNCTION.
Defined the flags used for the C compiler:
-W, -Wall and -std=gnu99 -- This turns on all warnings based on the C99 standard. Making the source warning free for an earlier standard is not necessary as this code is compiled on Unix, Windows, and Mac systems that all have C99 compliant C compilers. It also allows some gnu extensions. Using -std=c99 gives some spurious warnings about popen()
-O3 -- optimize, turning optimization on finds more errors and warnings.
-mno-cygwin -- Tells gcc not to link with cygwin1.dll but use the windows standard C library. (make mingw windows native executable under cygwin)
-s -- Strip debug info out from objects, making the executable smaller
-g -- Include all debugger info for GDB
NAME.
robodoc --
NOTE.
This assumes that your version of make knows how to make an .o file out of an .c file.
FUNCTION.
Structures and functions that deal with documentation parts. A part links a sourcefile to the documentation file and contains all the headers found in a sourcefile. Parts (in the form of struct RB_Part) are stored in a RB_Document structure.
FUNCTION.
Free the memory used by an RB_Part. Most of this is handled in other functions.
INPUTS.
part -- the part to be freed.
FUNCTION.
Create a new RB_Part and initialize it.
RESULT.
A freshly allocated and initializedand RB_Part.
NAME.
RB_Part -- a part of the total documentation
FUNCTION.
RB_Parts are stored in RB_Document. For each source file there is an RB_Part. It points to the source file, the documentation file, and contains all the headers that were found in the source file.
ATTRIBUTES.
next -- pointer to the next part (to form a linked list).
filename -- Information over the path to the sourcefile and the correcsponding documentation file.
headers -- All the headers that were found in the sourcefile.
last_header -- pointer to the last element in the list of headers. This is used to make it possible to add the the heades in the same order as they were found in the source file.
FUNCTION.
A collection of functions to generate output in RTF format. Supports sections upto 7 levels deep.
TODO.
Documentation
MODIFICATION HISTORY.
????-??-?? Anthon Pang V1.0 2003-02-03 Frans Slothouber Refactoring Anthon Pang
FUNCTION.
The generator for test output.
The purpose of this generator is to create output that is easily scanable by the system test scripts. This to make it easier to write tests for ROBODoc.
This generator produces output in utf-8 encoding.
This generator is experimental.
FUNCTION.
This module contains functions to parse the command line and inform the user about any errors.
FUNCTION.
Add the name of an option to the group of option names an option test applies to.
INPUTS.
option_test -- the option test name -- the name of the option
FUNCTION.
Add a test to the linked list of options tests.
INPUTS.
option_test -- the test to be added.
FUNCTION.
Check the validity of the item options. Users can specify their own items, item order, and items that ar to be ignored. This all should be consistent.
RESULT.
EXIT_SUCCESS -- all options are correct.
EXIT_FAILURE -- one of more options incorrect.
FUNCTION.
Check for misspelled options specified by the user.
RESULT.
EXIT_SUCCESS -- all options are correctly spelled.
EXIT_FAILURE -- one of more options are misspelled.
FUNCTION.
Check the validity of all the options in configuration.options[]. This runs a number of checks.
RESULT.
EXIT_SUCCESS -- all options are correct.
EXIT_FAILURE -- one of more options incorrect.
FUNCTION.
Allocate and initialize a new option test.
INPUTS.
kind -- the kind of test that has to be created.
FUNCTION.
Create a linked list of tests.
TODO.
Generate this code automatically from a set of high-level specifications.
FUNCTION.
Check all the options to see if combinations of options are used that mutually exclude each other, such as --singledoc and --multidoc.
INPUTS.
cur_option_test -- the test to be carried out.
FUNCTION.
Run a series of tests on the options that the user specified. These tests are specified in option_tests.
RESULT.
EXIT_FAILURE -- one of the tests failed.
EXIT_SUCCESS -- all test completed successfully
FUNCTION.
Searches through the options to find a path. This path is converted to a propper path if it contains errors such as the use of '\' or when it does not start with ./ or a drive name. The option must exist.
INPUTS.
option_name -- the option name for the path
RESULT.
path -- the path.
FUNCTION.
Search configuration.options for a specific option.
RESULT.
TRUE -- option does exist
FALSE -- option does not exist
FUNCTION.
Search for an option of the form
--a_option_name a_value
in configuration.options.
INPUTS.
optionname -- the name of the option to search for.
RESULT.
NULL if the option is not found, a pointer to the value otherwise.
NOTES.
Results in a Panic if the option is found but no value is specified.
FUNCTION.
Add a "./" to a path if it does not start with a "./" or does not contain a ":". If the path was "." just add a "/". Adding a "./" simplifies the creating of relative links during the generation process.
INPUTS.
path -- the path to be fixed.
RESULT.
A pointer to a newly allocated string containing the path.
FUNCTION.
Search for an option of the form
--a_option_name a_value
INPUTS.
n -- the number of options in the options array.
options -- the options array
optionname -- the name of the option to search for.
RESULT.
NULL if the option is not found, a pointer to the value otherwise.
NOTES.
Results in a Panic if the option is found but no value is specified.
FUNCTION.
Get and parse the arguments. Analyse document and generate the documentation. Everything starts from here.
FUNCTION.
An list of all allowed command-line options. If you add any options add its name here too. This list is used to verify the options specified by the user.
FUNCTION.
Enumeration for the kind of tests that are carried out on the options that the user specifies.
FUNCTION.
Test the validity of the doc and source path. The doc path should not be a sub directory of the source path otherwise the generated documentation will be part of the generated documentation if robodoc is run more than once.
INPUTS.
sourcepath -- the path to the source files.
docpath -- the path to the documentation files.
OUTPUT.
error messages
FUNCTION.
Although people are supposed to specify all paths with a '/' as seperator, sometimes people on Win32 use '\', this causes problems later on in some other function of robodoc that expect a '/'. So to prevent this we replace all the '\' in a path with '/'
In addition people sometimes add a '/' at the end of the path. We remove it.
INPUTS.
path -- the path.
RESULT.
path -- the converted path (in a newly allocated block of memory).
FUNCTION.
Checks the validity of a path. A path should start with
./
or
/
or
have a ':' some where
INPUTS.
path -- the path to be cheked.
RESULT.
FALSE -- path is not OK.
TRUE -- path is OK.
FUNCTION.
Search for an option of the form
--a_option_name a_value
in argv. The function is used to look for the
--rc
option that can be used to specify an alternate robodoc configuration file.
INPUTS.
RESULT.
NULL if the option is not found, a pointer to the value otherwise.
NOTES.
Results in a Panic if the option is found but no value is specified.
FUNCTION.
Element in a list of option names. Used in a RB_Option_Test to specify to what options a test applies.
FUNCTION.
Set of general purpose utility functions that are used in more than one module.
FUNCTION.
Fix CR/LF problems.
If ROBODoc reads a text file that was created on another OS line-endings might not be what ROBODoc expects of the current OS. This function tries to detect and fix this.
INPUTS.
line -- a line of text
RETURN VALUE.
number of characters that were removed.
FUNCTION.
Expand the tabs in a line of text.
INPUTS.
line -- the line to be expanded tab_size -- global. RETURN pointer to the expanded line.
NOTE.
This function is not reentrant.
FUNCTION.
allocate the struct RB_header
RESULT.
struct RB_header * -- all attributes/pointers set to zero
AUTHOR.
Koessi
SEE ALSO.
FUNCTION.
Check whether the provided line buffer contains a new line (NL) character.
INPUTS.
line -- line string to process
RETURN VALUE.
TRUE -- the line contains a NL character
FALSE -- the line does not contain a NL character
NAME.
RB_CopyFile -- copy a file to another file
RESULT.
Program Exit if one of the specified files did not open.
FUNCTION.
calcualtes crc32 value for a given buffer
INPUTS.
buf: input buffer to calculate
len: length of buffer
crc32: CRC32 init value
RETURN VALUE.
CRC32 value
NAME.
RB_Free_Header -- oop
FUNCTION.
free struct RB_header and associated strings
INPUTS.
struct RB_header *header -- this one
AUTHOR.
Koessi
SEE ALSO.
RB_Alloc_Header(), RB_Close_The_Shop()
FUNCTION.
Free the dynamically allocated line-buffer
INPUTS.
works on the globals line_buffer, readChars, myLine
FUNCTION.
See if a wildcard expression matches a target string. The wildcard expression can consists of any literal character and the two wildcards characters '*' and '?'. '*' matches the longest string of zero or more characters that fit. '?' matches any single character.
Examples:
"*aap" matches "aapaapaapaap" "?inux" matches "linux" "lin*ux" matches "linux" "linux*" matches "linux"
NOTES.
This is a recursive function.
INPUTS.
target -- the string to be matched agains the wildcard_expression.
wildcard_expression -- the wildcard expression
RETURN VALUE.
TRUE -- the target matches the wildcard expression FALSE -- it does not match.
NAME.
RB_Panic -- free resources and shut down
FUNCTION.
Print error message. Frees all resources used by robodoc. Terminates program. Output goes to stderr
INPUTS.
char *format -- formatstring ... -- parameters
AUTHOR.
Koessi
FUNCTION.
Sort an array of pointers according to the lexical order of the elements the pointers point to. This is based on the quicksort routine in "The C programming language" by B Kerninghan en D Ritchie.
INPUTS.
array -- the array of pointers.
left -- the most left element in the array.
right -- the most right element in the array.
f -- pointer to a function that can compare the objects two elements of the array point to.
RESULT.
array -- A sorted array of pointers.
EXAMPLE.
The following is an example program that shows the use
#define TEST_SIZE 10
char* test[ TEST_SIZE ] = { "ape", "zebra", "duck", "goofbal", "dodo", "rabit", "crow", "cow", "pig", "goat" };
int string_compare( void* p1, void* p2 ) { char *cp1 = p1; char *cp2 = p2; return strcmp( cp1, cp2 ); }
RB_QuickSort( test, 0, TEST_SIZE - 1, string_compare );
FUNCTION.
Read a line from the file using the provided buffer.
INPUTS.
file -- file to read from
buf -- buffer of length MAX_LINE_LEN to read chunks of the line to
arg_readChars -- reference to the variable to store the read characters in
RETURN VALUE.
returns a dynamically allocated buffer containing the complete line read
NOTES.
If the line did not end in a new line (NL) character one is added.
NAME.
RB_Say -- varargs
FUNCTION.
Say what's going on. Goes to stdout.
INPUTS.
char *format -- formatstring
long mode -- SAY_INFO | SAY_DEBUG
... -- parameters
AUTHOR.
Koessi
FUNCTION.
Skip space and tab chars from the start *buf. This is needed when searching for indented headers and items.
NOTES.
We should extract some info about indentation level and save it to global variable in order to write out source items (that originate from indented headers) neatly.
SEE ALSO.
RB_Find_Marker, RB_Find_End_Marker, RB_Find_Item, RB_Generate_Item_Body
FUNCTION.
Compare two strings, regardless of the case of the characters.
RESULT.
0 s == t -1 s < t 1 s > t
NAME.
DESCRIPTION.
Standalone program to insert ROBODoc headers to source code files. This program processes one source file at the time. Existing ROBODoc headers, if any, are not checked for. Beware since this may result in double headers. Current working directory should be the same as where the source file is located.
USES.
Exuberant Ctags 5.3.1 or newer required
USAGE.
robohdrs [options] <source file>
EXAMPLE.
robohdrs -p myproj test1.c robohdrs -s -p myproj -i "MODIFICATION HISTORY" -i IDEAS test2.c
Type `robohdrs -h' to see all command line options.
TODO.
garbage collection
support for other languages which ctags program supports
SEE ALSO.
ROBODoc https://sourceforge.net/projects/robodoc/ Exuberant Ctags http://ctags.sourceforge.net/
COPYRIGHT.
(c) 2003 Frans Slothouber and Petteri Kettunen Copying policy: GPL