The data contained in this repository can be downloaded to your computer using one of several clients.
Please see the documentation of your version control software client for more information.

Please select the desired protocol below to get the URL.

This URL has Read-Only access.

Statistics
| Branch: | Revision:

main_repo / libpurple / plugins / perl / common / Stringref.c @ a274da4f

History | View | Annotate | Download (8.75 KB)

1
/*
2
 * This file was generated automatically by ExtUtils::ParseXS version 3.18 from the
3
 * contents of Stringref.xs. Do not edit this file, edit Stringref.xs instead.
4
 *
5
 *    ANY CHANGES MADE HERE WILL BE LOST!
6
 *
7
 */
8

    
9
#line 1 "Stringref.xs"
10
#include "module.h"
11

    
12
#line 13 "Stringref.c"
13
#ifndef PERL_UNUSED_VAR
14
#  define PERL_UNUSED_VAR(var) if (0) var = var
15
#endif
16

    
17
#ifndef dVAR
18
#  define dVAR                dNOOP
19
#endif
20

    
21

    
22
/* This stuff is not part of the API! You have been warned. */
23
#ifndef PERL_VERSION_DECIMAL
24
#  define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
25
#endif
26
#ifndef PERL_DECIMAL_VERSION
27
#  define PERL_DECIMAL_VERSION \
28
          PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
29
#endif
30
#ifndef PERL_VERSION_GE
31
#  define PERL_VERSION_GE(r,v,s) \
32
          (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
33
#endif
34
#ifndef PERL_VERSION_LE
35
#  define PERL_VERSION_LE(r,v,s) \
36
          (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
37
#endif
38

    
39
/* XS_INTERNAL is the explicit static-linkage variant of the default
40
 * XS macro.
41
 *
42
 * XS_EXTERNAL is the same as XS_INTERNAL except it does not include
43
 * "STATIC", ie. it exports XSUB symbols. You probably don't want that
44
 * for anything but the BOOT XSUB.
45
 *
46
 * See XSUB.h in core!
47
 */
48

    
49

    
50
/* TODO: This might be compatible further back than 5.10.0. */
51
#if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1)
52
#  undef XS_EXTERNAL
53
#  undef XS_INTERNAL
54
#  if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
55
#    define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
56
#    define XS_INTERNAL(name) STATIC XSPROTO(name)
57
#  endif
58
#  if defined(__SYMBIAN32__)
59
#    define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
60
#    define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name)
61
#  endif
62
#  ifndef XS_EXTERNAL
63
#    if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
64
#      define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
65
#      define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__)
66
#    else
67
#      ifdef __cplusplus
68
#        define XS_EXTERNAL(name) extern "C" XSPROTO(name)
69
#        define XS_INTERNAL(name) static XSPROTO(name)
70
#      else
71
#        define XS_EXTERNAL(name) XSPROTO(name)
72
#        define XS_INTERNAL(name) STATIC XSPROTO(name)
73
#      endif
74
#    endif
75
#  endif
76
#endif
77

    
78
/* perl >= 5.10.0 && perl <= 5.15.1 */
79

    
80

    
81
/* The XS_EXTERNAL macro is used for functions that must not be static
82
 * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
83
 * macro defined, the best we can do is assume XS is the same.
84
 * Dito for XS_INTERNAL.
85
 */
86
#ifndef XS_EXTERNAL
87
#  define XS_EXTERNAL(name) XS(name)
88
#endif
89
#ifndef XS_INTERNAL
90
#  define XS_INTERNAL(name) XS(name)
91
#endif
92

    
93
/* Now, finally, after all this mess, we want an ExtUtils::ParseXS
94
 * internal macro that we're free to redefine for varying linkage due
95
 * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
96
 * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
97
 */
98

    
99
#undef XS_EUPXS
100
#if defined(PERL_EUPXS_ALWAYS_EXPORT)
101
#  define XS_EUPXS(name) XS_EXTERNAL(name)
102
#else
103
   /* default to internal */
104
#  define XS_EUPXS(name) XS_INTERNAL(name)
105
#endif
106

    
107
#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
108
#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)
109

    
110
/* prototype to pass -Wmissing-prototypes */
111
STATIC void
112
S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params);
113

    
114
STATIC void
115
S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params)
116
{
117
    const GV *const gv = CvGV(cv);
118

    
119
    PERL_ARGS_ASSERT_CROAK_XS_USAGE;
120

    
121
    if (gv) {
122
        const char *const gvname = GvNAME(gv);
123
        const HV *const stash = GvSTASH(gv);
124
        const char *const hvname = stash ? HvNAME(stash) : NULL;
125

    
126
        if (hvname)
127
            Perl_croak(aTHX_ "Usage: %s::%s(%s)", hvname, gvname, params);
128
        else
129
            Perl_croak(aTHX_ "Usage: %s(%s)", gvname, params);
130
    } else {
131
        /* Pants. I don't think that it should be possible to get here. */
132
        Perl_croak(aTHX_ "Usage: CODE(0x%"UVxf")(%s)", PTR2UV(cv), params);
133
    }
134
}
135
#undef  PERL_ARGS_ASSERT_CROAK_XS_USAGE
136

    
137
#ifdef PERL_IMPLICIT_CONTEXT
138
#define croak_xs_usage(a,b)    S_croak_xs_usage(aTHX_ a,b)
139
#else
140
#define croak_xs_usage        S_croak_xs_usage
141
#endif
142

    
143
#endif
144

    
145
/* NOTE: the prototype of newXSproto() is different in versions of perls,
146
 * so we define a portable version of newXSproto()
147
 */
