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

History | View | Annotate | Download (14.9 KB)

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

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

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

    
156
XS_EUPXS(XS_Purple__Log_get_handle); /* prototype to pass -Wmissing-prototypes */
157
XS_EUPXS(XS_Purple__Log_get_handle)
158
{
159
    dVAR; dXSARGS;
160
    if (items != 0)
161
       croak_xs_usage(cv,  "");
162
    {
163
        Purple__Handle        RETVAL;
164

    
165
        RETVAL = purple_log_get_handle();
166
        ST(0) = purple_perl_bless_object(RETVAL, "Purple::Handle");
167
        sv_2mortal(ST(0));
168
    }
169
    XSRETURN(1);
170
}
171

    
172

    
173
XS_EUPXS(XS_Purple__Log_common_sizer); /* prototype to pass -Wmissing-prototypes */
174
XS_EUPXS(XS_Purple__Log_common_sizer)
175
{
176
    dVAR; dXSARGS;
177
    if (items != 1)
178
       croak_xs_usage(cv,  "log");
179
    {
180
        Purple__Log        log = purple_perl_ref_object(ST(0))
181
;
182
        int        RETVAL;
183
        dXSTARG;
184

    
185
        RETVAL = purple_log_common_sizer(log);
186
        XSprePUSH; PUSHi((IV)RETVAL);
187
    }
188
    XSRETURN(1);
189
}
190

    
191

    
192
XS_EUPXS(XS_Purple__Log_common_writer); /* prototype to pass -Wmissing-prototypes */
193
XS_EUPXS(XS_Purple__Log_common_writer)
194
{
195
    dVAR; dXSARGS;
196
    if (items != 2)
197
       croak_xs_usage(cv,  "log, ext");
198
    {
199
        Purple__Log        log = purple_perl_ref_object(ST(0))
200
;
201
        const char *        ext = (const char *)SvPV_nolen(ST(1))
202
;
203

    
204
        purple_log_common_writer(log, ext);
205
    }
206
    XSRETURN_EMPTY;
207
}
208

    
209

    
210
XS_EUPXS(XS_Purple__Log_compare); /* prototype to pass -Wmissing-prototypes */
211
XS_EUPXS(XS_Purple__Log_compare)
212
{
213
    dVAR; dXSARGS;
214
    if (items != 2)
215
       croak_xs_usage(cv,  "y, z");
216
    {
217
        gconstpointer        y = INT2PTR(gconstpointer,SvIV(ST(0)))
218
;
219
        gconstpointer        z = INT2PTR(gconstpointer,SvIV(ST(1)))
220
;
221
        gint        RETVAL;
222
        dXSTARG;
223

    
224
        RETVAL = purple_log_compare(y, z);
225
        XSprePUSH; PUSHi((IV)RETVAL);
226
    }
227
    XSRETURN(1);
228
}
229

    
230

    
231
XS_EUPXS(XS_Purple__Log_free); /* prototype to pass -Wmissing-prototypes */
232
XS_EUPXS(XS_Purple__Log_free)
233
{
234
    dVAR; dXSARGS;
235
    if (items != 1)
236
       croak_xs_usage(cv,  "log");
237
    {
238
        Purple__Log        log = purple_perl_ref_object(ST(0))
239
;
240

    
241
        purple_log_free(log);
242
    }
243
    XSRETURN_EMPTY;
244
}
245

    
246

    
247
XS_EUPXS(XS_Purple__Log_get_log_dir); /* prototype to pass -Wmissing-prototypes */
248
XS_EUPXS(XS_Purple__Log_get_log_dir)
249
{
250
    dVAR; dXSARGS;
251
    if (items != 3)
252
       croak_xs_usage(cv,  "type, name, account");
253
    {
254
        Purple__LogType        type = (Purple__LogType)SvIV(ST(0))
255
;
256
        const char *        name = (const char *)SvPV_nolen(ST(1))
257
;
258
        Purple__Account        account = purple_perl_ref_object(ST(2))
259
;
260
        gchar_own *        RETVAL;
261

    
262
        RETVAL = purple_log_get_log_dir(type, name, account);
263
        ST(0) = sv_newmortal();
264
        /* used when we can directly own the returned string. */
265
        /* we have to copy in the case when perl's malloc != gtk's malloc,
266
         * so best copy all the time. */
267
        sv_setpv ((SV*)ST(0), RETVAL);
268
        SvUTF8_on (ST(0));
269
        g_free (RETVAL);
270
    }
271
    XSRETURN(1);
272
}
273

    
274

    
275
XS_EUPXS(XS_Purple__Log_get_log_sets); /* prototype to pass -Wmissing-prototypes */
276
XS_EUPXS(XS_Purple__Log_get_log_sets)
277
{
278
    dVAR; dXSARGS;
279
    if (items != 0)
280
       croak_xs_usage(cv,  "");
281
    PERL_UNUSED_VAR(ax); /* -Wall */
282
    SP -= items;
283
    {
284
#line 60 "Log.xs"
285
        GHashTable *l;
286
#line 287 "Log.c"
287
#line 62 "Log.xs"
288
        l = purple_log_get_log_sets();
289
        XPUSHs(sv_2mortal(purple_perl_bless_object(l, "GHashTable")));
290
#line 291 "Log.c"
291
        PUTBACK;
292
        return;
293
    }
294
}
295

    
296

    
297
XS_EUPXS(XS_Purple__Log_get_logs); /* prototype to pass -Wmissing-prototypes */
298
XS_EUPXS(XS_Purple__Log_get_logs)
299
{
300
    dVAR; dXSARGS;
301
    if (items != 3)
302
       croak_xs_usage(cv,  "type, name, account");
303
    PERL_UNUSED_VAR(ax); /* -Wall */
304
    SP -= items;
305
    {
306
        Purple__LogType        type = (Purple__LogType)SvIV(ST(0))
307
;
308
        const char *        name = (const char *)SvPV_nolen(ST(1))
309
;
310
        Purple__Account        account = purple_perl_ref_object(ST(2))
311
;
312
#line 71 "Log.xs"
313
        GList *l, *ll;
314
#line 315 "Log.c"
315
#line 73 "Log.xs"
316
        ll = purple_log_get_logs(type, name, account);
317
        for (l = ll; l != NULL; l = l->next) {
318
                XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Log")));
319
        }
320
        /* We can free the list here but the script needs to free the
321
         * Purple::Log 'objects' itself. */
322
        g_list_free(ll);
323
#line 324 "Log.c"
324
        PUTBACK;
325
        return;
326
    }
327
}
328

    
329

    
330
XS_EUPXS(XS_Purple__Log_get_size); /* prototype to pass -Wmissing-prototypes */
331
XS_EUPXS(XS_Purple__Log_get_size)
332
{
333
    dVAR; dXSARGS;
334
    if (items != 1)
335
       croak_xs_usage(cv,  "log");
336
    {
337
        Purple__Log        log = purple_perl_ref_object(ST(0))
338
;
339
        int        RETVAL;
340
        dXSTARG;
341

    
342
        RETVAL = purple_log_get_size(log);
343
        XSprePUSH; PUSHi((IV)RETVAL);
344
    }
345
    XSRETURN(1);
346
}
347

    
348

    
349
XS_EUPXS(XS_Purple__Log_get_system_logs); /* prototype to pass -Wmissing-prototypes */
350
XS_EUPXS(XS_Purple__Log_get_system_logs)
351
{
352
    dVAR; dXSARGS;
353
    if (items != 1)
354
       croak_xs_usage(cv,  "account");
355
    PERL_UNUSED_VAR(ax); /* -Wall */
356
    SP -= items;
357
    {
358
        Purple__Account        account = purple_perl_ref_object(ST(0))
359
;
360
#line 89 "Log.xs"
361
        GList *l, *ll;
362
#line 363 "Log.c"
363
#line 91 "Log.xs"
364
        ll = purple_log_get_system_logs(account);
365
        for (l = ll; l != NULL; l = l->next) {
366
                XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Log")));
367
        }
368
        /* We can free the list here but the script needs to free the
369
         * Purple::Log 'objects' itself. */
370
        g_list_free(ll);
371
#line 372 "Log.c"
372
        PUTBACK;
373
        return;
374
    }
375
}
376

    
377

    
378
XS_EUPXS(XS_Purple__Log_get_total_size); /* prototype to pass -Wmissing-prototypes */
379
XS_EUPXS(XS_Purple__Log_get_total_size)
380
{
381
    dVAR; dXSARGS;
382
    if (items != 3)
383
       croak_xs_usage(cv,  "type, name, account");
384
    {
385
        Purple__LogType        type = (Purple__LogType)SvIV(ST(0))
386
;
387
        const char *        name = (const char *)SvPV_nolen(ST(1))
388
;
389
        Purple__Account        account = purple_perl_ref_object(ST(2))
390
;
391
        int        RETVAL;
392
        dXSTARG;
393

    
394
        RETVAL = purple_log_get_total_size(type, name, account);
395
        XSprePUSH; PUSHi((IV)RETVAL);
396
    }
397
    XSRETURN(1);
398
}
399

    
400

    
401
XS_EUPXS(XS_Purple__Log_logger_free); /* prototype to pass -Wmissing-prototypes */
402
XS_EUPXS(XS_Purple__Log_logger_free)
403
{
404
    dVAR; dXSARGS;
405
    if (items != 1)
406
       croak_xs_usage(cv,  "logger");
407
    {
408
        Purple__Log__Logger        logger = purple_perl_ref_object(ST(0))
409
;
410

    
411
        purple_log_logger_free(logger);
412
    }
413
    XSRETURN_EMPTY;
414
}
415

    
416

    
417
XS_EUPXS(XS_Purple__Log_logger_get_options); /* prototype to pass -Wmissing-prototypes */
418
XS_EUPXS(XS_Purple__Log_logger_get_options)
419
{
420
    dVAR; dXSARGS;
421
    if (items != 0)
422
       croak_xs_usage(cv,  "");
423
    PERL_UNUSED_VAR(ax); /* -Wall */
424
    SP -= items;
425
    {
426
#line 112 "Log.xs"
427
        GList *l, *ll;
428
#line 429 "Log.c"
429
#line 114 "Log.xs"
430
        /* This might want to be massaged to a hash, since that's essentially
431
         * what the key/value list is emulating. */
432
        for (l = ll = purple_log_logger_get_options(); l != NULL; l = l->next) {
433
                XPUSHs(sv_2mortal(newSVpv(l->data, 0)));
434
        }
435
        g_list_free(ll);
436
#line 437 "Log.c"
437
        PUTBACK;
438
        return;
439
    }
440
}
441

    
442

    
443
XS_EUPXS(XS_Purple__Log_read); /* prototype to pass -Wmissing-prototypes */
444
XS_EUPXS(XS_Purple__Log_read)
445
{
446
    dVAR; dXSARGS;
447
    if (items != 2)
448
       croak_xs_usage(cv,  "log, flags");
449
    {
450
        Purple__Log        log = purple_perl_ref_object(ST(0))
451
;
452
        Purple__Log__ReadFlags        flags = purple_perl_ref_object(ST(1))
453
;
454
        gchar_own *        RETVAL;
455

    
456
        RETVAL = purple_log_read(log, flags);
457
        ST(0) = sv_newmortal();
458
        /* used when we can directly own the returned string. */
459
        /* we have to copy in the case when perl's malloc != gtk's malloc,
460
         * so best copy all the time. */
461
        sv_setpv ((SV*)ST(0), RETVAL);
462
        SvUTF8_on (ST(0));
463
        g_free (RETVAL);
464
    }
465
    XSRETURN(1);
466
}
467

    
468

    
469
XS_EUPXS(XS_Purple__Log_set_compare); /* prototype to pass -Wmissing-prototypes */
470
XS_EUPXS(XS_Purple__Log_set_compare)
471
{
472
    dVAR; dXSARGS;
473
    if (items != 2)
474
       croak_xs_usage(cv,  "y, z");
475
    {
476
        gconstpointer        y = INT2PTR(gconstpointer,SvIV(ST(0)))
477
;
478
        gconstpointer        z = INT2PTR(gconstpointer,SvIV(ST(1)))
479
;
480
        gint        RETVAL;
481
        dXSTARG;
482

    
483
        RETVAL = purple_log_set_compare(y, z);
484
        XSprePUSH; PUSHi((IV)RETVAL);
485
    }
486
    XSRETURN(1);
487
}
488

    
489
#ifdef __cplusplus
490
extern "C"
491
#endif
492
XS_EXTERNAL(boot_Purple__Log); /* prototype to pass -Wmissing-prototypes */
493
XS_EXTERNAL(boot_Purple__Log)
494
{
495
    dVAR; dXSARGS;
496
#if (PERL_REVISION == 5 && PERL_VERSION < 9)
497
    char* file = __FILE__;
498
#else
499
    const char* file = __FILE__;
500
#endif
501

    
502
    PERL_UNUSED_VAR(cv); /* -W */
503
    PERL_UNUSED_VAR(items); /* -W */
504
#ifdef XS_APIVERSION_BOOTCHECK
505
    XS_APIVERSION_BOOTCHECK;
506
#endif
507
    XS_VERSION_BOOTCHECK;
508

    
509
        (void)newXSproto_portable("Purple::Log::get_handle", XS_Purple__Log_get_handle, file, "");
510
        (void)newXSproto_portable("Purple::Log::common_sizer", XS_Purple__Log_common_sizer, file, "$");
511
        (void)newXSproto_portable("Purple::Log::common_writer", XS_Purple__Log_common_writer, file, "$$");
512
        (void)newXSproto_portable("Purple::Log::compare", XS_Purple__Log_compare, file, "$$");
513
        (void)newXSproto_portable("Purple::Log::free", XS_Purple__Log_free, file, "$");
514
        (void)newXSproto_portable("Purple::Log::get_log_dir", XS_Purple__Log_get_log_dir, file, "$$$");
515
        (void)newXSproto_portable("Purple::Log::get_log_sets", XS_Purple__Log_get_log_sets, file, "");
516
        (void)newXSproto_portable("Purple::Log::get_logs", XS_Purple__Log_get_logs, file, "$$$");
517
        (void)newXSproto_portable("Purple::Log::get_size", XS_Purple__Log_get_size, file, "$");
518
        (void)newXSproto_portable("Purple::Log::get_system_logs", XS_Purple__Log_get_system_logs, file, "$");
519
        (void)newXSproto_portable("Purple::Log::get_total_size", XS_Purple__Log_get_total_size, file, "$$$");
520
        (void)newXSproto_portable("Purple::Log::logger_free", XS_Purple__Log_logger_free, file, "$");
521
        (void)newXSproto_portable("Purple::Log::logger_get_options", XS_Purple__Log_logger_get_options, file, "");
522
        (void)newXSproto_portable("Purple::Log::read", XS_Purple__Log_read, file, "$$");
523
        (void)newXSproto_portable("Purple::Log::set_compare", XS_Purple__Log_set_compare, file, "$$");
524

    
525
    /* Initialisation Section */
526

    
527
#line 7 "Log.xs"
528
{
529
        HV *type_stash = gv_stashpv("Purple::Log::Type", 1);
530
        HV *flags_stash = gv_stashpv("Purple::Log::ReadFlags", 1);
531

    
532
        static const constiv *civ, type_const_iv[] = {
533
#define const_iv(name) {#name, (IV)PURPLE_LOG_##name}
534
                const_iv(IM),
535
                const_iv(CHAT),
536
                const_iv(SYSTEM),
537
        };
538
        static const constiv flags_const_iv[] = {
539
#undef const_iv
540
#define const_iv(name) {#name, (IV)PURPLE_LOG_READ_##name}
541
                const_iv(NO_NEWLINE),
542
        };
543

    
544
        for (civ = type_const_iv + sizeof(type_const_iv) / sizeof(type_const_iv[0]); civ-- > type_const_iv; )
545
                newCONSTSUB(type_stash, (char *)civ->name, newSViv(civ->iv));
546

    
547
        for (civ = flags_const_iv + sizeof(flags_const_iv) / sizeof(flags_const_iv[0]); civ-- > flags_const_iv; )
548
                newCONSTSUB(flags_stash, (char *)civ->name, newSViv(civ->iv));
549
}
550

    
551
#line 552 "Log.c"
552

    
553
    /* End of Initialisation Section */
554

    
555
#if (PERL_REVISION == 5 && PERL_VERSION >= 9)
556
  if (PL_unitcheckav)
557
       call_list(PL_scopestack_ix, PL_unitcheckav);
558
#endif
559
    XSRETURN_YES;
560
}
561