From f7606c4eb8c45033db41b2ec1fc3e446b375fa87 Mon Sep 17 00:00:00 2001 From: johnvg Date: Thu, 21 Apr 2011 15:11:27 +0000 Subject: use strictness annotations in instance member types, add instance member types in definition modules git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@1932 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d --- frontend/containers.icl | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'frontend/containers.icl') diff --git a/frontend/containers.icl b/frontend/containers.icl index 2b2bd8b..59fdb69 100644 --- a/frontend/containers.icl +++ b/frontend/containers.icl @@ -313,6 +313,22 @@ equal_strictness_lists (StrictList s1 l) (Strict s2) equal_strictness_lists (StrictList s1 l1) (StrictList s2 l2) = s1==s2 && equal_strictness_lists l1 l2 +more_or_equal_strictness_lists :: !StrictnessList !StrictnessList -> Bool +more_or_equal_strictness_lists NotStrict s2 + = is_not_strict s2 +more_or_equal_strictness_lists (Strict s) NotStrict + = True +more_or_equal_strictness_lists (Strict s1) (Strict s2) + = (bitnot s1) bitand s2==0 +more_or_equal_strictness_lists (Strict s1) (StrictList s2 l) + = (bitnot s1) bitand s2==0 && is_not_strict l +more_or_equal_strictness_lists (StrictList s l) NotStrict + = True +more_or_equal_strictness_lists (StrictList s1 l) (Strict s2) + = (bitnot s1) bitand s2==0 +more_or_equal_strictness_lists (StrictList s1 l1) (StrictList s2 l2) + = (bitnot s1) bitand s2==0 && more_or_equal_strictness_lists l1 l2 + add_next_strict :: !Int !Int !StrictnessList -> (!Int,!Int,!StrictnessList) add_next_strict strictness_index strictness strictness_list | strictness_index<32 @@ -383,7 +399,7 @@ screw :== 80 ikhEmpty :: .(IntKeyHashtable a) ikhEmpty = IntKeyHashtable 0 0 0 {} -ikhInsert :: !Bool !IntKey a !*(IntKeyHashtable a) -> (!Bool, !.IntKeyHashtable a) +ikhInsert :: !Bool !IntKey !a !*(IntKeyHashtable a) -> (!Bool, !.IntKeyHashtable a) ikhInsert overide int_key value (IntKeyHashtable ikh_rehash_threshold ikh_nr_of_entries ikh_bitmask ikh_entries) | ikh_rehash_threshold<=ikh_nr_of_entries = ikhInsert overide int_key value (grow ikh_entries) @@ -391,7 +407,7 @@ ikhInsert overide int_key value (IntKeyHashtable ikh_rehash_threshold ikh_nr_of_ (tree, ikh_entries) = ikh_entries![hash_value] (is_new, tree) = iktUInsert overide int_key value tree - ikh_entries = { ikh_entries & [hash_value] = tree } + ikh_entries = {ikh_entries & [hash_value] = tree} | is_new = (is_new, (IntKeyHashtable ikh_rehash_threshold (ikh_nr_of_entries+1) ikh_bitmask ikh_entries)) = (is_new, (IntKeyHashtable ikh_rehash_threshold ikh_nr_of_entries ikh_bitmask ikh_entries)) @@ -421,7 +437,7 @@ grow old_entries = foldSt (\(key, value) ikh -> snd (ikhInsert False key value ikh)) list ikh = (old_entries, ikh) -ikhInsert` :: !Bool !IntKey a !*(IntKeyHashtable a) -> .IntKeyHashtable a +ikhInsert` :: !Bool !IntKey !a !*(IntKeyHashtable a) -> .IntKeyHashtable a ikhInsert` overide int_key value ikh = snd (ikhInsert overide int_key value ikh) @@ -445,10 +461,10 @@ ikhUSearch int_key (IntKeyHashtable ikh_rehash_threshold ikh_nr_of_entries ikh_b (ikt, ikh_entries) = ikh_entries![hash_value] (opt_result, ikt) = iktUSearch int_key ikt - ikh_entries = { ikh_entries & [hash_value] = ikt } + ikh_entries = {ikh_entries & [hash_value] = ikt} = (opt_result, (IntKeyHashtable ikh_rehash_threshold ikh_nr_of_entries ikh_bitmask ikh_entries)) -iktUInsert :: !Bool !IntKey a !*(IntKeyTree a) -> (!Bool, !.IntKeyTree a) +iktUInsert :: !Bool !IntKey !a !*(IntKeyTree a) -> (!Bool, !.IntKeyTree a) iktUInsert overide int_key value IKT_Leaf = (True, IKT_Node int_key value IKT_Leaf IKT_Leaf) iktUInsert overide int_key value (IKT_Node key2 value2 left right) -- cgit v1.2.3