genstrs.inc 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2000 by Carl-Eric Codere,
  5. member of the Free Pascal development team.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {$ifndef FPC_UNIT_HAS_STRPCOPY}
  13. function strpcopy(d : pchar;const s : string) : pchar;
  14. var
  15. counter : byte;
  16. Begin
  17. counter := 0;
  18. { if empty pascal string }
  19. { then setup and exit now }
  20. if s = '' then
  21. Begin
  22. D[0] := #0;
  23. StrPCopy := D;
  24. exit;
  25. end;
  26. for counter:=1 to length(S) do
  27. D[counter-1] := S[counter];
  28. { terminate the string }
  29. D[counter] := #0;
  30. StrPCopy:=D;
  31. end;
  32. {$endif FPC_UNIT_HAS_STRPCOPY}
  33. {$ifndef FPC_UNIT_HAS_STRPAS}
  34. { also add a strpas alias for internal use in the system unit (JM) }
  35. function strpas(p:pchar):string; [external name 'FPC_PCHAR_TO_SHORTSTR'];
  36. {$endif FPC_UNIT_HAS_STRPCOPY}
  37. {
  38. $Log$
  39. Revision 1.1 2003-07-07 20:22:05 peter
  40. * generic string routines added
  41. }