Subversion Repositories Kolibri OS

Rev

Rev 5977 | Rev 6738 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5977 Rev 6285
Line 1... Line 1...
1
#ifndef INCLUDE_COLLECTION_H
1
#ifndef INCLUDE_COLLECTION_H
2
#define INCLUDE_COLLECTION_H
2
#define INCLUDE_COLLECTION_H
3
#print "[include ]\n"
3
#print "[include ]\n"
Line -... Line 4...
-
 
4
 
-
 
5
/*========================================================
-
 
6
=                                                        =
-
 
7
=                       String                           =
-
 
8
=                                                        =
-
 
9
========================================================*/
4
 
10
 
5
struct collection
11
struct collection
6
{
12
{
7
	int realloc_size, count;
13
	int realloc_size, count;
8
	dword data_start;
14
	dword data_start;
Line 48... Line 54...
48
void collection::drop() {
54
void collection::drop() {
49
	if (data_start) free(data_start);
55
	if (data_start) free(data_start);
50
	data_size = data_start = element_offset[count] = count = 0;
56
	data_size = data_start = element_offset[count] = count = 0;
51
}
57
}
Line -... Line 58...
-
 
58
 
-
 
59
 
-
 
60
/*========================================================
-
 
61
=                                                        =
-
 
62
=                       Integer                          =
-
 
63
=                                                        =
-
 
64
========================================================*/
-
 
65
 
-
 
66
struct collection_int
-
 
67
{
-
 
68
	int count;
-
 
69
	dword element[4096*3];
-
 
70
	int add();
-
 
71
	dword get();
-
 
72
	void drop();
-
 
73
};
-
 
74
 
-
 
75
int collection_int::add(dword in) {
-
 
76
	if (count >= 4096*3) return 0;
-
 
77
	element[count] = in;
-
 
78
	count++;
-
 
79
	return 1;
-
 
80
}
-
 
81
 
-
 
82
dword collection_int::get(dword pos) {
-
 
83
	if (pos<0) || (pos>=count) return 0;
-
 
84
	return element[pos];
-
 
85
}
-
 
86
 
-
 
87
void collection_int::drop() {
-
 
88
	element[0] = 
-
 
89
	count = 0;
-
 
90
}
52
 
91
 
53
#endif
92
#endif