diff --git a/Moose Development/LDT External Tools/Moose DOCUMENTATION Generate.launch b/Moose Development/LDT External Tools/Moose DOCUMENTATION Generate.launch index 85f0a3b46..43f710ca8 100644 --- a/Moose Development/LDT External Tools/Moose DOCUMENTATION Generate.launch +++ b/Moose Development/LDT External Tools/Moose DOCUMENTATION Generate.launch @@ -3,6 +3,6 @@ - + diff --git a/Utils/GenerateDocumentations.bat b/Utils/GenerateDocumentations.bat new file mode 100644 index 000000000..d106f5189 --- /dev/null +++ b/Utils/GenerateDocumentations.bat @@ -0,0 +1,13 @@ +@echo off + +:: Generate Luadocumentor documentation +echo Generating LuaDocumentor Documentation +echo -------------------------------------- +call luadocumentor.bat + +:: Generate Slate documentation +echo Generating Slate Documentation +echo ------------------------------ +cd "Slate Documentation Generator" +call Generate.bat +cd .. \ No newline at end of file diff --git a/Utils/Slate Documentation Generator/Generate.bat b/Utils/Slate Documentation Generator/Generate.bat new file mode 100644 index 000000000..592061d18 --- /dev/null +++ b/Utils/Slate Documentation Generator/Generate.bat @@ -0,0 +1,10 @@ +:: Generate the Markdown doc +"./bin/SlateDocGenerator2.exe" "../../../MOOSE/Moose Development/Moose" ../../../slate/source + +:: Do some cleanup +del /s /q "TreeHierarchySorted.csv" +del /s /q "FuctionList.txt" +rmdir /s /q "./bin/TEMP" + +:: Copy the Images that go with the documentation +robocopy ../../docs/Presentations ../../../slate/source/includes/Pictures /MIR /NJH /NJS diff --git a/Utils/Slate Documentation Generator/bin/SlateDocGenerator2.exe b/Utils/Slate Documentation Generator/bin/SlateDocGenerator2.exe new file mode 100644 index 000000000..ad688e4b7 Binary files /dev/null and b/Utils/Slate Documentation Generator/bin/SlateDocGenerator2.exe differ diff --git a/Utils/Slate Documentation Generator/bin/TreeHierarchy.csv b/Utils/Slate Documentation Generator/bin/TreeHierarchy.csv new file mode 100644 index 000000000..41eb85a6a --- /dev/null +++ b/Utils/Slate Documentation Generator/bin/TreeHierarchy.csv @@ -0,0 +1,35 @@ +@K=function, @M=Task_A2G, @N=onafterRouteToRendezVous, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_A2G.lua, @C=5129, +@K=function, @M=Task_A2G, @N=OnAfterArriveAtRendezVous, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_A2G.lua, @C=5789, +@K=function, @M=Task_A2G, @N=onafterEngage, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_A2G.lua, @C=6186, +@K=function, @M=Task_A2G, @N=onafterRouteToTarget, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_A2G.lua, @C=6508, +@K=function, @M=Task_A2G, @N=onafterRouteToTargets, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_A2G.lua, @C=7380, +@K=function, @M=Task_Cargo, @N=onenterWaitingForCommand, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=10431, +@K=function, @M=Task_Cargo, @N=OnLeaveWaitingForCommand, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=12652, +@K=function, @M=Task_Cargo, @N=onafterRouteToPickup, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=13428, +@K=function, @M=Task_Cargo, @N=onafterArriveAtPickup, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=13882, +@K=function, @M=Task_Cargo, @N=onafterRouteToDeploy, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=14310, +@K=function, @M=Task_Cargo, @N=onafterArriveAtDeploy, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=14757, +@K=function, @M=Task_Cargo, @N=onafterLand, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=15187, +@K=function, @M=Task_Cargo, @N=onafterLanded, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=16069, +@K=function, @M=Task_Cargo, @N=onafterPrepareBoarding, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=16762, +@K=function, @M=Task_Cargo, @N=onafterBoard, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=17166, +@K=function, @M=Task_Cargo, @N=onafterBoarded, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=18074, +@K=function, @M=Task_Cargo, @N=onafterPrepareUnBoarding, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=18704, +@K=function, @M=Task_Cargo, @N=onafterUnBoard, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=19134, +@K=function, @M=Task_Cargo, @N=onafterUnBoarded, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=19788, +@K=function, @M=Designate, @N=OnBeforeLaseOn, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=12232, +@K=function, @M=Designate, @N=OnAfterLaseOn, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=12480, +@K=function, @M=Designate, @N=LaseOn, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=12701, +@K=function, @M=Designate, @N=__LaseOn, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=12824, +@K=function, @M=Designate, @N=OnBeforeLaseOff, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=13114, +@K=function, @M=Designate, @N=OnAfterLaseOff, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=13364, +@K=function, @M=Designate, @N=LaseOff, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=13587, +@K=function, @M=Designate, @N=__LaseOff, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=13712, +@K=function, @M=Designate, @N=OnBeforeSmoke, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=13944, +@K=function, @M=Designate, @N=OnAfterSmoke, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=14190, +@K=function, @M=Designate, @N=Smoke, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=14409, +@K=function, @M=Designate, @N=__Smoke, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=14530, +@K=function, @M=Designate, @N=OnBeforeStatus, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=15628, +@K=function, @M=Designate, @N=OnAfterStatus, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=15876, +@K=function, @M=Designate, @N=Status, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=16097, +@K=function, @M=Designate, @N=__Status, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=16220, diff --git a/Utils/Slate Documentation Generator/src/DataStorer.au3 b/Utils/Slate Documentation Generator/src/DataStorer.au3 new file mode 100644 index 000000000..b5903009b --- /dev/null +++ b/Utils/Slate Documentation Generator/src/DataStorer.au3 @@ -0,0 +1,174 @@ +; This file only constains function related to storing the hierarchy in a tree-like tructure + +Func AddNode($Kind, $Module ,$Node, $Parent, $File, $CarretPos) + FileSetPos($DataFile, 0, $FILE_END) + + If $Parent == "" And $Kind == "type" Then + $Parent = "ROOT" + ElseIf $Kind == "module" Then + $Module = " " + $Parent = " " + EndIf + FileWrite($DataFile, "@K="&$Kind&", @M="&$Module&", @N="&$Node&", @P="&$Parent&", @F="&$File&", @C="&$CarretPos&","&@CRLF) +EndFunc + +; Search node by name and returns one data +Func GetData($Node, $Data) + FileSetPos($DataFile, 0, $FILE_BEGIN) + Local $CurrentLine = "" + Local $CurrentData + Local $RegexResult + Local $Regex + Switch $Data + Case "kind" + $Regex = "\@K=(.+?)," + Case "parent" + $Regex = "\@P=(.+?)," + Case "file" + $Regex = "\@F=(.+?)," + Case "carretpos" + $Regex = "\@C=(.+?)," + EndSwitch + FileSetPos($DataFile, 0, $FILE_BEGIN) + Do + $CurrentLine = FileReadLine($DataFile) + If @error == -1 Then + Return "" + ExitLoop + EndIf + $CurrentData = StringRegExp($CurrentLine, "\@N=(.+?),", $STR_REGEXPARRAYMATCH) + + Until $Node == $CurrentData[0] + $CurrentData = StringRegExp($CurrentLine, $Regex, $STR_REGEXPARRAYMATCH) + Return $CurrentData[0] +EndFunc + + +; Returns an array of parent nodes, up to the root, starting with the root +Func GetParents($Node) + Local $CurrentParent = $Node + Local $ParentsArray[0] + Local $NbOfParents = 1 + + While $CurrentParent <> "ROOT" + ReDim $ParentsArray[$NbOfParents] + $ParentsArray[$NbOfParents-1] = $CurrentParent + + $CurrentParent = GetData($CurrentParent, "parent") + If $CurrentParent == "" Then + FileWrite($Log, "ERROR : Couldn't find "&$ParentsArray[$NbOfParents-1]&"'s parent !") + $CurrentParent = "ERROR !" + ReDim $ParentsArray[$NbOfParents] + $ParentsArray[$NbOfParents-1] = $CurrentParent + ExitLoop + EndIf + $NbOfParents += 1 + WEnd + + _ArrayReverse($ParentsArray) + _ArrayDelete($ParentsArray, $NbOfParents) + Return $ParentsArray +EndFunc + + + +Func DataSort() + Local $SortedDataFile = FileOpen(@ScriptDir & "\TreeHierarchySorted.csv", $FO_OVERWRITE) + Local $Line = "" + Local $LineNb = 1 + Local $RegexResults + Local $CurrentModule + Local $CurrentType + + FileSetPos($DataFile, 0, $FILE_BEGIN) + + While True + $Line = FileReadLine($DataFile) + If @error then ExitLoop + + $RegexResults = StringRegExp($Line, "\@K=(.+?),", $STR_REGEXPARRAYMATCH) + If $RegexResults[0] == "module" Then + ConsoleWrite(".") + $RegexResults = StringRegExp($Line, "\@N=(.+?),", $STR_REGEXPARRAYMATCH) + $CurrentModule = $RegexResults[0] + FileWriteLine($SortedDataFile, $Line) + FileClose($DataFile) + _FileWriteToLine(@ScriptDir & "\TreeHierarchy.csv", $LineNb, "", True) + $DataFile = FileOpen(@ScriptDir & "\TreeHierarchy.csv", 1) + FileSetPos($DataFile, 0, $FILE_BEGIN) + $LineNb = 1 + + While True + $Line = FileReadLine($DataFile) + If @error then ExitLoop + + $RegexResults = StringRegExp($Line, "\@K=(.+?),", $STR_REGEXPARRAYMATCH) + If $RegexResults[0] == "type" Then + $RegexResults = StringRegExp($Line, "\@M=(.+?),", $STR_REGEXPARRAYMATCH) + If $RegexResults[0] == $CurrentModule Then + $RegexResults = StringRegExp($Line, "\@N=(.+?),", $STR_REGEXPARRAYMATCH) + $CurrentType = $RegexResults[0] + FileWriteLine($SortedDataFile, $Line) + FileClose($DataFile) + _FileWriteToLine(@ScriptDir & "\TreeHierarchy.csv", $LineNb, "", True) + $DataFile = FileOpen(@ScriptDir & "\TreeHierarchy.csv", 1) + FileSetPos($DataFile, 0, $FILE_BEGIN) + $LineNb = 1 + + While True + $Line = FileReadLine($DataFile) + If @error then ExitLoop + + $RegexResults = StringRegExp($Line, "\@K=(.+?),", $STR_REGEXPARRAYMATCH) + If $RegexResults[0] == "function" Then + $RegexResults = StringRegExp($Line, "\@P=(.+?),", $STR_REGEXPARRAYMATCH) + If $RegexResults[0] == $CurrentType Then + FileWriteLine($SortedDataFile, $Line) + FileClose($DataFile) + _FileWriteToLine(@ScriptDir & "\TreeHierarchy.csv", $LineNb, "", True) + $DataFile = FileOpen(@ScriptDir & "\TreeHierarchy.csv", 1) + FileSetPos($DataFile, 0, $FILE_BEGIN) + $LineNb = 0 + EndIf + EndIf + $LineNb += 1 + WEnd + FileSetPos($DataFile, 0, $FILE_BEGIN) + $LineNb = 0 + EndIf + EndIf + $LineNb += 1 + WEnd + FileSetPos($DataFile, 0, $FILE_BEGIN) + $LineNb = 0 + EndIf + $LineNb += 1 + Wend + If FileGetSize(@ScriptDir & "\TreeHierarchy.csv") <> 0 Then + FileWrite($Log, "ERROR : Some items couldn't be sorted. Verify them in the file TreeHierarchy.csv"&@CRLF) + ConsoleWrite(@CRLF&"INFO : Some items couldn't be sorted. Verify them in the file TreeHierarchy.csv"&@CRLF) + EndIf + FileClose($DataFile) + $DataFile = $SortedDataFile +EndFunc + + +Func FindInFunctionList($String) + Local $Line = "" + Local $TempStringArray + FileSetPos($FunctionList, 0, $FILE_BEGIN) + ;FileWrite($Log, 'Trying to find the function prototype for : ' & $String & @CRLF) + While 1 + $Line = FileReadLine($FunctionList) + If @error = -1 Then + SetError(0) + FileWrite($Log, "ERROR : Couldn't find " & $String & " in file. Does this method exitsts ?" & @CRLF) + Return $String + EndIf + If StringInStr($Line, $String) Then + $TempStringArray = StringSplit($Line, "-") + $Line = "[" & $TempStringArray[1] & ":" & $TempStringArray[2] & "()]" & '(#' & StringLower($Line) & ')' + Return $Line + EndIf + WEnd +EndFunc \ No newline at end of file diff --git a/Utils/Slate Documentation Generator/src/Parser.au3 b/Utils/Slate Documentation Generator/src/Parser.au3 new file mode 100644 index 000000000..307b98d20 --- /dev/null +++ b/Utils/Slate Documentation Generator/src/Parser.au3 @@ -0,0 +1,460 @@ +; This file include every function strictly related to the parsing of data in .lua files + +; Get the first comment block after $CarretPos +; We will also grab function declaration if possible/applicable +; The return is a Array : CarretPosition|BlockContent|Declaration|CarretPositionStart +Func ReadNextBlock($File, $CarretPos) + local $CommentBlock = "" ; This is where we'll store the comment block + local $Declaration = "" ; This is the next line after the comment block : usually the declaration statement + local $CurrentLine = "" + local $CurrentCarretPos = 0 + + local $IsCommentBlock = False + + local $RegExResult + local $RegexPos + + ; Start reading from $CarretPos + FileSetPos($File, $CarretPos, $FILE_BEGIN) + + ; Read till we find a comment block + Do + $CurrentLine = FileReadLine($File) + If @error Then ; We probably reached the eof + Local $ReturnArray[3] = [$CurrentCarretPos, "", ""] + Return $ReturnArray + ElseIf StringInStr($CurrentLine, "---") Then + $IsCommentBlock = True + EndIf + Until $IsCommentBlock + + Local $CarretPosStart = FileGetPos($File) - StringLen($CurrentLine) - 2 + + ; Add the first line to our comment block + $RegExResult = StringRegExp($CurrentLine, "---(.*)", $STR_REGEXPARRAYMATCH) + If Not @error Then ; The first line of the comment could be empty ! + $CommentBlock &= $RegExResult[0]&@CRLF + EndIf + + ; Read the comment block + Do + $CurrentCarretPos = FileGetPos($File) + $CurrentLine = FileReadLine($File) + If StringInStr($CurrentLine, "--") Then ; If we can't find any "--" in the line, then it's not the comment block anymore + $RegExResult = StringRegExp($CurrentLine, "--(.*)", $STR_REGEXPARRAYMATCH) + If Not @error Then; The line of the comment could be empty ! + $CommentBlock &= $RegExResult[0]&@CRLF + EndIf + Else + $IsCommentBlock = False + EndIf + Until Not $IsCommentBlock + + ; Ok, so now this is strange. If the comment block is class', we're going to have to check the + ; next comment block. If this next comment block contains a field, that is the same name as the class, then this + ; new comment block contains the whole informtion for the class. This is very shitty, but it's a workaround to + ; make intellisense show classes info while programing + If ParseForOneTag($CommentBlock, "@type") Then + Local $CommentBlock2 = "" + Do + $CurrentLine = FileReadLine($File) + If @error Then + Local $ReturnArray[3] = [$CurrentCarretPos, "", ""] + Return $ReturnArray + ElseIf StringInStr($CurrentLine, "---") Then + $IsCommentBlock = True + EndIf + Until $IsCommentBlock + + $RegExResult = StringRegExp($CurrentLine, "---(.*)", $STR_REGEXPARRAYMATCH) + If Not @error Then + $CommentBlock2 &= $RegExResult[0]&@CRLF + EndIf + + ; Yep, the next comment is the description of the class, let's read on ! + If StringInStr($CurrentLine, ParseForOneTag($CommentBlock, "@type")) And StringInStr($CurrentLine, "extend") Then + + Do + $CurrentLine = FileReadLine($File) + If StringInStr($CurrentLine, "--") Then + $RegExResult = StringRegExp($CurrentLine, "--(.*)", $STR_REGEXPARRAYMATCH) + If Not @error Then + $CommentBlock2 &= $RegExResult[0]&@CRLF + EndIf + Else + $IsCommentBlock = False + EndIf + Until Not $IsCommentBlock + + ; remove the line(s) with "@field" in the comment block. They are only needed for the intellisense hack + While 1 + $RegexResult = StringRegExp($CommentBlock2, "(.*)@field(.*)", $STR_REGEXPARRAYMATCH, $RegexPos) + $RegexPos = @extended + If @extended == 0 Then ExitLoop + + $CommentBlock2 = StringRegExpReplace($CommentBlock2, "(.*)@field(.*)", "", 1) + WEnd + + ; We also don't need the first line of the first comment block anymore... + ; $CommentBlock = StringRegExpReplace($CommentBlock, "(.*)", "", 1) + + ; append the description at the start of the comment block + $CommentBlock = $CommentBlock2&$CommentBlock + EndIf + + + ; We also need to check if the type is a list or a map. If so, the comment block does not describe a class, but a simple list / map. + ; It will have the formatting of a class, though, because it's closer closer to the actual code, even though it is highly confusing. + ; But it will only have 1 field : the list or map. + If StringInStr($CommentBlock, "@list") Then + $RegExResult = StringRegExp($CommentBlock, "@list\h<(.*?)>\h(.*)", $STR_REGEXPARRAYMATCH) + if not @error Then + $CommentBlock &= "@field #table["&$RegExResult[0]&"] "&$RegExResult[1] + EndIf + EndIf + ; TODO : Add support for @map the same way... + EndIf + + + + + ; We'll take the next line, as it might be the declaration statement + $Declaration = $CurrentLine + + + + ; let's do some cleanup + $CommentBlock = StringRegExpReplace($CommentBlock, "(?m)^\h+", "") ;remove leading whitespaces + $CommentBlock = StringRegExpReplace($CommentBlock, "(?m)\h+$", "") ;remove trailing whitespaces + $CommentBlock = StringRegExpReplace($CommentBlock, "(?m)^[#]+", "##### ") + $CommentBlock = StringRegExpReplace($CommentBlock, "(?m)^\h+", "") ;remove leading whitespaces again now that we removed the "#"s + $CommentBlock = StringRegExpReplace($CommentBlock, "(?m)-{3,}", "") ;remove sequences of at least 3 "-" which will mess up markdown + $CommentBlock = StringRegExpReplace($CommentBlock, "(?m)={3,}", "") ; remove sequences of at least 3 "=" which will mess up markdown + + Local $ReturnArray[4] = [$CurrentCarretPos, $CommentBlock, $Declaration, $CarretPosStart] + Return $ReturnArray +EndFunc + +; Parses the block and returns the data for one tag +; don't use it to find the function tag ! +Func ParseForOneTag($Block, $Tag) + Local $i = 1 + Local $DataArray[1] + Local $RegexResult[1] + Local $RegexPos = 1 + Local $Regex + + ; If we look for @usage, then it's a multiline data, the regex is different + If $Tag == "@usage" Then + $Regex = "(?s)@usage(.*)" + $RegexResult = StringRegExp($Block, $Regex, $STR_REGEXPARRAYMATCH, $RegexPos) + Else + $Regex = $Tag&"\h(.*)\s" + $RegexResult = StringRegExp($Block, $Regex, $STR_REGEXPARRAYMATCH, $RegexPos) + Endif + + If @error Then + Return "" + Else + Return $RegexResult[0] + EndIf + +EndFunc ;==>ReadOneTag + +; Parses the block and returns the data for multiple tags in an array +; Don't use it for @param ! +Func ParseForTags($Block, $Tag) + Local $i = 1 + Local $DataArray[1] + Local $RegexResult[1] + Local $RegexPos = 1 + + Local $Regex = $Tag&"(?m)\h([^\s]*)(?:\h)?([^\s]*)?(?:\h)?(.*)?$" + ; For each tag + While True + $RegexResult = StringRegExp($Block, $Regex, $STR_REGEXPARRAYMATCH, $RegexPos) + $RegexPos = @extended + If $RegexPos == 0 Then ; We couldn't find any tag + If Not $DataArray[0] Then + Return "" + Else + Return $DataArray + EndIf + EndIf + + ; Add the tag to the array.The array looks like this : type1|param1|description1|type2... + ReDim $DataArray[$i * 3] + $DataArray[($i * 3) - 3] = $RegexResult[0] + If $RegexResult[1] == "" Then + $DataArray[($i * 3) - 2] = "self" ; if the first param doesn't have a name, then it's self + Else + $DataArray[($i * 3) - 2] = $RegexResult[1] + EndIf + $DataArray[($i * 3) - 1] = $RegexResult[2] + $i += 1 + WEnd +EndFunc + +; Parses both the comment block and the declaration to find the function name and it's type +; Compares both of them if possible, but will always return the one in the comment block if possible +Func ParseFunctionName($CommentBlock, $Declaration) + local $RegExResult + local $FunctionNameFromDec + local $FunctionNameFromComment + local $ReturnArray[2] + + ; Parse for function name in both the comment block and the desclaration + $RegExResult = StringRegExp($CommentBlock, "\@function\h(?:(\[.*\]\h))?(.*)", $STR_REGEXPARRAYMATCH) + If Not @error Then + $FunctionNameFromComment = $RegExResult[1] + EndIf + $RegExResult = StringRegExp($Declaration, "function\h(?:.*\:)?(.*)\(.*\)", $STR_REGEXPARRAYMATCH) + If Not @error Then + $FunctionNameFromDec = $RegExResult[0] + EndIf + + ; compare them to each other + If $FunctionNameFromComment Then + If $FunctionNameFromDec <> $FunctionNameFromComment Then + FileWrite($Log,"CAUTION : The commented function doesn't match its declaration : "&$FunctionNameFromComment& " -> "&$Declaration&@CRLF) + EndIf + $ReturnArray[0] = $FunctionNameFromComment + ElseIf $FunctionNameFromDec Then + ;FileWrite($Log, "CAUTION: No data matching @function found in block, inferring the function name from its declaration : "& $FunctionNameFromDec & @CRLF) + $ReturnArray[0] = $FunctionNameFromDec + Else + $ReturnArray[0] = "" + $ReturnArray[1] = "" + return $ReturnArray + EndIf + + ;parses for function type in both the comment block and the desclaration + local $TypeFromComment + local $TypeFromDec + + $RegExResult = StringRegExp($Declaration, "function\h(.*):", $STR_REGEXPARRAYMATCH) + If Not @error Then + $TypeFromDec = $RegExResult[0] + EndIf + $RegExResult = StringRegExp($CommentBlock, "function\h\[parent=#(.*)\]", $STR_REGEXPARRAYMATCH) + If Not @error Then + $TypeFromComment = $RegExResult[0] + EndIf + + ; compare them to each other + If $TypeFromComment Then + If $TypeFromDec <> $TypeFromComment Then + FileWrite($Log,"CAUTION : The commented function type doesn't match its declaration : "&$TypeFromComment& " -> "&$Declaration&@CRLF) + EndIf + $ReturnArray[1] = $TypeFromComment + ElseIf $TypeFromDec Then + ;FileWrite($Log, "CAUTION: No function type found in block, inferring the function type from its declaration : "& $TypeFromDec & @CRLF) + $ReturnArray[1] = $TypeFromDec + Else + $ReturnArray[0] = "" + $ReturnArray[1] = "" + return $ReturnArray + EndIf + + Return $ReturnArray +EndFunc + +; Specifically designed to parse for @param tags +; will verify the comment by matching with the declaration (theoretically, I'm pretty sure it's bugged) +Func ParseParams($CommentBlock, $Declaration) + Local $ParamsFromComment = ParseForTags($CommentBlock, "@param") + Local $RegExResult + Local $RegexPos = StringInStr($Declaration, "(") + Local $ParamsFromDec[0] + Local $NbParam = 0 + + If StringInStr($Declaration, ":") Then + $NbParam = 1 + ReDim $ParamsFromDec[1] + $ParamsFromDec[0] = "self" + EndIf + + ; extract params from function decaration + While True + $RegExResult = StringRegExp($Declaration, "([^,\(\)\h]+)", $STR_REGEXPARRAYMATCH, $RegexPos) + $RegexPos = @extended + If @extended == 0 Then ExitLoop + + $NbParam += 1 + Redim $ParamsFromDec[$NbParam] + $ParamsFromDec[$NbParam-1] = $RegExResult[0] + WEnd + + ; compare these parameters with those found in the comment block + If UBound($ParamsFromComment) <> UBound($ParamsFromDec)*3 Then + FileWrite($Log, "CAUTION: The number of parameters don't match between the comment block and declaration "& @CRLF) + Else + + For $i=0 To $NbParam-1 + If $ParamsFromDec[$i] <> $ParamsFromComment[($i*3)+1] Then + FileWrite($Log, "CAUTION: Parameters missmatch between the comment block and declaration "& @CRLF) + FileWrite($Log, $ParamsFromComment[($i*3)+1]& " -> " & $ParamsFromDec[$i]&@CRLF) + ExitLoop + EndIf + Next + EndIf + + Return $ParamsFromComment +EndFunc + +; This does 3 things : +; - Replace the hyperlinks with new ones +; - change the stuff starting with # (#nil -> Nil) +; - Replace pictures paths +Func ReplaceHyperlinks($TempFile) + Local $StringFile = "" + Local $RegexResult + Local $RegexPos = 1 + Local $NewURL = "" + Local $i = 0 + FileSetPos($TempFile, 0, $FILE_BEGIN) + + $StringFile = FileRead($TempFile) + + ; Replace HyperLinks Using Regexs + ; --------------------------------------------------------- + While 1 ; @{File.Module} + $RegexResult = StringRegExp($StringFile, "\@{([A-Z][^\.#}]+)\.([^\.#}]+)}", $STR_REGEXPARRAYMATCH, $RegexPos) ; + $RegexPos = @extended + If @extended == 0 Then ExitLoop + + $NewURL = "[" & $RegexResult[1] & "](#" & StringLower($RegexResult[1]) & "-module-)" + ;FileWrite($Log, "Module : " & $RegexPos & " : " & _ArrayToString($RegexResult) & " -> " & $NewURL & @CRLF) + $StringFile = StringRegExpReplace($StringFile, "\@{([A-Z][^\.#}]+)\.([^\.#}]+)}", $NewURL, 1) + WEnd + While 1 ; @{Module} + $RegexResult = StringRegExp($StringFile, "\@{([A-Z][^\.#}]+)}", $STR_REGEXPARRAYMATCH, $RegexPos) + $RegexPos = @extended + If @extended == 0 Then ExitLoop + + $NewURL = "[" & $RegexResult[0] & "](#" & StringLower($RegexResult[0]) & "-module-)" + ;FileWrite($Log, "Module : " & $RegexPos & " : " & _ArrayToString($RegexResult) & " -> " & $NewURL & @CRLF) + $StringFile = StringRegExpReplace($StringFile, "\@{([A-Z][^\.#}]+)}", $NewURL, 1) + WEnd + While 1 ; @{File.Module#TYPE} + $RegexResult = StringRegExp($StringFile, "\@{([A-Z][^\.#}]+)\.([A-Z][^\.#}]+)#([A-Z,_]+)}", $STR_REGEXPARRAYMATCH, $RegexPos) + $RegexPos = @extended + If @extended == 0 Then ExitLoop + + $NewURL = "[" & $RegexResult[2] & "](#" & StringLower($RegexResult[2]) & "-class-)" + ;FileWrite($Log, "Class : " & $RegexPos & " : " & _ArrayToString($RegexResult) & " -> " & $NewURL & @CRLF) + $StringFile = StringRegExpReplace($StringFile, "\@{([A-Z][^\.#}]+)\.([A-Z][^\.#}]+)#([A-Z,_]+)}", $NewURL, 1) + WEnd + While 1 ; @{Module#TYPE} + $RegexResult = StringRegExp($StringFile, "\@{([A-Z][^\.#}]+)#([A-Z,_]+)}", $STR_REGEXPARRAYMATCH, $RegexPos) + $RegexPos = @extended + If @extended == 0 Then ExitLoop + + $NewURL = "[" & $RegexResult[1] & "](#" & StringLower($RegexResult[1]) & "-class-)" + ;FileWrite($Log, "Class : " & $RegexPos & " : " & _ArrayToString($RegexResult) & " -> " & $NewURL & @CRLF) + $StringFile = StringRegExpReplace($StringFile, "\@{([A-Z][^\.#}]+)#([A-Z,_]+)}", $NewURL, 1) + WEnd + While 1 ; @{#TYPE} + $RegexResult = StringRegExp($StringFile, "\@{#([A-Z,_]+)}", $STR_REGEXPARRAYMATCH, $RegexPos) + $RegexPos = @extended + If @extended == 0 Then ExitLoop + + $NewURL = "[" & $RegexResult[0] & "](#" & StringLower($RegexResult[0]) & "-class-)" + ;FileWrite($Log, "Class : " & $RegexPos & " : " & _ArrayToString($RegexResult) & " -> " & $NewURL & @CRLF) + $StringFile = StringRegExpReplace($StringFile, "\@{#([A-Z,_]+)}", $NewURL, 1) + WEnd + While 1 ; #TYPE&@CR + $RegexResult = StringRegExp($StringFile, "\h#([A-Z,_]+)\s", $STR_REGEXPARRAYMATCH, $RegexPos) + $RegexPos = @extended + If @extended == 0 Then ExitLoop + + $NewURL = " [" & $RegexResult[0] & "](#" & StringLower($RegexResult[0]) & "-class-)"&@CRLF + ;FileWrite($Log, "Class : " & $RegexPos & " : " & _ArrayToString($RegexResult) & " -> " & $NewURL & @CRLF) + $StringFile = StringRegExpReplace($StringFile, "\h#([A-Z,_]+)\s", $NewURL, 1) + WEnd + While 1 ; @{File.Module#TYPE.Function}(), catches the parenthesis + $RegexResult = StringRegExp($StringFile, "\@{([A-Z][^#}\.]+)\.([A-Z][^#}\.]+)#([A-Z,_]+)\.([^#\.]+)}[\(]?[\)]?", $STR_REGEXPARRAYMATCH, $RegexPos) + $RegexPos = @extended + If @extended == 0 Then ExitLoop + + $NewURL = FindInFunctionList($RegexResult[2] & "-" & $RegexResult[3]&"-") + ;FileWrite($Log, "Class : " & $RegexPos & " : " & _ArrayToString($RegexResult) & " -> " & $NewURL & @CRLF) + $StringFile = StringRegExpReplace($StringFile, "\@{([A-Z][^#}\.]+)\.([A-Z][^#}\.]+)#([A-Z,_]+)\.([^#\.]+)}[\(]?[\)]?", $NewURL, 1) + WEnd + While 1 ; @{Module#TYPE.Function}(), catches the parenthesis + $RegexResult = StringRegExp($StringFile, "\@{([A-Z][^#}\.]+)#([A-Z,_]+)\.([^#}\.]+)}[\(]?[\)]?", $STR_REGEXPARRAYMATCH, $RegexPos) + $RegexPos = @extended + If @extended == 0 Then ExitLoop + + $NewURL = FindInFunctionList($RegexResult[1] & "-" & $RegexResult[2]&"-") + ;FileWrite($Log, "Class : " & $RegexPos & " : " & _ArrayToString($RegexResult) & " -> " & $NewURL & @CRLF) + $StringFile = StringRegExpReplace($StringFile, "\@{([A-Z][^#}\.]+)#([A-Z,_]+)\.([^#}\.]+)}[\(]?[\)]?", $NewURL, 1) + WEnd + While 1 ; @{#TYPE.Function}(), catches the parenthesis + $RegexResult = StringRegExp($StringFile, "\@{#([A-Z,_]+)\.([^#}\.]+)}[\(]?[\)]?", $STR_REGEXPARRAYMATCH, $RegexPos) + $RegexPos = @extended + If @extended == 0 Then ExitLoop + + $NewURL = FindInFunctionList($RegexResult[0] & "-" & $RegexResult[1]&"-") + ;FileWrite($Log, "Class : " & $RegexPos & " : " & _ArrayToString($RegexResult) & " -> " & $NewURL & @CRLF) + $StringFile = StringRegExpReplace($StringFile, "\@{#([A-Z,_]+)\.([^#}\.]+)}[\(]?[\)]?", $NewURL, 1) + WEnd + While 1 ; Module#TYPE + $RegexResult = StringRegExp($StringFile, "\h(\w+[^\h\_])#(.*?)\h", $STR_REGEXPARRAYMATCH, $RegexPos) + $RegexPos = @extended + If @extended == 0 Then ExitLoop + + $NewURL = " [" & $RegexResult[1] & "](#" & StringLower($RegexResult[1]) & "-class-) " + ;FileWrite($Log, "Class : " & $RegexPos & " : " & _ArrayToString($RegexResult) & " -> " & $NewURL & @CRLF) + $StringFile = StringRegExpReplace($StringFile, "\h(\w+[^\h\_])#(.*?)\h", $NewURL, 1) + WEnd + While 1 ; File.Module#TYPE + $RegexResult = StringRegExp($StringFile, "\h(\w+)\.(\w+)#(.*?)\h", $STR_REGEXPARRAYMATCH, $RegexPos) + $RegexPos = @extended + If @extended == 0 Then ExitLoop + + $NewURL = " [" & $RegexResult[2] & "](#" & StringLower($RegexResult[2]) & "-class-) " + ;FileWrite($Log, "Class : " & $RegexPos & " : " & _ArrayToString($RegexResult) & " -> " & $NewURL & @CRLF) + $StringFile = StringRegExpReplace($StringFile, "\h(\w+)\.(\w+)#(.*?)\h", $NewURL, 1) + WEnd + While 1 ; #TYPE.type (nested type... really annoying and confusing lua stuff) + $RegexResult = StringRegExp($StringFile, "\h#([A-Z,_]+)\.(\w+)\h", $STR_REGEXPARRAYMATCH, $RegexPos) + $RegexPos = @extended + If @extended == 0 Then ExitLoop + + $NewURL = " [" & $RegexResult[1] & "](#" &StringLower($RegexResult[0])& "-"& StringLower($RegexResult[1]) & "-class-)" + ;FileWrite($Log, "Class : " & $RegexPos & " : " & _ArrayToString($RegexResult) & " -> " & $NewURL & @CRLF) + $StringFile = StringRegExpReplace($StringFile, "\h#([A-Z,_]+)\.(\w+)\h", $NewURL, 1) + WEnd + + ; Clean stuff with # + ; --------------------------------------------------------- + $StringFile = StringReplace($StringFile, "#nil", "Nil") + $StringFile = StringReplace($StringFile, "#number", "Number") + $StringFile = StringReplace($StringFile, "#boolean", "Boolean") + $StringFile = StringReplace($StringFile, "#string", "String") + $StringFile = StringReplace($StringFile, "#table", "List[]") + $StringFile = StringReplace($StringFile, "#function", "Function()") + + ; And replace the pictures Path if any + ; --------------------------------------------------------- + While 1 + $RegexResult = StringRegExp($StringFile, "!\[(.*)\]\(.*\\(.*)\\(.*)\)", $STR_REGEXPARRAYMATCH, $RegexPos) + $RegexPos = @extended + If @extended == 0 Then ExitLoop + + $NewPic = "![" & $RegexResult[0] & "](/includes/Pictures/" & $RegexResult[1] & "/"& $RegexResult[2]&")" + $StringFile = StringRegExpReplace($StringFile, "!\[(.*)\]\(.*\\(.*)\\(.*)\)", $NewPic, 1) + WEnd + + While 1 + $RegexResult = StringRegExp($StringFile, "(?m)^(\d(?:(\.\d))*\)(.*))$", $STR_REGEXPARRAYMATCH, $RegexPos) + $RegexPos = @extended + If @extended == 0 Then ExitLoop + + ;$StringFile = StringRegExpReplace($StringFile, "(?m)^(\d(?:(\.\d))*\)(.*))$", "

