forked from KolibriOS/kolibrios
RTL for FP 2.2.0
git-svn-id: svn://kolibrios.org@643 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
3e571197e0
commit
ec5962d52e
@ -1,10 +1,13 @@
|
||||
{$codepage cp866}
|
||||
|
||||
{ ‚ FreePascal 2.2.0 ª®¤¨à®¢ª cp866 ¥ ॠ«¨§®¢ . }
|
||||
{-$codepage cp866}
|
||||
|
||||
{$mode objfpc}
|
||||
{$smartlink on}
|
||||
{$apptype console}
|
||||
|
||||
{ <EFBFBD> ¤ ë© ¬®¬¥â à áᬠâਢ ¥âáï ¢ë¯®«¥¨¥ ¯à¨«®¤¥¨ï ⮫쪮 ª ª ª®á®«ì®¥,
|
||||
â.¥. ¤¨à¥ªâ¨¢ concole ®¡ï§ ⥫ì , ¯®¢¥¤¥¨¥ ¯à®£à ¬¬ë ¯à¨ ®âáãâá⢨¨ í⮩
|
||||
â.¥. ¤¨à¥ªâ¨¢ console ®¡ï§ ⥫ì , ¯®¢¥¤¥¨¥ ¯à®£à ¬¬ë ¯à¨ ®âáãâá⢨¨ í⮩
|
||||
¤¨à¥ªâ¨¢ë ¯à¥¤®¯à¥¤¥«¨âì ¥«ì§ï. ƒ à â¨à®¢ ® ¥«ì§ï ¨á¯®«ì§®¢ âì äãªæ¨¨
|
||||
Write, WriteLn, Read, ReadLn ®â®á¨â¥«ì® áâ ¤ à⮩ ª®á®«¨ ¢¢®¤ /¢ë¢®¤ .
|
||||
}
|
||||
@ -21,13 +24,13 @@ procedure DoPaint;
|
||||
{ ‚뢮¤ ᮤ¥à¦¨¬®£® ®ª ¯à¨«®¦¥¨ï }
|
||||
begin
|
||||
kos_begindraw();
|
||||
{®¯à¥¤¥«¥¨¥ ¯ à ¬¥â஢ ®ª (0)}
|
||||
{®¯à¥¤¥«¥¨¥ ¯ à ¬¥â஢ ®ª }
|
||||
kos_definewindow(200, 200, 200, 50, $23AABBCC);
|
||||
{kos_definewindow ¥ ¨¬¥¥â ¯ à ¬¥âà ¤«ï ¢ë¢®¤ § £®«®¢ª ,
|
||||
¤¥« ¥¬ íâ® ®â¤¥«ì®© äãªæ¨¥©}
|
||||
{kos_setcaption, ®â®¡à ¦¥¨¥ § £®«®¢ª ®ª (71.1)}
|
||||
¤¥« ¥¬ íâ® ®â¤¥«ì®© äãªæ¨¥© kos_setcaption}
|
||||
{®â®¡à ¦¥¨¥ § £®«®¢ª ®ª }
|
||||
kos_setcaption('<27><>ˆŒ…<C592> <20><>Žƒ<C5BD>€ŒŒ›');
|
||||
{¢ë¢®¤ á®®¡é¥¨ï (4)}
|
||||
{¢ë¢®¤ á®®¡é¥¨ï}
|
||||
kos_drawtext(3, 8, '<27> ¦¬¨â¥ «î¡ãî ª« ¢¨èã...');
|
||||
kos_enddraw();
|
||||
end;
|
||||
@ -44,7 +47,7 @@ begin
|
||||
Notes[1] := Key shr 8;
|
||||
Notes[2] := $00;
|
||||
{¢®á¯à®¨§¢®¤¨¬}
|
||||
kos_speak(@Notes);
|
||||
kos_speaker(@Notes);
|
||||
end;
|
||||
|
||||
|
||||
@ -53,27 +56,29 @@ function DoButton: Boolean;
|
||||
var
|
||||
Button: DWord;
|
||||
begin
|
||||
{¯®«ãç¨âì ª®¤ ¦ ⮩ ª«¨ë¨è¨}
|
||||
{¯®«ãç¨âì ª®¤ ¦ ⮩ ª«¨¢¨è¨}
|
||||
Button := kos_getbutton();
|
||||
{¥á«¨ X, â® § ¢¥à襨¥ ¯à¨«®¦¥¨ï}
|
||||
Result := Button = 1;
|
||||
{¥á«¨ [x], â® ¢¥àãâì «®¦ì, § ç¨â á¯à®¢®æ¨à®¢ âì § ªàë⨥ ¯à¨«®¦¥¨ï}
|
||||
Result := Button <> 1;
|
||||
end;
|
||||
|
||||
|
||||
function ProcessMessage: Boolean;
|
||||
{ @return: ‚®§¢à é ¥â False, ¥á«¨ ¡ë«® ᮡë⨥ ª § ¢¥àè¥¨î ¯à¨«®¦¥¨ï.
|
||||
{ Ž¦¨¤ ¨¥ ¨ ®¡à ¡®âª ᮡë⨩.
|
||||
|
||||
@return: ‚®§¢à é ¥â False, ¥á«¨ ¡ë«® ᮡë⨥ ª § ¢¥àè¥¨î ¯à¨«®¦¥¨ï.
|
||||
@rtype: True ¨«¨ False }
|
||||
var
|
||||
Event: DWord;
|
||||
begin
|
||||
Result := False;
|
||||
Result := True;
|
||||
{®¦¨¤ ¥¬ ᮡëâ¨ï ®â á¨á⥬ë}
|
||||
Event := kos_getevent();
|
||||
case Event of
|
||||
SE_PAINT : DoPaint; {¯¥à¥à¨á®¢ª ®ª }
|
||||
SE_KEYBOARD: DoKey; {ᮡë⨥ ®â ª« ¢¨ âãàë}
|
||||
SE_BUTTON : Result := DoButton; {ᮡ먥 ®â ª®¯ª¨, ¬®¦¥â ®¯à¥¤¥«¨âì
|
||||
§ ¢¥à襨¥ ¯à¨«®¦¥¨ï, ¥á«¨ ¢¥à¥â True}
|
||||
§ ¢¥à襨¥ ¯à¨«®¦¥¨ï, ¥á«¨ ¢¥à¥â False}
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -83,17 +88,14 @@ procedure MainLoop;
|
||||
var
|
||||
ThreadSlot: TThreadSlot;
|
||||
begin
|
||||
{ᤥ« âì íâ® ®ª® ªâ¨¢ë¬}
|
||||
ThreadSlot := kos_getthreadslot(ThreadID);
|
||||
kos_setactivewindow(ThreadSlot);
|
||||
{ áâà ¨¢ ¥¬ ᮡëâ¨ï, ª®â®àë¥ ¬ë £®â®¢ë ®¡à ¡ âë¢ âì}
|
||||
kos_maskevents(ME_PAINT or ME_KEYBOARD or ME_BUTTON);
|
||||
{£« ¢ë© 横«}
|
||||
while not ProcessMessage do;
|
||||
{®¡à ¡®âª ᮡë⨩}
|
||||
while ProcessMessage do;
|
||||
end;
|
||||
|
||||
|
||||
begin
|
||||
WriteLn('Look for a new window, I''m just a konsole, hi mike ;-)');
|
||||
WriteLn('Look for a new window, I''m just a konsole ;-)');
|
||||
MainLoop;
|
||||
end.
|
||||
|
@ -1,7 +1,7 @@
|
||||
Codepage: cp866
|
||||
|
||||
’¥ªã騩 ª®¤ ¤ ¯â¨à®¢ ¨ ¯à®¢¥àï«áï ⮫쪮 FreePascal 2.3.1 (SVN 8373) ¯à¨
|
||||
ª®¬¯¨«ï樨 ¨§ Windows.
|
||||
’¥ªã騩 ª®¤ ¤ ¯â¨à®¢ ¨ ¯à®¢¥àï«áï ⮫쪮 FreePascal 2.2.0 ¯à¨ ª®¬¯¨«ï樨
|
||||
¨§ Windows.
|
||||
|
||||
„«ο <20>®¬―¨«¨ΰ®Ά ¨ο Ά¥ΰᨨ RTL ¤«ο KolibriOS Ά ¬ ¥®΅ε®¤¨¬® ¨¬¥βμ γαβ ®Ά«¥λ©
|
||||
γ ᥡο FreePascal α ¨α室묨 <20>®¤ ¬¨ RTL γ<> § ®© Άλθ¥ Ά¥ΰᨨ. <20>β<EFBFBD>ΰ®©β¥ δ ©«
|
||||
|
@ -5,5 +5,7 @@
|
||||
{$undef os2}
|
||||
{$undef linux}
|
||||
|
||||
{$define EMULATOR}
|
||||
{$undef DISABLE_NO_THREAD_MANAGER}
|
||||
{$undef debug_mt}
|
||||
|
||||
{$define EMULATOR}
|
||||
|
@ -594,7 +594,7 @@ end;
|
||||
|
||||
{ Sound }
|
||||
|
||||
function kos_speak(notes: Pointer): Boolean; assembler; register;
|
||||
function kos_speaker(notes: Pointer): Boolean; assembler; register;
|
||||
asm
|
||||
pushl %esi
|
||||
pushl %ebx
|
||||
|
@ -151,6 +151,7 @@ begin
|
||||
FThreadID := BeginThread(TThreadFunc(@KonsoleThreadMain), @Self);
|
||||
if FThreadID <> 0 then
|
||||
{XXX: ¬®¦¥â § ¢¨áãâì}
|
||||
{‚®, в Є Ё Ґбвм ў 2.2.0.}
|
||||
while not FOpened do ThreadSwitch;
|
||||
end;
|
||||
|
||||
|
@ -142,7 +142,7 @@ function kos_fileinfo(kosfile: PKosFile): DWord;
|
||||
|
||||
{ Sound }
|
||||
|
||||
function kos_speak(notes: Pointer): Boolean;
|
||||
function kos_speaker(notes: Pointer): Boolean;
|
||||
|
||||
{ Work with hardware }
|
||||
function kos_readport(index: DWord): DWord;
|
||||
|
@ -185,7 +185,7 @@ begin
|
||||
if not IsMultiThread then
|
||||
begin
|
||||
TLSKey := TLSAlloc();
|
||||
InitThreadVars(@SysRelocateThreadVar); {XXX: must be @SysRelocateThreadvar}
|
||||
InitThreadVars(@SysRelocateThreadVar);
|
||||
IsMultiThread := True;
|
||||
end;
|
||||
|
||||
@ -287,6 +287,51 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
{*****************************************************************************
|
||||
Heap Mutex Protection
|
||||
*****************************************************************************}
|
||||
|
||||
{$ifndef HAS_MT_MEMORYMANAGER}
|
||||
var
|
||||
HeapMutex: TRTLCriticalSection;
|
||||
|
||||
procedure KosHeapMutexInit;
|
||||
begin
|
||||
InitCriticalSection(HeapMutex);
|
||||
end;
|
||||
|
||||
procedure KosHeapMutexDone;
|
||||
begin
|
||||
DoneCriticalSection(HeapMutex);
|
||||
end;
|
||||
|
||||
procedure KosHeapMutexLock;
|
||||
begin
|
||||
EnterCriticalSection(HeapMutex);
|
||||
end;
|
||||
|
||||
procedure KosHeapMutexUnlock;
|
||||
begin
|
||||
LeaveCriticalSection(HeapMutex);
|
||||
end;
|
||||
|
||||
|
||||
const
|
||||
KosMemoryMutexManager: TMemoryMutexManager = (
|
||||
MutexInit : @KosHeapMutexInit;
|
||||
MutexDone : @KosHeapMutexDone;
|
||||
MutexLock : @KosHeapMutexLock;
|
||||
MutexUnlock: @KosHeapMutexUnlock);
|
||||
|
||||
|
||||
procedure InitHeapMutexes;
|
||||
begin
|
||||
SetMemoryMutexManager(KosMemoryMutexManager);
|
||||
end;
|
||||
|
||||
{$endif HAS_MT_MEMORYMANAGER}
|
||||
|
||||
|
||||
var
|
||||
KosThreadManager: TThreadManager;
|
||||
|
||||
@ -336,5 +381,8 @@ begin
|
||||
SemaphorePost := @NoSemaphorePost;
|
||||
end;
|
||||
SetThreadManager(KosThreadManager);
|
||||
{$ifndef HAS_MT_MEMORYMANAGER}
|
||||
InitHeapMutexes;
|
||||
{$endif HAS_MT_MEMORYMANAGER}
|
||||
ThreadID := GetCurrentThreadID;
|
||||
end;
|
||||
|
@ -161,7 +161,7 @@ begin
|
||||
ReleaseFileRecord(Handle);
|
||||
end;
|
||||
|
||||
function FileTruncate(Handle: THandle; Size: Int64): Boolean;
|
||||
function FileTruncate(Handle: THandle; Size: Longint): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user