Changes between Version 3 and Version 4 of DataStructures
- Timestamp:
- 07/03/14 13:50:26 (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DataStructures
v3 v4 20 20 $seq $seq_empty($type type); 21 21 22 /* Returns the sequence formed by reading n consecutive elements 23 * from memory. The parameter ptr points to the first such element, 24 * and type is the type of each element. 25 */ 26 $seq $seq_from_array($type type, void * ptr, int n); 27 22 28 /* Returns the type of an element that goes in this seq */ 23 $type $seq_element_type($seq v);29 $type $seq_element_type($seq seq); 24 30 25 31 /* Returns the seq that is like the given one but with one more 26 32 * element added. A runtime exception is generated if the thing pointed 27 * to by eltptr doesn't have the right type for v. */28 $seq $seq_add($seq v, void * eltptr);33 * to by eltptr doesn't have the right type for the seq. */ 34 $seq $seq_add($seq seq, void * eltptr); 29 35 30 36 /* Returns the seq that is like the given one but with the element 31 37 * at position index removed and the subsequent elements shifted down */ 32 $seq $seq_remove($seq v, int index);38 $seq $seq_remove($seq seq, int index); 33 39 34 40 /* Returns the seq that is like the given one but with the element 35 41 * at position index replaced with whatever object is pointed to by 36 42 * ptr. */ 37 $seq $seq_set($seq v, int index, void * ptr);43 $seq $seq_set($seq seq, int index, void * ptr); 38 44 39 45 /* Returns the length of the seq (i.e., the number of elements) */ 40 int $seq_length($seq v);46 int $seq_length($seq seq); 41 47 42 48 /* Returns the seq that is like the given one but with an element 43 49 * inserted at position i (and the subsequent elements shifted up). 44 50 * The parameter eltptr is a pointer to the element to insert. */ 45 $seq $seq_insert($seq v, int index, void * eltptr);51 $seq $seq_insert($seq seq, int index, void * eltptr); 46 52 47 53 /* Gets the element at position index and stores it in wherever 48 54 * ptr points to. */ 49 void $seq_get($seq v, int index, void * ptr);55 void $seq_get($seq seq, int index, void * ptr); 50 56 51 /* Returns the subsequence */ 52 $seq $seq_sub($seq v, int start, int stop); 57 /* Returns the subsequence consisting of elements at index i, for 58 * start<=i<stop. */ 59 $seq $seq_subseq($seq seq, int start, int stop); 53 60 54 61 /* Returns the concatenation of the two sequences */ 55 62 $seq $seq_concat($seq s1, $seq s2); 56 57 63 }}} 58 64 … … 71 77 72 78 /* Returns the type of an element that goes in this set */ 73 $type $set_element_type($set v);79 $type $set_element_type($set set); 74 80 75 81 /* Returns the set that is like the given one but with one more 76 82 * element added. A runtime exception is generated if the thing pointed 77 83 * to by eltptr doesn't have the right type for s. */ 78 $set $set_add($set v, void * eltptr);84 $set $set_add($set set, void * eltptr); 79 85 80 86 /* Returns the set that is like the given one but with the specified element 81 87 * removed. If the set does not contain the element the set returned 82 88 * will equal the given one. */ 83 $set $set_remove($set s , void * eltptr);89 $set $set_remove($set set, void * eltptr); 84 90 85 91 /* Does the set contain the specified element? */ 86 _Bool $set_contains($set s , void * eltptr);92 _Bool $set_contains($set set, void * eltptr); 87 93 88 94 $set $set_union($set s1, $set s2); … … 97 103 98 104 // need a way to iterate over elements of a set. 105 // should set be ordered? 106 // used in $for loop ? 99 107 100 108 }}} … … 113 121 114 122 $map $map_removeKey($map map, void * keyPtr); 123 124 // need a way to get the Keys, at least 115 125 }}} 116 126