"&$RegExResult[0]&"

", 1) + $StringFile = StringRegExpReplace($StringFile, "(?m)^(\d(?:(\.\d))*\)(.*))$", "##### "&$RegExResult[0], 1) + WEnd + + Return $StringFile +EndFunc \ No newline at end of file diff --git a/Utils/Slate Documentation Generator/src/SlateGenerator2.au3 b/Utils/Slate Documentation Generator/src/SlateGenerator2.au3 new file mode 100644 index 000000000..75f8ea703 --- /dev/null +++ b/Utils/Slate Documentation Generator/src/SlateGenerator2.au3 @@ -0,0 +1,310 @@ +#Region ;**** Directives created by AutoIt3Wrapper_GUI **** +#AutoIt3Wrapper_Outfile=..\bin\SlateDocGenerator2.exe +#AutoIt3Wrapper_Change2CUI=y +#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** +#cs +This is the main script + +The script goal is to read .lua file, extract the documentation in comment blocks, and write .md files to be converted to html by Slate : https://github.com/lord/slate +It works in 5 steps : + +First, it reads the .lua files one bt one, indentifying the comment blocks. for each comment block, it determines the kind of content the comment block describes (module, class/type or function), +find some usefull stuff (for exemple in the declaration...) and writes all of this info in the creatively named TreeHierarchy.csv, with this format : +@K=kind, @M=ParentModule, @N=Name, @P=Parent, @F=FileWhereTheCommentBlockIsLocated, @C=CarretPositionOfTheCommentBlock +The functions used to do this step are mostly found in Parser.au3 + +Then the second step is the longest : we sort the TreeHiearchy.csv, and put the result into TreeHierarchySorted.csv +The idea is to have the data in this order : +Module A +Class A (belongs to Module A) +Function A (belongs to Class A) +Function B (belongs to Class A) +Class B Class A (belongs to Module A) +Function C (belongs to Class B) +Function D (belongs to Class B) +Module B ... +The functions used to do this step are found in DataStorer.au3 + +Then, step 3 : We read each line of TreeHierarchySorted.csv, read the appropriate comment block in the .lua source files, +and write the appropriate Markdown documentation for it in a temporary folder +This is where the markdown documentation is actually written for the first time. +The functions used to do this step are found in Writer.au3 + +Step 4 ! We read the newly created Markdown files, trying to find hyperlinks/picture paths... and we replace them with the new ones. +We copy each processed file into it's final destination. +The functions used to do this step are mostly found in Parser.au3 + +And finally Step 5 : We add the new markdown files to Slate's index and delete temporary files and folder +#ce + +#include +#include +#include +#include + +; Those are the arguments that need to be passed at the start +Global $SourceFolder = $CmdLine[1] ;"./Results" +Global $OutputFolder = $CmdLine[2] ;"@ScriptDir&"/source/index.html.md" + +Global $Log = FileOpen(@ScriptDir & "\SlateGenerator2.log", 2) +Global $DataFile = FileOpen(@ScriptDir & "\TreeHierarchy.csv", 2) +Global $FunctionList = FileOpen(@ScriptDir & "\FuctionList.txt", 2) + +#include "Parser.au3" +#include "DataStorer.au3" +#include "Writer.au3" + + +Func ExitCleanly() + FileClose($DataFile) + FileClose($FunctionList) + FileWrite($Log, "SlateGenerator2 exited cleanly") + FileClose($Log) +EndFunc + + +; Small function to determine if a comment block is describing a module, a type or a function +Func IdentifyBlock($Block, $Declaration) + Local $Kind + Local $KindFunction + + $Kind = ParseForOneTag($Block, "@module") + If $Kind Then + Return "module" + EndIf + + $Kind = ParseForOneTag($Block, "@type") + If $Kind Then + Return "type" + EndIf + + + $KindFunction = ParseFunctionName($Block, $Declaration) + If $KindFunction[0] Then + Return "function" + EndIf + + Return "" +EndFunc + + + + +; ----------------------------------------------------------------- +; Main +; ----------------------------------------------------------------- + +; Step 1 ! +; ----------------------------------------------------------------- + +Local $SourceList = _FileListToArrayRec($SourceFolder, "*", $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_NOSORT, $FLTAR_FULLPATH) +Local $CurrentFile +Local $CarretPos = 0 +Local $CommentBlock +Local $CommentKind +Local $CommentInfo[2] +Local $CurrentModule + +ConsoleWrite("1. Parsing Source Files... ") +FileWrite($Log, @CRLF&@CRLF&@TAB&"INFO : Building Hierarchy" & @CRLF) +For $i=1 To $SourceList[0] ; for each .lua source file + + + FileWrite($Log, "DEBUG : "&$SourceList[$i]) + + ; let's read the next .lua source file + $CurrentFile = FileOpen($SourceList[$i], $FO_READ) + FileWrite($Log, @CRLF&"INFO : Reading File "&$SourceList[$i] & @CRLF) + While True ; for each comment block in the current .lua source file + + ; We read the next comment block. If we could not, it's probably eof, time to open the next .lua file + $CommentBlock = ReadNextBlock($CurrentFile, $CarretPos) + If Not $CommentBlock[1] Then + ExitLoop + EndIf + + $CarretPos = $CommentBlock[0] + $CommentKind = IdentifyBlock($CommentBlock[1], $CommentBlock[2]) + ; Depending on the kind of comment block it is, we write the appropriate line in TreeHierarchy.csv + Switch $CommentKind + Case "function" + $CommentInfo = ParseFunctionName($CommentBlock[1], $CommentBlock[2]) + AddNode("function", $CurrentModule, $CommentInfo[0], $CommentInfo[1], $SourceList[$i], $CommentBlock[3]) + FileWrite($Log, "INFO : Added function "&$CommentInfo[0]&" to hierarchy" & @CRLF) + Case "type" + $CommentInfo[0] = ParseForOneTag($CommentBlock[1], "@type") + $CommentInfo[1] = ParseForOneTag($CommentBlock[1], "@extends") + $CommentInfo[1] = StringRegExpReplace($CommentInfo[1], "(.*#)", "") + AddNode("type", $CurrentModule, $CommentInfo[0], $CommentInfo[1], $SourceList[$i], $CommentBlock[3]) + FileWrite($Log, "INFO : Added type "&$CommentInfo[0]&" to hierarchy" & @CRLF) + Case "module" + $CurrentModule = ParseForOneTag($CommentBlock[1], "@module") + AddNode("module", "", $CurrentModule, "", $SourceList[$i], $CommentBlock[3]) + FileWrite($Log, "INFO : Added module "&$CurrentModule&" to hierarchy" & @CRLF) + EndSwitch + + WEnd + $CarretPos = 0 + FileClose($CurrentFile) + +Next +ConsoleWrite("Done"&@CRLF) + + +; Step 2 ! +; ----------------------------------------------------------------- +ConsoleWrite("2. Sorting Hierarchy") +FileWrite($Log, @CRLF&@CRLF&@TAB&"INFO : Sorting Hierarchy" & @CRLF) +; The magic happens in DataStorer.au3 +DataSort() +ConsoleWrite("Done"&@CRLF) + + + +; Step 3 ! +; ----------------------------------------------------------------- +ConsoleWrite("3. Writing Markdown Documentation") +FileWrite($Log, @CRLF&@CRLF&@TAB&"INFO : Writing Markdown Documentation" & @CRLF) + +Local $CurrentOutput +Local $CurrentFolder +Local $RegexResult +Local $Line +Local $CarretPos = 0 +Local $Results +Local $Output +Local $Declaration + +FileSetPos($DataFile, 0, $FILE_BEGIN) +While True ; For each line in TreeHierarchySorted.csv + + ; read the next line until eof + FileSetPos($DataFile, $CarretPos, $FILE_BEGIN) + $Line = FileReadLine($DataFile) + If @error Then ; eof + ExitLoop + Endif + + $CarretPos = FileGetPos($DataFile) + + ; find the file/position of the next comment block referenced in the line + $RegexResult = StringRegExp($Line, "\@F=(.+?),", $STR_REGEXPARRAYMATCH) + $CurrentFile = FileOpen($RegexResult[0], $FO_READ) + + $RegexResult = StringRegExp($Line, "\@C=(.+?),", $STR_REGEXPARRAYMATCH) + $DataPos = $RegexResult[0] + + ; get the comment block itself + $Results = ReadNextBlock($CurrentFile, $DataPos) + $Block = $Results[1] + $Declaration = $Results[2] + + + ; choose the right function to write mardown depending on the type of comment block + $RegexResult = StringRegExp($Line, "\@K=(.+?),", $STR_REGEXPARRAYMATCH) + + If $RegexResult[0] == "module" Then + ConsoleWrite(".") + ; We need the name of the folder containing this particular source file + $RegexResult = StringRegExp($Line, "\@F=(.+?),", $STR_REGEXPARRAYMATCH) + $RegexResult = StringRegExp($RegexResult[0], "\\(.*)\\.*\.lua", $STR_REGEXPARRAYMATCH) + If @error Then + $CurrentFolder = "" + Else + $CurrentFolder = $RegexResult[0] + Endif + + ; Now we can write the markdown for this module + $CurrentOutput = WriteModule($Block, $CurrentFolder) + EndIf + + If $RegexResult[0] == "type" Then + ; We need the name of the Module containing the type + $RegexResult = StringRegExp($Line, "\@M=(.+?),", $STR_REGEXPARRAYMATCH) + + ; Now we can write the markdown for this type + WriteType($Block, $RegexResult[0], $CurrentOutput) + EndIf + + If $RegexResult[0] == "function" Then + ; We can write the markdown for this function + WriteFunction($Block, $Declaration, $CurrentOutput) + EndIf + + FileClose($CurrentFile) +Wend +ConsoleWrite("Done"&@CRLF) + + +; Step 4 ! +; ----------------------------------------------------------------- +ConsoleWrite("4. Processing Hyperlinks...") +FileWrite($Log, @CRLF&@CRLF&@TAB&"INFO : Processing Hyperlinks" & @CRLF) +Local $i=1 +Local $TempFilesArray = _FileListToArray(@ScriptDir & "/TEMP") +Local $CurrentFile +Local $FinalFile +While $i <= $TempFilesArray[0] ; For each markdown file in the temporary folder + + ;read the file + $CurrentFile = FileOpen(@ScriptDir & "/TEMP/" & $TempFilesArray[$i], 0) + ; The magic happens in Parser.au3 + $FinalString = ReplaceHyperlinks($CurrentFile) + + ; copy the result to the final file location + $FinalFile = FileOpen($OutputFolder & "/includes/" & $TempFilesArray[$i], 2) + FileWrite($FinalFile, $FinalString) + + FileClose($FinalFile) + FileClose($CurrentFile) + $i += 1 +WEnd +ConsoleWrite("Done"&@CRLF) + + +; Step 5 ! +; ----------------------------------------------------------------- +ConsoleWrite("5. Adding new documentation to index...") +FileWrite($Log, @CRLF&@CRLF&@TAB&"INFO : Adding new documentation to index" & @CRLF) + +; Now this is a bit annoying : there is no way to insert a line in a document. +; So we need to read the first half of it, read the second half, and the wipe the whole document +; This way, in the new doc, we can write the first half, what we wanted to insert, and then the second half ! + +; Let's store the index file in $IndexString +Local $IndexFile = $OutputFolder&"/index.html.md" +Local $IndexFileHandle = FileOpen($IndexFile, 0) +Local $IndexString = FileRead($IndexFileHandle) +$IndexString = StringRegExpReplace($IndexString, "-\h[A-Z][a-z]+\.[A-Z][a-z]+\s", "") + +; Now we slpit it into and store the results in $BeforeString and $AfterString +Local $SearchPos = StringInStr($IndexString, "search:") +local $BeforeString = StringTrimRight($IndexString, StringLen($IndexString) - $SearchPos + 5) +local $AfterString = StringTrimLeft($IndexString, $SearchPos - 1) + +; reopening the index file wiping everything +FileClose($IndexFileHandle) +$IndexFileHandle = FileOpen($IndexFile, 2) + +; write the first half +FileWrite($IndexFileHandle, $BeforeString) +Local $IncludePos = StringInStr($IndexString, "includes:") +FileSetPos($IndexFileHandle, $IncludePos + 10, $FILE_BEGIN) + +; add the new markdown files to the index +$i = 1 +While $i <= $TempFilesArray[0] + FileWrite($Log, StringTrimRight($TempFilesArray[$i], 3)&@CRLF) + + FileWrite($IndexFileHandle, " - "&StringTrimRight($TempFilesArray[$i], 3)&@CRLF) + $i+=1 +WEnd +FileWrite($IndexFileHandle, @CRLF) + +; append the second half of the file +FileWrite($IndexFileHandle, $AfterString) +FileClose($IndexFileHandle) +ConsoleWrite("Done"&@CRLF) + +; WE ARE DONE ! +ExitCleanly() diff --git a/Utils/Slate Documentation Generator/src/Writer.au3 b/Utils/Slate Documentation Generator/src/Writer.au3 new file mode 100644 index 000000000..b6a249540 --- /dev/null +++ b/Utils/Slate Documentation Generator/src/Writer.au3 @@ -0,0 +1,209 @@ +; Takes an array and returns it in a markdown flavored list +; If the list is a retun, then, there is no variable name... +Func ArrayToList($Array, $Return) + $String = "" + $i = 0 + do + $String &= "* " + $String &= $Array[$i] & " " + + If $Return Then + If $Array[$i + 2] == "" or $Array[$i + 2] == " " Then + $String &= @CRLF + Else + $String &= " " & $Array[$i + 1] & " " & $Array[$i + 2] & @CRLF + EndIf + Else + + $String &= $Array[$i + 1] + If $Array[$i + 2] == "" or $Array[$i + 2] == " " Then + $String &= @CRLF + Else + $String &= " : " & $Array[$i + 2] & @CRLF + EndIf + EndIf + $i += 3 + Until $i >= UBound($Array) + Return $String +EndFunc + + +Func WriteModule($Block, $Group) + Local $ModuleName = ParseForOneTag($Block, "@module") + DirCreate(@ScriptDir & "\TEMP") + Local $Output = FileOpen(@ScriptDir & "\TEMP\" & $Group & "." & $ModuleName & ".md", $FO_OVERWRITE) + Local $Data = "" + Local $DataPos = 1 + + FileWrite($Log, @CRLF&@TAB&"Writing "&$Group & "." & $ModuleName & ".md" &@CRLF) + FileWrite($Log, "Writing Module "&$ModuleName&@CRLF) + + ; Add title of Module + FileWrite($Output, "# " & $Group & "." & $ModuleName & " Module" & @CRLF) + + ; Copy the short description + While StringRight($Data, 1) <> @CRLF And StringRight($Data, 1) <> @CR + If StringRight($Data, 7) == "@module" Then ; If there is no comment in the module block + Return $Output + EndIf + $Data &= StringMid($Block, $DataPos, 1) + $DataPos += 1 + WEnd + $Data = StringTrimRight($Data, 1) + $Block = StringTrimLeft($Block, $DataPos) + FileWrite($Output, $Data & @CRLF) + + ; copy the long description + $DataPos = 1 + $Data = "" + $Omit = False + While StringRight($Data, 7) <> "@module" + $Data &= StringMid($Block, $DataPos, 1) + $DataPos += 1 + WEnd + $Data = StringTrimRight($Data, 8) + FileWrite($Output, $Data & @CRLF) + Return $Output +EndFunc + + +Func WriteType($Block, $ModuleName, $Output) + Local $TypeName = ParseForOneTag($Block, "@type") + Local $ParentClass = GetData($TypeName, "parent") + Local $Fields = ParseForTags($Block, "@field") + + FileWrite($Log, "Writing Type "&$TypeName&@CRLF) + + ; Add title of Type + FileWrite($Output, "## " & $TypeName & " Class" & @CRLF) + + ; Add hierearchy info if necessary. Some cool ASCII drawing is going on ! + If $ParentClass <> "ROOT" Then + FileWrite($Output, "
" & @CRLF)
+		FileWrite($Output, "Inheritance : The " & $TypeName & " Class inherits from the following parents :" & @CRLF)
+		Local $Hierarchy = GetParents($TypeName)
+		Local $String = ""
+		Local $TabBuffer = @TAB
+		$String &= $Hierarchy[0]&@CRLF
+		For $i=1 to UBound($Hierarchy)-1
+			$String &= $TabBuffer&"`-- "&$Hierarchy[$i]&@CRLF
+			$TabBuffer &= @TAB
+		Next
+		FileWrite($Output, $String)
+		FileWrite($Output, "
" & @CRLF) + Else + FileWrite($Output, "
" & @CRLF)
+		FileWrite($Output, "The " & $TypeName & " class does not inherit" & @CRLF)
+		FileWrite($Output, "
" & @CRLF) + EndIf + + ; Copy the long description + Local $DataPos = 1 + Local $Data = "" + Local $Omit = False + + While StringRight($Data, 1) <> @CR ; We discard the first line + $Data &= StringMid($Block, $DataPos, 1) + $DataPos += 1 + WEnd + ; If there is a tag in the first line, there is no description + if StringInStr($Data, "@type") == 0 and StringInStr($Data, "@extends") == 0 and StringInStr($Data, "@field") == 0 Then + $Data = "" + $DataPos += 1 + + While StringRight($Data, 5) <> "@type" + $Data &= StringMid($Block, $DataPos, 1) + $DataPos += 1 + WEnd + $Data = StringTrimRight($Data, 5) + FileWrite($Output, $Data & @CRLF) + EndIf + + ; Add the Attributes + If IsArray($Fields) Then + FileWrite($Output, "

Attributes

" & @CRLF & @CRLF) + FileWrite($Output, ArrayToList($Fields, False) & @CRLF) + EndIf + FileWrite($Output, @CRLF) + Return $TypeName +EndFunc + + + +Func WriteFunction($Block, $Declaration, $Output) + Local $RegexResult = ParseFunctionName($Block, $Declaration) + Local $FunctionName = $RegexResult[0] + Local $TypeName = $RegexResult[1] + Local $Parameters = ParseParams($Block, $Declaration) + Local $Returns = ParseForTags($Block, "@return") + Local $Usage = ParseForOneTag($Block, "@usage") + Local $RegexResult + + FileWrite($Log, "Writing Function "&$FunctionName&@CRLF) + + If StringLeft($FunctionName, 1) == "_" Then + _FileWriteLog($Log, @TAB&@Tab&"Function is private. Ignored." & @CRLF) + Return $FunctionName + EndIf + ; Add the class before the function name + If IsArray($Parameters) Then + If $Parameters[1] == "self" Then + $FunctionName = $TypeName & ":" & $FunctionName + EndIf + Else + $FunctionName = $TypeName & "." & $FunctionName + EndIf + + ; add the parameters in parenthesis + $FunctionName &= "(" + If IsArray($Parameters) Then + For $i = 3 To UBound($Parameters) - 3 Step 3 + $FunctionName &= $Parameters[$i + 1] & ", " + Next + If UBound($Parameters) > 3 Then + $FunctionName = StringTrimRight($FunctionName, 2) + EndIf + EndIf + $FunctionName &= ")" + + ;write the file name + FileWrite($Output, "### " & $FunctionName & @CRLF) + + ;Write the exemple if any + If $Usage <> "" Then + FileWrite($Output, "``` lua") + FileWrite($Output, $Usage) + FileWrite($Output, "```" & @CRLF) + EndIf + + ;Write the description + FileWrite($Log, $Block) + FileWrite($Log, StringTrimRight($Block, StringLen($Block) - StringInStr($Block, "@param") + 1) & @CRLF) + FileWrite($Output, StringTrimRight($Block, StringLen($Block) - StringInStr($Block, "@param") + 1) & @CRLF) + + ; Write the parameters + FileWrite($Output, "

Parameters

" & @CRLF) + If IsArray($Parameters) Then + FileWrite($Output, ArrayToList($Parameters, False) & @CRLF) + EndIf + + ; Write the returns + FileWrite($Output, "

Returns

" & @CRLF) + If IsArray($Returns) Then + FileWrite($Output, ArrayToList($Returns, True) & @CRLF) + EndIf + + FileWrite($Output, @CRLF) + + ; add to the list of function balises (useful for hyperlinks) + $RegexResult = ParseFunctionName($Block, $Declaration) + Local $URLBalise = $TypeName & "-" & $RegexResult[0] & "-" + If IsArray($Parameters) Then + For $i = 3 To UBound($Parameters) - 3 Step 3 + $URLBalise &= StringLower($Parameters[$i + 1]) & "-" + Next + EndIf + $URLBalise = StringTrimRight($URLBalise, 1) + FileWrite($FunctionList, $URLBalise & @CRLF) + return $FunctionName +EndFunc \ No newline at end of file diff --git a/docs/Documentation/AI_Patrol.html b/docs/Documentation/AI_Patrol.html index 21275d1d5..da3a39afb 100644 --- a/docs/Documentation/AI_Patrol.html +++ b/docs/Documentation/AI_Patrol.html @@ -951,6 +951,9 @@ Use the method AIPATROLZONE.M + +

This table contains the targets detected during patrol.

+
diff --git a/docs/Documentation/CommandCenter.html b/docs/Documentation/CommandCenter.html index 99e1f3291..7b2d84919 100644 --- a/docs/Documentation/CommandCenter.html +++ b/docs/Documentation/CommandCenter.html @@ -251,24 +251,60 @@ REPORT:Add(Text)

Add a new line to a REPORT.

+ + + + REPORT:AddIndent(Text) + +

Add a new line to a REPORT.

REPORT.ClassName + + + + REPORT:HasText() + +

Has the REPORT Text?

+ + + + REPORT.Indent + + REPORT:New(Title)

Create a new REPORT.

+ + + + REPORT.Report + + + + + + REPORT:SetIndent(Indent) + +

Set indent of a REPORT.

REPORT:Text(Delimiter)

Produces the text of the report, taking into account an optional delimeter, which is \n by default.

+ + + + REPORT.Title + + @@ -765,6 +801,32 @@ Group#GROUP

#REPORT:

+ +
+
+
+ + +REPORT:AddIndent(Text) + +
+
+ +

Add a new line to a REPORT.

+ +

Parameter

+
    +
  • + +

    #string Text :

    + +
  • +
+

Return value

+ +

#REPORT:

+ +
@@ -779,6 +841,38 @@ Group#GROUP

+ +
+
+
+ + +REPORT:HasText() + +
+
+ +

Has the REPORT Text?

+ +

Return value

+ +

#boolean:

+ + +
+
+
+
+ + + +REPORT.Indent + +
+
+ + +
@@ -805,6 +899,46 @@ Group#GROUP

#REPORT:

+ +
+
+
+ + + +REPORT.Report + +
+
+ + + +
+
+
+
+ + +REPORT:SetIndent(Indent) + +
+
+ +

Set indent of a REPORT.

+ +

Parameter

+
    +
  • + +

    #number Indent :

    + +
  • +
+

Return value

+ +

#REPORT:

+ +
@@ -832,6 +966,20 @@ Group#GROUP

#string: The report text.

+ +
+
+
+ + + +REPORT.Title + +
+
+ + +
diff --git a/docs/Documentation/Controllable.html b/docs/Documentation/Controllable.html index 5b025cdc7..ad27bec5c 100644 --- a/docs/Documentation/Controllable.html +++ b/docs/Documentation/Controllable.html @@ -382,7 +382,7 @@ This is different from the EnRoute tasks, where the targets of the task need to - CONTROLLABLE:IsTargetDetected(DCSObject) + CONTROLLABLE:IsTargetDetected(DCSObject, DetectVisual, DetectOptical, DetectRadar, DetectIRST, DetectRWR, DetectDLINK) @@ -1466,19 +1466,49 @@ WayPoints If WayPoints is given, then return the WayPoints structure.

-CONTROLLABLE:IsTargetDetected(DCSObject) +CONTROLLABLE:IsTargetDetected(DCSObject, DetectVisual, DetectOptical, DetectRadar, DetectIRST, DetectRWR, DetectDLINK)
-

Parameter

+

Parameters

  • DCSObject :

    +
  • +
  • + +

    DetectVisual :

    + +
  • +
  • + +

    DetectOptical :

    + +
  • +
  • + +

    DetectRadar :

    + +
  • +
  • + +

    DetectIRST :

    + +
  • +
  • + +

    DetectRWR :

    + +
  • +
  • + +

    DetectDLINK :

    +
diff --git a/docs/Documentation/Database.html b/docs/Documentation/Database.html index e43251af7..bdaa3f280 100644 --- a/docs/Documentation/Database.html +++ b/docs/Documentation/Database.html @@ -326,6 +326,12 @@ The following iterator methods are currently available within the DATABASE:

DATABASE:ForEachPlayerJoined(IteratorFunction, ...)

Iterate the DATABASE and call an iterator function for each player who has joined the mission, providing the Unit of the player and optional parameters.

+ + + + DATABASE:ForEachStatic(IteratorFunction, FinalizeFunction, ...) + +

Iterate the DATABASE and call an iterator function for each alive STATIC, providing the STATIC and optional parameters.

@@ -1279,6 +1285,43 @@ self

+ +DATABASE:ForEachStatic(IteratorFunction, FinalizeFunction, ...) + +
+
+ +

Iterate the DATABASE and call an iterator function for each alive STATIC, providing the STATIC and optional parameters.

+ +

Parameters

+
    +
  • + +

    #function IteratorFunction : +The function that will be called for each object in the database. The function needs to accept a STATIC parameter.

    + +
  • +
  • + +

    FinalizeFunction :

    + +
  • +
  • + +

    ... :

    + +
  • +
+

Return value

+ +

#DATABASE: +self

+ +
+
+
+
+ DATABASE:ForEachUnit(IteratorFunction, FinalizeFunction, ...) diff --git a/docs/Documentation/Designate.html b/docs/Documentation/Designate.html index 9854fc628..0b38068a2 100644 --- a/docs/Documentation/Designate.html +++ b/docs/Documentation/Designate.html @@ -279,7 +279,7 @@ each detected set of potential targets can be lased or smoked...

- DESIGNATE:MenuStatus(AttackGroup) + DESIGNATE:MenuStatus(AttackGroup, Duration) @@ -375,7 +375,7 @@ each detected set of potential targets can be lased or smoked...

- DESIGNATE:SendStatus(AttackGroup, MenuAttackGroup) + DESIGNATE:SendStatus(AttackGroup, Duration, MenuAttackGroup)

Sends the status to the Attack Groups.

@@ -1065,19 +1065,24 @@ function below will use the range 1-7 just in case

-DESIGNATE:MenuStatus(AttackGroup) +DESIGNATE:MenuStatus(AttackGroup, Duration)
-

Parameter

+

Parameters

  • AttackGroup :

    +
  • +
  • + +

    Duration :

    +
@@ -1556,7 +1561,7 @@ The Attack collection of GROUP objects to designate and report for.

-DESIGNATE:SendStatus(AttackGroup, MenuAttackGroup) +DESIGNATE:SendStatus(AttackGroup, Duration, MenuAttackGroup)
@@ -1572,6 +1577,12 @@ The Attack collection of GROUP objects to designate and report for.

  • +

    #number Duration : +The time in seconds the report should be visible.

    + +
  • +
  • +

    MenuAttackGroup :

  • diff --git a/docs/Documentation/Detection.html b/docs/Documentation/Detection.html index af236b70d..73f24c75d 100644 --- a/docs/Documentation/Detection.html +++ b/docs/Documentation/Detection.html @@ -192,6 +192,12 @@ DETECTION uses the in-built detection capabilities of DCS World, but adds new fu DETECTION_AREAS:CreateDetectionItems()

    Make a DetectionSet table.

    + + + + DETECTION_AREAS:DetectedItemMenu(Index) + +

    Menu of a detected item using a given numeric index.

    @@ -204,6 +210,12 @@ DETECTION uses the in-built detection capabilities of DCS World, but adds new fu DETECTION_AREAS.DetectedItems

    A list of areas containing the set of Units, Zones, the center Unit within the zone, and ID of each area that was detected within a DetectionZoneRange.

    + + + + DETECTION_AREAS:DetectedReportDetailed() + +

    Report detailed of a detection result.

    @@ -331,7 +343,7 @@ DETECTION uses the in-built detection capabilities of DCS World, but adds new fu - DETECTION_BASE:AddDetectedItem(DetectedItemIndex, Set) + DETECTION_BASE:AddDetectedItem(ItemPrefix, DetectedItemIndex, Set)

    Adds a new DetectedItem to the DetectedItems list.

    @@ -424,6 +436,12 @@ DETECTION uses the in-built detection capabilities of DCS World, but adds new fu DETECTION_BASE.DetectedItemMax + + + + DETECTION_BASE:DetectedItemMenu(Index) + +

    Menu of a detected item using a given numeric index.

    @@ -513,12 +531,24 @@ The different values of Unit.Category can be:

    Multiple Unit.Category entries can be given as a table and then these will be evaluated as an OR expression.

    + + + + DETECTION_BASE:GetDetectedID(Index) + +

    Get a detected ID using a given numeric index.

    DETECTION_BASE:GetDetectedItem(Index)

    Get a detected item using a given numeric index.

    + + + + DETECTION_BASE:GetDetectedItemID(Index) + +

    Get a detected ItemID using a given numeric index.

    @@ -905,6 +935,42 @@ The different values of Unit.Category can be:

    DETECTION_BASE.DetectedObject.Identified + + + + DETECTION_BASE.DetectedObject.IsVisible + + + + + + DETECTION_BASE.DetectedObject.KnowDistance + + + + + + DETECTION_BASE.DetectedObject.KnowType + + + + + + DETECTION_BASE.DetectedObject.LastPos + + + + + + DETECTION_BASE.DetectedObject.LastTime + + + + + + DETECTION_BASE.DetectedObject.LastVelocity + + @@ -917,12 +983,6 @@ The different values of Unit.Category can be:

    DETECTION_BASE.DetectedObject.Type - - - - DETECTION_BASE.DetectedObject.Visible - - @@ -939,6 +999,12 @@ The different values of Unit.Category can be:

    DETECTION_TYPES:CreateDetectionItems()

    Create the DetectedItems list from the DetectedObjects table.

    + + + + DETECTION_TYPES:DetectedItemMenu(Index, DetectedTypeName) + +

    Menu of a DetectedItem using a given numeric index.

    @@ -1015,6 +1081,12 @@ The different values of Unit.Category can be:

    DETECTION_UNITS:CreateDetectionItems()

    Create the DetectedItems list from the DetectedObjects table.

    + + + + DETECTION_UNITS:DetectedItemMenu(Index) + +

    Menu of a DetectedItem using a given numeric index.

    @@ -1476,6 +1548,32 @@ self

    #DETECTION_AREAS: self

    +
    +
    +
    +
    + + +DETECTION_AREAS:DetectedItemMenu(Index) + +
    +
    + +

    Menu of a detected item using a given numeric index.

    + +

    Parameter

    +
      +
    • + +

      Index :

      + +
    • +
    +

    Return value

    + +

    #string:

    + +
    @@ -1516,6 +1614,24 @@ self

    A list of areas containing the set of Units, Zones, the center Unit within the zone, and ID of each area that was detected within a DetectionZoneRange.

    + +
    +
    +
    + + +DETECTION_AREAS:DetectedReportDetailed() + +
    +
    + +

    Report detailed of a detection result.

    + +

    Return value

    + +

    #string:

    + +
    @@ -1944,7 +2060,7 @@ self

    -DETECTION_BASE:AddDetectedItem(DetectedItemIndex, Set) +DETECTION_BASE:AddDetectedItem(ItemPrefix, DetectedItemIndex, Set)
    @@ -1958,6 +2074,11 @@ self

    • +

      ItemPrefix :

      + +
    • +
    • +

      #string DetectedItemIndex : The index of the DetectedItem.

      @@ -2223,6 +2344,32 @@ The index of the DetectedItem.

      +
    +
    +
    +
    + + +DETECTION_BASE:DetectedItemMenu(Index) + +
    +
    + +

    Menu of a detected item using a given numeric index.

    + +

    Parameter

    +
      +
    • + +

      Index :

      + +
    • +
    +

    Return value

    + +

    #string:

    + +
    @@ -2468,6 +2615,32 @@ self

    + +DETECTION_BASE:GetDetectedID(Index) + +
    +
    + +

    Get a detected ID using a given numeric index.

    + +

    Parameter

    +
      +
    • + +

      #number Index :

      + +
    • +
    +

    Return value

    + +

    #string: +DetectedItemID

    + +
    +
    +
    +
    + DETECTION_BASE:GetDetectedItem(Index) @@ -2489,6 +2662,32 @@ self

    #DETECTION_BASE.DetectedItem:

    + +
    +
    +
    + + +DETECTION_BASE:GetDetectedItemID(Index) + +
    +
    + +

    Get a detected ItemID using a given numeric index.

    + +

    Parameter

    +
      +
    • + +

      #number Index :

      + +
    • +
    +

    Return value

    + +

    #string: +DetectedItemID

    +
    @@ -4061,6 +4260,90 @@ The To State string.

    + +
    +
    +
    + + #boolean + +DETECTION_BASE.DetectedObject.IsVisible + +
    +
    + + + +
    +
    +
    +
    + + #boolean + +DETECTION_BASE.DetectedObject.KnowDistance + +
    +
    + + + +
    +
    +
    +
    + + #boolean + +DETECTION_BASE.DetectedObject.KnowType + +
    +
    + + + +
    +
    +
    +
    + + #boolean + +DETECTION_BASE.DetectedObject.LastPos + +
    +
    + + + +
    +
    +
    +
    + + #number + +DETECTION_BASE.DetectedObject.LastTime + +
    +
    + + + +
    +
    +
    +
    + + #number + +DETECTION_BASE.DetectedObject.LastVelocity + +
    +
    + + +
    @@ -4089,20 +4372,6 @@ The To State string.

    - -
    -
    -
    - - #boolean - -DETECTION_BASE.DetectedObject.Visible - -
    -
    - - -
    @@ -4154,6 +4423,37 @@ Beware that when the amount of different types detected is large, the DetectedIt

    #DETECTION_TYPES: self

    + +
    +
    +
    + + +DETECTION_TYPES:DetectedItemMenu(Index, DetectedTypeName) + +
    +
    + +

    Menu of a DetectedItem using a given numeric index.

    + +

    Parameters

    +
      +
    • + +

      Index :

      + +
    • +
    • + +

      DetectedTypeName :

      + +
    • +
    +

    Return value

    + +

    #string:

    + +
    @@ -4389,6 +4689,32 @@ Beware that when the amount of units detected is large, the DetectedItems list w

    #DETECTION_UNITS: self

    + +
    +
    +
    + + +DETECTION_UNITS:DetectedItemMenu(Index) + +
    +
    + +

    Menu of a DetectedItem using a given numeric index.

    + +

    Parameter

    +
      +
    • + +

      Index :

      + +
    • +
    +

    Return value

    + +

    #string:

    + +
    diff --git a/docs/Documentation/Fsm.html b/docs/Documentation/Fsm.html index 425da196e..eb52982ac 100644 --- a/docs/Documentation/Fsm.html +++ b/docs/Documentation/Fsm.html @@ -1622,7 +1622,7 @@ A string defining the start state.

    - #string + FSM._StartState @@ -1921,6 +1921,7 @@ A string defining the start state.

    + FSM.current diff --git a/docs/Documentation/Mission.html b/docs/Documentation/Mission.html index 5cf8ca5d8..96f09fc56 100644 --- a/docs/Documentation/Mission.html +++ b/docs/Documentation/Mission.html @@ -167,7 +167,7 @@ A CLIENT needs to be registered within the MISSION:GetMenu(TaskGroup) + MISSION:GetMenu()

    Gets the mission menu for the coalition.

    @@ -200,6 +200,12 @@ A CLIENT needs to be registered within the MISSION:GetTasks()

    Get all the TASKs from the Mission.

    + + + + MISSION:GetTasksRemaining() + + @@ -209,39 +215,51 @@ A CLIENT needs to be registered within the MISSION:IsCompleted() + MISSION:IsCOMPLETED() -

    Is the Mission Completed.

    +

    Is the Mission COMPLETED.

    - MISSION:IsFailed() + MISSION:IsENGAGED() -

    Is the Mission Failed.

    +

    Is the Mission ENGAGED.

    - MISSION:IsHold() + MISSION:IsFAILED() -

    Is the Mission Hold.

    +

    Is the Mission FAILED.

    - MISSION:IsIdle() + MISSION:IsHOLD() -

    Is the Mission Idle.

    +

    Is the Mission HOLD.

    - MISSION:IsOngoing() + MISSION:IsIDLE() -

    Is the Mission Ongoing.

    +

    Is the Mission IDLE.

    MISSION:JoinUnit(PlayerUnit, PlayerGroup)

    Add a Unit to join the Mission.

    + + + + MISSION:MenuReportOverview(TaskStatus, ReportGroup) + + + + + + MISSION:MenuReportSummary(ReportGroup) + + @@ -323,51 +341,51 @@ A CLIENT needs to be registered within the MISSION:OnEnterCompleted(From, Event, To) + MISSION:OnEnterCOMPLETED(From, Event, To) -

    OnEnter Transition Handler for State Completed.

    +

    OnEnter Transition Handler for State COMPLETED.

    - MISSION:OnEnterFailed(From, Event, To) + MISSION:OnEnterENGAGED(From, Event, To) -

    OnEnter Transition Handler for State Failed.

    +

    OnEnter Transition Handler for State ENGAGED.

    - MISSION:OnEnterIdle(From, Event, To) + MISSION:OnEnterFAILED(From, Event, To) -

    OnEnter Transition Handler for State Idle.

    +

    OnEnter Transition Handler for State FAILED.

    - MISSION:OnEnterOngoing(From, Event, To) + MISSION:OnEnterIDLE(From, Event, To) -

    OnEnter Transition Handler for State Ongoing.

    +

    OnEnter Transition Handler for State IDLE.

    - MISSION:OnLeaveCompleted(From, Event, To) + MISSION:OnLeaveCOMPLETED(From, Event, To) -

    OnLeave Transition Handler for State Completed.

    +

    OnLeave Transition Handler for State COMPLETED.

    - MISSION:OnLeaveFailed(From, Event, To) + MISSION:OnLeaveENGAGED(From, Event, To) -

    OnLeave Transition Handler for State Failed.

    +

    OnLeave Transition Handler for State ENGAGED.

    - MISSION:OnLeaveIdle(From, Event, To) + MISSION:OnLeaveFAILED(From, Event, To) -

    OnLeave Transition Handler for State Idle.

    +

    OnLeave Transition Handler for State FAILED.

    - MISSION:OnLeaveOngoing(From, Event, To) + MISSION:OnLeaveIDLE(From, Event, To) -

    OnLeave Transition Handler for State Ongoing.

    +

    OnLeave Transition Handler for State IDLE.

    @@ -395,7 +413,7 @@ A CLIENT needs to be registered within the MISSION:ReportOverview() + MISSION:ReportOverview(TaskStatus)

    Create a overview report of the Mission (multiple lines).

    @@ -467,7 +485,7 @@ A CLIENT needs to be registered within the MISSION:onenterCompleted(From, Event, To) + MISSION:onenterCOMPLETED(From, Event, To) @@ -697,21 +715,13 @@ true if Unit is part of a Task in the Mission.

    -MISSION:GetMenu(TaskGroup) +MISSION:GetMenu()

    Gets the mission menu for the coalition.

    -

    Parameter

    -

    Return value

    Core.Menu#MENU_COALITION: @@ -851,6 +861,24 @@ Returns nil if no task was found.

    Tasks = Mission:GetTasks() env.info( "Task 2 Completion = " .. Tasks[2]:GetGoalPercentage() .. "%" ) +
    +
    +
    +
    + + +MISSION:GetTasksRemaining() + +
    +
    + + + +

    Return value

    + +

    #number:

    + +
    @@ -893,13 +921,13 @@ true if the Mission has a Group.

    - -MISSION:IsCompleted() + +MISSION:IsCOMPLETED()
    -

    Is the Mission Completed.

    +

    Is the Mission COMPLETED.

    Return value

    @@ -911,13 +939,13 @@ true if the Mission has a Group.

    - -MISSION:IsFailed() + +MISSION:IsENGAGED()
    -

    Is the Mission Failed.

    +

    Is the Mission ENGAGED.

    Return value

    @@ -929,13 +957,13 @@ true if the Mission has a Group.

    - -MISSION:IsHold() + +MISSION:IsFAILED()
    -

    Is the Mission Hold.

    +

    Is the Mission FAILED.

    Return value

    @@ -947,13 +975,13 @@ true if the Mission has a Group.

    - -MISSION:IsIdle() + +MISSION:IsHOLD()
    -

    Is the Mission Idle.

    +

    Is the Mission HOLD.

    Return value

    @@ -965,13 +993,13 @@ true if the Mission has a Group.

    - -MISSION:IsOngoing() + +MISSION:IsIDLE()
    -

    Is the Mission Ongoing.

    +

    Is the Mission IDLE.

    Return value

    @@ -1016,6 +1044,54 @@ The GROUP of the player joining the Mission.

    #boolean: true if Unit is part of a Task in the Mission.

    +
    +
    +
    +
    + + +MISSION:MenuReportOverview(TaskStatus, ReportGroup) + +
    +
    + + + +

    Parameters

    + +
    +
    +
    +
    + + +MISSION:MenuReportSummary(ReportGroup) + +
    +
    + + + +

    Parameter

    +
    @@ -1422,13 +1498,13 @@ Return false to cancel Transition.

    - -MISSION:OnEnterCompleted(From, Event, To) + +MISSION:OnEnterCOMPLETED(From, Event, To)
    -

    OnEnter Transition Handler for State Completed.

    +

    OnEnter Transition Handler for State COMPLETED.

    Parameters