stringss.inc 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2000 by the Free Pascal development team
  5. Processor dependent part of strings.pp, not shared with
  6. sysutils unit.
  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. {$ifndef FPC_UNIT_HAS_STRPAS}
  14. {$define FPC_UNIT_HAS_STRPAS}
  15. function strpas(p : pchar) : string; assembler;
  16. {$i strpas.inc}
  17. {$endif FPC_UNIT_HAS_STRPAS}
  18. {$ifndef FPC_UNIT_HAS_STRPCOPY}
  19. {$define FPC_UNIT_HAS_STRPCOPY}
  20. function strpcopy(d : pchar;const s : string) : pchar;assembler;
  21. var
  22. saveesi,saveedi : longint;
  23. asm
  24. movl %edi,saveedi
  25. movl %esi,saveesi
  26. cld
  27. {$ifdef REGCALL}
  28. movl %eax,%edi // load destination address
  29. movl %edx,%esi // Load Source adress
  30. {$else}
  31. movl s,%esi // Load Source adress
  32. movl d,%edi // load destination address
  33. {$endif}
  34. movzbl (%esi),%ecx // load length in ECX
  35. incl %esi
  36. rep
  37. movsb
  38. movb $0,(%edi)
  39. {$ifndef REGCALL}
  40. movl d,%eax // return value to EAX
  41. {$endif}
  42. movl saveedi,%edi
  43. movl saveesi,%esi
  44. end;
  45. {$endif FPC_UNIT_HAS_STRPCOPY}
  46. {
  47. $Log$
  48. Revision 1.12 2004-05-01 15:26:33 jonas
  49. * use some more string routines from libc if FPC_USE_LIBC is used
  50. Revision 1.11 2003/11/19 16:58:44 peter
  51. * make strpas assembler function
  52. Revision 1.10 2003/11/11 21:08:17 peter
  53. * REGCALL define added
  54. Revision 1.9 2003/09/08 18:21:37 peter
  55. * save edi,esi,ebx
  56. Revision 1.8 2003/07/07 20:22:05 peter
  57. * generic string routines added
  58. Revision 1.7 2002/09/07 16:01:19 peter
  59. * old logs removed and tabs fixed
  60. }