macpas.pp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. {
  2. $Id$
  3. This file is part of the Free Pascal Run time library.
  4. Copyright (c) 2004 by Olle Raab
  5. This unit contain procedures specific for mode MacPas.
  6. It should be platform independant.
  7. See the file COPYING.FPC, included in this distribution,
  8. For details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. **********************************************************************}
  13. unit MacPas;
  14. interface
  15. { Using inlining for small system functions/wrappers }
  16. {$ifdef HASINLINE}
  17. {$inline on}
  18. {$define SYSTEMINLINE}
  19. {$endif}
  20. type
  21. LongDouble = ValReal;
  22. {FourCharCode coercion
  23. This routine coreces string literals to a FourCharCode.}
  24. function FCC(literal: string): LongWord; {$ifdef systeminline}inline;{$endif}
  25. {Same as FCC, to be compatible with GPC}
  26. function FOUR_CHAR_CODE(literal: string): LongWord; {$ifdef systeminline}inline;{$endif}
  27. {This makes casts from ShortString to FourCharCode automatically,
  28. to emulate the behaviour of mac pascal compilers}
  29. operator := (s: ShortString) result: LongWord; {$ifdef systeminline}inline;{$endif}
  30. implementation
  31. function FCC(literal: string): LongWord; {$ifdef systeminline}inline;{$endif}
  32. begin
  33. FCC := PLongWord(@literal[1])^;
  34. end;
  35. function FOUR_CHAR_CODE(literal: string): LongWord; {$ifdef systeminline}inline;{$endif}
  36. begin
  37. FOUR_CHAR_CODE := PLongWord(@literal[1])^;
  38. end;
  39. operator := (s: ShortString) result: LongWord; {$ifdef systeminline}inline;{$endif}
  40. begin
  41. result := PLongWord(@s[1])^;
  42. end;
  43. end.