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 / Debug.c @ a274da4f

History | View | Annotate | Download (9.74 KB)

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

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

    
12
#line 13 "Debug.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 "Debug.c"
155

    
156
XS_EUPXS(XS_Purple__Debug_purple_debug); /* prototype to pass -Wmissing-prototypes */
157
XS_EUPXS(XS_Purple__Debug_purple_debug)
158
{
159
    dVAR; dXSARGS;
160
    if (items != 3)
161
       croak_xs_usage(cv,  "level, category, string");
162
    {
163
        Purple__DebugLevel        level = (Purple__DebugLevel)SvIV(ST(0))
164
;
165
        const char *        category = (const char *)SvPV_nolen(ST(1))
166
;
167
        const char *        string = (const char *)SvPV_nolen(ST(2))
168
;
169
#line 30 "Debug.xs"
170
        purple_debug(level, category, "%s", string);
171
#line 172 "Debug.c"
172
    }
173
    XSRETURN_EMPTY;
174
}
175

    
176

    
177
XS_EUPXS(XS_Purple__Debug_misc); /* prototype to pass -Wmissing-prototypes */
178
XS_EUPXS(XS_Purple__Debug_misc)
179
{
180
    dVAR; dXSARGS;
181
    if (items != 2)
182
       croak_xs_usage(cv,  "category, string");
183
    {
184
        const char *        category = (const char *)SvPV_nolen(ST(0))
185
;
186
        const char *        string = (const char *)SvPV_nolen(ST(1))
187
;
188
#line 37 "Debug.xs"
189
        purple_debug_misc(category, "%s", string);
190
#line 191 "Debug.c"
191
    }
192
    XSRETURN_EMPTY;
193
}
194

    
195

    
196
XS_EUPXS(XS_Purple__Debug_info); /* prototype to pass -Wmissing-prototypes */
197
XS_EUPXS(XS_Purple__Debug_info)
198
{
199
    dVAR; dXSARGS;
200
    if (items != 2)
201
       croak_xs_usage(cv,  "category, string");
202
    {
203
        const char *        category = (const char *)SvPV_nolen(ST(0))
204
;
205
        const char *        string = (const char *)SvPV_nolen(ST(1))
206
;
207
#line 44 "Debug.xs"
208
        purple_debug_info(category, "%s", string);
209
#line 210 "Debug.c"
210
    }
211
    XSRETURN_EMPTY;
212
}
213

    
214

    
215
XS_EUPXS(XS_Purple__Debug_warning); /* prototype to pass -Wmissing-prototypes */
216
XS_EUPXS(XS_Purple__Debug_warning)
217
{
218
    dVAR; dXSARGS;
219
    if (items != 2)
220
       croak_xs_usage(cv,  "category, string");
221
    {
222
        const char *        category = (const char *)SvPV_nolen(ST(0))
223
;
224
        const char *        string = (const char *)SvPV_nolen(ST(1))
225
;
226
#line 51 "Debug.xs"
227
        purple_debug_warning(category, "%s", string);
228
#line 229 "Debug.c"
229
    }
230
    XSRETURN_EMPTY;
231
}
232

    
233

    
234
XS_EUPXS(XS_Purple__Debug_error); /* prototype to pass -Wmissing-prototypes */
235
XS_EUPXS(XS_Purple__Debug_error)
236
{
237
    dVAR; dXSARGS;
238
    if (items != 2)
239
       croak_xs_usage(cv,  "category, string");
240
    {
241
        const char *        category = (const char *)SvPV_nolen(ST(0))
242
;
243
        const char *        string = (const char *)SvPV_nolen(ST(1))
244
;
245
#line 58 "Debug.xs"
246
        purple_debug_error(category, "%s", string);
247
#line 248 "Debug.c"
248
    }
249
    XSRETURN_EMPTY;
250
}
251

    
252

    
253
XS_EUPXS(XS_Purple__Debug_fatal); /* prototype to pass -Wmissing-prototypes */
254
XS_EUPXS(XS_Purple__Debug_fatal)
255
{
256
    dVAR; dXSARGS;
257
    if (items != 2)
258
       croak_xs_usage(cv,  "category, string");
259
    {
260
        const char *        category = (const char *)SvPV_nolen(ST(0))
261
;
262
        const char *        string = (const char *)SvPV_nolen(ST(1))
263
;
264
#line 65 "Debug.xs"
265
        purple_debug_fatal(category, "%s", string);
266
#line 267 "Debug.c"
267
    }
268
    XSRETURN_EMPTY;
269
}
270

    
271

    
272
XS_EUPXS(XS_Purple__Debug_set_enabled); /* prototype to pass -Wmissing-prototypes */
273
XS_EUPXS(XS_Purple__Debug_set_enabled)
274
{
275
    dVAR; dXSARGS;
276
    if (items != 1)
277
       croak_xs_usage(cv,  "enabled");
278
    {
279
        gboolean        enabled = (bool)SvTRUE(ST(0))
280
;
281

    
282
        purple_debug_set_enabled(enabled);
283
    }
284
    XSRETURN_EMPTY;
285
}
286

    
287

    
288
XS_EUPXS(XS_Purple__Debug_is_enabled); /* prototype to pass -Wmissing-prototypes */
289
XS_EUPXS(XS_Purple__Debug_is_enabled)
290
{
291
    dVAR; dXSARGS;
292
    if (items != 0)
293
       croak_xs_usage(cv,  "");
294
    {
295
        gboolean        RETVAL;
296

    
297
        RETVAL = purple_debug_is_enabled();
298
        ST(0) = sv_newmortal();
299
        ST(0) = boolSV(RETVAL);
300
    }
301
    XSRETURN(1);
302
}
303

    
304
#ifdef __cplusplus
305
extern "C"
306
#endif
307
XS_EXTERNAL(boot_Purple__Debug); /* prototype to pass -Wmissing-prototypes */
308
XS_EXTERNAL(boot_Purple__Debug)
309
{
310
    dVAR; dXSARGS;
311
#if (PERL_REVISION == 5 && PERL_VERSION < 9)
312
    char* file = __FILE__;
313
#else
314
    const char* file = __FILE__;
315
#endif
316

    
317
    PERL_UNUSED_VAR(cv); /* -W */
318
    PERL_UNUSED_VAR(items); /* -W */
319
#ifdef XS_APIVERSION_BOOTCHECK
320
    XS_APIVERSION_BOOTCHECK;
321
#endif
322
    XS_VERSION_BOOTCHECK;
323

    
324
        (void)newXSproto_portable("Purple::Debug::purple_debug", XS_Purple__Debug_purple_debug, file, "$$$");
325
        (void)newXSproto_portable("Purple::Debug::misc", XS_Purple__Debug_misc, file, "$$");
326
        (void)newXSproto_portable("Purple::Debug::info", XS_Purple__Debug_info, file, "$$");
327
        (void)newXSproto_portable("Purple::Debug::warning", XS_Purple__Debug_warning, file, "$$");
328
        (void)newXSproto_portable("Purple::Debug::error", XS_Purple__Debug_error, file, "$$");
329
        (void)newXSproto_portable("Purple::Debug::fatal", XS_Purple__Debug_fatal, file, "$$");
330
        (void)newXSproto_portable("Purple::Debug::set_enabled", XS_Purple__Debug_set_enabled, file, "$");
331
        (void)newXSproto_portable("Purple::Debug::is_enabled", XS_Purple__Debug_is_enabled, file, "");
332

    
333
    /* Initialisation Section */
334

    
335
#line 7 "Debug.xs"
336
{
337
        HV *stash = gv_stashpv("Purple::Debug", 1);
338

    
339
        static const constiv *civ, const_iv[] = {
340
#define const_iv(name) {#name, (IV)PURPLE_DEBUG_##name}
341
                const_iv(ALL),
342
                const_iv(MISC),
343
                const_iv(INFO),
344
                const_iv(WARNING),
345
                const_iv(ERROR),
346
                const_iv(FATAL),
347
        };
348

    
349
        for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; )
350
                newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv));
351
}
352

    
353
#line 354 "Debug.c"
354

    
355
    /* End of Initialisation Section */
356

    
357
#if (PERL_REVISION == 5 && PERL_VERSION >= 9)
358
  if (PL_unitcheckav)
359
       call_list(PL_scopestack_ix, PL_unitcheckav);
360
#endif
361
    XSRETURN_YES;
362
}
363