~ubuntu-branches/ubuntu/dapper/fpc/dapper

« back to all changes in this revision

Viewing changes to rtl/inc/cgenstr.inc

  • Committer: Bazaar Package Importer
  • Author(s): Carlos Laviola
  • Date: 2004-08-12 16:29:37 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040812162937-moo8ulvysp1ln771
Tags: 1.9.4-5
fp-compiler: needs ld, adding dependency on binutils.  (Closes: #265265)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
    $Id: cgenstr.inc,v 1.2 2004/05/01 23:55:18 peter Exp $
 
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
 
 
7
    See the file COPYING.FPC, included in this distribution,
 
8
    for details about the copyright.
 
9
 
 
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
 **********************************************************************}
 
15
 
 
16
{ we have to call the libc routines, because simply declaring our routines }
 
17
{ as cdecl and external in libc cause problems because the calling         }
 
18
{ convention the interface is different                                    }
 
19
 
 
20
{$ifndef FPC_UNIT_HAS_STRLEN}
 
21
{$define FPC_UNIT_HAS_STRLEN}
 
22
 function libc_strlen(const p: pchar): cardinal; cdecl; external 'c' name 'strlen';
 
23
 
 
24
 function strlen(P : pchar) : longint;
 
25
   begin
 
26
     strlen := libc_strlen(p);
 
27
   end;
 
28
{$endif FPC_UNIT_HAS_STRLEN}
 
29
 
 
30
 
 
31
{$ifndef FPC_UNIT_HAS_STREND}
 
32
{$define FPC_UNIT_HAS_STREND}
 
33
 
 
34
 function StrEnd(P: PChar): PChar;{$ifdef SYSTEMINLINE}inline;{$endif}
 
35
   begin
 
36
     strend := p+strlen(p);
 
37
   end;
 
38
{$endif FPC_UNIT_HAS_STREND}
 
39
 
 
40
 
 
41
{$ifndef FPC_UNIT_HAS_STRCOPY}
 
42
{$define FPC_UNIT_HAS_STRCOPY}
 
43
 function libc_strcpy(dest: pchar; const src: pchar): pchar; cdecl; external 'c' name 'strcpy';
 
44
 
 
45
 Function StrCopy(Dest, Source:PChar): PChar;{$ifdef SYSTEMINLINE}inline;{$endif}
 
46
   Begin
 
47
     StrCopy := libc_strcpy(dest,source);
 
48
   end;
 
49
{$endif FPC_UNIT_HAS_STRCOPY}
 
50
 
 
51
 
 
52
{$ifndef FPC_UNIT_HAS_STRSCAN}
 
53
{$define FPC_UNIT_HAS_STRSCAN}
 
54
 function libc_strchr(const p: pchar; c: longint): pchar; cdecl; external 'c' name 'strchr';
 
55
 
 
56
 function StrScan(P: PChar; C: Char): PChar;{$ifdef SYSTEMINLINE}inline;{$endif}
 
57
   Begin
 
58
     StrScan := libc_strchr(p,longint(c));
 
59
   end;
 
60
{$endif FPC_UNIT_HAS_STRSCAN}
 
61
 
 
62
 
 
63
{$ifndef FPC_UNIT_HAS_STRRSCAN}
 
64
{$define FPC_UNIT_HAS_STRRSCAN}
 
65
 function libc_strrchr(const p: pchar; c: longint): pchar; cdecl; external 'c' name 'strrchr';
 
66
 
 
67
 function StrRScan(P: PChar; C: Char): PChar;{$ifdef SYSTEMINLINE}inline;{$endif}
 
68
   Begin
 
69
     StrRScan := libc_strrchr(p,longint(c));
 
70
   end;
 
71
{$endif FPC_UNIT_HAS_STRRSCAN}
 
