English | Magyar
JS ki | CSS ki | Ékezetek ki | HiContrast
Lapozó:  (0 - 1428) 
<== | ==>
Ugrás a végére | Összes megjelenítése | Utolsó oldal
OpenOpera patches | Opera-SSL patches | Opera 12.15 source (Git repository) | Opera 12.15 source (Torrent) | Opera internal pages | Otter Browser Linux x64 - Qt5.15.2/QtWebKit5.602.1 (2024.12.02. 21:02)
OS for MC680x0 | OS for PPC | OS for Sparc64 | besztofbégéaefcé | CSÉNDZSLOG | WebToolz | DDG Shit Filter | Google Shit Filter | Progz | Fast CSS Box | Browser | OS | Agent | Statisztika | BBCode
Monospace font-family: Courier New | Browser default monospace
Email értesítő / Email notification ===> 
Keresés
Σ: 1 post

TCH  (statz) Főfasz
#1, Főfasz (10466)
2182 | #2520 | ^ | Idézet | Mon, 15 Apr 2013 01:58:25 +02
78.92.*.* Linux x86 Opera Classic Hungary *.catv.pool.telekom.hu
Na, hát nem volt egészen oké a kód, pár helyen a derefer kimaradt, de mentségemre legyen mondva, hogy a "lektor" se vette észre. :P
A kész kód:
unit etimer;

interface

uses amiga, exec;

const

	unit_microhz = 0;
	unit_vblank = 1;


type
	ttimeval = packed record
		tv_secs: longint;
		tv_micro: longint;
	end;
	ptimeval = ^ttimeval;

	ttimerequest = packed record
		tr_node: tiorequest;
		tr_time: ttimeval;
	end;
	ptimerequest = ^ttimerequest;

procedure delete_timer(tr: ptimerequest);
function create_timer(_unit: longint): ptimerequest;
function wait_for_timer(tr: ptimerequest; secs, micro: longint): shortint;

implementation

procedure delete_timer(tr: ptimerequest);
var tp: pmsgport;
begin
	if (tr <> nil) then
	begin
		tp := tr^.tr_node.io_message.mn_replyport;
		if (tp <> nil) then
		begin
			deleteport(tp);
		end;
		closedevice(piorequest(tr));
		deleteextio(piorequest(tr));
	end;
end;

function create_timer(_unit: longint): ptimerequest;
var
	error: longint;
	timerport: pmsgport;
	timerio: ptimerequest;
begin
	timerport := createport(nil, 0);
	if (timerport = nil) then
	begin
		create_timer := nil;
		exit
	end;
	
	timerio := ptimerequest(createextio(timerport, sizeof(ttimerequest)));
	if (timerio = nil) then
	begin
		deleteport(timerport);
		create_timer := nil;
		exit;
	end;

	error := opendevice('timer.device', _unit, piorequest(timerio), 0);
	if (error <> 0) then
	begin
		delete_timer(timerio);
		create_timer := nil;
		exit;
	end;
	timerio^.tr_node.io_command := 9;
	create_timer := timerio;
end;

function wait_for_timer(tr: ptimerequest; secs, micro: longint): shortint;
begin
	tr^.tr_time.tv_secs := secs;
	tr^.tr_time.tv_micro := micro;
	wait_for_timer := doio(piorequest(tr));
end;

end.
Használati példa:
program timtest;

uses etimer;

var
	x: shortint;
	y: ptimerequest;
	i: integer;

begin
	y := create_timer(unit_microhz);
	writeln('x');
	for i := 0 to 29 do
	begin
		x := wait_for_timer(y, 0, 500000);
	end;
	writeln('x');
	delete_timer(y);
end.
Köszi saxus a C helpet. (Ja, igen, ez már megy Amigán.) Végre nem kell C-ben szopni, ha időzíteni kell valamit...


English | Magyar
JS ki | CSS ki | Ékezetek ki | HiContrast
Lapozó:  (0 - 1428) 
<== | ==>
Ugrás a végére | Összes megjelenítése | Utolsó oldal
OpenOpera patches | Opera-SSL patches | Opera 12.15 source (Git repository) | Opera 12.15 source (Torrent) | Opera internal pages | Otter Browser Linux x64 - Qt5.15.2/QtWebKit5.602.1 (2024.12.02. 21:02)
OS for MC680x0 | OS for PPC | OS for Sparc64 | besztofbégéaefcé | CSÉNDZSLOG | WebToolz | DDG Shit Filter | Google Shit Filter | Progz | Fast CSS Box | Browser | OS | Agent | Statisztika | BBCode
Monospace font-family: Courier New | Browser default monospace
Email értesítő / Email notification ===> 
Keresés

Név: (max 255 byte)

Email: (max 255 byte) Nem kötelező!

Üzenet: (max 65536 kar.) 65536-0=65536




crap_vkn v4.34.0 by TCH
Thx to saxus for the escaped string decoder function (PHP), the realIP function (PHP) & the SQL handle layer (PHP), to thookerov for the int_divide function (PHP), to Jeff Anderson for the getSelText function (JS), to Alex King for the insertAtCursor function (JS), Flood3r for the new CSS styles, Pety for the spamprotection idea and some design and comfort ideas, MaxMind for the IP2Country database, famfamfam for the flags of countries and an unknown PHP programmer for the removeAccents function.



Kecskebaszók ide!