ygDocument derived from cxxDocument

Description: the main class that analyzes and generates documentation for a Ygdrasil class

notes:
Category: Ygdrasil
Author: Alex Hill
11/01/01
Revision: 12/02/4 Alex Hill - added debuging and commenting

    Source

ygDocument.cxx
ygDocument.h

    Comments

constructor ygDocument

1 set the default Ygdrasil class template file
2 register the "ygString" variable type

method printMessagesHTML

1 for each child of the root of the object tree
1.1 if the object type is "function" then
1.1.1 for each child of the function
1.1.1.1 if the object type is "variable" and variable type is "functioncall"
1.1.1.1.1 if functioncall name is "addNetMessage" then
1.1.1.1.1.1 if name equals the given message name then
1.1.1.1.1.1.1 if current message length is non-zero then set the current arugments and comment
1.1.1.1.1.1.2 if a comment precedes the first function then set the current comment
1.1.1.1.1.1.3 else clear the current comment
1.1.1.1.1.1.4 set the current message to the functioncall name
1.1.1.1.1.1.5 clear the current arugments
1.1.1.1.1.1.6 create a message data object and add it to the message list
1.1.1.1.1.2 set the argument type to the name of the second functioncall argument
1.1.1.1.1.3 if the argument type is a boolean then
1.1.1.1.1.3.1 if this is the last functioncall for this message then enclose in brackets
1.1.1.1.1.3.2 add "bool" to the current argument string with or without brackets
1.1.1.1.1.4 else if the argument type is an integer then
1.1.1.1.1.4.1 if the next functioncall is "addNetMessageMap" then
1.1.1.1.1.4.1.1 add each mapped string to the current argument string separated by "|"
1.1.1.1.1.4.2 if this is the last functioncall for this message then enclose in brackets
1.1.1.1.1.5 else if the argument type is an integer then add "float" to the current argument string
1.1.1.1.1.6 else if the argument type is a class then add class options to the current argument string
1.1.1.1.1.7 else if the argument type is a node then add "node" to the current argument string
1.1.1.1.1.8 else if the argument type is a file then add "file" to the current argument string
1.1.1.1.1.9 else if the argument type is a string then add "string" to the current argument string
1.1.1.1.1.10 else if the argument type is a pfvec2 then add "two floats" to the current argument string
1.1.1.1.1.11 else if the argument type is a pfVec3 then add "three floats" to the current argument string
1.1.1.1.1.12 else if the argument type is a pfVec4 then add "four floats" to the current argument string
1.1.1.1.1.13 else if the argument type is a vector then add "multipe floats" to the current argument string
1.1.1.1.1.14 else if the argument type is a pfCoord then add "three floats, three floats" to the current argument string
1.1.1.1.1.15 else if the argument type is a pfMatrix then add "sixteen floats to the current argument string
1.1.1.1.2 if functioncall name is "dontSaveNetMessage" then
1.1.1.1.2.1 if the previous object type is "comment" and a message data object exists then
1.1.1.1.2.1.1 set the print flag to false
2 for each child of the root of the object tree
2.1 if the object type is "function" then
2.1.1 for each child of the function
2.1.1.1 if the object type is "statement" then
2.1.1.1.1 for each argument in the statement
2.1.1.1.1.1 if the statement is of the form "msg ==" then
2.1.1.1.1.1.1 extract the messsage arguments string from the statement children
2.1.1.1.1.1.2 if the message type string is non-zero and there is no corresponding message data object then
2.1.1.1.1.1.2.1 begin an HTML table
2.1.1.1.1.1.2.2 print out a table row with message name, message arguments, and comment
2.1.1.1.1.1.3 else if a corresponding message data object exists then
2.1.1.1.1.1.3.1 if the print flag is true then
2.1.1.1.1.1.3.1.1 begin an HTML table
2.1.1.1.1.1.3.1.2 print out a table row with message name, message arguments, and comment

method getMessageType

