hkey_ConstructMissingData

This function is part of the Global | HkeyArray | Tree | Menu controller. Browse related handlers using the tags: hkey, construct, missing, data, and find the function here on github

Handler: hkey_ConstructMissingData (hKeys, sObject, searchObjects, pDisplayView) OS: all Platforms: all Type: function

The function is used to robustly test an index of hkeys. It loops through each hKey, and fetches the handler form the script, then it extracts calls and checks if those calls are contained within the list of hKeys passed to the function. It examines and searches for "missing" hKeys.

This is the switch logic of the handler:

switch case handlerHkey is among the lines of hKeys -- foundArray break case word -1 of handlerHkey = "Missing" -- missingArray break case shortKey is among the lines of allShortHkeys -- inShortArray break default -- missingFoundShortArray end switch

It returns the elements as part of missingData: - missingArray - missingFoundArray - missingPlaceArray

- foundArray -- fine (already in hkeyIndex) - inShortArray --should be fine

- missingButFoundArray -- add dependency - missingArray -- bad

# Todo - [x] Change Me

# Where

File: Global_HkeyArray_Tree_Menu.livecodescript Hkey: F hkey_ConstructMissingData Kind: controller Path: controllers/Global_HkeyArray_Tree_Menu.livecodescript Project: lcw_Graph Script: stack "Global | HkeyArray | Tree | Menu"

# Code

