/***************************************************************************************/ /* */ /* SCS editor Version 2 */ /* File : ModuleLink.pkg */ /* Version : 19 Mai 2000 */ /* module link list functions */ /* */ /***************************************************************************************/ var LINK_OUTGOING = 1;; var LINK_INCOMING = 2;; fun MODULE_IsInLinkList (linkList, param) = isf_in_list linkList @LINK_CompareModules param ;; /**************************************************************************************** search the group of links associated with a module, in the list of link of a module ****************************************************************************************/ fun MODULE_GetLinksByModule (module1, module2) = search_in_list (module1.MODlinks) @MODULE_IsInLinkList [module1 module2] ;; /**************************************************************************************** return the links list between one module and all the module in the list ****************************************************************************************/ fun MODULE_ApplyGetLinksList (module, modList) = if modList==nil then nil else listcat (MODULE_GetLinksByModule module (hd modList)) (MODULE_ApplyGetLinksList module tl modList) ;; /**************************************************************************************** return the links list of all the module in the list ****************************************************************************************/ fun MODULE_GetLinksList (modList)= if modList == nil then nil else listcat (MODULE_ApplyGetLinksList (hd modList) modList) (MODULE_GetLinksList tl modList) ;; /**************************************************************************************** return corresponding link for all the parameters ****************************************************************************************/ fun MODULE_GetCompleteLink (source, event, destination, action, param, cond) = let MODULE_GetLinksByModule source destination -> linkList in search_in_list linkList @LINK_CompareAll [source event destination action param cond] ;; /**************************************************************************************** return corresponding link for all the parameters except event ****************************************************************************************/ fun MODULE_GetActionLink (source, destination, action, param, cond) = let MODULE_GetLinksByModule source destination -> linkList in search_in_list linkList @LINK_CompareAllExceptEvent [source destination action param cond] ;; /**************************************************************************************** return corresponding link for all the parameters except action ****************************************************************************************/ fun MODULE_GetEventLink (source, event, destination, param, cond) = let MODULE_GetLinksByModule source destination -> linkList in search_in_list linkList @LINK_CompareAllExceptAction [source event destination param cond] ;; /*************************************************************************************** return true if one of modules of link is in module list ***************************************************************************************/ fun MODULE_CompareModuleLink (link, moduleList) = isf_in_list moduleList @LINK_ModuleCompare link ;; fun MODULE_CompareModuleLinkList (linkList, moduleList) = MODULE_CompareModuleLink hd linkList moduleList ;; /**************************************************************************************** MODULE LINK SEARCH FUNCTIONS ****************************************************************************************/ /**************************************************************************************** return the specific list of list links from the modules links using the link search function in parameter ****************************************************************************************/ fun MODULE_SearchAllSpecificLink2 (linkList, function, param) = if linkList == nil then nil else if (exec function with [(hd linkList) param]) then (hd linkList)::(MODULE_SearchAllSpecificLink2 tl linkList function param) else MODULE_SearchAllSpecificLink2 tl linkList function param ;; fun MODULE_SearchAllSpecificLink (linkListList, function, param) = if linkListList == nil then nil else (MODULE_SearchAllSpecificLink2 hd linkListList function param):: (MODULE_SearchAllSpecificLink tl linkListList function param) ;; /*************************************************************************************** give all module links grouped by module destination ***************************************************************************************/ fun MODULE_GetLinks (module) = module.MODlinks ;; /*************************************************************************************** give outgoing module links ***************************************************************************************/ fun MODULE_GetOutgoingLinks (module) = listList_to_list MODULE_SearchAllSpecificLink module.MODlinks @LINK_CompareSource module ;; fun MODULE_LinkDestinationIsChild (linkList, site, module) = if linkList == nil then nil else let linkList -> [link next] in let MODULE_LinkDestinationIsChild next site module -> result in if (MODULE_GetFather site (LINK_GetDestination link)) == module then link::result else result ;; /*************************************************************************************** give incoming module links ***************************************************************************************/ fun MODULE_GetIncomingLinks (module) = listList_to_list MODULE_SearchAllSpecificLink module.MODlinks @LINK_CompareDestination module ;; /*************************************************************************************** return : - all links between one black box and all his children - all links between all the modules of these children all links are grouped by couple of modules ***************************************************************************************/ fun MODULE_GetChildrenLinks (site, module) = if module == nil then /* ERROR NOT SENT TO END-USER */ logScsError "MODULE_GetChildrenLinks" nil "Module is nil" nil else let MODULE_GetChildren site module -> allChild in if allChild == nil then nil else MODULE_GetLinksList module::allChild ;; /*************************************************************************************** return true if link destination module is in module list ***************************************************************************************/ fun MODULE_CompareDestinationModuleLink (link, moduleList) = isf_in_list moduleList @LINK_DestinationCompare link ;; /*************************************************************************************** return true if link destination module is in module list ***************************************************************************************/ fun MODULE_CompareSourceModuleLink (link, moduleList) = isf_in_list moduleList @LINK_SourceCompare link ;; /*************************************************************************************** return list of single links (no double) list from a module list ***************************************************************************************/ fun MODULE_GetAllLinksExceptPreviousList (moduleList, exceptList) = if moduleList == nil then nil else let hd moduleList -> module in let module.MODlinks -> links in let if exceptList == nil then links else removef_from_list links @MODULE_CompareModuleLinkList exceptList -> list in listcat list (MODULE_GetAllLinksExceptPreviousList (tl moduleList) (hd moduleList)::exceptList) ;; fun MODULE_ListGetAllLinks (moduleList) = listList_to_list MODULE_GetAllLinksExceptPreviousList moduleList nil ;; /*************************************************************************************** remove link from links list if link module destination or source is in moduleList ***************************************************************************************/ fun MODULE_RemoveListModuleLinksButModule (module, links, moduleList, type) = if links == nil then nil else let hd links -> listLink in let let hd listLink -> firstLink in if LINK_CompareDestination firstLink module then if MODULE_CompareSourceModuleLink firstLink moduleList then nil else if type & LINK_INCOMING then listLink else nil else if MODULE_CompareDestinationModuleLink firstLink moduleList then nil else if type & LINK_OUTGOING then listLink else nil -> curr in (curr)::(MODULE_RemoveListModuleLinksButModule module tl links moduleList type) ;; /*************************************************************************************** get external links from module list ***************************************************************************************/ fun MODULE_ListGetExternalLinks (moduleList, notModuleList, type) = if moduleList == nil then nil else let hd moduleList -> module in let module.MODlinks -> links in listcat (MODULE_RemoveListModuleLinksButModule module links notModuleList type) (MODULE_ListGetExternalLinks (tl moduleList) notModuleList type) ;; /*************************************************************************************** return all external links from module list ***************************************************************************************/ fun MODULE_ListGetAllExternalLinks (moduleList) = listList_to_list MODULE_ListGetExternalLinks moduleList moduleList LINK_OUTGOING|LINK_INCOMING ;; /*************************************************************************************** return all external outgoing links from module list ***************************************************************************************/ fun MODULE_ListGetAllExternalOutgoingLinks (moduleList) = listList_to_list MODULE_ListGetExternalLinks moduleList moduleList LINK_OUTGOING ;; /*************************************************************************************** return all external incoming links from module list ***************************************************************************************/ fun MODULE_ListGetAllExternalIncomingLinks (moduleList) = listList_to_list MODULE_ListGetExternalLinks moduleList moduleList LINK_INCOMING ;; fun MODULE_GetAllLinkFromEvent (module, event) = listList_to_list MODULE_SearchAllSpecificLink module.MODlinks @LINK_CompareCompleteSource [module event] ;; fun MODULE_GetAllLinkFromAction (module, action) = listList_to_list MODULE_SearchAllSpecificLink module.MODlinks @LINK_CompareCompleteDestination [module action] ;; /*************************************************************************************** MODULE LINK MANIPULATION ***************************************************************************************/ /**************************************************************************************** add link to corresponding link list in list of link list ****************************************************************************************/ fun MODULE_AddLinkToList (linkList, newLink) = if linkList == nil then (newLink::nil)::nil else let hd hd linkList -> oneLink in if LINK_CompareModules oneLink [(LINK_GetSource newLink) (LINK_GetDestination newLink)] then (newLink::(hd linkList))::(tl linkList) else (hd linkList)::(MODULE_AddLinkToList tl linkList newLink) ;; /**************************************************************************************** add specified link in the module list ****************************************************************************************/ fun MODULE_AddLink (module, newLink) = set module.MODlinks = MODULE_AddLinkToList module.MODlinks newLink; newLink ;; /**************************************************************************************** remove link from corresponding link list in list of link list using module to determine the appropriate link list ****************************************************************************************/ fun MODULE_RemoveLinkFromList (linkList, link) = if linkList == nil then logScsError "MODULE_RemoveLinkFromList" nil "unable to find link during link deletion !" nil else let hd hd linkList -> oneLink in if LINK_CompareModules oneLink [(LINK_GetSource link) (LINK_GetDestination link)] then (removef_from_list (hd linkList) @LINK_Compare link)::(tl linkList) else (hd linkList)::(MODULE_RemoveLinkFromList (tl linkList) link) ;; /**************************************************************************************** remove specified link in the module list ****************************************************************************************/ fun MODULE_RemoveLink (module, link) = /* MAC ICI MAT ICI a mon avis ca marche pas avec un lien d'un module vers lui-meme, a revoir */ set module.MODlinks = MODULE_RemoveLinkFromList module.MODlinks link; link ;; /*************************************************************************************** suppress module link reference in other modules ***************************************************************************************/ fun MODULE_RemoveModuleLinksInOther (modLinkList, outModule) = if modLinkList == nil then nil else ( let hd hd modLinkList -> link in let link.LINKsource -> source in if source == outModule then let link.LINKdestination -> dest in if dest == outModule then nil else set dest.MODlinks = removef_from_list dest.MODlinks @MODULE_CompareModuleLinkList outModule::nil else set source.MODlinks = removef_from_list source.MODlinks @MODULE_CompareModuleLinkList outModule::nil; MODULE_RemoveModuleLinksInOther tl modLinkList outModule; ); 1 ;; fun MODULE_DestroyLink (link) = MODULE_RemoveLink link.LINKsource link; MODULE_RemoveLink link.LINKdestination link; 1 ;; fun MODULE_RecreateLink( link, param )= MODULE_AddLink link.LINKsource link; if link.LINKsource != link.LINKdestination then MODULE_AddLink link.LINKdestination link else nil ;; fun MODULE_RecreateLinks( links )= if links == nil then nil else ( apply_on_list links @MODULE_RecreateLink nil; REFLEX_LinkAdded links nil; ); 1 ;; /**************************************************************************************** load new link ****************************************************************************************/ fun MODULE_LoadLink (site, source, event, destination, action, sParameter, sCondition) = if source == nil || event == nil || destination == nil || action == nil then logScsError "MODULE_LoadLink" nil "At least one of the parameters of function is nil" nil else let MODULE_SearchEvent site source event -> eventFound in if !eventFound then logScsError "MODULE_LoadLink" "Event"::event::nil "Event not found" nil else let MODULE_SearchAction site destination action -> actionFound in if !actionFound then logScsError "MODULE_LoadLink" "Action"::action::nil "Action not found" nil else let LINK_RealCreation source event destination action sParameter sCondition -> newLink in ( MODULE_RecreateLink newLink nil; newLink ) ;; /**************************************************************************************** create links between modules ****************************************************************************************/ fun MODULE_RealCreateLink (site, source, event, destinations, action) = if destinations == nil then nil else let destinations -> [destination next] in (/* test link existance */ let MODULE_GetCompleteLink source event destination action nil nil -> linkFound in if linkFound != nil then /* a similar link already exist */ ( ERRORS_AddError 0 60 (_locSCS "errorlabel-DUPLICATELINK" nil); logScsError "MODULE_LoadLink" nil "Link already exists ; new link created anyway" 0 ) else 1; let MODULE_LoadLink site source event destination action nil nil -> newLink in if newLink == nil then MODULE_RealCreateLink site source event next action else newLink::MODULE_RealCreateLink site source event next action ) ;; fun MODULE_RealCreateLinks (site, sources, event, destinations, action) = if sources == nil then nil else let sources -> [source next] in listcat MODULE_RealCreateLink site source event destinations action MODULE_RealCreateLinks site next event destinations action ;; proto MODULE_RealDestroyLinks = fun [[Link r1]] I;; proto MODULE_CreateLinks = fun [Site [Module r1] S [Module r1] S] I;; fun MODULE_CreateLinks (site, sources, event, destinations, action) = let MODULE_RealCreateLinks site sources event destinations action -> newLinks in ( REFLEX_LinkAdded newLinks nil; HISTORY_AddCurrentSite if (sizelist newLinks) > 1 then _locSCS "undo-LINKSCREATED" nil else _locSCS "undo-LINKCREATED" (LINK_Print hd newLinks)::nil mkfun1 @MODULE_RealDestroyLinks newLinks mkfun1 @MODULE_RecreateLinks newLinks; nil ); 1 ;; /*************************************************************************************** duplicate old module links for new module ***************************************************************************************/ fun MODULE_DuplicateLink (link, param) = let param -> [newModule oldModule] in let LINK_GetCompleteSource link -> [source event] in let LINK_GetCompleteDestination link -> [destination action] in ( if source == oldModule then set source = newModule else nil; if destination == oldModule then set destination = newModule else nil; let LINK_RealCreation source event destination action (LINK_GetParameter link) (LINK_GetCondition link) -> newLink in MODULE_RecreateLink newLink nil ) ;; /**************************************************************************************** destroy a module links ****************************************************************************************/ fun MODULE_DestroyAllLinks (links)= if links == nil then 1 else let links -> [link next] in ( MODULE_DestroyLink link; MODULE_DestroyAllLinks next ) ;; fun MODULE_RealDestroyLinks (links) = MODULE_DestroyAllLinks links; REFLEX_LinkRemoved links nil; SELECT_DestroyLink links ;; fun MODULE_DestroyLinks (links) = MODULE_RealDestroyLinks links; HISTORY_AddCurrentSite if (sizelist links) > 1 then _locSCS "undo-LINKSDESTROYED" nil else _locSCS "undo-LINKDESTROYED" (LINK_Print hd links)::nil mkfun1 @MODULE_RecreateLinks links mkfun1 @MODULE_RealDestroyLinks links; 1 ;; /**************************************************************************************** return real destination and action list from destinations and actions of all links in list real destination and action are the corresponding destination and action of final module from path using black box relay ****************************************************************************************/ fun MODULE_GetRealLinkDestination (site, linkList) = if linkList == nil then nil else listcat let hd linkList -> link in let LINK_GetCompleteDestination link -> [destination action] in if MODULE_IsBlackBox destination then MODULE_GetRealLinkDestination site MODULE_GetAllLinkFromEvent destination action else ([destination action])::nil MODULE_GetRealLinkDestination site tl linkList ;; /**************************************************************************************** return real source and event list from sources and events of all links in list real source and event are the corresponding source and event of initial module from path using black box relay ****************************************************************************************/ fun MODULE_GetRealLinkSource (site, linkList) = if linkList == nil then nil else listcat let hd linkList -> link in let LINK_GetCompleteSource link -> [source event] in if (MODULE_IsBlackBox source) && (source != (SITE_GetModuleRoot site)) then MODULE_GetRealLinkSource site MODULE_GetAllLinkFromAction source event else ([source event])::nil MODULE_GetRealLinkSource site tl linkList ;; fun MODULE_BuildLinkListDestination (sourceParam, destinationList, parame, condition) = let sourceParam -> [source event] in if destinationList == nil then nil else let hd destinationList -> [newDestination newAction] in (LINK_RealCreation source event newDestination newAction parame condition):: (MODULE_BuildLinkListDestination sourceParam (tl destinationList) parame condition) ;; fun MODULE_BuildLinkListSource (sourceList, destinationList, param, cond) = if sourceList == nil then nil else listcat MODULE_BuildLinkListDestination hd sourceList destinationList param cond MODULE_BuildLinkListSource tl sourceList destinationList param cond ;; /**************************************************************************************** return real links from link real link is the link corresponding to final module in path using black box relay ****************************************************************************************/ fun MODULE_GetRealLink (site, link) = let MODULE_GetRealLinkSource site link::nil -> newSourceList in let MODULE_GetRealLinkDestination site link::nil -> newDestinationList in MODULE_BuildLinkListSource newSourceList newDestinationList (LINK_GetParameter link) (LINK_GetCondition link) ;; fun MODULE_ConvertLinkListToRealLinkList (site, linkList) = if linkList == nil then nil else listcat (MODULE_GetRealLink site hd linkList) (MODULE_ConvertLinkListToRealLinkList site tl linkList) ;; fun MODULE_ConvertLinksToRealLinks (site, linksList) = if linksList == nil then nil else (MODULE_ConvertLinkListToRealLinkList site hd linksList)::(MODULE_ConvertLinksToRealLinks site tl linksList) ;; fun MODULE_VerifyLinkActionEventElt (link, param) = let param -> [site module] in let if (LINK_GetSource link) == module then MODULE_SearchEvent site module (LINK_GetEvent link) else MODULE_SearchAction site module (LINK_GetAction link) -> founded in if founded then 1 else ( MODULE_DestroyLink link; REFLEX_LinkRemoved link::nil nil; ERRORS_AddError 0 33 (_locSCS "errorlabel-16" (LINK_Print link)::nil); logScsError "MODULE_VerifyLinkActionEvent" nil "link destroyed because corresponding action or event has been deleted" 0 ) ;; fun MODULE_VerifyLinkActionEventList (linkList, param) = apply_on_list linkList @MODULE_VerifyLinkActionEventElt param ;; fun MODULE_VerifyAllActionEventInLink (site, module) = apply_on_list module.MODlinks @MODULE_VerifyLinkActionEventList [site module] ;; fun MODULE_RenameLinkActionEventElt (link, param) = let param -> [site module defList] in let if (LINK_GetSource link) == module then let if (MODULE_GetFather site (LINK_GetDestination link)) == module then MOD_DEF_BB_IN else MOD_DEF_BB_OUT -> defSe in [(LINK_GetEvent link) defSe @LINK_SetEvent] else let if (MODULE_GetFather site (LINK_GetSource link)) == module then MOD_DEF_BB_OUT else MOD_DEF_BB_IN -> defSe in [(LINK_GetAction link) defSe @LINK_SetAction] -> [actevt defsearch setfunc] in let hd tl tl (search_in_list defList @MODULE_CompareDefAndVal [defsearch actevt]) -> replace in if replace == nil then nil else ( exec setfunc with [link replace]; link ) ;; fun MODULE_RenameLinkActionEventList (linkList, param) = apply_on_list_with_return linkList @MODULE_RenameLinkActionEventElt param ;; fun MODULE_RenameAllActionEventInLink (site, module, defList) = if defList == nil then nil else let apply_on_list_with_return module.MODlinks @MODULE_RenameLinkActionEventList [site module defList] -> modifiedlinks in if modifiedlinks == nil then nil else REFLEX_LinkModified listList_to_list modifiedlinks REFLEX_OTHER ;; /*fun tmpfoo (list) =_showconsole; if list == nil then nil else let hd list -> [un deux] in "["::(un.MODname)::"->"::(deux.MODname)::"]"::(tmpfoo tl list) ;;*/ fun MODULE_ReBuildLink (site, linkList, linkRef, eventRef, actionRef) = if linkList == nil then nil else let hd linkList -> [source destination] in if (tl linkList) == nil then /* end rebuild */ if (MODULE_GetCompleteLink source eventRef destination actionRef (LINK_GetParameter linkRef) (LINK_GetCondition linkRef)) != nil then /* link already exist */ nil else let LINK_RealCreation source eventRef destination actionRef (LINK_GetParameter linkRef) (LINK_GetCondition linkRef) -> newLink in ( MODULE_RecreateLink newLink nil; newLink::nil ) else let MODULE_BBcreateNewRelay destination eventRef (if (MODULE_GetFather site source) == destination then MOD_DEF_BB_OUT else MOD_DEF_BB_IN) -> newRelayInBB in ( REFLEX_ModuleModified destination::nil REFLEX_OTHER; let LINK_RealCreation source eventRef destination newRelayInBB (LINK_GetParameter linkRef) (LINK_GetCondition linkRef) -> newLink in ( MODULE_RecreateLink newLink nil; let MODULE_ReBuildLink site (tl linkList) linkRef newRelayInBB actionRef -> newListLink in newLink::newListLink ) ) ;; fun MODULE_ScrapExistingLinkPath (linkPath, linkRef, sideRef, eventSide) = if (linkPath == nil) || ((tl linkPath) == nil) then [linkPath sideRef] else let hd linkPath -> [source destination] in let if eventSide then MODULE_GetEventLink source sideRef destination (LINK_GetParameter linkRef) (LINK_GetCondition linkRef) else MODULE_GetActionLink source destination sideRef (LINK_GetParameter linkRef) (LINK_GetCondition linkRef) -> oldLink in if oldLink == nil then [linkPath sideRef] else MODULE_ScrapExistingLinkPath (tl linkPath) linkRef (if eventSide then (LINK_GetAction oldLink) else (LINK_GetEvent oldLink)) eventSide ;; fun MODULE_BuildRealLink (link, site) = let SITE_GetLinkPath site (LINK_GetSource link) (LINK_GetDestination link) -> newLinkPath in (/*_fooS strbuild (tmpfoo newLinkPath)::nil;*/ let MODULE_ScrapExistingLinkPath newLinkPath link (LINK_GetEvent link) 1 -> [newLinkPath eventRef] in let MODULE_ScrapExistingLinkPath (mirror newLinkPath) link (LINK_GetAction link) 0 -> [newLinkPath actionRef] in MODULE_ReBuildLink site (mirror newLinkPath) link eventRef actionRef ) ;; fun MODULE_BuildRealLinks (linkList, site) = if linkList == nil then nil else listcat (MODULE_BuildRealLink hd linkList site) (MODULE_BuildRealLinks tl linkList site) ;; proto MODULE_ClearFreeLinkOnBB = fun [Link Module] I;; fun MODULE_ClearFreeLinkOnBBother (link, moduleOrig) = let if ((LINK_GetSource link) == moduleOrig) && ((LINK_GetDestination link) != moduleOrig) then (LINK_GetDestination link) else if ((LINK_GetSource link) != moduleOrig) && ((LINK_GetDestination link) == moduleOrig) then (LINK_GetSource link) else nil -> module in if module == nil then nil else ( MODULE_DestroyLink link; MODULE_ClearFreeLinkOnBB link module; ) ;; fun MODULE_ClearFreeLinkOnBB (link, moduleToClean) = if (LINK_GetSource link) == moduleToClean then if (MODULE_GetAllLinkFromEvent moduleToClean (LINK_GetEvent link)) == nil then let MODULE_GetAllLinkFromAction moduleToClean (LINK_GetEvent link) -> links in apply_on_list links @MODULE_ClearFreeLinkOnBBother moduleToClean else nil else if (MODULE_GetAllLinkFromAction moduleToClean (LINK_GetAction link)) == nil then let MODULE_GetAllLinkFromEvent moduleToClean (LINK_GetAction link) -> links in apply_on_list links @MODULE_ClearFreeLinkOnBBother moduleToClean else nil ;; fun MODULE_DestroyLinksFromModule (modLinks, module) = if modLinks == nil then ( set module.MODlinks = nil; 1 ) else ( let hd hd modLinks -> link in let if (LINK_GetSource link) != module then LINK_GetSource link else if (LINK_GetDestination link) != module then LINK_GetDestination link else nil -> moduleToClean in if moduleToClean == nil then nil else ( if MODULE_IsBlackBox moduleToClean then let search_in_list moduleToClean.MODlinks @MODULE_CompareModuleLinkList module::nil -> linkList in ( set moduleToClean.MODlinks = removef_from_list moduleToClean.MODlinks @MODULE_CompareModuleLinkList module::nil; apply_on_list linkList @MODULE_ClearFreeLinkOnBB moduleToClean; nil ) else set moduleToClean.MODlinks = removef_from_list moduleToClean.MODlinks @MODULE_CompareModuleLinkList module::nil; 1 ); MODULE_DestroyLinksFromModule tl modLinks module; ) ;; fun MODULE_CompareFirstModule (tupMod, module1) = let tupMod -> [first _] in (first == module1) ;; fun MODULE_ReplaceModuleInLink (link, modulesAssoList) = let LINK_GetSource link -> moduleSource in let search_in_list modulesAssoList @MODULE_CompareFirstModule moduleSource -> [_ newModuleSource] in if newModuleSource != nil then LINK_SetSource link newModuleSource else let LINK_GetDestination link -> moduleDestination in let search_in_list modulesAssoList @MODULE_CompareFirstModule moduleDestination -> [_ newModuleDestination] in if newModuleDestination != nil then LINK_SetDestination link newModuleDestination else /* nothing to do ; link is valid */ nil ;; fun MODULE_ReplaceModuleInModuleLinksList (linkList, modulesAssoList) = apply_on_list linkList @MODULE_ReplaceModuleInLink modulesAssoList ;; fun MODULE_ReplaceModuleInModuleLinks (module, modulesAssoList) = apply_on_list module.MODlinks @MODULE_ReplaceModuleInModuleLinksList modulesAssoList ;; fun MODULE_ListGetNumberOfLinks (moduleList) = if moduleList == nil then 0 else (sizelist MODULE_GetOutgoingLinks hd moduleList) + (MODULE_ListGetNumberOfLinks tl moduleList) ;; var PARASEPARATOR = "#########################################################################";; var LINESEPARATOR = "-------------------------------------------------------------------------";; proto MODULE_GetActionsCS = fun [Site Module I] [S r1];; proto MODULE_GetEventsCS = fun [Site Module I] [S r1];; fun MODULE_Report (site, module) = let quicksort_doublon (MODULE_GetOutgoingLinks module) @LINK_CompareStrBySource -> outlinks in let quicksort_doublon (MODULE_GetIncomingLinks module) @LINK_CompareStrByDestination -> inlinks in let get_doublon_from_sorted_list outlinks @LINK_CompareStrBySource nil -> doublonOutlinks in let get_doublon_from_sorted_list inlinks @LINK_CompareStrByDestination nil -> doublonInlinks in let quicksort (MODULE_GetActionsCS site module SCS_SERVER) @stringCompare -> Sactions in let quicksort (MODULE_GetActionsCS site module SCS_CLIENT) @stringCompare -> Cactions in let quicksort (MODULE_GetEventsCS site module SCS_SERVER) @stringCompare -> Sevents in let quicksort (MODULE_GetEventsCS site module SCS_CLIENT) @stringCompare -> Cevents in let sizelist Sactions -> sizeSactions in let sizelist Sevents -> sizeSevents in let sizelist Cactions -> sizeCactions in let sizelist Cevents -> sizeCevents in let sizelist outlinks -> sizeoutlinks in let sizelist inlinks -> sizeinlinks in let quicksort (LINK_GetPredecessors inlinks) @MODULE_CompareStrByName -> predecessors in let quicksort (LINK_GetSuccessors outlinks) @MODULE_CompareStrByName -> successors in "":: PARASEPARATOR:: "":: "******************************Module Class*******************************":: (strcatn "Module Class Name : "::(module.MODclass.MODCname)::nil):: (strcatn "Total Actions : "::(itoa sizeSactions+sizeCactions)::nil):: (strcatn "Total Events : "::(itoa sizeSevents+sizeCevents)::nil):: LINESEPARATOR:: (strcatn "Server Actions : "::(itoa sizeSactions)::nil):: (strcat " " lineBuildSeparator Sactions "\n "):: LINESEPARATOR:: (strcatn "Client Actions : "::(itoa sizeCactions)::nil):: (strcat " " lineBuildSeparator Cactions "\n "):: LINESEPARATOR:: (strcatn "Server Events : "::(itoa sizeSevents)::nil):: (strcat " " lineBuildSeparator Sevents "\n "):: LINESEPARATOR:: (strcatn "Client Events : "::(itoa sizeCevents)::nil):: (strcat " " lineBuildSeparator Cevents "\n "):: "":: "*****************************Module Instance*****************************":: (strcatn "Module Name : "::(module.MODname)::nil):: (strcatn "Module Server Number : "::(itoa module.MODserver)::nil):: (strcatn "Total Connected Links : "::(itoa sizeoutlinks+sizeinlinks)::nil):: LINESEPARATOR:: (strcatn "Predecessors : "::(itoa sizelist predecessors)::nil):: (strcat " " lineBuildSeparator (MODULE_PrintList predecessors) "\n "):: LINESEPARATOR:: (strcatn "Successors : "::(itoa sizelist successors)::nil):: (strcat " " lineBuildSeparator (MODULE_PrintList successors) "\n "):: LINESEPARATOR:: (strcatn "Incoming links : "::(itoa sizeinlinks)::nil):: (strcat " " lineBuildSeparator (LINK_PrintList inlinks @LINK_ReportIn) "\n "):: LINESEPARATOR:: (strcatn "Outgoing links : "::(itoa sizeoutlinks)::nil):: (strcat " " lineBuildSeparator (LINK_PrintList outlinks @LINK_ReportOut) "\n "):: ( listcat if doublonInlinks == nil then nil else LINESEPARATOR:: (strcatn "Incoming Doublon links : "::(itoa sizelist doublonInlinks)::nil):: (strcat " " lineBuildSeparator (LINK_PrintList doublonInlinks @LINK_ReportIn) "\n "):: nil if doublonOutlinks == nil then nil else LINESEPARATOR:: (strcatn "Outgoing Doublon links : "::(itoa sizelist doublonOutlinks)::nil):: (strcat " " lineBuildSeparator (LINK_PrintList doublonOutlinks @LINK_ReportOut) "\n "):: nil ) ;; fun MODULE_ListReport (site, moduleList) = if moduleList == nil then nil else listcat MODULE_Report site hd moduleList MODULE_ListReport site tl moduleList ;;