AS_Library.der.hs revision 15d3f558a8506ed7bf2b1cf3d471448283dfe2dd
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Author: Klaus L�ttich
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster These data structures describe the abstract syntax tree for heterogenous
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster libraries in HetCASL.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster - ATermConversion SML-CATS has now his own module
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster - LaTeX Pretty Printing
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostermodule AS_Library where
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster-- DrIFT command:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster{-! global: UpPos !-}
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport AS_Annotation
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport qualified AS_Architecture
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport qualified AS_Structured
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport Grothendieck
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterdata LIB_DEFN = Lib_defn LIB_NAME [Annoted LIB_ITEM] [Pos] [Annotation]
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster -- pos: "library"
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington -- list of annotations is parsed preceding the first LIB_ITEM
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington -- the last LIB_ITEM may be annotated with a following comment
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster -- the first LIB_ITEM cannot be annotated
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster deriving (Show,Eq)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster{- for information on the list of Pos see the documentation in
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterdata LIB_ITEM = Spec_defn AS_Structured.SPEC_NAME
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster | Arch_spec_defn AS_Architecture.ARCH_SPEC_NAME
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster | Download_items LIB_NAME [ITEM_NAME_OR_MAP] [Pos]
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster -- pos: "from","get",commas, opt "end"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster | Logic_decl AS_Structured.Logic_name [Pos]
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster -- pos: "logic", Logic_name
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster deriving (Show,Eq)
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunningtondata ITEM_NAME_OR_MAP = Item_name ITEM_NAME
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington | Item_name_map ITEM_NAME ITEM_NAME [Pos]
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster -- pos: "|->"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster deriving (Show,Eq)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostertype ITEM_NAME = SIMPLE_ID
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterdata LIB_NAME = Lib_version LIB_ID VERSION_NUMBER
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster | Lib_id LIB_ID
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterdata LIB_ID = Direct_link URL [Pos]
365156d5428edc07eae024879829e586bbaf9d42Neil Madden -- pos: start of URL
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster | Indirect_link PATH [Pos]
365156d5428edc07eae024879829e586bbaf9d42Neil Madden -- pos: start of PATH
365156d5428edc07eae024879829e586bbaf9d42Neil Maddendata VERSION_NUMBER = Version_number [String] [Pos]
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster -- pos: "version", start of first string
365156d5428edc07eae024879829e586bbaf9d42Neil Madden deriving (Show,Eq)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostertype URL = String
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostertype PATH = String
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterinstance Show LIB_ID where
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster show (Direct_link s1 _) = s1
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster show (Indirect_link s1 _) = s1
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterinstance Show LIB_NAME where
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster show (Lib_version libid _) = show libid
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster show (Lib_id libid) = show libid
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterinstance Eq LIB_ID where
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Direct_link s1 _ == Direct_link s2 _ = s1==s2
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Direct_link s1 _ == Indirect_link s2 _ = False
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Indirect_link s1 _ == Direct_link s2 _ = False
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Indirect_link s1 _ == Indirect_link s2 _ = s1==s2
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterinstance Ord LIB_ID where
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Direct_link s1 _ <= Direct_link s2 _ = s1<=s2
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Direct_link _ _ <= Indirect_link _ _ = True
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Indirect_link _ _ <= Direct_link _ _ = False
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Indirect_link s1 _ <= Indirect_link s2 _ = s1<=s2
8af80418ba1ec431c8027fa9668e5678658d3611Allan FostergetLIB_ID :: LIB_NAME -> LIB_ID
8af80418ba1ec431c8027fa9668e5678658d3611Allan FostergetLIB_ID (Lib_version libid _) = libid
8af80418ba1ec431c8027fa9668e5678658d3611Allan FostergetLIB_ID (Lib_id libid) = libid
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterinstance Eq LIB_NAME where
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ln1 == ln2 = getLIB_ID ln1 == getLIB_ID ln2
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterinstance Ord LIB_NAME where
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ln1 <= ln2 = getLIB_ID ln1 <= getLIB_ID ln2
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster-- functions for casts
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostercast_S_L_Spec_defn :: AS_Structured.SPEC_DEFN -> LIB_ITEM
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostercast_L_S_Spec_defn :: LIB_ITEM -> AS_Structured.SPEC_DEFN
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostercast_S_L_Spec_defn (AS_Structured.Spec_defn x y z p) =
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostercast_S_L_Spec_defn _ = error "wrong constructor for \"cast_S_L_Spec_defn\""
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostercast_L_S_Spec_defn (AS_Library.Spec_defn x y z p) =
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostercast_L_S_Spec_defn _ = error "wrong constructor for \"cast_L_S_Spec_defn\""
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostercast_S_L_View_defn :: AS_Structured.VIEW_DEFN -> LIB_ITEM
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostercast_L_S_View_defn :: LIB_ITEM -> AS_Structured.VIEW_DEFN
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostercast_S_L_View_defn (AS_Structured.View_defn w x y z p) =
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostercast_S_L_View_defn _ = error "wrong constructor for \"cast_S_L_View_defn\""
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostercast_L_S_View_defn (AS_Library.View_defn w x y z p) =
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostercast_L_S_View_defn _ = error "wrong constructor for \"cast_L_S_View_defn\""
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostercast_A_L_Arch_spec_defn :: AS_Architecture.ARCH_SPEC_DEFN -> LIB_ITEM
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostercast_L_A_Arch_spec_defn :: LIB_ITEM -> AS_Architecture.ARCH_SPEC_DEFN
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostercast_A_L_Arch_spec_defn (AS_Architecture.Arch_spec_defn x y p) =
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostercast_A_L_Arch_spec_defn _ =
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster error "wrong constructor for \"cast_A_L_Arch_defn\""
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostercast_L_A_Arch_spec_defn (AS_Library.Arch_spec_defn x y p) =
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostercast_L_A_Arch_defn _ = error "wrong constructor for \"cast_L_A_Arch_defn\""
365156d5428edc07eae024879829e586bbaf9d42Neil Maddencast_A_L_Unit_spec_defn :: AS_Architecture.UNIT_SPEC_DEFN -> LIB_ITEM
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostercast_L_A_Unit_spec_defn :: LIB_ITEM -> AS_Architecture.UNIT_SPEC_DEFN
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostercast_A_L_Unit_spec_defn (AS_Architecture.Unit_spec_defn x y p) =
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostercast_A_L_Unit_defn _ = error "wrong constructor for \"cast_A_L_Unit_defn\""
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostercast_L_A_Unit_spec_defn (AS_Library.Unit_spec_defn x y p) =
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostercast_L_A_Spec_defn _ = error "wrong constructor for \"cast_L_A_Unit_defn\""