Subversion Repositories Kolibri OS

Rev

Rev 7970 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7970 Rev 7972
1
struct _anchors {
1
struct _anchors {
2
	char current[256];
2
	char current[256];
3
	collection anchor_name;
3
	collection anchor_name;
4
	collection anchor_position;
4
	collection anchor_position;
5
	void add();
5
	void add();
6
	int get_pos_by_name();
6
	int get_pos_by_name();
7
	void clear();
7
	void clear();
8
	void take_anchor_from();
8
	void take_anchor_from();
9
} anchors;
9
} anchors=0;
10
 
10
 
11
void _anchors::add(dword _name, _pos)
11
void _anchors::add(dword _name, _pos)
12
{
12
{
13
	anchor_name.add(_name);
13
	anchor_name.add(_name);
14
	anchor_position.add(itoa(_pos));
14
	anchor_position.add(itoa(_pos));
15
}
15
}
16
 
16
 
17
int _anchors::get_pos_by_name(dword _get_name)
17
int _anchors::get_pos_by_name(dword _get_name)
18
{
18
{
19
	dword pos_name = anchor_name.get_pos_by_name(_get_name);
19
	dword pos_name = anchor_name.get_pos_by_name(_get_name);
20
	if (ESBYTE[_get_name]==NULL) return 0;
20
	if (ESBYTE[_get_name]==NULL) return 0;
21
	if (pos_name==-1) { 
21
	if (pos_name==-1) { 
22
		return -1;
22
		return -1;
23
	} else {
23
	} else {
24
		return atoi(anchor_position.get(pos_name));
24
		return atoi(anchor_position.get(pos_name));
25
	}
25
	}
26
}
26
}
27
 
27
 
28
void _anchors::clear()
28
void _anchors::clear()
29
{
29
{
30
	anchor_name.drop();
30
	anchor_name.drop();
31
	anchor_position.drop();
31
	anchor_position.drop();
32
}
32
}
33
 
33
 
34
void _anchors::take_anchor_from(dword _URL)
34
void _anchors::take_anchor_from(dword _URL)
35
{
35
{
36
	int anchor_pos;
36
	int anchor_pos;
37
	if (!current) && (_URL) && (anchor_pos = strrchr(_URL, '#')) {
37
	if (!current) && (_URL) && (anchor_pos = strrchr(_URL, '#')) {
38
		strncpy(#current, _URL+anchor_pos-1, sizeof(_anchors.current)-1);
38
		strncpy(#current, _URL+anchor_pos-1, sizeof(_anchors.current)-1);
39
		ESBYTE[_URL+anchor_pos-1] = '\0';
39
		ESBYTE[_URL+anchor_pos-1] = '\0';
40
	}
40
	}
41
}
41
}