Subversion Repositories Kolibri OS

Rev

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

Rev 7997 Rev 8000
Line 1... Line 1...
1
/* TIMERS PaulCodeman */
1
/* TIMERS PaulCodeman */
-
 
2
/**
-
 
3
	void Timers::revise(void) -> This function revising all timers.
-
 
4
	void Timers::getTime(void) -> This function updating current time for timers.
-
 
5
	dword set(dword,dword,byte); -> This function seting timer for function Timers::revise.
-
 
6
	dword clear(dword); -> This function clearning anything timer.
-
 
7
	---------
-
 
8
	The functions setTimeout,setInterval,clearInterval,clearTimeout implementing functional JavaScript.
2
 
9
*/
3
#define offsetSizeTimers 4*3+1
10
#define offsetSizeTimers 4*3+1
4
#define defaultMaxTimers 1000
11
#define defaultMaxTimers 1000
5
:struct Timers
12
:struct Timers
6
{
13
{
7
	dword time;
14
	dword time;
8
    dword alloc;
15
    dword alloc;
9
    dword count;
16
    dword count;
10
    dword size;
17
    dword size;
11
    void watch(void);
18
    void revise(void);
12
    void getTime();
19
    void getTime(void);
13
    dword set(dword,dword,byte);
20
    dword set(dword,dword,byte);
14
    dword clear(dword);
21
    dword clear(dword);
15
};
22
};
16
void Timers::getTime(void)
23
void Timers::getTime(void)
17
{
24
{
18
	EAX = 26;
25
	EAX = 26;
19
	EBX = 9;
26
	EBX = 9;
20
	$int 0x40
27
	$int 0x40
21
	time = EAX;
28
	time = EAX;
22
}
29
}
23
void Timers::watch(void)
30
void Timers::revise(void)
24
{
31
{
25
	dword position = 0;
32
	dword position = 0;
26
	dword i = 0;
33
	dword i = 0;
27
	IF (!alloc) RETURN;
34
	IF (!alloc) RETURN;
28
	getTime();
35
	getTime();
Line 72... Line 79...
72
	DSBYTE[position+12] = repeat;
79
	DSBYTE[position+12] = repeat;
73
	RETURN position;
80
	RETURN position;
74
}
81
}
75
dword Timers::clear(dword id)
82
dword Timers::clear(dword id)
76
{
83
{
77
	IF (!alloc) || (!DSDWORD[id]) RETURN 0;
84
	IF (!alloc) || (!id) || (!DSDWORD[id]) RETURN 0;
78
	count--;
85
	count--;
79
	DSDWORD[id] = 0;
86
	DSDWORD[id] = 0;
80
	RETURN id;
87
	RETURN id;
81
}
88
}