RTL for FP 2.2.0

git-svn-id: svn://kolibrios.org@643 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
bw 2007-09-28 12:26:28 +00:00
parent 3e571197e0
commit ec5962d52e
8 changed files with 79 additions and 26 deletions

View File

@ -1,10 +1,13 @@
{$codepage cp866}
{ FreePascal 2.2.0 ª®¤¨à®¢ª  cp866 ­¥ ॠ«¨§®¢ ­ . }
{-$codepage cp866}
{$mode objfpc} {$mode objfpc}
{$smartlink on} {$smartlink on}
{$apptype console} {$apptype console}
{ <EFBFBD>  ¤ ­­ë© ¬®¬¥­â à áᬠâਢ ¥âáï ¢ë¯®«­¥­¨¥ ¯à¨«®¤¥­¨ï ⮫쪮 ª ª ª®­á®«ì­®¥, { <EFBFBD>  ¤ ­­ë© ¬®¬¥­â à áᬠâਢ ¥âáï ¢ë¯®«­¥­¨¥ ¯à¨«®¤¥­¨ï ⮫쪮 ª ª ª®­á®«ì­®¥,
â.¥. ¤¨à¥ªâ¨¢  concole ®¡ï§ â¥«ì­ , ¯®¢¥¤¥­¨¥ ¯à®£à ¬¬ë ¯à¨ ®âáãâá⢨¨ í⮩ â.¥. ¤¨à¥ªâ¨¢  console ®¡ï§ â¥«ì­ , ¯®¢¥¤¥­¨¥ ¯à®£à ¬¬ë ¯à¨ ®âáãâá⢨¨ í⮩
¤¨à¥ªâ¨¢ë ¯à¥¤®¯à¥¤¥«¨âì ­¥«ì§ï. ƒ à ­â¨à®¢ ­­® ­¥«ì§ï ¨á¯®«ì§®¢ âì ä㭪樨 ¤¨à¥ªâ¨¢ë ¯à¥¤®¯à¥¤¥«¨âì ­¥«ì§ï. ƒ à ­â¨à®¢ ­­® ­¥«ì§ï ¨á¯®«ì§®¢ âì ä㭪樨
Write, WriteLn, Read, ReadLn ®â­®á¨â¥«ì­® áâ ­¤ àâ­®© ª®­á®«¨ ¢¢®¤ /¢ë¢®¤ . Write, WriteLn, Read, ReadLn ®â­®á¨â¥«ì­® áâ ­¤ àâ­®© ª®­á®«¨ ¢¢®¤ /¢ë¢®¤ .
} }
@ -21,13 +24,13 @@ procedure DoPaint;
{ ‚뢮¤ ᮤ¥à¦¨¬®£® ®ª­  ¯à¨«®¦¥­¨ï } { ‚뢮¤ ᮤ¥à¦¨¬®£® ®ª­  ¯à¨«®¦¥­¨ï }
begin begin
kos_begindraw(); kos_begindraw();
{®¯à¥¤¥«¥­¨¥ ¯ à ¬¥â஢ ®ª­  (0)} {®¯à¥¤¥«¥­¨¥ ¯ à ¬¥â஢ ®ª­ }
kos_definewindow(200, 200, 200, 50, $23AABBCC); kos_definewindow(200, 200, 200, 50, $23AABBCC);
{kos_definewindow ­¥ ¨¬¥¥â ¯ à ¬¥âà  ¤«ï ¢ë¢®¤  § £®«®¢ª , {kos_definewindow ­¥ ¨¬¥¥â ¯ à ¬¥âà  ¤«ï ¢ë¢®¤  § £®«®¢ª ,
¤¥« ¥¬ íâ® ®â¤¥«ì­®© ä㭪樥©} ¤¥« ¥¬ íâ® ®â¤¥«ì­®© ä㭪樥© kos_setcaption}
{kos_setcaption, ®â®¡à ¦¥­¨¥ § £®«®¢ª  ®ª­  (71.1)} {®â®¡à ¦¥­¨¥ § £®«®¢ª  ®ª­ }
kos_setcaption('<27><>ˆŒ…<C592> <20><>Žƒ<C5BD>€ŒŒ'); kos_setcaption('<27><>ˆŒ…<C592> <20><>Žƒ<C5BD>€ŒŒ');
{¢ë¢®¤ á®®¡é¥­¨ï (4)} {¢ë¢®¤ á®®¡é¥­¨ï}
kos_drawtext(3, 8, '<27> ¦¬¨â¥ «î¡ãî ª« ¢¨èã...'); kos_drawtext(3, 8, '<27> ¦¬¨â¥ «î¡ãî ª« ¢¨èã...');
kos_enddraw(); kos_enddraw();
end; end;
@ -44,7 +47,7 @@ begin
Notes[1] := Key shr 8; Notes[1] := Key shr 8;
Notes[2] := $00; Notes[2] := $00;
{¢®á¯à®¨§¢®¤¨¬} {¢®á¯à®¨§¢®¤¨¬}
kos_speak(@Notes); kos_speaker(@Notes);
end; end;
@ -53,27 +56,29 @@ function DoButton: Boolean;
var var
Button: DWord; Button: DWord;
begin begin
{¯®«ãç¨âì ª®¤ ­ ¦ â®© ª«¨ë¨è¨} {¯®«ãç¨âì ª®¤ ­ ¦ â®© ª«¨¢¨è¨}
Button := kos_getbutton(); Button := kos_getbutton();
{¥á«¨ X, â® § ¢¥à襭¨¥ ¯à¨«®¦¥­¨ï} {¥á«¨ [x], â® ¢¥à­ãâì «®¦ì,   §­ ç¨â á¯à®¢®æ¨à®¢ âì § ªàë⨥ ¯à¨«®¦¥­¨ï}
Result := Button = 1; Result := Button <> 1;
end; end;
function ProcessMessage: Boolean; function ProcessMessage: Boolean;
{ @return: ‚®§¢à é ¥â False, ¥á«¨ ¡ë«® ᮡë⨥ ª § ¢¥à襭¨î ¯à¨«®¦¥­¨ï. { Ž¦¨¤ ­¨¥ ¨ ®¡à ¡®âª  ᮡë⨩.
@return: ‚®§¢à é ¥â False, ¥á«¨ ¡ë«® ᮡë⨥ ª § ¢¥à襭¨î ¯à¨«®¦¥­¨ï.
@rtype: True ¨«¨ False } @rtype: True ¨«¨ False }
var var
Event: DWord; Event: DWord;
begin begin
Result := False; Result := True;
{®¦¨¤ ¥¬ ᮡëâ¨ï ®â á¨á⥬ë} {®¦¨¤ ¥¬ ᮡëâ¨ï ®â á¨á⥬ë}
Event := kos_getevent(); Event := kos_getevent();
case Event of case Event of
SE_PAINT : DoPaint; {¯¥à¥à¨á®¢ª  ®ª­ } SE_PAINT : DoPaint; {¯¥à¥à¨á®¢ª  ®ª­ }
SE_KEYBOARD: DoKey; {ᮡë⨥ ®â ª« ¢¨ âãàë} SE_KEYBOARD: DoKey; {ᮡë⨥ ®â ª« ¢¨ âãàë}
SE_BUTTON : Result := DoButton; {ᮡ먥 ®â ª­®¯ª¨, ¬®¦¥â ®¯à¥¤¥«¨âì SE_BUTTON : Result := DoButton; {ᮡ먥 ®â ª­®¯ª¨, ¬®¦¥â ®¯à¥¤¥«¨âì
§ ¢¥à襭¨¥ ¯à¨«®¦¥­¨ï, ¥á«¨ ¢¥à­¥â True} § ¢¥à襭¨¥ ¯à¨«®¦¥­¨ï, ¥á«¨ ¢¥à­¥â False}
end; end;
end; end;
@ -83,17 +88,14 @@ procedure MainLoop;
var var
ThreadSlot: TThreadSlot; ThreadSlot: TThreadSlot;
begin begin
{ᤥ« âì íâ® ®ª­®  ªâ¨¢­ë¬}
ThreadSlot := kos_getthreadslot(ThreadID);
kos_setactivewindow(ThreadSlot);
{­ áâà ¨¢ ¥¬ ᮡëâ¨ï, ª®â®àë¥ ¬ë £®â®¢ë ®¡à ¡ â뢠âì} {­ áâà ¨¢ ¥¬ ᮡëâ¨ï, ª®â®àë¥ ¬ë £®â®¢ë ®¡à ¡ â뢠âì}
kos_maskevents(ME_PAINT or ME_KEYBOARD or ME_BUTTON); kos_maskevents(ME_PAINT or ME_KEYBOARD or ME_BUTTON);
{£« ¢­ë© 横«} {®¡à ¡®âª  ᮡë⨩}
while not ProcessMessage do; while ProcessMessage do;
end; end;
begin 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; MainLoop;
end. end.

