/***************************************************************************************/ /* */ /* SCS editor Version 2 */ /* File : Association.pkg */ /* Version : 8 Jun 2000 */ /* Zone and ModuleZone association Struct and basic functions */ /* */ /***************************************************************************************/ struct Association = [ ASSOzone : Zone , /* Association zone */ ASSOmodule : Module , /* Association module */ ASSOname : S /* Association module zone name */ ] mkAssociation ;; /**************************************************************************************** compare association ****************************************************************************************/ fun ASSO_CompareAssociation (asso1, asso2) = (!strcmp asso1.ASSOname asso2.ASSOname) && (asso1.ASSOzone == asso2.ASSOzone) && (asso1.ASSOmodule == asso2.ASSOmodule) ;; /*************************************************************************************** zone association comparison function Return value: 1 (success) or 0 (failure) ***************************************************************************************/ fun ASSO_AssociationByZone (elt, zone) = elt.ASSOzone == zone ;; fun ASSO_ZoneByAssociation (zone, elt) = elt.ASSOzone == zone ;; fun ASSO_AssociationByZoneList (elt, zoneList) = isf_in_list zoneList @ASSO_ZoneByAssociation elt ;; /*************************************************************************************** zone association comparison function Return value: 1 (success) or 0 (failure) ***************************************************************************************/ fun ASSO_AssociationByModule (elt, module) = elt.ASSOmodule == module ;; /*************************************************************************************** zone association comparison function Return value: 1 (success) or 0 (failure) ***************************************************************************************/ fun ASSO_AssociationByModuleAndName (elt, param) = let param -> [module name] in (!strcmp elt.ASSOname name) && (elt.ASSOmodule == module) ;; fun ASSO_AddSubAssociation (list, asso) = if (search_in_list list @ASSO_CompareAssociation asso) != nil then { ERRORS_AddError 0 10 (_locSCS "errorlabel-10" nil) ; logScsError "ASSO_AddSubAssociation" nil "association already exists" list } else asso::list ;; fun ASSO_RemoveSubAssociation (list, asso) = removef_from_list list @ASSO_CompareAssociation asso ;; proto SITE_GetZoneCompleteName = fun [Site Zone] [S r1];; /*************************************************************************************** build asso definition ***************************************************************************************/ fun ASSO_BuildDef (site, asso) = (if (asso.ASSOzone.ZONEsideFlag) == SCS_CLIENT then MOD_DEF_ZONE_C else MOD_DEF_ZONE_S2):: (asso.ASSOname):: (lineBuildSeparator SITE_GetZoneCompleteName site asso.ASSOzone ".")::nil ;; /*************************************************************************************** build assos ***************************************************************************************/ fun ASSO_GetDefinitions (site, assoList) = if assoList == nil then nil else let ASSO_BuildDef site hd assoList -> lineList in lineList::(ASSO_GetDefinitions site tl assoList) ;;