From b086b10adf25417cf5917f842da5411a7ac98cd8 Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 12 Nov 2017 22:14:21 +0000 Subject: [PATCH] * enable more features for avr6 * ifdef'ed uncompilable procedures git-svn-id: trunk@37584 - --- rtl/embedded/rtl.cfg | 2 ++ rtl/inc/system.inc | 6 ++++++ rtl/inc/ustrings.inc | 16 ++++++++++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/rtl/embedded/rtl.cfg b/rtl/embedded/rtl.cfg index add8dc6144..3a29d7af17 100644 --- a/rtl/embedded/rtl.cfg +++ b/rtl/embedded/rtl.cfg @@ -168,7 +168,9 @@ -SfEXCEPTIONS -SfCLASSES -SfRTTI +# AVR6 has normally more memory, so enable more functions #ifdef CPUAVR6 +-SfANSISTRINGS -SfWIDESTRINGS -SfDYNARRAYS -SfTHREADING diff --git a/rtl/inc/system.inc b/rtl/inc/system.inc index 5394e8fcf9..fdc8bbf51b 100644 --- a/rtl/inc/system.inc +++ b/rtl/inc/system.inc @@ -1332,6 +1332,11 @@ End; {$ifdef FPC_HAS_FEATURE_HEAP} {$ifdef FPC_HAS_FEATURE_ANSISTRINGS} function ArrayStringToPPchar(const S:Array of AnsiString;reserveentries:Longint):ppchar; // const ? +{$ifdef EXCLUDE_COMPLEX_PROCS} +begin + runerror(217); +end; +{$else EXCLUDE_COMPLEX_PROCS} // Extra allocate reserveentries pchar's at the beginning (default param=0 after 1.0.x ?) // Note: for internal use by skilled programmers only // if "s" goes out of scope in the parent procedure, the pointer is dangling. @@ -1354,6 +1359,7 @@ begin p[high(s)+1+Reserveentries]:=nil; ArrayStringToPPchar:=p; end; +{$endif EXCLUDE_COMPLEX_PROCS} Function StringToPPChar(Var S:AnsiString;ReserveEntries:integer):ppchar; diff --git a/rtl/inc/ustrings.inc b/rtl/inc/ustrings.inc index e9375642c4..3795b41df4 100644 --- a/rtl/inc/ustrings.inc +++ b/rtl/inc/ustrings.inc @@ -642,7 +642,7 @@ var begin {$ifndef FPC_HAS_CPSTRING} cp:=DefaultSystemCodePage; -{$endif FPC_HAS_CPSTRING} +{$endif FPC_HAS_CPSTRING} cp:=TranslatePlaceholderCP(cp); widestringmanager.Unicode2AnsiMoveProc(@c, fpc_UChar_To_AnsiStr, cp, 1); end; @@ -1690,6 +1690,11 @@ function UnicodeToUtf8(Dest: PChar; Source: PUnicodeChar; MaxBytes: SizeInt): Si function UnicodeToUtf8(Dest: PChar; MaxDestBytes: SizeUInt; Source: PUnicodeChar; SourceChars: SizeUInt): SizeUInt; +{$ifdef EXCLUDE_COMPLEX_PROCS} +begin + runerror(217); +end; +{$else EXCLUDE_COMPLEX_PROCS} var i,j : SizeUInt; lw : longword; @@ -1782,6 +1787,7 @@ function UnicodeToUtf8(Dest: PChar; MaxDestBytes: SizeUInt; Source: PUnicodeChar end; result:=j+1; end; +{$endif EXCLUDE_COMPLEX_PROCS} function Utf8ToUnicode(Dest: PUnicodeChar; Source: PChar; MaxChars: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif} @@ -1794,6 +1800,11 @@ function Utf8ToUnicode(Dest: PUnicodeChar; Source: PChar; MaxChars: SizeInt): Si function UTF8ToUnicode(Dest: PUnicodeChar; MaxDestChars: SizeUInt; Source: PChar; SourceBytes: SizeUInt): SizeUInt; +{$ifdef EXCLUDE_COMPLEX_PROCS} +begin + runerror(217); +end; +{$else EXCLUDE_COMPLEX_PROCS} const UNICODE_INVALID=63; var @@ -2072,6 +2083,7 @@ function UTF8ToUnicode(Dest: PUnicodeChar; MaxDestChars: SizeUInt; Source: PChar Result:=OutputUnicode+1; end; end; +{$endif EXCLUDE_COMPLEX_PROCS} function UTF8Encode(const s : RawByteString) : RawByteString; inline; @@ -2378,7 +2390,7 @@ begin Result := UTF8Decode(S); end; -function UTF8ToString(const S: ShortString): UnicodeString; +function UTF8ToString(const S: ShortString): UnicodeString; Var rs: RawByteString; begin