View File

@ -1,7 +1,7 @@
Codepage: cp866 Codepage: cp866
’¥ªã騩 ª®¤  ¤ ¯â¨à®¢ ­ ¨ ¯à®¢¥àï«áï ⮫쪮 ­  FreePascal 2.3.1 (SVN 8373) ¯à¨ ’¥ªã騩 ª®¤  ¤ ¯â¨à®¢ ­ ¨ ¯à®¢¥àï«áï ⮫쪮 ­  FreePascal 2.2.0 ¯à¨ ª®¬¯¨«ï樨
ª®¬¯¨«ï樨 ¨§ Windows. ¨§ Windows.
„«ο <20>®¬―¨«¨ΰ®Ά ­¨ο Ά¥ΰᨨ RTL ¤«ο KolibriOS Ά ¬ ­¥®΅ε®¤¨¬® ¨¬¥βμ γαβ ­®Ά«¥­­λ© „«ο <20>®¬―¨«¨ΰ®Ά ­¨ο Ά¥ΰᨨ RTL ¤«ο KolibriOS Ά ¬ ­¥®΅ε®¤¨¬® ¨¬¥βμ γαβ ­®Ά«¥­­λ©
γ ᥡο FreePascal α ¨α室­λ¬¨ <20>®¤ ¬¨ RTL γ<> § ­­®© Άλθ¥ Ά¥ΰᨨ. <20>β<EFBFBD>ΰ®©β¥ δ ©« γ ᥡο FreePascal α ¨α室­λ¬¨ <20>®¤ ¬¨ RTL γ<> § ­­®© Άλθ¥ Ά¥ΰᨨ. <20>β<EFBFBD>ΰ®©β¥ δ ©«