digraph "overlayArray_ConstructDot" { graph [ clusterrank="true" ]; subgraph "PF" { node []; n2 [label="_ConstructQuoteReg" URL="PF+_ConstructQuoteReg+of+stack+%27lib_Text%27"]; n25 [label="_GetHandlerCalls" URL="PF+_GetHandlerCalls+of+stack+%27lib_HkeyWalk%27"]; n17 [label="_ExtractFunctionCalls" URL="PF+_ExtractFunctionCalls+of+stack+%27lib_HandlerCalls%27"]; } subgraph "PC" { node []; n31 [label="_WalkHkeyRecursive" URL="PC+_WalkHkeyRecursive+of+stack+%27lib_HkeyWalk%27"]; } subgraph "S" { node [fillcolor="grey", style="filled", color="white"]; n48 [label="hilited_Element" URL="S+hilited_Element+of+Missing"]; } subgraph "M" { node [fillcolor="Orange", style="filled", color="Red"]; n27 [label="htable_ExactLineOffsets" URL="M+htable_ExactLineOffsets+of+stack+%27lib_HandlerTable%27"]; n23 [label="ide_FilterOutStacks" URL="M+ide_FilterOutStacks+of+stack+%27model_ScriptHierarchy%27"]; n38 [label="hkey_Normalize" URL="M+hkey_Normalize+of+stack+%27model_HkeyLine%27"]; n42 [label="folder_CreateNested" URL="M+folder_CreateNested+of+stack+%27lib_LCW%27"]; n14 [label="line_Add" URL="M+line_Add+of+stack+%27lib_Fedwiki%27"]; n10 [label="object_AddBehaviors" URL="M+object_AddBehaviors+of+stack+%27model_ScriptHierarchy%27"]; n32 [label="hkeyLine_Deconstruct" URL="M+hkeyLine_Deconstruct+of+stack+%27lib_MenuArray%27"]; n6 [label="line_Delete" URL="M+line_Delete+of+stack+%27lib_Fedwiki%27"]; } subgraph "G" { node [fillcolor="grey50", style="filled", color="white"]; n45 [label="textStack_Folder" URL="G+textStack_Folder+of+stack+%27model_TextStack%27"]; n7 [label="hkey_Or" URL="G+hkey_Or+of+stack+%27lib_HandlerTable%27"]; n3 [label="hkey_Either" URL="G+hkey_Either+of+stack+%27lib_HandlerTable%27"]; n37 [label="dataObject_Folder" URL="G+dataObject_Folder+of+stack+%27model_ScriptFiles%27"]; n41 [label="dataObjects_Folder" URL="G+dataObjects_Folder+of+stack+%27model_ScriptFiles%27"]; n43 [label="textStack_DataFolder" URL="G+textStack_DataFolder+of+stack+%27model_TextStack%27"]; } subgraph "C" { node [fillcolor="LightBlue", style="filled", color="Blue"]; n50 [label="htable_OrLineOffsets" URL="C+htable_OrLineOffsets+of+stack+%27lib_HandlerTable%27"]; n18 [label="handler_AddToCallArray" URL="C+handler_AddToCallArray+of+stack+%27lib_HandlerCalls%27"]; n29 [label="text_AddTrailing" URL="C+text_AddTrailing+of+stack+%27lib_LCW%27"]; n30 [label="folder_CreateNested" URL="C+folder_CreateNested+of+stack+%27lib_LCW%27"]; n34 [label="walk_HkeyCalls" URL="C+walk_HkeyCalls+of+stack+%27lib_HkeyWalk%27"]; n24 [label="walk_SetSearchHierarchy" URL="C+walk_SetSearchHierarchy+of+stack+%27lib_HkeyWalk%27"]; } subgraph "F" { node [fillcolor="GreenYellow", style="filled", color="Green4"]; n33 [label="walk_GetHkeyArray" URL="F+walk_GetHkeyArray+of+stack+%27lib_HkeyWalk%27"]; n28 [label="lcw_UserProjectFolder" URL="F+lcw_UserProjectFolder+of+stack+%27lib_LCW%27"]; n47 [label="hkey_ListShort" URL="F+hkey_ListShort+of+stack+%27lib_FindHkey%27"]; n49 [label="array_ListKeys" URL="F+array_ListKeys+of+stack+%27lib_HkeyArray%27"]; n9 [label="env_ListBackScripts" URL="F+env_ListBackScripts+of+stack+%27model_Environment%27"]; n5 [label="hkey_FindShortHkey" URL="F+hkey_FindShortHkey+of+stack+%27lib_FindHkey%27"]; n21 [label="text_Get" URL="F+text_Get+of+stack+%27lib_Fedwiki%27"]; n36 [label="hKeyLine_AddObject" URL="F+hKeyLine_AddObject+of+stack+%27lib_MenuArray%27"]; n40 [label="lcw_UserMetadataFolder" URL="F+lcw_UserMetadataFolder+of+stack+%27lib_LCW%27"]; n44 [label="textStack_ConstructFolder" URL="F+textStack_ConstructFolder+of+stack+%27model_TextStack%27"]; n16 [label="sha1_Hash" URL="F+sha1_Hash+of+stack+%27lib_Text%27"]; n1 [label="text_StripQuoted" URL="F+text_StripQuoted+of+stack+%27lib_Text%27"]; n46 [label="hkey_ConstructMissingData" URL="F+hkey_ConstructMissingData+of+stack+%27Global+%7C+HkeyArray+%7C+Tree+%7C+Menu%27"]; n12 [label="stack_PathsToObjects" URL="F+stack_PathsToObjects+of+stack+%27model_ScriptHierarchy%27"]; n26 [label="handler_ExtractCalls" URL="F+handler_ExtractCalls+of+stack+%27lib_HandlerCalls%27"]; n22 [label="hkey_CallsFile" URL="F+hkey_CallsFile+of+stack+%27model_HkeyFiles%27"]; n20 [label="hkey_FetchCalls" URL="F+hkey_FetchCalls+of+stack+%27model_HandlerLibrary%27"]; n19 [label="ide_GetDictionaryTerms" URL="F+ide_GetDictionaryTerms+of+stack+%27lib_LiveCodeDictionary%27"]; n8 [label="env_ScriptHierarchy" URL="F+env_ScriptHierarchy+of+stack+%27model_Environment%27"]; n39 [label="htable_GetOr" URL="F+htable_GetOr+of+stack+%27lib_HandlerTable%27"]; n4 [label="htable_GetEither" URL="F+htable_GetEither+of+stack+%27lib_HandlerTable%27"]; n35 [label="hKeyLine_Construct" URL="F+hKeyLine_Construct+of+stack+%27lib_MenuArray%27"]; n15 [label="ide_IsDictionaryTerm" URL="F+ide_IsDictionaryTerm+of+stack+%27lib_LiveCodeDictionary%27"]; n11 [label="env_ListFrontScripts" URL="F+env_ListFrontScripts+of+stack+%27model_Environment%27"]; n13 [label="handler_ConstructCallArray" URL="F+handler_ConstructCallArray+of+stack+%27lib_HandlerCalls%27"]; } subgraph cluster1 { label="Missing"; style=filled; color=red; fillcolor=orange; n48 } subgraph cluster2 { label="stack \"Global | HkeyArray | Tree | Menu\""; style=filled; color=grey60; fillcolor=grey60; n46 } subgraph cluster3 { label="stack \"lib_Fedwiki\""; style=filled; color=grey60; fillcolor=grey60; n21; n14; n6 } subgraph cluster4 { label="stack \"lib_FindHkey\""; style=filled; color=grey60; fillcolor=grey60; n47; n5 } subgraph cluster5 { label="stack \"lib_HandlerCalls\""; style=filled; color=grey60; fillcolor=grey60; n18; n26; n17; n13 } subgraph cluster6 { label="stack \"lib_HandlerTable\""; style=filled; color=grey60; fillcolor=grey60; n50; n27; n7; n3; n39; n4 } subgraph cluster7 { label="stack \"lib_HkeyArray\""; style=filled; color=grey60; fillcolor=grey60; n49 } subgraph cluster8 { label="stack \"lib_HkeyWalk\""; style=filled; color=grey60; fillcolor=grey60; n33; n31; n25; n34; n24 } subgraph cluster9 { label="stack \"lib_LCW\""; style=filled; color=grey60; fillcolor=grey60; n28; n40; n42; n29; n30 } subgraph cluster10 { label="stack \"lib_LiveCodeDictionary\""; style=filled; color=grey60; fillcolor=grey60; n19; n15 } subgraph cluster11 { label="stack \"lib_MenuArray\""; style=filled; color=grey60; fillcolor=grey60; n36; n32; n35 } subgraph cluster12 { label="stack \"lib_Text\""; style=filled; color=grey60; fillcolor=grey60; n2; n16; n1 } subgraph cluster13 { label="stack \"model_Environment\""; style=filled; color=grey60; fillcolor=grey60; n9; n8; n11 } subgraph cluster14 { label="stack \"model_HandlerLibrary\""; style=filled; color=grey60; fillcolor=grey60; n20 } subgraph cluster15 { label="stack \"model_HkeyFiles\""; style=filled; color=grey60; fillcolor=grey60; n22 } subgraph cluster16 { label="stack \"model_HkeyLine\""; style=filled; color=grey60; fillcolor=grey60; n38 } subgraph cluster17 { label="stack \"model_ScriptFiles\""; style=filled; color=grey60; fillcolor=grey60; n37; n41 } subgraph cluster18 { label="stack \"model_ScriptHierarchy\""; style=filled; color=grey60; fillcolor=grey60; n23; n10; n12 } subgraph cluster19 { label="stack \"model_TextStack\""; style=filled; color=grey60; fillcolor=grey60; n45; n44; n43 } n37 -> n42; n37 -> n41; n39 -> n35; n39 -> n50; n3 -> n4; n13 -> n17; n13 -> n18; n13 -> n1; n13 -> n15; n13 -> n16; n13 -> n14; n28 -> n29; n28 -> n30; n11 -> n23; n17 -> n17; n17 -> n1; n17 -> n15; n17 -> n14; n1 -> n2; n15 -> n19; n7 -> n39; n5 -> n3; n5 -> n7; n5 -> n6; n4 -> n35; n9 -> n23; n8 -> n12; n8 -> n9; n8 -> n11; n8 -> n10; n20 -> n21; n20 -> n22; n46 -> n47; n46 -> n48; n46 -> n49; n46 -> n33; n22 -> n38; n22 -> n37; n22 -> n32; n25 -> n26; n25 -> n27; n25 -> n20; n24 -> n8; n30 -> n29; n31 -> n32; n31 -> n31; n31 -> n5; n31 -> n25; n26 -> n13; n33 -> n24; n33 -> n34; n44 -> n40; n44 -> n42; n41 -> n43; n40 -> n28; n43 -> n45; n43 -> n42; n34 -> n32; n34 -> n25; n34 -> n31; n35 -> n36; n45 -> n44; }

