Rev 7878 | Rev 7886 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7878 | Rev 7885 | ||
---|---|---|---|
Line 19... | Line 19... | ||
19 | dword get(); //get_name_by_pos |
19 | dword get(); //get_name_by_pos |
20 | dword get_pos_by_name(); |
20 | dword get_pos_by_name(); |
21 | void drop(); |
21 | void drop(); |
22 | void increase_data_size(); |
22 | void increase_data_size(); |
23 | dword get_last(); |
23 | dword get_last(); |
24 | bool delete_last(); |
24 | bool pop(); |
25 | }; |
25 | }; |
Line 26... | Line 26... | ||
26 | 26 | ||
27 | :void collection::increase_data_size() { |
27 | :void collection::increase_data_size() { |
28 | int filled_size; |
28 | int filled_size; |
Line 80... | Line 80... | ||
80 | data_start = 0; |
80 | data_start = 0; |
81 | element_offset[count] = 0; |
81 | element_offset[count] = 0; |
82 | count = 0; |
82 | count = 0; |
83 | } |
83 | } |
Line 84... | Line 84... | ||
84 | 84 | ||
85 | :bool collection::delete_last() { |
85 | :bool collection::pop() { |
86 | count--; |
86 | if (count>0) count--; |
Line 87... | Line 87... | ||
87 | } |
87 | } |
88 | 88 | ||
89 | /*======================================================== |
89 | /*======================================================== |
90 | = = |
90 | = = |
91 | = Integer = |
91 | = Integer = |
Line 92... | Line 92... | ||
92 | = = |
92 | = = |
93 | ========================================================*/ |
93 | ========================================================*/ |
- | 94 | ||
- | 95 | struct collection_int |
|
94 | 96 | { |
|
95 | struct collection_int |
97 | dword buf; |
96 | { |
98 | dword buf_size; |
97 | int count; |
99 | unsigned count; |
98 | dword element[4096*3]; |
100 | void alloc(); |
99 | int add(); |
101 | void add(); |
100 | dword get(); |
102 | dword get(); |
101 | dword get_last(); |
103 | dword get_last(); |
Line -... | Line 104... | ||
- | 104 | void pop(); |
|
- | 105 | void drop(); |
|
- | 106 | }; |
|
- | 107 | ||
- | 108 | :void collection_int::alloc() { |
|
- | 109 | if (!buf) { |
|
- | 110 | buf_size = 4096; |
|
- | 111 | buf = malloc(4096); |
|
- | 112 | } else { |
|
- | 113 | buf_size += 4096; |
|
102 | void pop(); |
114 | buf = realloc(buf, buf_size); |
- | 115 | } |
|
103 | void drop(); |
116 | } |
104 | }; |
117 | |
105 | 118 | :void collection_int::add(dword _in) { |
|
106 | :int collection_int::add(dword in) { |
- | |
107 | if (count >= 4096*3) return 0; |
119 | if (!buf) || (count * sizeof(dword) >= buf_size) alloc(); |
Line 108... | Line 120... | ||
108 | element[count] = in; |
120 | EAX = count * sizeof(dword) + buf; |
109 | count++; |
121 | ESDWORD[EAX] = _in; |
110 | return 1; |
122 | count++; |
111 | } |
123 | } |
Line 112... | Line 124... | ||
112 | 124 | ||
113 | :dword collection_int::get(dword pos) { |
125 | :dword collection_int::get(dword pos) { |
114 | if (pos<0) || (pos>=count) return 0; |
126 | if (pos<0) || (pos>=count) return 0; |
Line 115... | Line 127... | ||
115 | return element[pos]; |
127 | return ESDWORD[pos * sizeof(dword) + buf]; |
116 | } |
128 | } |
117 | 129 | ||
Line 118... | Line 130... | ||
118 | :dword collection_int::get_last() { |
130 | :dword collection_int::get_last() { |
119 | return element[count]; |
131 | return get(count-1); |
120 | } |
- | |
121 | 132 | } |
|
Line 122... | Line 133... | ||
122 | :void collection_int::pop() { |
133 | |
123 | if (count>0) count--; |
134 | :void collection_int::pop() { |