148
#ifdef newXS_flags
149
#define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
150
#else
151
#define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
152
#endif /* !defined(newXS_flags) */
153

    
154
#line 155 "Stringref.c"
155

    
156
XS_EUPXS(XS_Purple__Stringref_cmp); /* prototype to pass -Wmissing-prototypes */
157
XS_EUPXS(XS_Purple__Stringref_cmp)
158
{
159
    dVAR; dXSARGS;
160
    if (items != 2)
161
       croak_xs_usage(cv,  "s1, s2");
162
    {
163
        Purple__Stringref        s1 = purple_perl_ref_object(ST(0))
164
;
165
        Purple__Stringref        s2 = purple_perl_ref_object(ST(1))
166
;
167
        int        RETVAL;
168
        dXSTARG;
169

    
170
        RETVAL = purple_stringref_cmp(s1, s2);
171
        XSprePUSH; PUSHi((IV)RETVAL);
172
    }
173
    XSRETURN(1);
174
}
175

    
176

    
177
XS_EUPXS(XS_Purple__Stringref_len); /* prototype to pass -Wmissing-prototypes */
178
XS_EUPXS(XS_Purple__Stringref_len)
179
{
180
    dVAR; dXSARGS;
181
    if (items != 1)
182
       croak_xs_usage(cv,  "stringref");
183
    {
184
        Purple__Stringref        stringref = purple_perl_ref_object(ST(0))
185
;
186
        size_t        RETVAL;
187
        dXSTARG;
188

    
189
        RETVAL = purple_stringref_len(stringref);
190
        XSprePUSH; PUSHu((UV)RETVAL);
191
    }
192
    XSRETURN(1);
193
}
194

    
195

    
196
XS_EUPXS(XS_Purple__Stringref_new); /* prototype to pass -Wmissing-prototypes */
197
XS_EUPXS(XS_Purple__Stringref_new)
198
{
199
    dVAR; dXSARGS;
200
    if (items != 2)
201
       croak_xs_usage(cv,  "class, value");
202
    {
203
        const char *        value = (const char *)SvPV_nolen(ST(1))
204
;
205
        Purple__Stringref        RETVAL;
206

    
207
        RETVAL = purple_stringref_new(value);
208
        ST(0) = purple_perl_bless_object(RETVAL, "Purple::Stringref");
209
        sv_2mortal(ST(0));
210
    }
211
    XSRETURN(1);
212
}
213

    
214

    
215
XS_EUPXS(XS_Purple__Stringref_new_noref); /* prototype to pass -Wmissing-prototypes */
216
XS_EUPXS(XS_Purple__Stringref_new_noref)
217
{
218
    dVAR; dXSARGS;
219
    if (items != 2)
220
       croak_xs_usage(cv,  "class, value");
221
    {
222
        const char *        value = (const char *)SvPV_nolen(ST(1))
223
;
224
        Purple__Stringref        RETVAL;
225

    
226
        RETVAL = purple_stringref_new_noref(value);
227
        ST(0) = purple_perl_bless_object(RETVAL, "Purple::Stringref");
228
        sv_2mortal(ST(0));
229
    }
230
    XSRETURN(1);
231
}
232

    
233

    
234
XS_EUPXS(XS_Purple__Stringref_ref); /* prototype to pass -Wmissing-prototypes */
235
XS_EUPXS(XS_Purple__Stringref_ref)
236
{
237
    dVAR; dXSARGS;
238
    if (items != 1)
239
       croak_xs_usage(cv,  "stringref");
240
    {
241
        Purple__Stringref        stringref = purple_perl_ref_object(ST(0))
242
;
243
        Purple__Stringref        RETVAL;
244

    
245
        RETVAL = purple_stringref_ref(stringref);
246
        ST(0) = purple_perl_bless_object(RETVAL, "Purple::Stringref");
247
        sv_2mortal(ST(0));
248
    }
249
    XSRETURN(1);
250
}
251

    
252

    
253
XS_EUPXS(XS_Purple__Stringref_unref); /* prototype to pass -Wmissing-prototypes */
254
XS_EUPXS(XS_Purple__Stringref_unref)
255
{
256
    dVAR; dXSARGS;
257
    if (items != 1)
258
       croak_xs_usage(cv,  "stringref");
259
    {
260
        Purple__Stringref        stringref = purple_perl_ref_object(ST(0))
261
;
262

    
263
        purple_stringref_unref(stringref);
264
    }
265
    XSRETURN_EMPTY;
266
}
267

    
268

    
269
XS_EUPXS(XS_Purple__Stringref_value); /* prototype to pass -Wmissing-prototypes */
270
XS_EUPXS(XS_Purple__Stringref_value)
271
{
272
    dVAR; dXSARGS;
273
    if (items != 1)
274
       croak_xs_usage(cv,  "stringref");
275
    {
276
        Purple__Stringref        stringref = purple_perl_ref_object(ST(0))
277
;
278
        const char *        RETVAL;
279
        dXSTARG;
280

    
281
        RETVAL = purple_stringref_value(stringref);
282
        sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
283
    }
284
    XSRETURN(1);
285
}
286

    
287
#ifdef __cplusplus
288
extern "C"
289
#endif
290
XS_EXTERNAL(boot_Purple__Stringref); /* prototype to pass -Wmissing-prototypes */
291
XS_EXTERNAL(boot_Purple__Stringref)
292
{
293
    dVAR; dXSARGS;
294
#if (PERL_REVISION == 5 && PERL_VERSION < 9)
295
    char* file = __FILE__;
296
#else
297
    const char* file = __FILE__;
298
#endif
299

    
300
    PERL_UNUSED_VAR(cv); /* -W */
301
    PERL_UNUSED_VAR(items); /* -W */
302
#ifdef XS_APIVERSION_BOOTCHECK
303
    XS_APIVERSION_BOOTCHECK;
304
#endif
305
    XS_VERSION_BOOTCHECK;
306

    
307
        (void)newXSproto_portable("Purple::Stringref::cmp", XS_Purple__Stringref_cmp, file, "$$");
308
        (void)newXSproto_portable("Purple::Stringref::len", XS_Purple__Stringref_len, file, "$");
309
        (void)newXSproto_portable("Purple::Stringref::new", XS_Purple__Stringref_new, file, "$$");
310
        (void)newXSproto_portable("Purple::Stringref::new_noref", XS_Purple__Stringref_new_noref, file, "$$");
311
        (void)newXSproto_portable("Purple::Stringref::ref", XS_Purple__Stringref_ref, file, "$");
312
        (void)newXSproto_portable("Purple::Stringref::unref", XS_Purple__Stringref_unref, file, "$");
313
        (void)newXSproto_portable("Purple::Stringref::value", XS_Purple__Stringref_value, file, "$");
314
#if (PERL_REVISION == 5 && PERL_VERSION >= 9)
315
  if (PL_unitcheckav)
316
       call_list(PL_scopestack_ix, PL_unitcheckav);
317
#endif
318
    XSRETURN_YES;
319
}
320