X-Git-Url: http://plrg.eecs.uci.edu/git/?p=cdsspec-compiler.git;a=blobdiff_plain;f=grammer%2Fspec.txt;fp=grammer%2Fspec.txt;h=1ac8dc15792098ff6de3938343b3d5320ea8a73b;hp=ed30de8b3e76bc78c9c1fbd46525d7ae0bfaed19;hb=24022553f123d8f8a796b257410b4c1c1b9ef8ee;hpb=f2d6efad8b1ee05ef5dd12175af9e59e61c7b8f8 diff --git a/grammer/spec.txt b/grammer/spec.txt index ed30de8..1ac8dc1 100644 --- a/grammer/spec.txt +++ b/grammer/spec.txt @@ -1 +1,55 @@ -void enqueue(queue_t *q, unsigned int val) +/** +@Begin + @Options: + LANG = C; + CLASS = cliffc_hashtable; + @Global_define: + @DeclareVar: + spec_hashtable map; + spec_hashtable id_map; + Tag tag; + @InitVar: + map = spec_hashtable(); + id_map = spec_hashtable(); + tag = Tag(); + @DefineFunc: + static bool equals_val(TypeV *ptr1, TypeV *ptr2) { + // ... + } + + # Update the tag for the current key slot if the corresponding tag + # is NULL, otherwise just return that tag. It will update the next + # available tag too if it requires a new tag for that key slot. + static Tag getKeyTag(TypeK &key) { + if (id_map.get(key) == NULL) { + Tag cur_tag = tag.current(); + id_map.put(key, cur_tag); + tag.next(); + return cur_tag; + } else { + return id_map.get(key); + } + } + + @Interface_cluster: + Read_interface = { + Get, + PutIfAbsent, + RemoveAny, + RemoveIfMatch, + ReplaceAny, + ReplaceIfMatch + } + + Write_interface = { + Put, + PutIfAbsent(COND_PutIfAbsentSucc), + RemoveAny, + RemoveIfMatch(COND_RemoveIfMatchSucc), + ReplaceAny, + ReplaceIfMatch(COND_ReplaceIfMatchSucc) + } + @Happens_before: + Write_interface -> Read_interface + @End + */