72
 
 
73
(*
 
74
{$ifndef FPC_UNIT_HAS_STRECOPY}
 
75
{$define FPC_UNIT_HAS_STRECOPY}
 
76
 function libc_stpcpy(dest: pchar; const src: pchar): pchar; cdecl; external 'c' name 'stpcpy';
 
77
 
 
78
  Function StrECopy(Dest, Source: PChar): PChar;{$ifdef SYSTEMINLINE}inline;{$endif}
 
79
    Begin
 
80
      StrECopy := libc_stpcpy(dest,source);
 
81
    end;
 
82
{$endif FPC_UNIT_HAS_STRECOPY}
 
83
*)
 
84
 
 
85
(*
 
86
{$ifndef FPC_UNIT_HAS_STRLCOPY}
 
87
{$define FPC_UNIT_HAS_STRLCOPY}
 
88
 
 
89
 function libc_strlcpy(dest: pchar; const src: pchar; maxlen: SizeInt): SizeInt; cdecl; external 'c' name 'strlcpy';
 
90
 
 
91
 Function StrLCopy(Dest,Source: PChar; MaxLen: SizeInt): PChar;{$ifdef SYSTEMINLINE}inline;{$endif}
 
92
   Begin
 
93
     libc_strlcpy(dest,source,maxlen);
 
94
     StrLCopy := Dest;
 
95
   end;
 
96
{$endif FPC_UNIT_HAS_STRLCOPY}
 
97
*)
 
98
 
 
99
{$ifndef FPC_UNIT_HAS_STRCOMP}
 
100
{$define FPC_UNIT_HAS_STRCOMP}
 
101
 function libc_strcmp(const str1,str2: pchar): longint; cdecl; external 'c' name 'strcmp';
 
102
 
 
103
 function StrComp(Str1, Str2 : PChar): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
 
104
   Begin
 
105
     strcomp := libc_strcmp(str1,str2);
 
106
   end;
 
107
{$endif FPC_UNIT_HAS_STRCOMP}
 
108
 
 
109
 
 
110
{$ifndef FPC_UNIT_HAS_STRICOMP}
 
111
{$define FPC_UNIT_HAS_STRICOMP}
 
112
 function libc_strcasecmp(const str1,str2: pchar): longint; cdecl; external 'c' name 'strcasecmp';
 
113
 
 
114
 function StrIComp(Str1, Str2 : PChar): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
 
115
   Begin
 
116
     stricomp := libc_strcasecmp(str1,str2);
 
117
   end;
 
118
{$endif FPC_UNIT_HAS_STRICOMP}
 
119
 
 
120
 
 
121
{$ifndef FPC_UNIT_HAS_STRLCOMP}
 
122
{$define FPC_UNIT_HAS_STRLCOMP}
 
123
 function libc_strncmp(const str1,str2: pchar; l: Cardinal): longint; cdecl; external 'c' name 'strncmp';
 
124
 
 
125
 function StrLComp(Str1, Str2 : PChar; L: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
 
126
   Begin
 
127
     strlcomp := libc_strncmp(str1,str2,l);
 
128
   end;
 
129
{$endif FPC_UNIT_HAS_STRLCOMP}
 
130
 
 
131
 
 
132
{$ifndef FPC_UNIT_HAS_STRLICOMP}
 
133
{$define FPC_UNIT_HAS_STRLICOMP}
 
134
 function libc_strncasecmp(const str1,str2: pchar; l: Cardinal): longint; cdecl; external 'c' name 'strncasecmp';
 
135
 
 
136
 function StrLIComp(Str1, Str2 : PChar; L: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
 
137
   Begin
 
138
     strlicomp := libc_strncasecmp(str1,str2,l);
 
139
   end;
 
140
{$endif FPC_UNIT_HAS_STRLICOMP}
 
141
 
 
142
 
 
143
{
 
144
  $Log: cgenstr.inc,v $
 
145
  Revision 1.2  2004/05/01 23:55:18  peter
 
146
    * replace strlenint with sizeint
 
147
 
 
148
  Revision 1.1  2004/05/01 15:26:33  jonas
 
149
    * use some more string routines from libc if FPC_USE_LIBC is used
 
150
 
 
151
 
 
152
}