/***************************************************************************************/ /* */ /* SCS editor Version 2 */ /* File : Reflex.pkg */ /* Version : 08 Juin 2000 */ /* Reflex struct and functions */ /* */ /***************************************************************************************/ var REFLEX_ADDED = 1;; var REFLEX_REMOVED = 2;; var REFLEX_MODIFIED = 3;; var REFLEX_SELECTED = 4;; /* REFLEX_SELECTED is used as well for selection and unselection using the param of the function which can take the value : REFLEX_SELECTION or REFLEX_UNSELECTION */ var REFLEX_NAME = 20;; var REFLEX_SERVER = 21;; var REFLEX_POSITION = 22;; var REFLEX_DEFINITIONS = 23;; var REFLEX_SIZE = 24;; var REFLEX_SOURCE = 25;; var REFLEX_DESTINATION = 26;; var REFLEX_PARAMETER = 27;; var REFLEX_CONDITION = 28;; var REFLEX_BITMAP = 29;; var REFLEX_COLOR = 31;; var REFLEX_TYPE = 32;; var REFLEX_FILENAME = 33;; var REFLEX_STATUS = 34;; /* specific reflex for site modification state */ var REFLEX_OTHER = 30;; /* indifferent reflex */ var REFLEX_POSITIONSTYLE = 35;; var REFLEX_SATSCOLCONTENT = 36;; var REFLEX_PROPERTIE = 37;; /* flags */ var REFLEX_PRIORITY_ONE = 1;; var REFLEX_PRIORITY_TWO = 2;; var REFLEX_PRIORITY_THREE = 4;; var REFLEX_SELECTION = 8;; var REFLEX_UNSELECTION = 16;; struct ReflexLists = [ REFLEXmodule : [[I [fun [[Module r1] I] I r1]] r1] , /* list of subscribed functions for module CB */ REFLEXzone : [[I [fun [[Zone r1] I] I r1]] r1] , /* list of subscribed functions for zone CB */ REFLEXlink : [[I [fun [[Link r1] I] I r1]] r1] , /* list of subscribed functions for link CB */ REFLEXassociation : [[I [fun [[Association r1] I] I r1]] r1] , /* list of subscribed functions for association CB */ REFLEXsite : [[I [fun [Site I] I r1]] r1] /* list of subscribed functions for site CB */ ] mkReflexLists ;; /**************************************************************************************** ****************************************************************************************/ fun REFLEX_CompareReflex (reflexList, type)= let reflexList -> [typeList _] in typeList == type ;; fun REFLEX_RegisterFunction (reflexList, type, function) = let search_in_list reflexList @REFLEX_CompareReflex type -> foundReflex in if foundReflex == nil then [type function::nil]::reflexList else let foundReflex -> [_ functionList] in let [type listcat functionList function::nil] -> newReflex in replace_in_list reflexList foundReflex newReflex ;; fun REFLEX_UnregisterFunction (reflexList, type, function) = let search_in_list reflexList @REFLEX_CompareReflex type -> foundReflex in if foundReflex == nil then reflexList else let foundReflex -> [_ functionList] in let [type remove_from_list functionList function] -> newReflex in replace_in_list reflexList foundReflex newReflex ;; fun REFLEX_ActivateFunctions (function, paramFun) = exec function with paramFun ;; fun REFLEX_Activate (reflexList, type, paramFun) = let search_in_list reflexList @REFLEX_CompareReflex type -> foundReflex in if foundReflex == nil then nil else let foundReflex -> [_ functionList] in apply_on_list functionList @REFLEX_ActivateFunctions paramFun ;;