stringss.inc 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. function strpas(p : pchar) : string;
  14. {$i strpas.inc}
  15. function strpcopy(d : pchar;const s : string) : pchar;assembler;
  16. asm
  17. pushl %esi // Save ESI
  18. cld
  19. movl s,%esi // Load Source adress
  20. movl d,%edi // load destination address
  21. movzbl (%esi),%ecx // load length in ECX
  22. incl %esi
  23. rep
  24. movsb
  25. movb $0,(%edi)
  26. movl d,%eax // return value to EAX
  27. popl %esi
  28. end ['EDI','EAX','ECX'];
  29. {
  30. $Log$
  31. Revision 1.6 2001-03-05 17:10:04 jonas
  32. * moved implementations of strlen and strpas to separate include files
  33. (they were duplicated in i386.inc and strings.inc/stringss.inc)
  34. * strpas supports 'nil' pchars again (returns an empty string)
  35. (both merged)
  36. Revision 1.5 2001/03/04 17:31:35 jonas
  37. * fixed all implementations of strpas
  38. Revision 1.4 2001/03/04 12:42:18 jonas
  39. * fixed strpas (was limited to 254 chars) and made it overall slightly faster
  40. Revision 1.3 2001/02/10 16:08:46 jonas
  41. * fixed non-working alignment code
  42. Revision 1.2 2000/07/13 11:33:42 michael
  43. + removed logs
  44. }