View File

@ -5,5 +5,7 @@
{$undef os2} {$undef os2}
{$undef linux} {$undef linux}
{$define EMULATOR} {$undef DISABLE_NO_THREAD_MANAGER}
{$undef debug_mt} {$undef debug_mt}
{$define EMULATOR}

View File

@ -594,7 +594,7 @@ end;
{ Sound } { Sound }
function kos_speak(notes: Pointer): Boolean; assembler; register; function kos_speaker(notes: Pointer): Boolean; assembler; register;
asm asm
pushl %esi pushl %esi
pushl %ebx pushl %ebx

View File

@ -151,6 +151,7 @@ begin
FThreadID := BeginThread(TThreadFunc(@KonsoleThreadMain), @Self); FThreadID := BeginThread(TThreadFunc(@KonsoleThreadMain), @Self);
if FThreadID <> 0 then if FThreadID <> 0 then
{XXX: ¬®¦¥â § ¢¨á­ãâì} {XXX: ¬®¦¥â § ¢¨á­ãâì}
{‚®, в Є Ё Ґбвм ў 2.2.0.}
while not FOpened do ThreadSwitch; while not FOpened do ThreadSwitch;
end; end;

View File

@ -142,7 +142,7 @@ function kos_fileinfo(kosfile: PKosFile): DWord;
{ Sound } { Sound }
function kos_speak(notes: Pointer): Boolean; function kos_speaker(notes: Pointer): Boolean;
{ Work with hardware } { Work with hardware }
function kos_readport(index: DWord): DWord; function kos_readport(index: DWord): DWord;

View File

@ -185,7 +185,7 @@ begin
if not IsMultiThread then if not IsMultiThread then
begin begin
TLSKey := TLSAlloc(); TLSKey := TLSAlloc();
InitThreadVars(@SysRelocateThreadVar); {XXX: must be @SysRelocateThreadvar} InitThreadVars(@SysRelocateThreadVar);
IsMultiThread := True; IsMultiThread := True;
end; end;
@ -287,6 +287,51 @@ begin
end; 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 var
KosThreadManager: TThreadManager; KosThreadManager: TThreadManager;
@ -336,5 +381,8 @@ begin
SemaphorePost := @NoSemaphorePost; SemaphorePost := @NoSemaphorePost;
end; end;
SetThreadManager(KosThreadManager); SetThreadManager(KosThreadManager);
{$ifndef HAS_MT_MEMORYMANAGER}
InitHeapMutexes;
{$endif HAS_MT_MEMORYMANAGER}
ThreadID := GetCurrentThreadID; ThreadID := GetCurrentThreadID;
end; end;

View File

@ -161,7 +161,7 @@ begin
ReleaseFileRecord(Handle); ReleaseFileRecord(Handle);
end; end;
function FileTruncate(Handle: THandle; Size: Int64): Boolean; function FileTruncate(Handle: THandle; Size: Longint): Boolean;
begin begin
Result := False; Result := False;
end; end;