//License: See LICENSE.txt for copy of source license (AGPLv3) //Copyright: Author: Richard Bruce Baxter Copyright (c) 2005-2016 Baxter AI (baxterai.com) //Release Notes: Ensure CSrules.xml and all input files are formatted for your operating system, e.g. Linux: dos2unix CSrules.xml Windows: toDos.exe CSrules.xml (http://www.textpad.com/add-ons/files/utilities/convert.zip) //Change Record: Release-30July2012: OpenCS 29-July-2012 - first public release OpenCS 27-September-2012 - updates support HTML documentation auto generation OpenCS 28-September-2012a - comments clean up / OpenCS compatibility updates OpenCS 30-September-2012a - update CS to generate function summary [a) function description and b) function return value in table] OpenCS 11-October-2012a - upgrade all svg code to use XMLParserClass OpenCS 16-November-2012a - support printing of all source files to single html file while maintaining order OpenCS 16-November-2012a - support printing of even-odd offsets of heirachical tree nodes - CS_DRAW_APPLY_EVEN_ODD_X_OFFSET OpenCS 16-November-2012a - support printing of header file function lists - CS_HTML_DOCUMENTATION_GENERATE_FUNCTION_LIST_WITH_INDENTATION, CS_SUPPORT_FUNCTION_RETURN_POINTERS (eg char *get_char_argument()) OpenCS 17-November-2012a - split up multi usage class CSReference into CSFileReference and CSFunctionReference OpenCS 18-November-2012a - manually decapitalise first letter of each word in function before abbreviations (ie double capitalisation) OpenCS 18-November-2012a - CS Capitalise first letter of each word in function + treat numbers (eg '2') as capital letters eg generateExperienceWith2DrgbMap. NB Case 1: aA, Case 2: ABa OpenCS 18-November-2012a - add function reference list for each function - CS_HTML_DOCUMENTATION_GENERATE_FUNCTION_REFERENCE_LIST/CS_HTML_DOCUMENTATION_GENERATE_FUNCTION_REFERENCE_LIST_WITH_INDENTATION/CS_HTML_DOCUMENTATION_GENERATE_FUNCTION_REFERENCE_LIST_WITH_INDENTATION_ADVANCED [functionality disabled due to information overload] OpenCS 19-November-2012a - support printing of individual function svg diagrams, improve (only print unique function references, fix html output error) and activate CS_HTML_DOCUMENTATION_GENERATE_FUNCTION_REFERENCE_LIST/CS_HTML_DOCUMENTATION_GENERATE_FUNCTION_REFERENCE_LIST_WITH_INDENTATION/CS_HTML_DOCUMENTATION_GENERATE_FUNCTION_REFERENCE_LIST_WITH_INDENTATION_ADVANCED, support write of arbitrary svg width/height and viewport parameters OpenCS 30-November-2012a - support generation of html from .CSclass files (which have been semi-automatically generated from .h class files using regular expressions) OpenCS 01-December-2012a - CS_WRITE_SVG_CONNECTORS_TO_SVG (inkscape support only: NB connectors have not yet been integrated into formal SVG standard) OpenCS 03-December-2012a - support parameter -disablefileconnections for manual rearrangement of generated code structure diagrams, support the assignment of node colours based on the occurrence of project abbreviation within file names (!CS_USE_RAINBOW_COLOURS_FOR_FILE_BOXES), support dynamic assignment of connector widths CS_FILE_CONNECTOR_STROKE_WIDTH_SVG/CS_FUNCTION_CONNECTOR_STROKE_WIDTH_SVG OpenCS 15-December-2012a - record functionText with CS_HTML_DOCUMENTATION_GENERATE_FUNCTION_REFERENCE_LIST such that reference lists can be generated in the correct order, do not parse comments (CS_IGNORE_COMMENTS_IN_FUNCTIONS) OpenCS 15-December-2012a - update CS software to output HTML headings one up OpenCS 19-December-2012a - internal updates only for HTML documentation generation - support CS_CONVERT_INDENTED_LIST_TO_HTML_LIST (along with CS_GENERATE_CLASS_HTML_DOCUMENTATION_FROM_CUSTOM_CSCLASS_FORMAT) OpenCS 21-December-2012a - add convertIndentedListToHTMLlist tool OpenCS 12-October-2013a - use topLevelFunctionName OpenCS 13-October-2013a - use CS_SUPPORT_PREDEFINED_GRID (CSrules.xml defined grid) ... OpenCS 17May2014a - update CSoperations.h; introduce CS_MAX_NUM_CHARACTERS_PER_LINE and increase from 1000 to 3000 OpenCS 17May2014a - update CSexecflow.h; increase CS_CODE_STRUCTURE_FUNCTION_DIAGRAM_MAXY from 2000 to 3500 OpenCS 17May2014a - introduce CSrules.xml.printcodeStructureAndHTML.NLC and CSrules.xml.printcodeStructure-manualRearrangement.NLC OpenCS 17May2014c - CS compatibility update; add to CSrules.xml grid; GIAcorpus.h GIAcorpusTranslator.h GIAcorpusOperations.h GIAcorpusDatabase.h wn.h math.h CECodeextensionClass.h OpenCS 24May2014a - create specific CSrules.xml file grids for all BAI projects OpenCS 24May2014a - add hasPreviousFileReferenceWithThisNameHasbeenPrintedConnections() to prevent duplication of connections OpenCS 24May2014a - add hasPrintedFileConnection()/resetPrintedFileConnection() to prevent duplication of connections OpenCS 24May2014a - add hasPrintedFunctionConnection() to prevent duplication of connections OpenCS 24May2014a - resetPrintedFunctionConnection() to prevent duplication of connections during HTML gen OpenCS 24May2014a - fix OpenXXXsourceAutoDocumentationBasicList.html - each svg file doesnt contain the first row of functions / it only contains functions which have a parent in the same file OpenCS 05August2014a - update CSexecflow.h CSclassesArray[] for additional functions OpenCS 05August2014a - update createFunctionReferenceListBoxesAndConnections() to remove "if(!usePredefinedGrid)" requirement for CS_DRAW_APPLY_EVEN_ODD_X_OFFSET OpenCS 27August2014a - replace file i/o char* strings with C++ strings OpenCS 27August2014a - create CSgenerateHTMLdocumentation.cpp/.h from CSexecflow.cpp/.h OpenCS 27August2014a - create CSgenerateObjectOrientedCode.cpp/.h OpenCS 27August2014a - CS_GENERATE_CPP_CLASSES: [Commercial] OpenCS 27August2014a - CS_GENERATE_CPP_CLASSES: [Commercial] OpenCS 27August2014a - CS_GENERATE_CPP_CLASSES: [Commercial] OpenCS 27August2014a - CS_GENERATE_CPP_CLASSES: [Commercial] OpenCS 27August2014a - CS_GENERATE_CPP_CLASSES: [Commercial] OpenCS 27August2014a - CS_GENERATE_CPP_CLASSES: [Commercial] OpenCS 27August2014a - CS_GENERATE_CPP_CLASSES: [Commercial] OpenCS 27August2014a - CS_GENERATE_CPP_CLASSES: [Commercial] OpenCS 27August2014a - CS_GENERATE_CPP_CLASSES: [Commercial] OpenCS 27August2014a - CS_GENERATE_CPP_CLASSES: [Commercial] OpenCS 27August2014a - CS_GENERATE_CPP_CLASSES: [Commercial] OpenCS 27August2014a - normalise findPrintedFunctionReferenceWithName() OpenCS 29August2014a - CS_GENERATE_CPP_CLASSES: [Commercial] OpenCS 29August2014a - CS_GENERATE_CPP_CLASSES: [Commercial] OpenCS 29August2014a - CS_GENERATE_CPP_CLASSES: [Commercial] OpenCS 29August2014a - CS_GENERATE_CPP_CLASSES: [Commercial] OpenCS 29August2014a - CS_GENERATE_CPP_CLASSES: [Commercial] OpenCS 29August2014a - CS_GENERATE_CPP_CLASSES: [Commercial] OpenCS 29August2014a - CS_GENERATE_CPP_CLASSES: [Commercial] OpenCS 29August2014a - CS_GENERATE_CPP_CLASSES: [Commercial] OpenCS 29August2014a - CS_GENERATE_CPP_CLASSES: [Commercial] OpenCS 29August2014a - CS_GENERATE_CPP_CLASSES: [Commercial] OpenCS 29August2014a - CS_GENERATE_CPP_CLASSES: [Commercial] OpenCS 30August2014a - update preprocessor defs in CSglobalDefs.h and CSreferenceClass.h OpenCS 03September2014a - CSoperations.cpp getIncludeFileNamesFromCorHfile()/getFunctionNamesFromFunctionDeclarationsInHfile(): fix bug - detect small comments - test tempChar not c; support lines ending in '/' OpenCS 03September2014a - lowpri CSoperations.cpp getFunctionNamesFromFunctionDeclarationsInHfile(): change redundant "else if((readingBeforeOpeningBracket) && (c == '('))" to "(c == '('))" OpenCS 03September2014a - lowpri CSoperations.cpp getFunctionNamesFromFunctionDeclarationsInHfile(): only set "currentReferenceInFunctionList->functionReferenceIndentation = functionReferenceIndentationInHfileTemp;" #ifdef CS_HTML_DOCUMENTATION_GENERATE_FUNCTION_LIST_WITH_INDENTATION OpenCS 03September2014a - CS_HTML_DOCUMENTATION_GENERATE_FUNCTION_REFERENCE_LIST: getFunctionReferenceNamesFromFunctionsInCfile()/searchFunctionStringForFunctionReferencesRecursive()/searchFunctionStringForFunctionReferences(): add to firstReferenceInFunctionReferenceListRepeats as well as firstReferenceInFunctionReferenceList OpenCS 03September2014a - getFunctionReferenceNamesFromFunctionsInCfile(): new lines are required to be stored to recalculate indentation: "functionContentsString = functionContentsString + c;" when "waitingForNewLine = false;" OpenCS 03September2014a - generateHTMLdocumentationFunctionReferenceList()/generateHTMLdocumentationIndentedList(): update white space formatting OpenCS 03September2014a - update destructor: delete firstReferenceInFunctionReferenceList/firstReferenceInFunctionReferenceListRepeats OpenCS 03September2014a - disable CS_GENERATE_CPP_CLASSES by default [OpenCS is not compiled with CSgenerateOOcode.cpp/.h] ... OpenCS 10-May-2015a - upgrade CS to use minimal RAM (upgrade and implement CSfileReferenceContainer and CSfunctionReferenceContainer); this is required for CS to parse large projects OpenCS 10-May-2015a - generateCPPclassesFile(): replace replaceAllOccurancesOfString with replaceAllOccurancesOfFunctionReferenceReferenceNameInFunction - ensure previous character is not a letter (this ensures that ABCfunctionName is not found when searching for functionName) OpenCS 10-May-2015a - searchFunctionStringForFunctionReferences(): when searching for functionReferenceReference, ensure previous character is not a letter (this ensures that ABCfunctionName is not found when searching for functionName) OpenCS 10-May-2015a - add additional CS generateoo requirements; function contents cannot include a reference to themselves in comments of their contents (required for HTML generation function reference list and generateoo)" OpenCS 10-May-2015a - replace all (): with {}: OpenCS 10-May-2015a - replace all ()" with {}" OpenCS 10-May-2015a - add additional[?] CS generateoo requirements; CS does not support 2 identical function declarations (with identical arguments) for a single function in a header file (separated by preprocessor definitions) OpenCS 10-May-2015a - fix bug in replaceAllOccurancesOfFunctionReferenceReferenceNameInFunction(); not replacing all occurances (only first occurance) ... OpenCS 21-July-2015a - fix createFileReferenceListConnections to print all file connections [bug in CS3f1a] OpenCS 27-July-2015a - CS_ASSUME_TOP_LEVEL_FILE_IS_SOURCE_FILE - will not write connections between top level source file and its child (top level source header) ... OpenCS 14-November-2015a - update CSdraw (resetPrintedFunctionConnections/createFunctionReferenceListBoxesAndConnections) to use findFunctionObjectWithName instead of findFunctionReferenceInAPrintedFileReferenceRecursive OpenCS 14-November-2015a - create CSfunction* functionReferenceTarget/CSfile* functionReferenceTargetFileOwner, and set them using attachFunctionReferenceTargets OpenCS 14-November-2015a - extract CSfileClass.cpp/.h/CSfunctionClass.cpp/.h from CSreferenceClass.cpp/.h OpenCS 14-November-2015a - change CSfunctionReferenceContainer/CSfileReferenceContainer/CSfunctionReference/CSfileReference to CSfunctionContainer/CSfileContainer/CSfunction/CSfile OpenCS 14-November-2015a - ensure to record full functionReferenceReference name (functionReferenceReferenceNameFull) when parsing code structure heirachy OpenCS 14-November-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 14-November-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 14-November-2015a - update SHAREDvars.cpp; change cout << "Error: getFloatArgument(" << keystr << ") to cout << "Error: getFloatArgument{}; " << keystr << endl; OpenCS 14-November-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 14-November-2015a - debug identifyFunctionDeclarationArguments/identifyFunctionReferenceArguments OpenCS 14-November-2015a - update generateConstFunctionArgumentsFunction(); check that the argument reference name is not preceeded or succeeded by an alphanumeric character OpenCS 14-November-2015a - add to requirements (1h1f); function contents cannot include a reference to their name in cout statements followed by an equals sign, unless it is referenced at the start of the comment (e.g. cout << \"generateHTMLdocumentationMode = \" ...) OpenCS 14-November-2015a - add to requirements; function contents cannot include a reference to themselves in cout statements (e.g. cout << \"dothis()\") OpenCS 14-November-2015a - change writeByteArrayToFile to use string fileName instead of const char* fileName OpenCS 14-November-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 14-November-2015a - currentFunctionObject->functionArgumentConstsIdentified = true; //moved condition CS3h1d; ignore recursive function references OpenCS 14-November-2015a - change "CSfunction* currentFunctionReference = currentFunctionObject->firstReferenceInFunctionReferenceList;" to "CSfunction* currentFunctionReference = currentFunctionObject->firstReferenceInFunctionReferenceListRepeats;" OpenCS 14-November-2015a - fix embedded argument detection OpenCS 14-November-2015a - fix bug in generateConstFunctionArgumentsFunction; how isConst is set OpenCS 14-November-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 14-November-2015a - CS_MATCH_FUNCTION_REFERENCES_WITH_CORRECT_NUMBER_OF_ARGUMENTS OpenCS 14-November-2015a - add to requirements; CS doesn't support overloaded functions with the same number of arguments (required for precise referencing) OpenCS 14-November-2015a - support function references with same name but different number of arguments; rename findFunctionObjectWithName to findFunctionReferenceTarget, and search for both name and numArguments OpenCS 19-November-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 23-November-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 23-November-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 23-November-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 23-November-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 23-November-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 23-November-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 23-November-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 23-November-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 23-November-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 23-November-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 30-November-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 30-November-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 30-November-2015a - prevent recursion of currentReferenceInPrintList in [don't detect as current pointer assignment of list..]; OpenCS 30-November-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 01-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 01-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 01-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 01-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 03-December-2015a - CS_GENERATE_CPP_CLASSES: [Commercial] OpenCS 03-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 03-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 06-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 06-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 06-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 06-December-2015a - permanently code const into firstReferenceInPrimitivesReferenceList/firstReferenceInPrimitivesReferenceListGlobal LDopengl.cpp/LDopengl.h code OpenCS 06-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 06-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 06-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 08-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 08-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 08-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 08-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 08-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 09-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 09-December-2015a - CS_SUPPORT_POINTER_TYPE_DECLARATIONS_WITH_SPACE_BEFORE_RATHER_THAN_AFTER_ASTERIX OpenCS 09-December-2015a - fix checkIfVariableIsBeingModifiedInFunction bracket detection code OpenCS 09-December-2015a - update identifyFunctionDeclarationArguments code to detect function argumentName properly in case of appended[], eg "typeX* argumentName[]" OpenCS 09-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 09-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 09-December-2015a - deal with situation in which a pointer variable is saved to an object subobject, and then modified later; OpenCS 10-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 10-December-2015a - update replaceAllOccurancesOfFunctionObjectFunctionArgumentSecondaryAssignmentDeclarationInFunction(): replace extractFullVariableNameReverse with extractFullVariableTypeReverse OpenCS 10-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 10-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 10-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 10-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 10-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 10-December-2015a - fix error OpenCS 10-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 11-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 11-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 11-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 11-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 11-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 11-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 11-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 11-December-2015a - remove redundant "(indexOfEqualsSetPrevious < indexOfEndOfCommand)" from "if((indexOfEqualsSetPrevious > indexOfStartOfLine) && (indexOfEqualsSetPrevious < indexOfEndOfCommand))" OpenCS 11-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 11-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 11-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 11-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 11-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 11-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 11-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 11-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 11-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 11-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 11-December-2015a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] OpenCS 29-February-2016a - CS_GENERATE_CONST_FUNCTION_ARGUMENTS: [Commercial] ... OpenCS 20-September-2016a - fix bug in OpenCS.exe; execute identifyFunctionDeclarationArguments if CS_MATCH_FUNCTION_REFERENCES_WITH_CORRECT_NUMBER_OF_ARGUMENTS or CS_GENERATE_CONST_FUNCTION_ARGUMENTS (not if CS_GENERATE_CONST_FUNCTION_ARGUMENTS)