mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-11 20:29:14 +02:00
+ added assigning op which converts FourCharCode to LongWord
+ added convertion functions FCC and FOUR_CHAR_CODE which does the above conv manually.
This commit is contained in:
parent
846e44f674
commit
6d429b0d95
@ -19,9 +19,43 @@ unit MacPas;
|
||||
|
||||
interface
|
||||
|
||||
{ Using inlining for small system functions/wrappers }
|
||||
{$ifdef HASINLINE}
|
||||
{$inline on}
|
||||
{$define SYSTEMINLINE}
|
||||
{$endif}
|
||||
|
||||
type
|
||||
LongDouble = ValReal;
|
||||
|
||||
{FourCharCode coercion
|
||||
This routine coreces string literals to a FourCharCode.}
|
||||
function FCC(literal: string): LongWord; {$ifdef systeminline}inline;{$endif}
|
||||
|
||||
{Same as FCC, to be compatible with GPC}
|
||||
function FOUR_CHAR_CODE(literal: string): LongWord; {$ifdef systeminline}inline;{$endif}
|
||||
|
||||
{This makes casts from ShortString to FourCharCode automatically,
|
||||
to emulate the behaviour of mac pascal compilers}
|
||||
operator := (s: ShortString) result: LongWord; {$ifdef systeminline}inline;{$endif}
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
function FCC(literal: string): LongWord; {$ifdef systeminline}inline;{$endif}
|
||||
begin
|
||||
FCC := PLongWord(@literal[1])^;
|
||||
end;
|
||||
|
||||
function FOUR_CHAR_CODE(literal: string): LongWord; {$ifdef systeminline}inline;{$endif}
|
||||
begin
|
||||
FOUR_CHAR_CODE := PLongWord(@literal[1])^;
|
||||
end;
|
||||
|
||||
operator := (s: ShortString) result: LongWord; {$ifdef systeminline}inline;{$endif}
|
||||
begin
|
||||
result := PLongWord(@s[1])^;
|
||||
end;
|
||||
|
||||
end.
|
Loading…
Reference in New Issue
Block a user