kolibrios/programs/develop/fp/examples/example.pp

100 lines
2.6 KiB
ObjectPascal
Raw Normal View History

{$codepage cp866}
{$mode objfpc}
{$smartlink on}
{$apptype console}
{ <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ⮫쪮 <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>᮫쭮<EFBFBD>,
<EFBFBD>.<EFBFBD>. <EFBFBD><EFBFBD>४⨢<EFBFBD> concole <EFBFBD><EFBFBD>易⥫쭠, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ணࠬ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>
<EFBFBD><EFBFBD>४⨢<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>㭪樨
Write, WriteLn, Read, ReadLn <EFBFBD><EFBFBD><EFBFBD>⥫쭮 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<EFBFBD><EFBFBD><EFBFBD>.
}
program Example;
{ <EFBFBD><EFBFBD><EFBFBD> <EFBFBD>㭪樨 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> 'kos_' <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᨬ묨
<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ⮫쪮 <EFBFBD><EFBFBD><EFBFBD> KolibriOS. <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ணࠬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD> <EFBFBD>㭪樨, <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> (<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ࠪ樨).
}
procedure DoPaint;
{ <20><EFBFBD><><EFBFBD><E0A6A8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><EFBFBD><E0A8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> }
begin
kos_begindraw();
{<7B><><EFBFBD><E0A5A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E0A0AC><20><><EFBFBD><EFBFBD> (0)}
kos_definewindow(200, 200, 200, 50, $23AABBCC);
{kos_definewindow <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD>㭪樥<EFBFBD>}
{kos_setcaption, <20>⮡ࠦ<E2AEA1><E0A0A6><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> (71.1)}
kos_setcaption('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
{<7B><EFBFBD><><EFBFBD><E9A5AD> (4)}
kos_drawtext(3, 8, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...');
kos_enddraw();
end;
procedure DoKey;
{ <20><><EFBFBD>⪠ ᮡ<><E1AEA1><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> }
var
Key: DWord;
Notes: array[0..3] of Byte;
begin
Key := kos_getkey();
{<7B><><EFBFBD><EFBFBD><EFBFBD><E0A0A8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD>}
Notes[0] := $90;
Notes[1] := Key shr 8;
Notes[2] := $00;
{<7B><><EFBFBD><EFBFBD><EFBFBD><E0AEA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}
kos_speak(@Notes);
end;
function DoButton: Boolean;
{ <20><><EFBFBD>⪠ ᮡ<><E1AEA1><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> GUI }
var
Button: DWord;
begin
{<7B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}
Button := kos_getbutton();
{<7B>᫨ X, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E8A5AD> <20><EFBFBD><E0A8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}
Result := Button = 1;
end;
function ProcessMessage: Boolean;
{ @return: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> False, <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
@rtype: True <EFBFBD><EFBFBD><EFBFBD> False }
var
Event: DWord;
begin
Result := False;
{<7B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E1AEA1><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>}
Event := kos_getevent();
case Event of
SE_PAINT : DoPaint; {<7B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1AEA2> <20><><EFBFBD><EFBFBD>}
SE_KEYBOARD: DoKey; {ᮡ<><20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}
SE_BUTTON : Result := DoButton; {ᮡ먥 <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD> <EFBFBD><EFBFBD><EFBFBD> True}
end;
end;
procedure MainLoop;
{ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><> <20><EFBFBD><E0A8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> }
var
ThreadSlot: TThreadSlot;
begin
{ᤥ<><E1A4A5><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><E2A8A2><EFBFBD>}
ThreadSlot := kos_getthreadslot(ThreadID);
kos_setactivewindow(ThreadSlot);
{<7B><><EFBFBD><EFBFBD><EFBFBD><E0A0A8><EFBFBD><EFBFBD><><E1AEA1><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> <20><><EFBFBD><E0A0A1><EFBFBD><EBA2A0>}
kos_maskevents(ME_PAINT or ME_KEYBOARD or ME_BUTTON);
{<7B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>}
while not ProcessMessage do;
end;
begin
WriteLn('Look for a new window, I''m just a konsole, hi mike ;-)');
MainLoop;
end.