stringss.inc 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2000 by Jonas Maebe, member of the
  5. Free Pascal development team
  6. Processor dependent part of strings.pp, not shared with
  7. sysutils unit.
  8. See the file COPYING.FPC, included in this distribution,
  9. for details about the copyright.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. **********************************************************************}
  14. {$ifndef FPC_UNIT_HAS_STRPAS}
  15. {$define FPC_UNIT_HAS_STRPAS}
  16. function strpas(p : pchar) : string; assembler;
  17. {$i strpas.inc}
  18. {$endif FPC_UNIT_HAS_STRPAS}
  19. {$ifndef FPC_UNIT_HAS_STRPCOPY}
  20. {$define FPC_UNIT_HAS_STRPCOPY}
  21. function strpcopy(d : pchar;const s : string) : pchar;assembler;
  22. asm
  23. { get length }
  24. lbz r0,0(r4)
  25. { put in counter }
  26. cmplwi r0,0
  27. mtctr r0
  28. subi r10,r3,1
  29. beq .LStrPCopyEmpty
  30. .LStrPCopyLoop:
  31. { copy everything }
  32. lbzu r0,1(r4)
  33. stbu r0,1(r10)
  34. bdnz .LStrPCopyLoop
  35. { add terminating #0 }
  36. li r0,0
  37. .LStrPCopyEmpty:
  38. stb r0,1(r10)
  39. end;
  40. {$endif FPC_UNIT_HAS_STRPCOPY}
  41. {
  42. $Log$
  43. Revision 1.12 2004-05-01 17:02:37 jonas
  44. * use some more string routines from libc if FPC_USE_LIBC is used
  45. Revision 1.11 2003/11/29 16:27:19 jonas
  46. * fixed several ppc assembler reader related problems
  47. * local vars in assembler procedures now start at offset 4
  48. * fixed second_int_to_bool (apparently an integer can be in LOC_JUMP??)
  49. Revision 1.10 2003/07/07 20:23:46 peter
  50. * added defines to override generic implementations
  51. Revision 1.9 2003/06/14 12:41:09 jonas
  52. * fixed compilation problems (removed unnecessary modified registers
  53. lists from procedures)
  54. Revision 1.8 2002/09/11 07:49:40 jonas
  55. * fixed assembler errors
  56. Revision 1.7 2002/09/07 16:01:26 peter
  57. * old logs removed and tabs fixed
  58. Revision 1.6 2002/09/06 16:58:43 jonas
  59. * fixed wrong references (used r0 as base register)
  60. Revision 1.5 2002/08/10 17:14:36 jonas
  61. * various fixes, mostly changing the names of the modifies registers to
  62. upper case since that seems to be required by the compiler
  63. }