~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/packages/base/httpd/httpd-2.2/apr/apr.pas

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
 apr.pas
 
3
 
 
4
 Copyright (C) 2006 Felipe Monteiro de Carvalho
 
5
 
 
6
 This unit is a pascal binding for the Apache 2.0.58 headers.
 
7
 The headers were released under the following copyright:
 
8
}
 
9
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
 
10
 * applicable.
 
11
 *
 
12
 * Licensed under the Apache License, Version 2.0 (the "License");
 
13
 * you may not use this file except in compliance with the License.
 
14
 * You may obtain a copy of the License at
 
15
 *
 
16
 *     http://www.apache.org/licenses/LICENSE-2.0
 
17
 *
 
18
 * Unless required by applicable law or agreed to in writing, software
 
19
 * distributed under the License is distributed on an "AS IS" BASIS,
 
20
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
21
 * See the License for the specific language governing permissions and
 
22
 * limitations under the License.
 
23
 }
 
24
unit apr;
 
25
 
 
26
interface
 
27
 
 
28
{$ifdef fpc}
 
29
  {$mode delphi}{$H+}
 
30
{$endif}
 
31
 
 
32
{$IFNDEF FPC}
 
33
  {$DEFINE WINDOWS}
 
34
{$ENDIF}
 
35
 
 
36
{$IFDEF WIN32}
 
37
  {$DEFINE WINDOWS}
 
38
{$ENDIF}
 
39
 
 
40
{$ifdef Unix}
 
41
  {$PACKRECORDS C}
 
42
{$endif}
 
43
 
 
44
uses
 
45
{$ifdef WINDOWS}
 
46
  Windows, winsock,
 
47
{$ELSE}
 
48
  UnixType,
 
49
{$ENDIF}
 
50
  SysUtils, ctypes;
 
51
  
 
52
const
 
53
{$IFDEF WINDOWS}
 
54
  LibAPR = 'libapr-1.dll';
 
55
{$ELSE}
 
56
  LibAPR = '';
 
57
{$ENDIF}
 
58
 
 
59
{$IFDEF WINDOWS}
 
60
  LibNamePrefix = '_';
 
61
  LibSuff0 = '@0';
 
62
  LibSuff4 = '@4';
 
63
  LibSuff8 = '@8';
 
64
  LibSuff12 = '@12';
 
65
  LibSuff16 = '@16';
 
66
  LibSuff20 = '@20';
 
67
  LibSuff24 = '@24';
 
68
  LibSuff28 = '@28';
 
69
  LibSuff32 = '@32';
 
70
{$ELSE}
 
71
  LibNamePrefix = '';
 
72
  LibSuff0 = '';
 
73
  LibSuff4 = '';
 
74
  LibSuff8 = '';
 
75
  LibSuff12 = '';
 
76
  LibSuff16 = '';
 
77
  LibSuff20 = '';
 
78
  LibSuff24 = '';
 
79
  LibSuff28 = '';
 
80
  LibSuff32 = '';
 
81
{$ENDIF}
 
82
 
 
83
type
 
84
  uid_t = Integer;
 
85
  gid_t = Integer;
 
86
  time_t = LongInt;
 
87
  size_t = Integer;
 
88
  pid_t = Integer;
 
89
  Ppid_t = ^pid_t;
 
90
  apr_uint16_t = Word;
 
91
  apr_uint32_t = Cardinal;
 
92
  apr_int64_t = Int64;
 
93
  apr_uint64_t = Int64;
 
94
  apr_socklen_t = Integer;
 
95
  apr_byte_t = Byte;
 
96
 
 
97
  apr_uint32_tso_handle_t = cuint;
 
98
 
 
99
type
 
100
  {$IFDEF WINDOWS}
 
101
  apr_off_t = Int64;
 
102
  {$ENDIF}
 
103
  {$IFDEF UNIX}
 
104
  {$ifdef CPU64}
 
105
  apr_off_t = int64;
 
106
  {$else}
 
107
  apr_off_t = Integer;
 
108
  {$endif}
 
109
  {$ENDIF}
 
110
 
 
111
  apr_int32_t = Integer;
 
112
  Papr_int32_t = ^Integer;
 
113
  apr_size_t = size_t;
 
114
  Papr_size_t = ^apr_size_t;
 
115
  apr_int16_t = SmallInt;
 
116
  Papr_int16_t = ^SmallInt;
 
117
 
 
118
  // Network structures
 
119
  
 
120
  sockaddr = record
 
121
    sa_family: cushort;    // address family, AF_xxx
 
122
    sa_data: array [1..14] of Char;  // (NBO) 14 bytes of protocol address
 
123
  end;
 
