palmos: use tinyheap, also tweaks to startup code

git-svn-id: trunk@37217 -
This commit is contained in:
Károly Balogh 2017-09-15 16:18:28 +00:00
parent 587471a0bb
commit 893228deee
2 changed files with 18 additions and 22 deletions

View File

@ -13,3 +13,4 @@
**********************************************************************}
{$i palmos.inc}

View File

@ -16,9 +16,11 @@ unit System;
interface
{$DEFINE HAS_MEMORYMANAGER}
{$DEFINE FPC_ANSI_TEXTFILEREC}
{$i systemh.inc}
{$i tnyheaph.inc}
{Platform specific information}
const
@ -62,12 +64,6 @@ var
{$endif defined(FPUSOFT)}
var
{ this variables are passed to PilotMain by the PalmOS }
cmd : Word;
cmdPBP : PChar; // Ptr;
launchFlags : Word;
implementation
{$if defined(FPUSOFT)}
@ -93,20 +89,11 @@ var
{$endif defined(FPUSOFT)}
{$i system.inc}
{$i tinyheap.inc}
{$i syspara.inc}
{ mimic the C start code }
function PilotMain(_cmd : Word;_cmdPBP : PChar;{Ptr;}_launchFlags : Word) : DWord;cdecl;public;
begin
cmd:=_cmd;
cmdPBP:=_cmdPBP;
launchFlags:=_launchFlags;
// asm
// bsr PASCALMAIN
// end;
PilotMain:=ExitCode;
end;
var
palmAppInfo: SysAppInfoPtr; external name '__appInfo';
procedure SysInitParamsAndEnv;
begin
@ -124,8 +111,11 @@ var
{*****************************************************************************
System Dependent Exit code
*****************************************************************************}
Procedure system_exit;
procedure haltproc(e:longint);cdecl; external name 'haltproc';
procedure system_exit;
begin
haltproc(ExitCode);
end;
function GetProcessID: SizeUInt;
@ -153,11 +143,16 @@ begin
end;
begin
StackLength := CheckInitialStkLen (InitialStkLen);
{ we don't support anything but normal startup now }
{ FIXME: lets figure it out how various startup modes }
{ can coexist with the system unit infrastructure (KB) }
if not (palmAppInfo^.cmd = sysAppLaunchCmdNormalLaunch) then
halt(0);
StackLength := CheckInitialStkLen(InitialStkLen);
{ Initialize ExitProc }
ExitProc:=Nil;
{ Setup heap }
InitHeap;
SysInitExceptions;
InitUnicodeStringManager;
{ Setup stdin, stdout and stderr }