2 * ====================================================================
3 * Copyright (c) 2000-2006 CollabNet. All rights reserved.
5 * This software is licensed as described in the file COPYING, which
6 * you should have received as part of this distribution. The terms
7 * are also available at http://subversion.tigris.org/license-1.html.
8 * If newer versions of this license are posted there, you may use a
9 * newer version instead, at your option.
11 * This software consists of voluntary contributions made by many
12 * individuals. For exact contribution history, see the revision
13 * history and logs, available at http://subversion.tigris.org/.
14 * ====================================================================
16 * apr.swg: This is a child file of svn_types.swg, and should not be
17 * included directly. This file should contain typemaps that deal
18 * with APR functionality, not involving any parts of Subversion.
21 /* -----------------------------------------------------------------------
22 Create perl5 typemaps for long long datatypes
23 PERL-FIXME: These typemaps are decidedly odd. They convert long long
24 values to strings before returning them. This behaviour is either
25 wrong, or needful of a comment explaining it.
28 %typemap(out) long long {
30 sprintf(temp, "%" APR_INT64_T_FMT, (apr_int64_t) $1);
31 ST(argvi) = sv_newmortal();
32 sv_setpv((SV*)ST(argvi++), temp);
35 %typemap(out) unsigned long long {
37 sprintf(temp, "%" APR_UINT64_T_FMT, (apr_uint64_t) $1);
38 ST(argvi) = sv_newmortal();
39 sv_setpv((SV*)ST(argvi++), temp);
42 %typemap(in, numinputs=0) long long *OUTPUT (apr_int64_t temp)
44 %typemap(argout) long long *OUTPUT {
46 sprintf(temp, "%" APR_INT64_T_FMT, (apr_int64_t)*($1));
47 %append_output(sv_2mortal(newSVpv(temp, 0)));
50 %typemap(in, numinputs=0) unsigned long long *OUTPUT (apr_uint64_t temp)
52 %typemap(argout) unsigned long long *OUTPUT {
54 sprintf(temp, "%" APR_UINT64_T_FMT, (apr_uint64_t)*($1));
55 %append_output(sv_2mortal(newSVpv(temp, 0)));
59 /* -----------------------------------------------------------------------
60 * APR datatypes (from apr.h)
63 /* Integers for which sizeof(type) <= sizeof(long) */
64 %apply long { apr_int16_t, apr_int32_t, apr_ssize_t }
65 %apply unsigned long { apr_byte_t, apr_uint16_t, apr_uint32_t, apr_size_t }
66 %apply unsigned long *OUTPUT { apr_uint32_t *, apr_size_t * }
68 /* If sizeof(apr_off_t) > sizeof(apr_int64_t), apr_off_t will get truncated
69 * to a 64-bit integer */
70 %apply long long { apr_off_t, apr_int64_t }
71 %apply long long *OUTPUT { apr_int64_t * };
72 %apply unsigned long long { apr_uint64_t }
74 /* -----------------------------------------------------------------------
78 /* Define the time type (rather than picking up all of apr_time.h) */
79 typedef apr_int64_t apr_time_t;
81 /* For apr_time_ansi_put().
82 We guess, because only the system C compiler can successfully parse
83 system headers if they incorporate weird include paths
84 (e.g. /usr/lib/gcc-lib/plat/ver/include). */
85 typedef apr_int32_t time_t;
87 /* -----------------------------------------------------------------------
92 %typemap(in) apr_file_t * {
93 $1 = svn_swig_py_make_file($input, _global_pool);
99 %typemap(in) apr_file_t * {
100 $1 = svn_swig_pl_make_file($input, _global_pool);
105 %typemap(in) apr_file_t * {
106 $1 = svn_swig_rb_make_file($input, _global_pool);
110 /* -----------------------------------------------------------------------
111 Output of apr_file_t *
112 ... is currently being handled by the standard OUTPARAM code in
113 svn_types.swg, but should probably be more comfortably translated to
114 scripting language concepts.