1 for each child of the object
1.1 if the child is a statement and one of "if,for,while" then
1.1.1 call this function recursively on the child
1.1.2 if the returned argument substring is not empty then
1.1.2.1 if the number of statements found is non-zero then
1.1.2.1.1 clear the statement string
1.1.2.1.2 reset the number of statements
1.1.2.1.3 reset the optional flag
1.1.2.1.4 reset the grouped flag
1.1.2.2 increment the number of strings
1.1.2.3 add "multiple" to the argument string
1.1.2.4 add the argument substring to the argument string
1.2 else if the child is a statement such as "if"
1.2.1 for each one of the statement conditionals
1.2.1.1 if the conditional is of the form "msg.stringArg* ==" then
1.2.1.1.1 increment the number of statement options
1.2.1.1.2 if this is not the first option then add " | "
1.2.1.1.3 add the option to the statement options string
1.2.2 for each one of the statment conditionals (again)
1.2.2.1 if the conditional is of the form "msg.*" then
1.2.2.1.1 if the name contains ".getVec2Args" then
1.2.2.1.1.1 increment the number of statement arguments
1.2.2.1.1.2 add "two floats" to the statement arguments string
1.2.2.1.2 if the name contains ".getVec3Args" then
1.2.2.1.2.1 increment the number of statement arguments
1.2.2.1.2.2 add "three floats" to the statement arguments string
1.2.2.1.3 if the name contains ".getVec4Args" then
1.2.2.1.3.1 increment the number of statement arguments
1.2.2.1.3.2 add "four floats" to the statement arguments string
1.2.3 call this function recursively on the child
1.2.4 if the returned argument substring is not empty, the number of statments arguments or options is non-zero then
1.2.4.1 if the statement name is "if" then
1.2.4.1.1 clear the statement string
1.2.4.1.2 reset the number of statements
1.2.4.1.3 reset the optional flag
1.2.4.1.4 reset the grouped flag
1.2.4.2 increment the number of statements
1.2.4.3 if the number of statements is 1 then
1.2.4.3.1 increment the number of strings
1.2.4.3.1 else add "|" to the statement string
1.2.4.4 if the number of statement options is non-zero then
1.2.4.4.1 if the number of statement options is greater than 1 then
1.2.4.4.1.1 add the statement options to the statement string enclosed in parenthesis
1.2.4.4.2 else add the statement options to the statement string
1.2.4.5 if the number of statement arguments is non-zero then
1.2.4.5.1 add the statement arguments to the statement string
1.2.4.6 if the argument substring is not empty then
1.2.4.6.1 add the arugment substring to the statement string
1.2.4.7 if the number of statements or the number of statement arguments is greater than 1 then set option grouping flag
1.2.5 if the statement name is "else" and the argument substring is empty then
1.2.5.1 set the optional grouping flag
1.2.5.2 for each statment child
1.2.5.2.1 if the child is of the form "msg.error*" then unset the optional grouping flag
1.3 else if the object is of type "variable" then
1.3.1 if the variable type is "functioncall" and starts with "msg" then
1.3.1.1 if the name contains ".boolArg" then add "bool" to the variable string
1.3.1.2 else if the name contains ".intArg" then add "integer" to the variable string
1.3.1.3 else if the name contains ".floatArg" then add "bool" to the variable string
1.3.1.4 else if the name contains ".stringArg" then add "string" to the variable string
1.3.1.5 else if the name contains ".getVec2Args" then add "two floats" to the variable string
1.3.1.6 else if the name contains ".getVec3Args" then add "three floats" to the variable string
1.3.1.7 else if the name contains ".getVec4Args" then add "four floats" to the variable string
1.3.2 call this function recursively on the child
1.3.3 if the returned argument substring is not empty or the variable string is not empty then
1.3.3.1 if the number of statements is non-zero then
1.3.3.1.1 clear the statement string
1.3.3.1.2 reset the number of statements
1.3.3.1.3 reset the optional flag
1.3.3.1.4 reset the grouped flag
1.3.3.2 increment the number of strings
1.3.3.3 if the variable string in not empty then add it to the argument string
1.3.3.4 if the argument substring is not empty then add it to the argument string
2 if the number of statements is non-zero then

method addSubstring

1 if the items are part of a group then
1.1 if the arguments are optional then enclose the substring in brackets and add to the string
1.2 else enclose the substring in parenthesis and add to the string
2 else
2.1 if the arguments are optional then enclose the substring in brackets and add to the string
2.2 else add the substring to the string

method printEventsHTML

1 for each child of the given cxxObject
1.1 call this function recursively on the child
1.2 if the object type is "variable" and variable type is "functioncall" then
1.2.1 if functioncall name is "eventOccurred" then
1.2.1.1 begin an HTML table
1.2.1.2 print out a table row with event name, arguments, and comment

method getString

1 for each variable in the variables list
1.1 if the given variable is found then break
1.2 else if the variable name equals that of the given variable then
1.2.1 if the type is "assignment" then
1.2.1.1 get the first child of the variable
1.2.1.2 if type is "text" then set the substring to the text
1.2.1.3 else if type is "identifier" then
1.2.1.3.1 either set the substring to the child name in brackets or add the child name to it
1.2.1.4 else set the substring to the result of calling print() on the child
1.2.1.5 if the varialbe style is "declaration" then set the string to the substring
1.2.1.6 else if the variable style is "assignment" then add the substring to the string
1.2.2 else if one of the registered types then
1.2.2.1 clear the string
1.2.2.2 if the variable has only 1 child then set the string to the name of that child

method printKeysHTML

1 for each child of the given cxxObject
1.1 call this function recursively on the child
1.2 if the object type is "variable" and variable type is "functioncall" then
1.2.1 if functioncall name is "addNetKey" then
1.2.1.1 begin an HTML table
1.2.1.2 print out a table row with key name, data type, and comment

method printDebugsHTML

1 for each child of the given cxxObject
1.1 call this function recursively on the child
1.2 if the object type is "variable" and variable type is "functioncall" then
1.2.1 if functioncall name is "debugFlag" then
1.2.1.1 begin an HTML table
1.2.1.2 print out a table row with event name and comment

method printBeginTableHTML

1 print the HTML to begin a table

method printEndTableHTML

1 print the HTML to end a table

method report

1 open the class template file
2 if file is not found then
2.1 open the file at /usr/local/cxxDocuemtor_0.2
3 if file is not found then error and return
4 open the class output file
5 while not at the end of the file
5.1 get a line from the stream
5.2 output the line to the output file
5.3 if the line contains "
5.3.1 extract the first meta tag parameter from the line
5.3.2 extract the second meta tag parameter from the line
5.3.3 if the name meta tag parameter equals "cxxDocument" then
5.3.3.1 if the meta tag content parameter equals "header" then
5.3.3.1.1 print out the header HTML
5.3.3.2 else if the meta tag content parameter equals "messages" then
5.3.3.2.1 print out the Ygdrasil messages HTML
5.3.3.3 else if the meta tag content parameter equals "events" then
5.3.3.3.1 print out the Ygdrasil events HTML
5.3.3.4 else if the meta tag content parameter equals "keys" then
5.3.3.4.1 print out the Ygdrasil events HTML
5.3.3.5 else if the meta tag content parameter equals "print" then
5.3.3.6 else if the meta tag content parameter equals "print" then
5.3.3.6.1 print out the source code in HTML
5.3.3.7 else if the meta tag content parameter equals "comments" then
5.3.3.7.1 print out the comments in HTML
6 close the input stream
7 close the output stream

method debugPrint