function hkey_ConstructMissingData hKeys, sObject, searchObjects, pDisplayView put hkey_ListShort (hKeys) into allShortHkeys -- repeat with lineNum = 1 to the number of lines of hKeys if the commandKey is "down" then breakpoint if the shiftKey is "down" then exit repeat -- put line lineNum of hKeys into hKey -- if exists (pDisplayView) then set the hilited_Element of pDisplayView to hKey end if # List handler calls = allHandlerKeys put walk_GetHkeyArray (hKey, searchObjects) into handlerHkeyArray put array_ListKeys (handlerHkeyArray) into allHandlerKeys repeat for each line handlerHkey in allHandlerKeys put word 1 to 2 of handlerHkey into shortHandlerKey -- switch case handlerHkey is among the lines of hKeys put empty into foundArray [handlerHkey] break case word -1 of handlerHkey = "Missing" put empty into missingArray [handlerHkey] break case shortHandlerKey is not among the lines of allShortHkeys put empty into missingFoundShortArray [handlerHkey] break default put empty into missingButFoundArray [handlerHkey] end switch end repeat end repeat -- put foundArray into missingData ["foundArray"] put missingArray into missingData ["missingArray"] put missingFoundShortArray into missingData ["missingFoundShortArray"] put missingButFoundArray into missingData ["missingButFoundArray"] -- return missingData end hkey_ConstructMissingData

# See also - Fedwiki Tools