124
  
 
125
  in_addr = record
 
126
    s_addr: culong;        // load with inet_aton()
 
127
  end;
 
128
 
 
129
{$ifndef windows}
 
130
 
 
131
  va_list = Pointer;
 
132
 
 
133
  sockaddr_in = record
 
134
    sin_family: cshort;    // e.g. AF_INET
 
135
    sin_port: cushort;     // e.g. htons(3490)
 
136
    sin_addr: in_addr;     // see struct in_addr, below
 
137
    sin_zero: array [1..8] of Char;  // zero this if you want to
 
138
  end;
 
139
  
 
140
{$endif}
 
141
 
 
142
  in6_addr = record
 
143
   Case Integer of
 
144
    1: (u6_addr8: array [1..16] of Byte);
 
145
    2: (u6_addr16: array [1..8] of Word);
 
146
    3: (u6_addr32: array [1..4] of Cardinal);
 
147
  end;
 
148
//#define s6_addr      in6_u.u6_addr8
 
149
//#define s6_addr16    in6_u.u6_addr16
 
150
//#define s6_addr32    in6_u.u6_addr32
 
151
 
 
152
  sockaddr_in6 = record
 
153
   sin6_family: cushort;
 
154
    sin6_port: Word;
 
155
    sin6_flowinfo: Cardinal;
 
156
    sin6_addr: in6_addr;
 
157
    sin6_scope_id: Cardinal;
 
158
  end;
 
159
 
 
160
  // TEMPORARY
 
161
  
 
162
  Papr_xml_ns_scope = Pointer;
 
163
 
 
164
  Pap_method_list_t = Pointer;
 
165
  Pcore_output_filter_ctx_t = Pointer;
 
166
  Pap_directive_t = Pointer;
 
167
  Pap_filter_t = Pointer;
 
168
  Papr_file_t = Pointer;
 
169
  Papr_off_t = Pointer;
 
170
 
 
171
  iovec = record
 
172
    /// byte count to read/write
 
173
    iov_len: culong;
 
174
    /// data to be read/written
 
175
    iov_base: PChar;
 
176
  end;
 
177
  
 
178
  Piovec = ^iovec;
 
179
 
 
180
{$include apr_errno.inc}
 
181
{$include apr_pools.inc}
 
182
{$include apr_general.inc}
 
183
{$include apr_dso.inc}
 
184
{$include apr_user.inc}
 
185
{$include apr_time.inc}
 
186
{$include apr_tables.inc}
 
187
{$include apr_file_info.inc}
 
188
{$include apr_file_io.inc}
 
189
{$include apr_strings.inc}
 
190
{$include apr_lib.inc}
 
191
{$include apr_signal.inc}
 
192
{$include apr_network_io.inc}
 
193
{.$include apr_portable.inc}
 
194
 
 
195
{.$include ../aprutils/apr_uri.inc}
 
196
 
 
197
{$include apr_thread_proc.inc}
 
198
{$include apr_version.inc}
 
199
{$include apr_poll.inc}
 
200
 
 
201
implementation
 
202
 
 
203
{
 
204
  Macros transformed into functions in the translation
 
205
}
 
206
 
 
207
{ apr_pools.inc }
 
208
 
 
209
{$ifndef DOXYGEN}
 
210
function apr_pool_create(newpool: PPapr_pool_t; parent: Papr_pool_t): apr_status_t;
 
211
begin
 
212
  Result := apr_pool_create_ex(newpool, parent, nil, nil);
 
213
end;
 
214
{$endif}
 
215
 
 
216
function apr_pool_sub_make(newpool: PPapr_pool_t; parent: Papr_pool_t;
 
217
 abort_fn: apr_abortfunc_t): apr_status_t;
 
218
begin
 
219
  Result := apr_pool_create_ex(newpool, parent, abort_fn, nil);
 
220
end;
 
221
 
 
222
{ apr_lib.inc }
 
223
 
 
224
function apr_tolower(c: Char): Char;
 
225
var
 
226
  buf: array[0..1] of Char;
 
227
begin
 
228
  buf[0] := c;
 
229
  buf[1] := #0;
 
230
  
 
231
  buf := StrLower(@buf[0]);
 
232
  
 
233
  Result := buf[0];
 
234
end;
 
235
 
 
236
function apr_toupper(c: Char): Char;
 
237
var
 
238
  buf: array[0..1] of Char;
 
239
begin
 
240
  buf[0] := c;
 
241
  buf[1] := #0;
 
242
 
 
243
  buf := StrUpper(@buf[0]);
 
244
 
 
245
  Result := buf[0];
 
246
end;
 
247
 
 
248
end.
 
249