2
This file is part of the Free Pascal run time library.
3
Copyright (c) 1999-2000 by Carl-Eric Codere,
4
member of the Free Pascal development team.
6
See the file COPYING.FPC, included in this distribution,
7
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.
13
**********************************************************************}
15
{ we have to call the libc routines, because simply declaring our routines }
16
{ as cdecl and external in libc cause problems because the calling }
17
{ convention the interface is different }
19
{$ifndef FPC_UNIT_HAS_STREND}
20
{$define FPC_UNIT_HAS_STREND}
22
function StrEnd(P: PChar): PChar;{$ifdef SYSTEMINLINE}inline;{$endif}
24
strend := p+strlen(p);
26
{$endif FPC_UNIT_HAS_STREND}
29
{$ifndef FPC_UNIT_HAS_STRCOPY}
30
{$define FPC_UNIT_HAS_STRCOPY}
31
function libc_strcpy(dest: pchar; const src: pchar): pchar; cdecl; external 'c' name 'strcpy';
33
Function StrCopy(Dest, Source:PChar): PChar;{$ifdef SYSTEMINLINE}inline;{$endif}
35
StrCopy := libc_strcpy(dest,source);
37
{$endif FPC_UNIT_HAS_STRCOPY}
40
{$ifndef FPC_UNIT_HAS_STRSCAN}
41
{$define FPC_UNIT_HAS_STRSCAN}
42
function libc_strchr(const p: pchar; c: longint): pchar; cdecl; external 'c' name 'strchr';
44
function StrScan(P: PChar; C: Char): PChar;{$ifdef SYSTEMINLINE}inline;{$endif}
46
StrScan := libc_strchr(p,longint(c));
48
{$endif FPC_UNIT_HAS_STRSCAN}
51
{$ifndef FPC_UNIT_HAS_STRRSCAN}
52
{$define FPC_UNIT_HAS_STRRSCAN}
53
function libc_strrchr(const p: pchar; c: longint): pchar; cdecl; external 'c' name 'strrchr';
55
function StrRScan(P: PChar; C: Char): PChar;{$ifdef SYSTEMINLINE}inline;{$endif}
57
StrRScan := libc_strrchr(p,longint(c));
59
{$endif FPC_UNIT_HAS_STRRSCAN}
62
{$ifndef FPC_UNIT_HAS_STRECOPY}
63
{$define FPC_UNIT_HAS_STRECOPY}
64
function libc_stpcpy(dest: pchar; const src: pchar): pchar; cdecl; external 'c' name 'stpcpy';
66
Function StrECopy(Dest, Source: PChar): PChar;{$ifdef SYSTEMINLINE}inline;{$endif}
68
StrECopy := libc_stpcpy(dest,source);
70
{$endif FPC_UNIT_HAS_STRECOPY}
74
{$ifndef FPC_UNIT_HAS_STRLCOPY}
75
{$define FPC_UNIT_HAS_STRLCOPY}
77
function libc_strlcpy(dest: pchar; const src: pchar; maxlen: SizeInt): SizeInt; cdecl; external 'c' name 'strlcpy';
79
Function StrLCopy(Dest,Source: PChar; MaxLen: SizeInt): PChar;{$ifdef SYSTEMINLINE}inline;{$endif}
81
libc_strlcpy(dest,source,maxlen);
84
{$endif FPC_UNIT_HAS_STRLCOPY}
87
{$ifndef FPC_UNIT_HAS_STRCOMP}
88
{$define FPC_UNIT_HAS_STRCOMP}
89
function libc_strcmp(const str1,str2: pchar): longint; cdecl; external 'c' name 'strcmp';
91
function StrComp(Str1, Str2 : PChar): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
93
strcomp := libc_strcmp(str1,str2);
95
{$endif FPC_UNIT_HAS_STRCOMP}
98
{$ifndef FPC_UNIT_HAS_STRICOMP}
99
{$define FPC_UNIT_HAS_STRICOMP}
100
function libc_strcasecmp(const str1,str2: pchar): longint; cdecl; external 'c' name 'strcasecmp';
102
function StrIComp(Str1, Str2 : PChar): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
104
stricomp := libc_strcasecmp(str1,str2);
106
{$endif FPC_UNIT_HAS_STRICOMP}
109
{$ifndef FPC_UNIT_HAS_STRLCOMP}
110
{$define FPC_UNIT_HAS_STRLCOMP}
111
function libc_strncmp(const str1,str2: pchar; l: Cardinal): longint; cdecl; external 'c' name 'strncmp';
113
function StrLComp(Str1, Str2 : PChar; L: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
115
strlcomp := libc_strncmp(str1,str2,l);
117
{$endif FPC_UNIT_HAS_STRLCOMP}
120
{$ifndef FPC_UNIT_HAS_STRLICOMP}
121
{$define FPC_UNIT_HAS_STRLICOMP}
122
function libc_strncasecmp(const str1,str2: pchar; l: Cardinal): longint; cdecl; external 'c' name 'strncasecmp';
124
function StrLIComp(Str1, Str2 : PChar; L: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
126
strlicomp := libc_strncasecmp(str1,str2,l);
128
{$endif FPC_UNIT_HAS_STRLICOMP}