~ubuntu-branches/ubuntu/wily/weechat/wily

« back to all changes in this revision

Viewing changes to src/plugins/guile/weechat-guile-api.c

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bouthenot
  • Date: 2015-08-19 18:34:17 UTC
  • mfrom: (29.1.11 sid)
  • Revision ID: package-import@ubuntu.com-20150819183417-u026z5wo8knpcdqd
Tags: 1.3-1
* New upstream release
  - Remove backported patch to fix FTBFS with ruby 2.2
* Use dh-exec to build javascript plugin only on architectures which v8
  engine supports. Thanks to Mateusz Łukasik for the patch
  (Closes: #794584)

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
/* max strings created by an API function */
36
36
#define GUILE_MAX_STRINGS 64
37
37
 
38
 
#define API_FUNC(__init, __name, __ret)                                 \
 
38
#define API_INIT_FUNC(__init, __name, __ret)                            \
39
39
    char *guile_function_name = __name;                                 \
40
40
    char *guile_strings[GUILE_MAX_STRINGS];                             \
41
41
    int guile_num_strings = 0;                                          \
69
69
    }
70
70
#define API_RETURN_OK                                                   \
71
71
    API_FREE_STRINGS;                                                   \
72
 
    return SCM_BOOL_T;
 
72
    return SCM_BOOL_T
73
73
#define API_RETURN_ERROR                                                \
74
74
    API_FREE_STRINGS                                                    \
75
 
    return SCM_BOOL_F;
 
75
    return SCM_BOOL_F
76
76
#define API_RETURN_EMPTY                                                \
77
77
    API_FREE_STRINGS;                                                   \
78
 
    return scm_from_locale_string("");
 
78
    return scm_from_locale_string("")
79
79
#define API_RETURN_STRING(__string)                                     \
80
80
    API_FREE_STRINGS;                                                   \
81
81
    if (__string)                                                       \
92
92
    return scm_from_locale_string("")
93
93
#define API_RETURN_INT(__int)                                           \
94
94
    API_FREE_STRINGS;                                                   \
95
 
    return scm_from_int (__int);
 
95
    return scm_from_int (__int)
96
96
#define API_RETURN_LONG(__long)                                         \
97
97
    API_FREE_STRINGS;                                                   \
98
 
    return scm_from_long (__long);
 
98
    return scm_from_long (__long)
99
99
#define API_RETURN_OTHER(__scm)                                         \
100
100
    API_FREE_STRINGS;                                                   \
101
 
    return __scm;
 
101
    return __scm
 
102
 
102
103
#define API_DEF_FUNC(__name, __argc)                                    \
103
104
    scm_c_define_gsubr ("weechat:" #__name, __argc, 0, 0,               \
104
105
                        &weechat_guile_api_##__name);                   \
156
157
weechat_guile_api_register (SCM name, SCM author, SCM version, SCM license,
157
158
                            SCM description, SCM shutdown_func, SCM charset)
158
159
{
159
 
    API_FUNC(0, "register", API_RETURN_ERROR);
 
160
    API_INIT_FUNC(0, "register", API_RETURN_ERROR);
160
161
    if (guile_registered_script)
161
162
    {
162
163
        /* script already registered */
234
235
{
235
236
    const char *result;
236
237
 
237
 
    API_FUNC(1, "plugin_get_name", API_RETURN_EMPTY);
 
238
    API_INIT_FUNC(1, "plugin_get_name", API_RETURN_EMPTY);
238
239
    if (!scm_is_string (plugin))
239
240
        API_WRONG_ARGS(API_RETURN_EMPTY);
240
241
 
246
247
SCM
247
248
weechat_guile_api_charset_set (SCM charset)
248
249
{
249
 
    API_FUNC(1, "charset_set", API_RETURN_ERROR);
 
250
    API_INIT_FUNC(1, "charset_set", API_RETURN_ERROR);
250
251
    if (!scm_is_string (charset))
251
252
        API_WRONG_ARGS(API_RETURN_ERROR);
252
253
 
261
262
    char *result;
262
263
    SCM return_value;
263
264
 
264
 
    API_FUNC(1, "iconv_to_internal", API_RETURN_EMPTY);
 
265
    API_INIT_FUNC(1, "iconv_to_internal", API_RETURN_EMPTY);
265
266
    if (!scm_is_string (charset) || !scm_is_string (string))
266
267
        API_WRONG_ARGS(API_RETURN_EMPTY);
267
268
 
277
278
    char *result;
278
279
    SCM return_value;
279
280
 
280
 
    API_FUNC(1, "iconv_from_internal", API_RETURN_EMPTY);
 
281
    API_INIT_FUNC(1, "iconv_from_internal", API_RETURN_EMPTY);
281
282
    if (!scm_is_string (charset) || !scm_is_string (string))
282
283
        API_WRONG_ARGS(API_RETURN_EMPTY);
283
284
 
292
293
{
293
294
    const char *result;
294
295
 
295
 
    API_FUNC(1, "gettext", API_RETURN_EMPTY);
 
296
    API_INIT_FUNC(1, "gettext", API_RETURN_EMPTY);
296
297
    if (!scm_is_string (string))
297
298
        API_WRONG_ARGS(API_RETURN_EMPTY);
298
299
 
306
307
{
307
308
    const char *result;
308
309
 
309
 
    API_FUNC(1, "ngettext", API_RETURN_EMPTY);
 
310
    API_INIT_FUNC(1, "ngettext", API_RETURN_EMPTY);
310
311
    if (!scm_is_string (single) || !scm_is_string (plural)
311
312
        || !scm_is_integer (count))
312
313
        API_WRONG_ARGS(API_RETURN_EMPTY);
323
324
{
324
325
    int value;
325
326
 
326
 
    API_FUNC(1, "strlen_screen", API_RETURN_INT(0));
 
327
    API_INIT_FUNC(1, "strlen_screen", API_RETURN_INT(0));
327
328
    if (!scm_is_string (string))
328
329
        API_WRONG_ARGS(API_RETURN_INT(0));
329
330
 
337
338
{
338
339
    int value;
339
340
 
340
 
    API_FUNC(1, "string_match", API_RETURN_INT(0));
 
341
    API_INIT_FUNC(1, "string_match", API_RETURN_INT(0));
341
342
    if (!scm_is_string (string) || !scm_is_string (mask)
342
343
        || !scm_is_integer (case_sensitive))
343
344
        API_WRONG_ARGS(API_RETURN_INT(0));
354
355
{
355
356
    int value;
356
357
 
357
 
    API_FUNC(1, "string_has_highlight", API_RETURN_INT(0));
 
358
    API_INIT_FUNC(1, "string_has_highlight", API_RETURN_INT(0));
358
359
    if (!scm_is_string (string) || !scm_is_string (highlight_words))
359
360
        API_WRONG_ARGS(API_RETURN_INT(0));
360
361
 
369
370
{
370
371
    int value;
371
372
 
372
 
    API_FUNC(1, "string_has_highlight_regex", API_RETURN_INT(0));
 
373
    API_INIT_FUNC(1, "string_has_highlight_regex", API_RETURN_INT(0));
373
374
    if (!scm_is_string (string) || !scm_is_string (regex))
374
375
        API_WRONG_ARGS(API_RETURN_INT(0));
375
376
 
385
386
    char *result;
386
387
    SCM return_value;
387
388
 
388
 
    API_FUNC(1, "string_mask_to_regex", API_RETURN_EMPTY);
 
389
    API_INIT_FUNC(1, "string_mask_to_regex", API_RETURN_EMPTY);
389
390
    if (!scm_is_string (mask))
390
391
        API_WRONG_ARGS(API_RETURN_EMPTY);
391
392
 
400
401
    char *result;
401
402
    SCM return_value;
402
403
 
403
 
    API_FUNC(1, "string_remove_color", API_RETURN_EMPTY);
 
404
    API_INIT_FUNC(1, "string_remove_color", API_RETURN_EMPTY);
404
405
    if (!scm_is_string (string) || !scm_is_string (replacement))
405
406
        API_WRONG_ARGS(API_RETURN_EMPTY);
406
407
 
415
416
{
416
417
    int value;
417
418
 
418
 
    API_FUNC(1, "string_is_command_char", API_RETURN_INT(0));
 
419
    API_INIT_FUNC(1, "string_is_command_char", API_RETURN_INT(0));
419
420
    if (!scm_is_string (string))
420
421
        API_WRONG_ARGS(API_RETURN_INT(0));
421
422
 
429
430
{
430
431
    const char *result;
431
432
 
432
 
    API_FUNC(1, "string_input_for_buffer", API_RETURN_EMPTY);
 
433
    API_INIT_FUNC(1, "string_input_for_buffer", API_RETURN_EMPTY);
433
434
    if (!scm_is_string (string))
434
435
        API_WRONG_ARGS(API_RETURN_EMPTY);
435
436
 
446
447
    SCM return_value;
447
448
    struct t_hashtable *c_pointers, *c_extra_vars, *c_options;
448
449
 
449
 
    API_FUNC(1, "string_eval_expression", API_RETURN_EMPTY);
 
450
    API_INIT_FUNC(1, "string_eval_expression", API_RETURN_EMPTY);
450
451
    if (!scm_is_string (expr) || !scm_list_p (pointers)
451
452
        || !scm_list_p (extra_vars) || !scm_list_p (options))
452
453
        API_WRONG_ARGS(API_RETURN_EMPTY);
479
480
}
480
481
 
481
482
SCM
 
483
weechat_guile_api_string_eval_path_home (SCM path, SCM pointers,
 
484
                                         SCM extra_vars, SCM options)
 
485
{
 
486
    char *result;
 
487
    SCM return_value;
 
488
    struct t_hashtable *c_pointers, *c_extra_vars, *c_options;
 
489
 
 
490
    API_INIT_FUNC(1, "string_eval_path_home", API_RETURN_EMPTY);
 
491
    if (!scm_is_string (path) || !scm_list_p (pointers)
 
492
        || !scm_list_p (extra_vars) || !scm_list_p (options))
 
493
        API_WRONG_ARGS(API_RETURN_EMPTY);
 
494
 
 
495
    c_pointers = weechat_guile_alist_to_hashtable (
 
496
        pointers,
 
497
        WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
 
498
        WEECHAT_HASHTABLE_STRING,
 
499
        WEECHAT_HASHTABLE_POINTER);
 
500
    c_extra_vars = weechat_guile_alist_to_hashtable (
 
501
        extra_vars,
 
502
        WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
 
503
        WEECHAT_HASHTABLE_STRING,
 
504
        WEECHAT_HASHTABLE_STRING);
 
505
    c_options = weechat_guile_alist_to_hashtable (
 
506
        options,
 
507
        WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
 
508
        WEECHAT_HASHTABLE_STRING,
 
509
        WEECHAT_HASHTABLE_STRING);
 
510
 
 
511
    result = weechat_string_eval_path_home (API_SCM_TO_STRING(path),
 
512
                                            c_pointers, c_extra_vars,
 
513
                                            c_options);
 
514
 
 
515
    if (c_pointers)
 
516
        weechat_hashtable_free (c_pointers);
 
517
    if (c_extra_vars)
 
518
        weechat_hashtable_free (c_extra_vars);
 
519
    if (c_options)
 
520
        weechat_hashtable_free (c_options);
 
521
 
 
522
    API_RETURN_STRING_FREE(result);
 
523
}
 
524
 
 
525
SCM
482
526
weechat_guile_api_mkdir_home (SCM directory, SCM mode)
483
527
{
484
 
    API_FUNC(1, "mkdir_home", API_RETURN_ERROR);
 
528
    API_INIT_FUNC(1, "mkdir_home", API_RETURN_ERROR);
485
529
    if (!scm_is_string (directory) || !scm_is_integer (mode))
486
530
        API_WRONG_ARGS(API_RETURN_ERROR);
487
531
 
494
538
SCM
495
539
weechat_guile_api_mkdir (SCM directory, SCM mode)
496
540
{
497
 
    API_FUNC(1, "mkdir", API_RETURN_ERROR);
 
541
    API_INIT_FUNC(1, "mkdir", API_RETURN_ERROR);
498
542
    if (!scm_is_string (directory) || !scm_is_integer (mode))
499
543
        API_WRONG_ARGS(API_RETURN_ERROR);
500
544
 
507
551
SCM
508
552
weechat_guile_api_mkdir_parents (SCM directory, SCM mode)
509
553
{
510
 
    API_FUNC(1, "mkdir_parents", API_RETURN_ERROR);
 
554
    API_INIT_FUNC(1, "mkdir_parents", API_RETURN_ERROR);
511
555
    if (!scm_is_string (directory) || !scm_is_integer (mode))
512
556
        API_WRONG_ARGS(API_RETURN_ERROR);
513
557
 
522
566
{
523
567
    char *result;
524
568
 
525
 
    API_FUNC(1, "list_new", API_RETURN_EMPTY);
 
569
    API_INIT_FUNC(1, "list_new", API_RETURN_EMPTY);
526
570
 
527
571
    result = API_PTR2STR(weechat_list_new ());
528
572
 
534
578
{
535
579
    char *result;
536
580
 
537
 
    API_FUNC(1, "list_add", API_RETURN_EMPTY);
 
581
    API_INIT_FUNC(1, "list_add", API_RETURN_EMPTY);
538
582
    if (!scm_is_string (weelist) || !scm_is_string (data)
539
583
        || !scm_is_string (where) || !scm_is_string (user_data))
540
584
        API_WRONG_ARGS(API_RETURN_EMPTY);
552
596
{
553
597
    char *result;
554
598
 
555
 
    API_FUNC(1, "list_search", API_RETURN_EMPTY);
 
599
    API_INIT_FUNC(1, "list_search", API_RETURN_EMPTY);
556
600
    if (!scm_is_string (weelist) || !scm_is_string (data))
557
601
        API_WRONG_ARGS(API_RETURN_EMPTY);
558
602
 
567
611
{
568
612
    int pos;
569
613
 
570
 
    API_FUNC(1, "list_search_pos", API_RETURN_INT(-1));
 
614
    API_INIT_FUNC(1, "list_search_pos", API_RETURN_INT(-1));
571
615
    if (!scm_is_string (weelist) || !scm_is_string (data))
572
616
        API_WRONG_ARGS(API_RETURN_INT(-1));
573
617
 
582
626
{
583
627
    char *result;
584
628
 
585
 
    API_FUNC(1, "list_casesearch", API_RETURN_EMPTY);
 
629
    API_INIT_FUNC(1, "list_casesearch", API_RETURN_EMPTY);
586
630
    if (!scm_is_string (weelist) || !scm_is_string (data))
587
631
        API_WRONG_ARGS(API_RETURN_EMPTY);
588
632
 
597
641
{
598
642
    int pos;
599
643
 
600
 
    API_FUNC(1, "list_casesearch_pos", API_RETURN_INT(-1));
 
644
    API_INIT_FUNC(1, "list_casesearch_pos", API_RETURN_INT(-1));
601
645
    if (!scm_is_string (weelist) || !scm_is_string (data))
602
646
        API_WRONG_ARGS(API_RETURN_INT(-1));
603
647
 
612
656
{
613
657
    char *result;
614
658
 
615
 
    API_FUNC(1, "list_get", API_RETURN_EMPTY);
 
659
    API_INIT_FUNC(1, "list_get", API_RETURN_EMPTY);
616
660
    if (!scm_is_string (weelist) || !scm_is_integer (position))
617
661
        API_WRONG_ARGS(API_RETURN_EMPTY);
618
662
 
625
669
SCM
626
670
weechat_guile_api_list_set (SCM item, SCM new_value)
627
671
{
628
 
    API_FUNC(1, "list_set", API_RETURN_ERROR);
 
672
    API_INIT_FUNC(1, "list_set", API_RETURN_ERROR);
629
673
    if (!scm_is_string (item) || !scm_is_string (new_value))
630
674
        API_WRONG_ARGS(API_RETURN_ERROR);
631
675
 
640
684
{
641
685
    char *result;
642
686
 
643
 
    API_FUNC(1, "list_next", API_RETURN_EMPTY);
 
687
    API_INIT_FUNC(1, "list_next", API_RETURN_EMPTY);
644
688
    if (!scm_is_string (item))
645
689
        API_WRONG_ARGS(API_RETURN_EMPTY);
646
690
 
654
698
{
655
699
    char *result;
656
700
 
657
 
    API_FUNC(1, "list_prev", API_RETURN_EMPTY);
 
701
    API_INIT_FUNC(1, "list_prev", API_RETURN_EMPTY);
658
702
    if (!scm_is_string (item))
659
703
        API_WRONG_ARGS(API_RETURN_EMPTY);
660
704
 
668
712
{
669
713
    const char *result;
670
714
 
671
 
    API_FUNC(1, "list_string", API_RETURN_EMPTY);
 
715
    API_INIT_FUNC(1, "list_string", API_RETURN_EMPTY);
672
716
    if (!scm_is_string (item))
673
717
        API_WRONG_ARGS(API_RETURN_EMPTY);
674
718
 
682
726
{
683
727
    int size;
684
728
 
685
 
    API_FUNC(1, "list_size", API_RETURN_INT(0));
 
729
    API_INIT_FUNC(1, "list_size", API_RETURN_INT(0));
686
730
    if (!scm_is_string (weelist))
687
731
        API_WRONG_ARGS(API_RETURN_INT(0));
688
732
 
694
738
SCM
695
739
weechat_guile_api_list_remove (SCM weelist, SCM item)
696
740
{
697
 
    API_FUNC(1, "list_remove", API_RETURN_ERROR);
 
741
    API_INIT_FUNC(1, "list_remove", API_RETURN_ERROR);
698
742
    if (!scm_is_string (weelist) || !scm_is_string (item))
699
743
        API_WRONG_ARGS(API_RETURN_ERROR);
700
744
 
707
751
SCM
708
752
weechat_guile_api_list_remove_all (SCM weelist)
709
753
{
710
 
    API_FUNC(1, "list_remove_all", API_RETURN_ERROR);
 
754
    API_INIT_FUNC(1, "list_remove_all", API_RETURN_ERROR);
711
755
    if (!scm_is_string (weelist))
712
756
        API_WRONG_ARGS(API_RETURN_ERROR);
713
757
 
719
763
SCM
720
764
weechat_guile_api_list_free (SCM weelist)
721
765
{
722
 
    API_FUNC(1, "list_free", API_RETURN_ERROR);
 
766
    API_INIT_FUNC(1, "list_free", API_RETURN_ERROR);
723
767
    if (!scm_is_string (weelist))
724
768
        API_WRONG_ARGS(API_RETURN_ERROR);
725
769
 
771
815
    char *result;
772
816
    SCM return_value;
773
817
 
774
 
    API_FUNC(1, "config_new", API_RETURN_EMPTY);
 
818
    API_INIT_FUNC(1, "config_new", API_RETURN_EMPTY);
775
819
    if (!scm_is_string (name) || !scm_is_string (function)
776
820
        || !scm_is_string (data))
777
821
        API_WRONG_ARGS(API_RETURN_EMPTY);
1008
1052
    char *result;
1009
1053
    SCM return_value;
1010
1054
 
1011
 
    API_FUNC(1, "config_new_section", API_RETURN_EMPTY);
 
1055
    API_INIT_FUNC(1, "config_new_section", API_RETURN_EMPTY);
1012
1056
    if (!scm_list_p (args) || (scm_to_int (scm_length (args)) != 14))
1013
1057
        API_WRONG_ARGS(API_RETURN_EMPTY);
1014
1058
 
1067
1111
    char *result;
1068
1112
    SCM return_value;
1069
1113
 
1070
 
    API_FUNC(1, "config_search_section", API_RETURN_EMPTY);
 
1114
    API_INIT_FUNC(1, "config_search_section", API_RETURN_EMPTY);
1071
1115
    if (!scm_is_string (config_file) || !scm_is_string (section_name))
1072
1116
        API_WRONG_ARGS(API_RETURN_EMPTY);
1073
1117
 
1184
1228
    char *result;
1185
1229
    SCM return_value;
1186
1230
 
1187
 
    API_FUNC(1, "config_new_option", API_RETURN_EMPTY);
 
1231
    API_INIT_FUNC(1, "config_new_option", API_RETURN_EMPTY);
1188
1232
    if (!scm_list_p (args) || (scm_to_int (scm_length (args)) != 17))
1189
1233
        API_WRONG_ARGS(API_RETURN_EMPTY);
1190
1234
 
1251
1295
    char *result;
1252
1296
    SCM return_value;
1253
1297
 
1254
 
    API_FUNC(1, "config_search_option", API_RETURN_EMPTY);
 
1298
    API_INIT_FUNC(1, "config_search_option", API_RETURN_EMPTY);
1255
1299
    if (!scm_is_string (config_file) || !scm_is_string (section)
1256
1300
        || !scm_is_string (option_name))
1257
1301
        API_WRONG_ARGS(API_RETURN_EMPTY);
1268
1312
{
1269
1313
    int value;
1270
1314
 
1271
 
    API_FUNC(1, "config_string_to_boolean", API_RETURN_INT(0));
 
1315
    API_INIT_FUNC(1, "config_string_to_boolean", API_RETURN_INT(0));
1272
1316
    if (!scm_is_string (text))
1273
1317
        API_WRONG_ARGS(API_RETURN_INT(0));
1274
1318
 
1282
1326
{
1283
1327
    int rc;
1284
1328
 
1285
 
    API_FUNC(1, "config_option_reset", API_RETURN_INT(0));
 
1329
    API_INIT_FUNC(1, "config_option_reset", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
1286
1330
    if (!scm_is_string (option) || !scm_is_integer (run_callback))
1287
 
        API_WRONG_ARGS(API_RETURN_INT(0));
 
1331
        API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
1288
1332
 
1289
1333
    rc = weechat_config_option_reset (API_STR2PTR(API_SCM_TO_STRING(option)),
1290
1334
                                      scm_to_int (run_callback));
1298
1342
{
1299
1343
    int rc;
1300
1344
 
1301
 
    API_FUNC(1, "config_option_set", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
 
1345
    API_INIT_FUNC(1, "config_option_set", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
1302
1346
    if (!scm_is_string (option) || !scm_is_string (new_value)
1303
1347
        || !scm_is_integer (run_callback))
1304
1348
        API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
1315
1359
{
1316
1360
    int rc;
1317
1361
 
1318
 
    API_FUNC(1, "config_option_set_null", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
 
1362
    API_INIT_FUNC(1, "config_option_set_null", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
1319
1363
    if (!scm_is_string (option) || !scm_is_integer (run_callback))
1320
1364
        API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
1321
1365
 
1330
1374
{
1331
1375
    int rc;
1332
1376
 
1333
 
    API_FUNC(1, "config_option_unset", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
 
1377
    API_INIT_FUNC(1, "config_option_unset", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
1334
1378
    if (!scm_is_string (option))
1335
1379
        API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
1336
1380
 
1342
1386
SCM
1343
1387
weechat_guile_api_config_option_rename (SCM option, SCM new_name)
1344
1388
{
1345
 
    API_FUNC(1, "config_option_rename", API_RETURN_ERROR);
 
1389
    API_INIT_FUNC(1, "config_option_rename", API_RETURN_ERROR);
1346
1390
    if (!scm_is_string (option) || !scm_is_string (new_name))
1347
1391
        API_WRONG_ARGS(API_RETURN_ERROR);
1348
1392
 
1357
1401
{
1358
1402
    int value;
1359
1403
 
1360
 
    API_FUNC(1, "config_option_is_null", API_RETURN_INT(1));
 
1404
    API_INIT_FUNC(1, "config_option_is_null", API_RETURN_INT(1));
1361
1405
    if (!scm_is_string (option))
1362
1406
        API_WRONG_ARGS(API_RETURN_INT(1));
1363
1407
 
1371
1415
{
1372
1416
    int value;
1373
1417
 
1374
 
    API_FUNC(1, "config_option_default_is_null", API_RETURN_INT(1));
 
1418
    API_INIT_FUNC(1, "config_option_default_is_null", API_RETURN_INT(1));
1375
1419
    if (!scm_is_string (option))
1376
1420
        API_WRONG_ARGS(API_RETURN_INT(1));
1377
1421
 
1385
1429
{
1386
1430
    int value;
1387
1431
 
1388
 
    API_FUNC(1, "config_boolean", API_RETURN_INT(0));
 
1432
    API_INIT_FUNC(1, "config_boolean", API_RETURN_INT(0));
1389
1433
    if (!scm_is_string (option))
1390
1434
        API_WRONG_ARGS(API_RETURN_INT(0));
1391
1435
 
1399
1443
{
1400
1444
    int value;
1401
1445
 
1402
 
    API_FUNC(1, "config_boolean_default", API_RETURN_INT(0));
 
1446
    API_INIT_FUNC(1, "config_boolean_default", API_RETURN_INT(0));
1403
1447
    if (!scm_is_string (option))
1404
1448
        API_WRONG_ARGS(API_RETURN_INT(0));
1405
1449
 
1413
1457
{
1414
1458
    int value;
1415
1459
 
1416
 
    API_FUNC(1, "config_integer", API_RETURN_INT(0));
 
1460
    API_INIT_FUNC(1, "config_integer", API_RETURN_INT(0));
1417
1461
    if (!scm_is_string (option))
1418
1462
        API_WRONG_ARGS(API_RETURN_INT(0));
1419
1463
 
1427
1471
{
1428
1472
    int value;
1429
1473
 
1430
 
    API_FUNC(1, "config_integer_default", API_RETURN_INT(0));
 
1474
    API_INIT_FUNC(1, "config_integer_default", API_RETURN_INT(0));
1431
1475
    if (!scm_is_string (option))
1432
1476
        API_WRONG_ARGS(API_RETURN_INT(0));
1433
1477
 
1441
1485
{
1442
1486
    const char *result;
1443
1487
 
1444
 
    API_FUNC(1, "config_string", API_RETURN_EMPTY);
 
1488
    API_INIT_FUNC(1, "config_string", API_RETURN_EMPTY);
1445
1489
    if (!scm_is_string (option))
1446
1490
        API_WRONG_ARGS(API_RETURN_EMPTY);
1447
1491
 
1455
1499
{
1456
1500
    const char *result;
1457
1501
 
1458
 
    API_FUNC(1, "config_string_default", API_RETURN_EMPTY);
 
1502
    API_INIT_FUNC(1, "config_string_default", API_RETURN_EMPTY);
1459
1503
    if (!scm_is_string (option))
1460
1504
        API_WRONG_ARGS(API_RETURN_EMPTY);
1461
1505
 
1469
1513
{
1470
1514
    const char *result;
1471
1515
 
1472
 
    API_FUNC(1, "config_color", API_RETURN_INT(0));
 
1516
    API_INIT_FUNC(1, "config_color", API_RETURN_EMPTY);
1473
1517
    if (!scm_is_string (option))
1474
 
        API_WRONG_ARGS(API_RETURN_INT(0));
 
1518
        API_WRONG_ARGS(API_RETURN_EMPTY);
1475
1519
 
1476
1520
    result = weechat_config_color (API_STR2PTR(API_SCM_TO_STRING(option)));
1477
1521
 
1483
1527
{
1484
1528
    const char *result;
1485
1529
 
1486
 
    API_FUNC(1, "config_color_default", API_RETURN_INT(0));
 
1530
    API_INIT_FUNC(1, "config_color_default", API_RETURN_EMPTY);
1487
1531
    if (!scm_is_string (option))
1488
 
        API_WRONG_ARGS(API_RETURN_INT(0));
 
1532
        API_WRONG_ARGS(API_RETURN_EMPTY);
1489
1533
 
1490
1534
    result = weechat_config_color_default (API_STR2PTR(API_SCM_TO_STRING(option)));
1491
1535
 
1495
1539
SCM
1496
1540
weechat_guile_api_config_write_option (SCM config_file, SCM option)
1497
1541
{
1498
 
    API_FUNC(1, "config_write_option", API_RETURN_ERROR);
 
1542
    API_INIT_FUNC(1, "config_write_option", API_RETURN_ERROR);
1499
1543
    if (!scm_is_string (config_file) || !scm_is_string (option))
1500
1544
        API_WRONG_ARGS(API_RETURN_ERROR);
1501
1545
 
1509
1553
weechat_guile_api_config_write_line (SCM config_file,
1510
1554
                                    SCM option_name, SCM value)
1511
1555
{
1512
 
    API_FUNC(1, "config_write_line", API_RETURN_ERROR);
 
1556
    API_INIT_FUNC(1, "config_write_line", API_RETURN_ERROR);
1513
1557
    if (!scm_is_string (config_file) || !scm_is_string (option_name) || !scm_is_string (value))
1514
1558
        API_WRONG_ARGS(API_RETURN_ERROR);
1515
1559
 
1526
1570
{
1527
1571
    int rc;
1528
1572
 
1529
 
    API_FUNC(1, "config_write", API_RETURN_INT(-1));
 
1573
    API_INIT_FUNC(1, "config_write", API_RETURN_INT(WEECHAT_CONFIG_WRITE_ERROR));
1530
1574
    if (!scm_is_string (config_file))
1531
 
        API_WRONG_ARGS(API_RETURN_INT(-1));
 
1575
        API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_WRITE_ERROR));
1532
1576
 
1533
1577
    rc = weechat_config_write (API_STR2PTR(API_SCM_TO_STRING(config_file)));
1534
1578
 
1540
1584
{
1541
1585
    int rc;
1542
1586
 
1543
 
    API_FUNC(1, "config_read", API_RETURN_INT(-1));
 
1587
    API_INIT_FUNC(1, "config_read", API_RETURN_INT(WEECHAT_CONFIG_READ_FILE_NOT_FOUND));
1544
1588
    if (!scm_is_string (config_file))
1545
 
        API_WRONG_ARGS(API_RETURN_INT(-1));
 
1589
        API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_READ_FILE_NOT_FOUND));
1546
1590
 
1547
1591
    rc = weechat_config_read (API_STR2PTR(API_SCM_TO_STRING(config_file)));
1548
1592
 
1554
1598
{
1555
1599
    int rc;
1556
1600
 
1557
 
    API_FUNC(1, "config_reload", API_RETURN_INT(-1));
 
1601
    API_INIT_FUNC(1, "config_reload", API_RETURN_INT(WEECHAT_CONFIG_READ_FILE_NOT_FOUND));
1558
1602
    if (!scm_is_string (config_file))
1559
 
        API_WRONG_ARGS(API_RETURN_INT(-1));
 
1603
        API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_READ_FILE_NOT_FOUND));
1560
1604
 
1561
1605
    rc = weechat_config_reload (API_STR2PTR(API_SCM_TO_STRING(config_file)));
1562
1606
 
1566
1610
SCM
1567
1611
weechat_guile_api_config_option_free (SCM option)
1568
1612
{
1569
 
    API_FUNC(1, "config_option_free", API_RETURN_ERROR);
 
1613
    API_INIT_FUNC(1, "config_option_free", API_RETURN_ERROR);
1570
1614
    if (!scm_is_string (option))
1571
1615
        API_WRONG_ARGS(API_RETURN_ERROR);
1572
1616
 
1580
1624
SCM
1581
1625
weechat_guile_api_config_section_free_options (SCM section)
1582
1626
{
1583
 
    API_FUNC(1, "config_section_free_options", API_RETURN_ERROR);
 
1627
    API_INIT_FUNC(1, "config_section_free_options", API_RETURN_ERROR);
1584
1628
    if (!scm_is_string (section))
1585
1629
        API_WRONG_ARGS(API_RETURN_ERROR);
1586
1630
 
1594
1638
SCM
1595
1639
weechat_guile_api_config_section_free (SCM section)
1596
1640
{
1597
 
    API_FUNC(1, "config_section_free", API_RETURN_ERROR);
 
1641
    API_INIT_FUNC(1, "config_section_free", API_RETURN_ERROR);
1598
1642
    if (!scm_is_string (section))
1599
1643
        API_WRONG_ARGS(API_RETURN_ERROR);
1600
1644
 
1608
1652
SCM
1609
1653
weechat_guile_api_config_free (SCM config_file)
1610
1654
{
1611
 
    API_FUNC(1, "config_free", API_RETURN_ERROR);
 
1655
    API_INIT_FUNC(1, "config_free", API_RETURN_ERROR);
1612
1656
    if (!scm_is_string (config_file))
1613
1657
        API_WRONG_ARGS(API_RETURN_ERROR);
1614
1658
 
1625
1669
    char *result;
1626
1670
    SCM return_value;
1627
1671
 
1628
 
    API_FUNC(1, "config_get", API_RETURN_EMPTY);
 
1672
    API_INIT_FUNC(1, "config_get", API_RETURN_EMPTY);
1629
1673
    if (!scm_is_string (option))
1630
1674
        API_WRONG_ARGS(API_RETURN_EMPTY);
1631
1675
 
1639
1683
{
1640
1684
    const char *result;
1641
1685
 
1642
 
    API_FUNC(1, "config_get_plugin", API_RETURN_EMPTY);
 
1686
    API_INIT_FUNC(1, "config_get_plugin", API_RETURN_EMPTY);
1643
1687
    if (!scm_is_string (option))
1644
1688
        API_WRONG_ARGS(API_RETURN_EMPTY);
1645
1689
 
1655
1699
{
1656
1700
    int rc;
1657
1701
 
1658
 
    API_FUNC(1, "config_is_set_plugin", API_RETURN_INT(0));
 
1702
    API_INIT_FUNC(1, "config_is_set_plugin", API_RETURN_INT(0));
1659
1703
    if (!scm_is_string (option))
1660
1704
        API_WRONG_ARGS(API_RETURN_INT(0));
1661
1705
 
1671
1715
{
1672
1716
    int rc;
1673
1717
 
1674
 
    API_FUNC(1, "config_set_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
 
1718
    API_INIT_FUNC(1, "config_set_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
1675
1719
    if (!scm_is_string (option) || !scm_is_string (value))
1676
1720
        API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
1677
1721
 
1686
1730
SCM
1687
1731
weechat_guile_api_config_set_desc_plugin (SCM option, SCM description)
1688
1732
{
1689
 
    API_FUNC(1, "config_set_desc_plugin", API_RETURN_ERROR);
 
1733
    API_INIT_FUNC(1, "config_set_desc_plugin", API_RETURN_ERROR);
1690
1734
    if (!scm_is_string (option) || !scm_is_string (description))
1691
1735
        API_WRONG_ARGS(API_RETURN_ERROR);
1692
1736
 
1703
1747
{
1704
1748
    int rc;
1705
1749
 
1706
 
    API_FUNC(1, "config_unset_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
 
1750
    API_INIT_FUNC(1, "config_unset_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
1707
1751
    if (!scm_is_string (option))
1708
1752
        API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
1709
1753
 
1720
1764
    struct t_hashtable *c_keys;
1721
1765
    int num_keys;
1722
1766
 
1723
 
    API_FUNC(1, "key_bind", API_RETURN_INT(0));
 
1767
    API_INIT_FUNC(1, "key_bind", API_RETURN_INT(0));
1724
1768
    if (!scm_is_string (context) || !scm_list_p (keys))
1725
1769
        API_WRONG_ARGS(API_RETURN_INT(0));
1726
1770
 
1742
1786
{
1743
1787
    int num_keys;
1744
1788
 
1745
 
    API_FUNC(1, "key_unbind", API_RETURN_INT(0));
 
1789
    API_INIT_FUNC(1, "key_unbind", API_RETURN_INT(0));
1746
1790
    if (!scm_is_string (context) || !scm_is_string (key))
1747
1791
        API_WRONG_ARGS(API_RETURN_INT(0));
1748
1792
 
1757
1801
{
1758
1802
    const char *result;
1759
1803
 
1760
 
    API_FUNC(0, "prefix", API_RETURN_EMPTY);
 
1804
    API_INIT_FUNC(0, "prefix", API_RETURN_EMPTY);
1761
1805
    if (!scm_is_string (prefix))
1762
1806
        API_WRONG_ARGS(API_RETURN_EMPTY);
1763
1807
 
1771
1815
{
1772
1816
    const char *result;
1773
1817
 
1774
 
    API_FUNC(0, "color", API_RETURN_EMPTY);
 
1818
    API_INIT_FUNC(0, "color", API_RETURN_EMPTY);
1775
1819
    if (!scm_is_string (color))
1776
1820
        API_WRONG_ARGS(API_RETURN_EMPTY);
1777
1821
 
1783
1827
SCM
1784
1828
weechat_guile_api_print (SCM buffer, SCM message)
1785
1829
{
1786
 
    API_FUNC(0, "print", API_RETURN_ERROR);
 
1830
    API_INIT_FUNC(0, "print", API_RETURN_ERROR);
1787
1831
    if (!scm_is_string (buffer) || !scm_is_string (message))
1788
1832
        API_WRONG_ARGS(API_RETURN_ERROR);
1789
1833
 
1798
1842
SCM
1799
1843
weechat_guile_api_print_date_tags (SCM buffer, SCM date, SCM tags, SCM message)
1800
1844
{
1801
 
    API_FUNC(1, "print_date_tags", API_RETURN_ERROR);
 
1845
    API_INIT_FUNC(1, "print_date_tags", API_RETURN_ERROR);
1802
1846
    if (!scm_is_string (buffer) || !scm_is_integer (date)
1803
1847
        || !scm_is_string (tags) || !scm_is_string (message))
1804
1848
        API_WRONG_ARGS(API_RETURN_ERROR);
1816
1860
SCM
1817
1861
weechat_guile_api_print_y (SCM buffer, SCM y, SCM message)
1818
1862
{
1819
 
    API_FUNC(1, "print_y", API_RETURN_ERROR);
 
1863
    API_INIT_FUNC(1, "print_y", API_RETURN_ERROR);
1820
1864
    if (!scm_is_string (buffer) || !scm_is_integer (y)
1821
1865
        || !scm_is_string (message))
1822
1866
        API_WRONG_ARGS(API_RETURN_ERROR);
1833
1877
SCM
1834
1878
weechat_guile_api_log_print (SCM message)
1835
1879
{
1836
 
    API_FUNC(1, "log_print", API_RETURN_ERROR);
 
1880
    API_INIT_FUNC(1, "log_print", API_RETURN_ERROR);
1837
1881
    if (!scm_is_string (message))
1838
1882
        API_WRONG_ARGS(API_RETURN_ERROR);
1839
1883
 
1893
1937
    char *result;
1894
1938
    SCM return_value;
1895
1939
 
1896
 
    API_FUNC(1, "hook_command", API_RETURN_EMPTY);
 
1940
    API_INIT_FUNC(1, "hook_command", API_RETURN_EMPTY);
1897
1941
    if (!scm_is_string (command) || !scm_is_string (description)
1898
1942
        || !scm_is_string (args) || !scm_is_string (args_description)
1899
1943
        || !scm_is_string (completion) || !scm_is_string (function)
1900
1944
        || !scm_is_string (data))
1901
 
        API_WRONG_ARGS(API_RETURN_ERROR);
 
1945
        API_WRONG_ARGS(API_RETURN_EMPTY);
1902
1946
 
1903
1947
    result = API_PTR2STR(plugin_script_api_hook_command (weechat_guile_plugin,
1904
1948
                                                         guile_current_script,
1958
2002
    char *result;
1959
2003
    SCM return_value;
1960
2004
 
1961
 
    API_FUNC(1, "hook_command_run", API_RETURN_EMPTY);
 
2005
    API_INIT_FUNC(1, "hook_command_run", API_RETURN_EMPTY);
1962
2006
    if (!scm_is_string (command) || !scm_is_string (function)
1963
2007
        || !scm_is_string (data))
1964
2008
        API_WRONG_ARGS(API_RETURN_EMPTY);
2017
2061
    char *result;
2018
2062
    SCM return_value;
2019
2063
 
2020
 
    API_FUNC(1, "hook_timer", API_RETURN_EMPTY);
 
2064
    API_INIT_FUNC(1, "hook_timer", API_RETURN_EMPTY);
2021
2065
    if (!scm_is_integer (interval) || !scm_is_integer (align_second)
2022
2066
        || !scm_is_integer (max_calls) || !scm_is_string (function)
2023
2067
        || !scm_is_string (data))
2078
2122
    char *result;
2079
2123
    SCM return_value;
2080
2124
 
2081
 
    API_FUNC(1, "hook_fd", API_RETURN_EMPTY);
 
2125
    API_INIT_FUNC(1, "hook_fd", API_RETURN_EMPTY);
2082
2126
    if (!scm_is_integer (fd) || !scm_is_integer (read)
2083
2127
        || !scm_is_integer (write) || !scm_is_integer (exception)
2084
2128
        || !scm_is_string (function) || !scm_is_string (data))
2143
2187
    char *result;
2144
2188
    SCM return_value;
2145
2189
 
2146
 
    API_FUNC(1, "hook_process", API_RETURN_EMPTY);
 
2190
    API_INIT_FUNC(1, "hook_process", API_RETURN_EMPTY);
2147
2191
    if (!scm_is_string (command) || !scm_is_integer (timeout)
2148
2192
        || !scm_is_string (function) || !scm_is_string (data))
2149
2193
        API_WRONG_ARGS(API_RETURN_EMPTY);
2167
2211
    SCM return_value;
2168
2212
    struct t_hashtable *c_options;
2169
2213
 
2170
 
    API_FUNC(1, "hook_process_hashtable", API_RETURN_EMPTY);
 
2214
    API_INIT_FUNC(1, "hook_process_hashtable", API_RETURN_EMPTY);
2171
2215
    if (!scm_is_string (command) || !scm_list_p (options)
2172
2216
        || !scm_is_integer (timeout) || !scm_is_string (function)
2173
2217
        || !scm_is_string (data))
2246
2290
    char *result;
2247
2291
    SCM return_value;
2248
2292
 
2249
 
    API_FUNC(1, "hook_connect", API_RETURN_EMPTY);
 
2293
    API_INIT_FUNC(1, "hook_connect", API_RETURN_EMPTY);
2250
2294
    if (!scm_is_string (proxy) || !scm_is_string (address)
2251
2295
        || !scm_is_integer (port) || !scm_is_integer (ipv6)
2252
2296
        || !scm_is_integer (retry) || !scm_is_string (local_hostname)
2335
2379
    char *result;
2336
2380
    SCM return_value;
2337
2381
 
2338
 
    API_FUNC(1, "hook_print", API_RETURN_EMPTY);
 
2382
    API_INIT_FUNC(1, "hook_print", API_RETURN_EMPTY);
2339
2383
    if (!scm_is_string (buffer) || !scm_is_string (tags)
2340
2384
        || !scm_is_string (message) || !scm_is_integer (strip_colors)
2341
2385
        || !scm_is_string (function) || !scm_is_string (data))
2420
2464
    char *result;
2421
2465
    SCM return_value;
2422
2466
 
2423
 
    API_FUNC(1, "hook_signal", API_RETURN_EMPTY);
 
2467
    API_INIT_FUNC(1, "hook_signal", API_RETURN_EMPTY);
2424
2468
    if (!scm_is_string (signal) || !scm_is_string (function) || !scm_is_string (data))
2425
2469
        API_WRONG_ARGS(API_RETURN_EMPTY);
2426
2470
 
2440
2484
{
2441
2485
    int number, rc;
2442
2486
 
2443
 
    API_FUNC(1, "hook_signal_send", API_RETURN_INT(WEECHAT_RC_ERROR));
 
2487
    API_INIT_FUNC(1, "hook_signal_send", API_RETURN_INT(WEECHAT_RC_ERROR));
2444
2488
    if (!scm_is_string (signal) || !scm_is_string (type_data))
2445
2489
        API_WRONG_ARGS(API_RETURN_INT(WEECHAT_RC_ERROR));
2446
2490
 
2518
2562
    char *result;
2519
2563
    SCM return_value;
2520
2564
 
2521
 
    API_FUNC(1, "hook_hsignal", API_RETURN_EMPTY);
 
2565
    API_INIT_FUNC(1, "hook_hsignal", API_RETURN_EMPTY);
2522
2566
    if (!scm_is_string (signal) || !scm_is_string (function)
2523
2567
        || !scm_is_string (data))
2524
2568
        API_WRONG_ARGS(API_RETURN_EMPTY);
2539
2583
    struct t_hashtable *c_hashtable;
2540
2584
    int rc;
2541
2585
 
2542
 
    API_FUNC(1, "hook_hsignal_send", API_RETURN_INT(WEECHAT_RC_ERROR));
 
2586
    API_INIT_FUNC(1, "hook_hsignal_send", API_RETURN_INT(WEECHAT_RC_ERROR));
2543
2587
    if (!scm_is_string (signal) || !scm_list_p (hashtable))
2544
2588
        API_WRONG_ARGS(API_RETURN_INT(WEECHAT_RC_ERROR));
2545
2589
 
2597
2641
    char *result;
2598
2642
    SCM return_value;
2599
2643
 
2600
 
    API_FUNC(1, "hook_config", API_RETURN_EMPTY);
 
2644
    API_INIT_FUNC(1, "hook_config", API_RETURN_EMPTY);
2601
2645
    if (!scm_is_string (option) || !scm_is_string (function)
2602
2646
        || !scm_is_string (data))
2603
2647
        API_WRONG_ARGS(API_RETURN_EMPTY);
2661
2705
    char *result;
2662
2706
    SCM return_value;
2663
2707
 
2664
 
    API_FUNC(1, "hook_completion", API_RETURN_EMPTY);
 
2708
    API_INIT_FUNC(1, "hook_completion", API_RETURN_EMPTY);
2665
2709
    if (!scm_is_string (completion) || !scm_is_string (description)
2666
2710
        || !scm_is_string (function) || !scm_is_string (data))
2667
2711
        API_WRONG_ARGS(API_RETURN_EMPTY);
2678
2722
}
2679
2723
 
2680
2724
SCM
 
2725
weechat_guile_api_hook_completion_get_string (SCM completion, SCM property)
 
2726
{
 
2727
    const char *result;
 
2728
 
 
2729
    API_INIT_FUNC(1, "hook_completion_get_string", API_RETURN_EMPTY);
 
2730
    if (!scm_is_string (completion) || !scm_is_string (property))
 
2731
        API_WRONG_ARGS(API_RETURN_EMPTY);
 
2732
 
 
2733
    result = weechat_hook_completion_get_string (
 
2734
        API_STR2PTR(API_SCM_TO_STRING(completion)),
 
2735
        API_SCM_TO_STRING(property));
 
2736
 
 
2737
    API_RETURN_STRING(result);
 
2738
}
 
2739
 
 
2740
SCM
2681
2741
weechat_guile_api_hook_completion_list_add (SCM completion, SCM word,
2682
2742
                                            SCM nick_completion, SCM where)
2683
2743
{
2684
 
    API_FUNC(1, "hook_completion_list_add", API_RETURN_ERROR);
 
2744
    API_INIT_FUNC(1, "hook_completion_list_add", API_RETURN_ERROR);
2685
2745
    if (!scm_is_string (completion) || !scm_is_string (word)
2686
2746
        || !scm_is_integer (nick_completion) || !scm_is_string (where))
2687
2747
        API_WRONG_ARGS(API_RETURN_ERROR);
2726
2786
    char *result;
2727
2787
    SCM return_value;
2728
2788
 
2729
 
    API_FUNC(1, "hook_modifier", API_RETURN_EMPTY);
 
2789
    API_INIT_FUNC(1, "hook_modifier", API_RETURN_EMPTY);
2730
2790
    if (!scm_is_string (modifier) || !scm_is_string (function)
2731
2791
        || !scm_is_string (data))
2732
2792
        API_WRONG_ARGS(API_RETURN_EMPTY);
2748
2808
    char *result;
2749
2809
    SCM return_value;
2750
2810
 
2751
 
    API_FUNC(1, "hook_modifier_exec", API_RETURN_EMPTY);
 
2811
    API_INIT_FUNC(1, "hook_modifier_exec", API_RETURN_EMPTY);
2752
2812
    if (!scm_is_string (modifier) || !scm_is_string (modifier_data)
2753
2813
        || !scm_is_string (string))
2754
2814
        API_WRONG_ARGS(API_RETURN_EMPTY);
2792
2852
    char *result;
2793
2853
    SCM return_value;
2794
2854
 
2795
 
    API_FUNC(1, "hook_info", API_RETURN_EMPTY);
 
2855
    API_INIT_FUNC(1, "hook_info", API_RETURN_EMPTY);
2796
2856
    if (!scm_is_string (info_name) || !scm_is_string (description)
2797
2857
        || !scm_is_string (args_description) || !scm_is_string (function)
2798
2858
        || !scm_is_string (data))
2844
2904
    char *result;
2845
2905
    SCM return_value;
2846
2906
 
2847
 
    API_FUNC(1, "hook_info_hashtable", API_RETURN_EMPTY);
 
2907
    API_INIT_FUNC(1, "hook_info_hashtable", API_RETURN_EMPTY);
2848
2908
    if (!scm_is_string (info_name) || !scm_is_string (description)
2849
2909
        || !scm_is_string (args_description) || !scm_is_string (output_description)
2850
2910
        || !scm_is_string (function) || !scm_is_string (data))
2903
2963
    char *result;
2904
2964
    SCM return_value;
2905
2965
 
2906
 
    API_FUNC(1, "hook_infolist", API_RETURN_EMPTY);
 
2966
    API_INIT_FUNC(1, "hook_infolist", API_RETURN_EMPTY);
2907
2967
    if (!scm_is_string (infolist_name) || !scm_is_string (description)
2908
2968
        || !scm_is_string (pointer_description) || !scm_is_string (args_description)
2909
2969
        || !scm_is_string (function) || !scm_is_string (data))
2951
3011
    char *result;
2952
3012
    SCM return_value;
2953
3013
 
2954
 
    API_FUNC(1, "hook_focus", API_RETURN_EMPTY);
 
3014
    API_INIT_FUNC(1, "hook_focus", API_RETURN_EMPTY);
2955
3015
    if (!scm_is_string (area) || !scm_is_string (function)
2956
3016
        || !scm_is_string (data))
2957
3017
        API_WRONG_ARGS(API_RETURN_EMPTY);
2969
3029
SCM
2970
3030
weechat_guile_api_hook_set (SCM hook, SCM property, SCM value)
2971
3031
{
2972
 
    API_FUNC(1, "hook_set", API_RETURN_ERROR);
 
3032
    API_INIT_FUNC(1, "hook_set", API_RETURN_ERROR);
2973
3033
    if (!scm_is_string (hook) || !scm_is_string (property)
2974
3034
        || !scm_is_string (value))
2975
3035
        API_WRONG_ARGS(API_RETURN_ERROR);
2984
3044
SCM
2985
3045
weechat_guile_api_unhook (SCM hook)
2986
3046
{
2987
 
    API_FUNC(1, "unhook", API_RETURN_ERROR);
 
3047
    API_INIT_FUNC(1, "unhook", API_RETURN_ERROR);
2988
3048
    if (!scm_is_string (hook))
2989
3049
        API_WRONG_ARGS(API_RETURN_ERROR);
2990
3050
 
2998
3058
SCM
2999
3059
weechat_guile_api_unhook_all ()
3000
3060
{
3001
 
    API_FUNC(1, "unhook_all", API_RETURN_ERROR);
 
3061
    API_INIT_FUNC(1, "unhook_all", API_RETURN_ERROR);
3002
3062
 
3003
3063
    plugin_script_api_unhook_all (weechat_guile_plugin, guile_current_script);
3004
3064
 
3086
3146
    char *result;
3087
3147
    SCM return_value;
3088
3148
 
3089
 
    API_FUNC(1, "buffer_new", API_RETURN_EMPTY);
 
3149
    API_INIT_FUNC(1, "buffer_new", API_RETURN_EMPTY);
3090
3150
    if (!scm_is_string (name) || !scm_is_string (function_input)
3091
3151
        || !scm_is_string (data_input) || !scm_is_string (function_close)
3092
3152
        || !scm_is_string (data_close))
3111
3171
    char *result;
3112
3172
    SCM return_value;
3113
3173
 
3114
 
    API_FUNC(1, "buffer_search", API_RETURN_EMPTY);
 
3174
    API_INIT_FUNC(1, "buffer_search", API_RETURN_EMPTY);
3115
3175
    if (!scm_is_string (plugin) || !scm_is_string (name))
3116
3176
        API_WRONG_ARGS(API_RETURN_EMPTY);
3117
3177
 
3127
3187
    char *result;
3128
3188
    SCM return_value;
3129
3189
 
3130
 
    API_FUNC(1, "buffer_search_main", API_RETURN_EMPTY);
 
3190
    API_INIT_FUNC(1, "buffer_search_main", API_RETURN_EMPTY);
3131
3191
 
3132
3192
    result = API_PTR2STR(weechat_buffer_search_main ());
3133
3193
 
3140
3200
    char *result;
3141
3201
    SCM return_value;
3142
3202
 
3143
 
    API_FUNC(1, "current_buffer", API_RETURN_EMPTY);
 
3203
    API_INIT_FUNC(1, "current_buffer", API_RETURN_EMPTY);
3144
3204
 
3145
3205
    result = API_PTR2STR(weechat_current_buffer ());
3146
3206
 
3150
3210
SCM
3151
3211
weechat_guile_api_buffer_clear (SCM buffer)
3152
3212
{
3153
 
    API_FUNC(1, "buffer_clear", API_RETURN_ERROR);
 
3213
    API_INIT_FUNC(1, "buffer_clear", API_RETURN_ERROR);
3154
3214
    if (!scm_is_string (buffer))
3155
3215
        API_WRONG_ARGS(API_RETURN_ERROR);
3156
3216
 
3162
3222
SCM
3163
3223
weechat_guile_api_buffer_close (SCM buffer)
3164
3224
{
3165
 
    API_FUNC(1, "buffer_close", API_RETURN_ERROR);
 
3225
    API_INIT_FUNC(1, "buffer_close", API_RETURN_ERROR);
3166
3226
    if (!scm_is_string (buffer))
3167
3227
        API_WRONG_ARGS(API_RETURN_ERROR);
3168
3228
 
3176
3236
SCM
3177
3237
weechat_guile_api_buffer_merge (SCM buffer, SCM target_buffer)
3178
3238
{
3179
 
    API_FUNC(1, "buffer_merge", API_RETURN_ERROR);
 
3239
    API_INIT_FUNC(1, "buffer_merge", API_RETURN_ERROR);
3180
3240
    if (!scm_is_string (buffer) || !scm_is_string (target_buffer))
3181
3241
        API_WRONG_ARGS(API_RETURN_ERROR);
3182
3242
 
3189
3249
SCM
3190
3250
weechat_guile_api_buffer_unmerge (SCM buffer, SCM number)
3191
3251
{
3192
 
    API_FUNC(1, "buffer_unmerge", API_RETURN_ERROR);
 
3252
    API_INIT_FUNC(1, "buffer_unmerge", API_RETURN_ERROR);
3193
3253
    if (!scm_is_string (buffer) || !scm_is_integer (number))
3194
3254
        API_WRONG_ARGS(API_RETURN_ERROR);
3195
3255
 
3204
3264
{
3205
3265
    int value;
3206
3266
 
3207
 
    API_FUNC(1, "buffer_get_integer", API_RETURN_INT(-1));
 
3267
    API_INIT_FUNC(1, "buffer_get_integer", API_RETURN_INT(-1));
3208
3268
    if (!scm_is_string (buffer) || !scm_is_string (property))
3209
3269
        API_WRONG_ARGS(API_RETURN_INT(-1));
3210
3270
 
3219
3279
{
3220
3280
    const char *result;
3221
3281
 
3222
 
    API_FUNC(1, "buffer_get_string", API_RETURN_EMPTY);
 
3282
    API_INIT_FUNC(1, "buffer_get_string", API_RETURN_EMPTY);
3223
3283
    if (!scm_is_string (buffer) || !scm_is_string (property))
3224
3284
        API_WRONG_ARGS(API_RETURN_EMPTY);
3225
3285
 
3235
3295
    char *result;
3236
3296
    SCM return_value;
3237
3297
 
3238
 
    API_FUNC(1, "buffer_get_pointer", API_RETURN_EMPTY);
 
3298
    API_INIT_FUNC(1, "buffer_get_pointer", API_RETURN_EMPTY);
3239
3299
    if (!scm_is_string (buffer) || !scm_is_string (property))
3240
3300
        API_WRONG_ARGS(API_RETURN_EMPTY);
3241
3301
 
3248
3308
SCM
3249
3309
weechat_guile_api_buffer_set (SCM buffer, SCM property, SCM value)
3250
3310
{
3251
 
    API_FUNC(1, "buffer_set", API_RETURN_ERROR);
 
3311
    API_INIT_FUNC(1, "buffer_set", API_RETURN_ERROR);
3252
3312
    if (!scm_is_string (buffer) || !scm_is_string (property)
3253
3313
        || !scm_is_string (value))
3254
3314
        API_WRONG_ARGS(API_RETURN_ERROR);
3266
3326
    char *result;
3267
3327
    SCM return_value;
3268
3328
 
3269
 
    API_FUNC(1, "buffer_string_replace_local_var", API_RETURN_ERROR);
 
3329
    API_INIT_FUNC(1, "buffer_string_replace_local_var", API_RETURN_EMPTY);
3270
3330
    if (!scm_is_string (buffer) || !scm_is_string (string))
3271
 
        API_WRONG_ARGS(API_RETURN_ERROR);
 
3331
        API_WRONG_ARGS(API_RETURN_EMPTY);
3272
3332
 
3273
3333
    result = weechat_buffer_string_replace_local_var (API_STR2PTR(API_SCM_TO_STRING(buffer)),
3274
3334
                                                      API_SCM_TO_STRING(string));
3281
3341
{
3282
3342
    int value;
3283
3343
 
3284
 
    API_FUNC(1, "buffer_match_list", API_RETURN_INT(0));
 
3344
    API_INIT_FUNC(1, "buffer_match_list", API_RETURN_INT(0));
3285
3345
    if (!scm_is_string (buffer) || !scm_is_string (string))
3286
3346
        API_WRONG_ARGS(API_RETURN_INT(0));
3287
3347
 
3297
3357
    char *result;
3298
3358
    SCM return_value;
3299
3359
 
3300
 
    API_FUNC(1, "current_window", API_RETURN_EMPTY);
 
3360
    API_INIT_FUNC(1, "current_window", API_RETURN_EMPTY);
3301
3361
 
3302
3362
    result = API_PTR2STR(weechat_current_window ());
3303
3363
 
3310
3370
    char *result;
3311
3371
    SCM return_value;
3312
3372
 
3313
 
    API_FUNC(1, "window_search_with_buffer", API_RETURN_EMPTY);
 
3373
    API_INIT_FUNC(1, "window_search_with_buffer", API_RETURN_EMPTY);
3314
3374
    if (!scm_is_string (buffer))
3315
3375
        API_WRONG_ARGS(API_RETURN_EMPTY);
3316
3376
 
3324
3384
{
3325
3385
    int value;
3326
3386
 
3327
 
    API_FUNC(1, "window_get_integer", API_RETURN_INT(-1));
 
3387
    API_INIT_FUNC(1, "window_get_integer", API_RETURN_INT(-1));
3328
3388
    if (!scm_is_string (window) || !scm_is_string (property))
3329
3389
        API_WRONG_ARGS(API_RETURN_INT(-1));
3330
3390
 
3339
3399
{
3340
3400
    const char *result;
3341
3401
 
3342
 
    API_FUNC(1, "window_get_string", API_RETURN_EMPTY);
 
3402
    API_INIT_FUNC(1, "window_get_string", API_RETURN_EMPTY);
3343
3403
    if (!scm_is_string (window) || !scm_is_string (property))
3344
3404
        API_WRONG_ARGS(API_RETURN_EMPTY);
3345
3405
 
3355
3415
    char *result;
3356
3416
    SCM return_value;
3357
3417
 
3358
 
    API_FUNC(1, "window_get_pointer", API_RETURN_EMPTY);
 
3418
    API_INIT_FUNC(1, "window_get_pointer", API_RETURN_EMPTY);
3359
3419
    if (!scm_is_string (window) || !scm_is_string (property))
3360
3420
        API_WRONG_ARGS(API_RETURN_EMPTY);
3361
3421
 
3368
3428
SCM
3369
3429
weechat_guile_api_window_set_title (SCM title)
3370
3430
{
3371
 
    API_FUNC(1, "window_set_title", API_RETURN_ERROR);
 
3431
    API_INIT_FUNC(1, "window_set_title", API_RETURN_ERROR);
3372
3432
    if (!scm_is_string (title))
3373
3433
        API_WRONG_ARGS(API_RETURN_ERROR);
3374
3434
 
3384
3444
    char *result;
3385
3445
    SCM return_value;
3386
3446
 
3387
 
    API_FUNC(1, "nicklist_add_group", API_RETURN_EMPTY);
 
3447
    API_INIT_FUNC(1, "nicklist_add_group", API_RETURN_EMPTY);
3388
3448
    if (!scm_is_string (buffer) || !scm_is_string (parent_group)
3389
3449
        || !scm_is_string (name) || !scm_is_string (color)
3390
3450
        || !scm_is_integer (visible))
3405
3465
    char *result;
3406
3466
    SCM return_value;
3407
3467
 
3408
 
    API_FUNC(1, "nicklist_search_group", API_RETURN_EMPTY);
 
3468
    API_INIT_FUNC(1, "nicklist_search_group", API_RETURN_EMPTY);
3409
3469
    if (!scm_is_string (buffer) || !scm_is_string (from_group)
3410
3470
        || !scm_is_string (name))
3411
3471
        API_WRONG_ARGS(API_RETURN_EMPTY);
3425
3485
    char *result;
3426
3486
    SCM return_value;
3427
3487
 
3428
 
    API_FUNC(1, "nicklist_add_nick", API_RETURN_EMPTY);
 
3488
    API_INIT_FUNC(1, "nicklist_add_nick", API_RETURN_EMPTY);
3429
3489
    if (!scm_is_string (buffer) || !scm_is_string (group)
3430
3490
        || !scm_is_string (name) || !scm_is_string (color)
3431
3491
        || !scm_is_string (prefix) || !scm_is_string (prefix_color)
3449
3509
    char *result;
3450
3510
    SCM return_value;
3451
3511
 
3452
 
    API_FUNC(1, "nicklist_search_nick", API_RETURN_EMPTY);
 
3512
    API_INIT_FUNC(1, "nicklist_search_nick", API_RETURN_EMPTY);
3453
3513
    if (!scm_is_string (buffer) || !scm_is_string (from_group)
3454
3514
        || !scm_is_string (name))
3455
3515
        API_WRONG_ARGS(API_RETURN_EMPTY);
3464
3524
SCM
3465
3525
weechat_guile_api_nicklist_remove_group (SCM buffer, SCM group)
3466
3526
{
3467
 
    API_FUNC(1, "nicklist_remove_group", API_RETURN_ERROR);
 
3527
    API_INIT_FUNC(1, "nicklist_remove_group", API_RETURN_ERROR);
3468
3528
    if (!scm_is_string (buffer) || !scm_is_string (group))
3469
3529
        API_WRONG_ARGS(API_RETURN_ERROR);
3470
3530
 
3477
3537
SCM
3478
3538
weechat_guile_api_nicklist_remove_nick (SCM buffer, SCM nick)
3479
3539
{
3480
 
    API_FUNC(1, "nicklist_remove_nick", API_RETURN_ERROR);
 
3540
    API_INIT_FUNC(1, "nicklist_remove_nick", API_RETURN_ERROR);
3481
3541
    if (!scm_is_string (buffer) || !scm_is_string (nick))
3482
3542
        API_WRONG_ARGS(API_RETURN_ERROR);
3483
3543
 
3490
3550
SCM
3491
3551
weechat_guile_api_nicklist_remove_all (SCM buffer)
3492
3552
{
3493
 
    API_FUNC(1, "nicklist_remove_all", API_RETURN_ERROR);
 
3553
    API_INIT_FUNC(1, "nicklist_remove_all", API_RETURN_ERROR);
3494
3554
    if (!scm_is_string (buffer))
3495
3555
        API_WRONG_ARGS(API_RETURN_ERROR);
3496
3556
 
3505
3565
{
3506
3566
    int value;
3507
3567
 
3508
 
    API_FUNC(1, "nicklist_group_get_integer", API_RETURN_INT(-1));
 
3568
    API_INIT_FUNC(1, "nicklist_group_get_integer", API_RETURN_INT(-1));
3509
3569
    if (!scm_is_string (buffer) || !scm_is_string (group)
3510
3570
        || !scm_is_string (property))
3511
3571
        API_WRONG_ARGS(API_RETURN_INT(-1));
3523
3583
{
3524
3584
    const char *result;
3525
3585
 
3526
 
    API_FUNC(1, "nicklist_group_get_string", API_RETURN_EMPTY);
 
3586
    API_INIT_FUNC(1, "nicklist_group_get_string", API_RETURN_EMPTY);
3527
3587
    if (!scm_is_string (buffer) || !scm_is_string (group)
3528
3588
        || !scm_is_string (property))
3529
3589
        API_WRONG_ARGS(API_RETURN_EMPTY);
3542
3602
    char *result;
3543
3603
    SCM return_value;
3544
3604
 
3545
 
    API_FUNC(1, "nicklist_group_get_pointer", API_RETURN_EMPTY);
 
3605
    API_INIT_FUNC(1, "nicklist_group_get_pointer", API_RETURN_EMPTY);
3546
3606
    if (!scm_is_string (buffer) || !scm_is_string (group)
3547
3607
        || !scm_is_string (property))
3548
3608
        API_WRONG_ARGS(API_RETURN_EMPTY);
3558
3618
weechat_guile_api_nicklist_group_set (SCM buffer, SCM group, SCM property,
3559
3619
                                      SCM value)
3560
3620
{
3561
 
    API_FUNC(1, "nicklist_group_set", API_RETURN_ERROR);
 
3621
    API_INIT_FUNC(1, "nicklist_group_set", API_RETURN_ERROR);
3562
3622
    if (!scm_is_string (buffer) || !scm_is_string (group) || !scm_is_string (property) || !scm_is_string (value))
3563
3623
        API_WRONG_ARGS(API_RETURN_ERROR);
3564
3624
 
3575
3635
{
3576
3636
    int value;
3577
3637
 
3578
 
    API_FUNC(1, "nicklist_nick_get_integer", API_RETURN_INT(-1));
 
3638
    API_INIT_FUNC(1, "nicklist_nick_get_integer", API_RETURN_INT(-1));
3579
3639
    if (!scm_is_string (buffer) || !scm_is_string (nick)
3580
3640
        || !scm_is_string (property))
3581
3641
        API_WRONG_ARGS(API_RETURN_INT(-1));
3592
3652
{
3593
3653
    const char *result;
3594
3654
 
3595
 
    API_FUNC(1, "nicklist_nick_get_string", API_RETURN_EMPTY);
 
3655
    API_INIT_FUNC(1, "nicklist_nick_get_string", API_RETURN_EMPTY);
3596
3656
    if (!scm_is_string (buffer) || !scm_is_string (nick)
3597
3657
        || !scm_is_string (property))
3598
3658
        API_WRONG_ARGS(API_RETURN_EMPTY);
3610
3670
    char *result;
3611
3671
    SCM return_value;
3612
3672
 
3613
 
    API_FUNC(1, "nicklist_nick_get_pointer", API_RETURN_EMPTY);
 
3673
    API_INIT_FUNC(1, "nicklist_nick_get_pointer", API_RETURN_EMPTY);
3614
3674
    if (!scm_is_string (buffer) || !scm_is_string (nick)
3615
3675
        || !scm_is_string (property))
3616
3676
        API_WRONG_ARGS(API_RETURN_EMPTY);
3626
3686
weechat_guile_api_nicklist_nick_set (SCM buffer, SCM nick, SCM property,
3627
3687
                                     SCM value)
3628
3688
{
3629
 
    API_FUNC(1, "nicklist_nick_set", API_RETURN_ERROR);
 
3689
    API_INIT_FUNC(1, "nicklist_nick_set", API_RETURN_ERROR);
3630
3690
    if (!scm_is_string (buffer) || !scm_is_string (nick)
3631
3691
        || !scm_is_string (property) || !scm_is_string (value))
3632
3692
        API_WRONG_ARGS(API_RETURN_ERROR);
3645
3705
    char *result;
3646
3706
    SCM return_value;
3647
3707
 
3648
 
    API_FUNC(1, "bar_item_search", API_RETURN_EMPTY);
 
3708
    API_INIT_FUNC(1, "bar_item_search", API_RETURN_EMPTY);
3649
3709
    if (!scm_is_string (name))
3650
3710
        API_WRONG_ARGS(API_RETURN_EMPTY);
3651
3711
 
3719
3779
    char *result;
3720
3780
    SCM return_value;
3721
3781
 
3722
 
    API_FUNC(1, "bar_item_new", API_RETURN_EMPTY);
 
3782
    API_INIT_FUNC(1, "bar_item_new", API_RETURN_EMPTY);
3723
3783
    if (!scm_is_string (name) || !scm_is_string (function)
3724
3784
        || !scm_is_string (data))
3725
3785
        API_WRONG_ARGS(API_RETURN_EMPTY);
3737
3797
SCM
3738
3798
weechat_guile_api_bar_item_update (SCM name)
3739
3799
{
3740
 
    API_FUNC(1, "bar_item_update", API_RETURN_ERROR);
 
3800
    API_INIT_FUNC(1, "bar_item_update", API_RETURN_ERROR);
3741
3801
    if (!scm_is_string (name))
3742
3802
        API_WRONG_ARGS(API_RETURN_ERROR);
3743
3803
 
3749
3809
SCM
3750
3810
weechat_guile_api_bar_item_remove (SCM item)
3751
3811
{
3752
 
    API_FUNC(1, "bar_item_remove", API_RETURN_ERROR);
 
3812
    API_INIT_FUNC(1, "bar_item_remove", API_RETURN_ERROR);
3753
3813
    if (!scm_is_string (item))
3754
3814
        API_WRONG_ARGS(API_RETURN_ERROR);
3755
3815
 
3766
3826
    char *result;
3767
3827
    SCM return_value;
3768
3828
 
3769
 
    API_FUNC(1, "bar_search", API_RETURN_EMPTY);
 
3829
    API_INIT_FUNC(1, "bar_search", API_RETURN_EMPTY);
3770
3830
    if (!scm_is_string (name))
3771
3831
        API_WRONG_ARGS(API_RETURN_EMPTY);
3772
3832
 
3784
3844
    char *result;
3785
3845
    SCM return_value;
3786
3846
 
3787
 
    API_FUNC(1, "bar_new", API_RETURN_EMPTY);
 
3847
    API_INIT_FUNC(1, "bar_new", API_RETURN_EMPTY);
3788
3848
    if (!scm_list_p (args) || (scm_to_int (scm_length (args)) != 15))
3789
3849
        API_WRONG_ARGS(API_RETURN_EMPTY);
3790
3850
 
3836
3896
SCM
3837
3897
weechat_guile_api_bar_set (SCM bar, SCM property, SCM value)
3838
3898
{
3839
 
    API_FUNC(1, "bar_set", API_RETURN_ERROR);
 
3899
    int rc;
 
3900
 
 
3901
    API_INIT_FUNC(1, "bar_set", API_RETURN_INT(0));
3840
3902
    if (!scm_is_string (bar) || !scm_is_string (property)
3841
3903
        || !scm_is_string (value))
3842
 
        API_WRONG_ARGS(API_RETURN_ERROR);
3843
 
 
3844
 
    weechat_bar_set (API_STR2PTR(API_SCM_TO_STRING(bar)),
3845
 
                     API_SCM_TO_STRING(property),
3846
 
                     API_SCM_TO_STRING(value));
3847
 
 
3848
 
    API_RETURN_OK;
 
3904
        API_WRONG_ARGS(API_RETURN_INT(0));
 
3905
 
 
3906
    rc = weechat_bar_set (API_STR2PTR(API_SCM_TO_STRING(bar)),
 
3907
                          API_SCM_TO_STRING(property),
 
3908
                          API_SCM_TO_STRING(value));
 
3909
 
 
3910
    API_RETURN_INT(rc);
3849
3911
}
3850
3912
 
3851
3913
SCM
3852
3914
weechat_guile_api_bar_update (SCM name)
3853
3915
{
3854
 
    API_FUNC(1, "bar_update", API_RETURN_ERROR);
 
3916
    API_INIT_FUNC(1, "bar_update", API_RETURN_ERROR);
3855
3917
    if (!scm_is_string (name))
3856
3918
        API_WRONG_ARGS(API_RETURN_ERROR);
3857
3919
 
3863
3925
SCM
3864
3926
weechat_guile_api_bar_remove (SCM bar)
3865
3927
{
3866
 
    API_FUNC(1, "bar_remove", API_RETURN_ERROR);
 
3928
    API_INIT_FUNC(1, "bar_remove", API_RETURN_ERROR);
3867
3929
    if (!scm_is_string (bar))
3868
3930
        API_WRONG_ARGS(API_RETURN_ERROR);
3869
3931
 
3877
3939
{
3878
3940
    int rc;
3879
3941
 
3880
 
    API_FUNC(1, "command", API_RETURN_ERROR);
 
3942
    API_INIT_FUNC(1, "command", API_RETURN_INT(WEECHAT_RC_ERROR));
3881
3943
    if (!scm_is_string (buffer) || !scm_is_string (command))
3882
 
        API_WRONG_ARGS(API_RETURN_ERROR);
 
3944
        API_WRONG_ARGS(API_RETURN_INT(WEECHAT_RC_ERROR));
3883
3945
 
3884
3946
    rc = plugin_script_api_command (weechat_guile_plugin,
3885
3947
                                    guile_current_script,
3894
3956
{
3895
3957
    const char *result;
3896
3958
 
3897
 
    API_FUNC(1, "info_get", API_RETURN_EMPTY);
 
3959
    API_INIT_FUNC(1, "info_get", API_RETURN_EMPTY);
3898
3960
    if (!scm_is_string (info_name) || !scm_is_string (arguments))
3899
3961
        API_WRONG_ARGS(API_RETURN_EMPTY);
3900
3962
 
3910
3972
    struct t_hashtable *c_hashtable, *result_hashtable;
3911
3973
    SCM result_alist;
3912
3974
 
3913
 
    API_FUNC(1, "info_get_hashtable", API_RETURN_EMPTY);
 
3975
    API_INIT_FUNC(1, "info_get_hashtable", API_RETURN_EMPTY);
3914
3976
    if (!scm_is_string (info_name) || !scm_list_p (hash))
3915
3977
        API_WRONG_ARGS(API_RETURN_EMPTY);
3916
3978
 
3937
3999
    char *result;
3938
4000
    SCM return_value;
3939
4001
 
3940
 
    API_FUNC(1, "infolist_new", API_RETURN_EMPTY);
 
4002
    API_INIT_FUNC(1, "infolist_new", API_RETURN_EMPTY);
3941
4003
 
3942
4004
    result = API_PTR2STR(weechat_infolist_new ());
3943
4005
 
3950
4012
    char *result;
3951
4013
    SCM return_value;
3952
4014
 
3953
 
    API_FUNC(1, "infolist_new_item", API_RETURN_EMPTY);
 
4015
    API_INIT_FUNC(1, "infolist_new_item", API_RETURN_EMPTY);
3954
4016
    if (!scm_is_string (infolist))
3955
4017
        API_WRONG_ARGS(API_RETURN_EMPTY);
3956
4018
 
3960
4022
}
3961
4023
 
3962
4024
SCM
3963
 
weechat_guile_api_infolist_new_var_integer (SCM infolist, SCM name, SCM value)
 
4025
weechat_guile_api_infolist_new_var_integer (SCM item, SCM name, SCM value)
3964
4026
{
3965
4027
    char *result;
3966
4028
    SCM return_value;
3967
4029
 
3968
 
    API_FUNC(1, "infolist_new_var_integer", API_RETURN_EMPTY);
3969
 
    if (!scm_is_string (infolist) || !scm_is_string (name)
 
4030
    API_INIT_FUNC(1, "infolist_new_var_integer", API_RETURN_EMPTY);
 
4031
    if (!scm_is_string (item) || !scm_is_string (name)
3970
4032
        || !scm_is_integer (value))
3971
4033
        API_WRONG_ARGS(API_RETURN_EMPTY);
3972
4034
 
3973
 
    result = API_PTR2STR(weechat_infolist_new_var_integer (API_STR2PTR(API_SCM_TO_STRING(infolist)),
 
4035
    result = API_PTR2STR(weechat_infolist_new_var_integer (API_STR2PTR(API_SCM_TO_STRING(item)),
3974
4036
                                                           API_SCM_TO_STRING(name),
3975
4037
                                                           scm_to_int (value)));
3976
4038
 
3978
4040
}
3979
4041
 
3980
4042
SCM
3981
 
weechat_guile_api_infolist_new_var_string (SCM infolist, SCM name, SCM value)
 
4043
weechat_guile_api_infolist_new_var_string (SCM item, SCM name, SCM value)
3982
4044
{
3983
4045
    char *result;
3984
4046
    SCM return_value;
3985
4047
 
3986
 
    API_FUNC(1, "infolist_new_var_string", API_RETURN_EMPTY);
3987
 
    if (!scm_is_string (infolist) || !scm_is_string (name)
 
4048
    API_INIT_FUNC(1, "infolist_new_var_string", API_RETURN_EMPTY);
 
4049
    if (!scm_is_string (item) || !scm_is_string (name)
3988
4050
        || !scm_is_string (value))
3989
4051
        API_WRONG_ARGS(API_RETURN_EMPTY);
3990
4052
 
3991
 
    result = API_PTR2STR(weechat_infolist_new_var_string (API_STR2PTR(API_SCM_TO_STRING(infolist)),
 
4053
    result = API_PTR2STR(weechat_infolist_new_var_string (API_STR2PTR(API_SCM_TO_STRING(item)),
3992
4054
                                                          API_SCM_TO_STRING(name),
3993
4055
                                                          API_SCM_TO_STRING(value)));
3994
4056
 
3996
4058
}
3997
4059
 
3998
4060
SCM
3999
 
weechat_guile_api_infolist_new_var_pointer (SCM infolist, SCM name, SCM value)
 
4061
weechat_guile_api_infolist_new_var_pointer (SCM item, SCM name, SCM value)
4000
4062
{
4001
4063
    char *result;
4002
4064
    SCM return_value;
4003
4065
 
4004
 
    API_FUNC(1, "infolist_new_var_pointer", API_RETURN_EMPTY);
4005
 
    if (!scm_is_string (infolist) || !scm_is_string (name)
 
4066
    API_INIT_FUNC(1, "infolist_new_var_pointer", API_RETURN_EMPTY);
 
4067
    if (!scm_is_string (item) || !scm_is_string (name)
4006
4068
        || !scm_is_string (value))
4007
4069
        API_WRONG_ARGS(API_RETURN_EMPTY);
4008
4070
 
4009
 
    result = API_PTR2STR(weechat_infolist_new_var_pointer (API_STR2PTR(API_SCM_TO_STRING(infolist)),
 
4071
    result = API_PTR2STR(weechat_infolist_new_var_pointer (API_STR2PTR(API_SCM_TO_STRING(item)),
4010
4072
                                                           API_SCM_TO_STRING(name),
4011
4073
                                                           API_STR2PTR(API_SCM_TO_STRING(value))));
4012
4074
 
4014
4076
}
4015
4077
 
4016
4078
SCM
4017
 
weechat_guile_api_infolist_new_var_time (SCM infolist, SCM name, SCM value)
 
4079
weechat_guile_api_infolist_new_var_time (SCM item, SCM name, SCM value)
4018
4080
{
4019
4081
    char *result;
4020
4082
    SCM return_value;
4021
4083
 
4022
 
    API_FUNC(1, "infolist_new_var_time", API_RETURN_EMPTY);
4023
 
    if (!scm_is_string (infolist) || !scm_is_string (name)
 
4084
    API_INIT_FUNC(1, "infolist_new_var_time", API_RETURN_EMPTY);
 
4085
    if (!scm_is_string (item) || !scm_is_string (name)
4024
4086
        || !scm_is_integer (value))
4025
4087
        API_WRONG_ARGS(API_RETURN_EMPTY);
4026
4088
 
4027
 
    result = API_PTR2STR(weechat_infolist_new_var_time (API_STR2PTR(API_SCM_TO_STRING(infolist)),
 
4089
    result = API_PTR2STR(weechat_infolist_new_var_time (API_STR2PTR(API_SCM_TO_STRING(item)),
4028
4090
                                                        API_SCM_TO_STRING(name),
4029
4091
                                                        scm_to_int (value)));
4030
4092
 
4032
4094
}
4033
4095
 
4034
4096
SCM
 
4097
weechat_guile_api_infolist_search_var (SCM infolist, SCM name)
 
4098
{
 
4099
    char *result;
 
4100
    SCM return_value;
 
4101
 
 
4102
    API_INIT_FUNC(1, "infolist_search_var", API_RETURN_EMPTY);
 
4103
    if (!scm_is_string (infolist) || !scm_is_string (name))
 
4104
        API_WRONG_ARGS(API_RETURN_EMPTY);
 
4105
 
 
4106
    result = API_PTR2STR(weechat_infolist_search_var (API_STR2PTR(API_SCM_TO_STRING(infolist)),
 
4107
                                                      API_SCM_TO_STRING(name)));
 
4108
 
 
4109
    API_RETURN_STRING_FREE(result);
 
4110
}
 
4111
 
 
4112
SCM
4035
4113
weechat_guile_api_infolist_get (SCM name, SCM pointer, SCM arguments)
4036
4114
{
4037
4115
    char *result;
4038
4116
    SCM return_value;
4039
4117
 
4040
 
    API_FUNC(1, "infolist_get", API_RETURN_EMPTY);
 
4118
    API_INIT_FUNC(1, "infolist_get", API_RETURN_EMPTY);
4041
4119
    if (!scm_is_string (name) || !scm_is_string (pointer)
4042
4120
        || !scm_is_string (arguments))
4043
4121
        API_WRONG_ARGS(API_RETURN_EMPTY);
4054
4132
{
4055
4133
    int value;
4056
4134
 
4057
 
    API_FUNC(1, "infolist_next", API_RETURN_INT(0));
 
4135
    API_INIT_FUNC(1, "infolist_next", API_RETURN_INT(0));
4058
4136
    if (!scm_is_string (infolist))
4059
4137
        API_WRONG_ARGS(API_RETURN_INT(0));
4060
4138
 
4068
4146
{
4069
4147
    int value;
4070
4148
 
4071
 
    API_FUNC(1, "infolist_prev", API_RETURN_INT(0));
 
4149
    API_INIT_FUNC(1, "infolist_prev", API_RETURN_INT(0));
4072
4150
    if (!scm_is_string (infolist))
4073
4151
        API_WRONG_ARGS(API_RETURN_INT(0));
4074
4152
 
4080
4158
SCM
4081
4159
weechat_guile_api_infolist_reset_item_cursor (SCM infolist)
4082
4160
{
4083
 
    API_FUNC(1, "infolist_reset_item_cursor", API_RETURN_ERROR);
 
4161
    API_INIT_FUNC(1, "infolist_reset_item_cursor", API_RETURN_ERROR);
4084
4162
    if (!scm_is_string (infolist))
4085
4163
        API_WRONG_ARGS(API_RETURN_ERROR);
4086
4164
 
4094
4172
{
4095
4173
    const char *result;
4096
4174
 
4097
 
    API_FUNC(1, "infolist_fields", API_RETURN_EMPTY);
 
4175
    API_INIT_FUNC(1, "infolist_fields", API_RETURN_EMPTY);
4098
4176
    if (!scm_is_string (infolist))
4099
4177
        API_WRONG_ARGS(API_RETURN_EMPTY);
4100
4178
 
4108
4186
{
4109
4187
    int value;
4110
4188
 
4111
 
    API_FUNC(1, "infolist_integer", API_RETURN_INT(0));
 
4189
    API_INIT_FUNC(1, "infolist_integer", API_RETURN_INT(0));
4112
4190
    if (!scm_is_string (infolist) || !scm_is_string (variable))
4113
4191
        API_WRONG_ARGS(API_RETURN_INT(0));
4114
4192
 
4123
4201
{
4124
4202
    const char *result;
4125
4203
 
4126
 
    API_FUNC(1, "infolist_string", API_RETURN_EMPTY);
 
4204
    API_INIT_FUNC(1, "infolist_string", API_RETURN_EMPTY);
4127
4205
    if (!scm_is_string (infolist) || !scm_is_string (variable))
4128
4206
        API_WRONG_ARGS(API_RETURN_EMPTY);
4129
4207
 
4139
4217
    char *result;
4140
4218
    SCM return_value;
4141
4219
 
4142
 
    API_FUNC(1, "infolist_pointer", API_RETURN_EMPTY);
 
4220
    API_INIT_FUNC(1, "infolist_pointer", API_RETURN_EMPTY);
4143
4221
    if (!scm_is_string (infolist) || !scm_is_string (variable))
4144
4222
        API_WRONG_ARGS(API_RETURN_EMPTY);
4145
4223
 
4157
4235
    struct tm *date_tmp;
4158
4236
    SCM return_value;
4159
4237
 
4160
 
    API_FUNC(1, "infolist_time", API_RETURN_EMPTY);
 
4238
    API_INIT_FUNC(1, "infolist_time", API_RETURN_EMPTY);
4161
4239
    if (!scm_is_string (infolist) || !scm_is_string (variable))
4162
4240
        API_WRONG_ARGS(API_RETURN_EMPTY);
4163
4241
 
4175
4253
SCM
4176
4254
weechat_guile_api_infolist_free (SCM infolist)
4177
4255
{
4178
 
    API_FUNC(1, "infolist_free", API_RETURN_ERROR);
 
4256
    API_INIT_FUNC(1, "infolist_free", API_RETURN_ERROR);
4179
4257
    if (!scm_is_string (infolist))
4180
4258
        API_WRONG_ARGS(API_RETURN_ERROR);
4181
4259
 
4190
4268
    char *result;
4191
4269
    SCM return_value;
4192
4270
 
4193
 
    API_FUNC(1, "hdata_get", API_RETURN_EMPTY);
 
4271
    API_INIT_FUNC(1, "hdata_get", API_RETURN_EMPTY);
4194
4272
    if (!scm_is_string (name))
4195
4273
        API_WRONG_ARGS(API_RETURN_EMPTY);
4196
4274
 
4204
4282
{
4205
4283
    int value;
4206
4284
 
4207
 
    API_FUNC(1, "hdata_get_var_offset", API_RETURN_INT(0));
 
4285
    API_INIT_FUNC(1, "hdata_get_var_offset", API_RETURN_INT(0));
4208
4286
    if (!scm_is_string (hdata) || !scm_is_string (name))
4209
4287
        API_WRONG_ARGS(API_RETURN_INT(0));
4210
4288
 
4219
4297
{
4220
4298
    const char *result;
4221
4299
 
4222
 
    API_FUNC(1, "hdata_get_var_type_string", API_RETURN_EMPTY);
 
4300
    API_INIT_FUNC(1, "hdata_get_var_type_string", API_RETURN_EMPTY);
4223
4301
    if (!scm_is_string (hdata) || !scm_is_string (name))
4224
4302
        API_WRONG_ARGS(API_RETURN_EMPTY);
4225
4303
 
4234
4312
{
4235
4313
    int value;
4236
4314
 
4237
 
    API_FUNC(1, "hdata_get_var_array_size", API_RETURN_INT(-1));
 
4315
    API_INIT_FUNC(1, "hdata_get_var_array_size", API_RETURN_INT(-1));
4238
4316
    if (!scm_is_string (hdata) || !scm_is_string (pointer)
4239
4317
        || !scm_is_string (name))
4240
4318
        API_WRONG_ARGS(API_RETURN_INT(-1));
4252
4330
{
4253
4331
    const char *result;
4254
4332
 
4255
 
    API_FUNC(1, "hdata_get_var_array_size_string", API_RETURN_EMPTY);
 
4333
    API_INIT_FUNC(1, "hdata_get_var_array_size_string", API_RETURN_EMPTY);
4256
4334
    if (!scm_is_string (hdata) || !scm_is_string (pointer)
4257
4335
        || !scm_is_string (name))
4258
4336
        API_WRONG_ARGS(API_RETURN_EMPTY);
4269
4347
{
4270
4348
    const char *result;
4271
4349
 
4272
 
    API_FUNC(1, "hdata_get_var_hdata", API_RETURN_EMPTY);
 
4350
    API_INIT_FUNC(1, "hdata_get_var_hdata", API_RETURN_EMPTY);
4273
4351
    if (!scm_is_string (hdata) || !scm_is_string (name))
4274
4352
        API_WRONG_ARGS(API_RETURN_EMPTY);
4275
4353
 
4285
4363
    char *result;
4286
4364
    SCM return_value;
4287
4365
 
4288
 
    API_FUNC(1, "hdata_get_list", API_RETURN_EMPTY);
 
4366
    API_INIT_FUNC(1, "hdata_get_list", API_RETURN_EMPTY);
4289
4367
    if (!scm_is_string (hdata) || !scm_is_string (name))
4290
4368
        API_WRONG_ARGS(API_RETURN_EMPTY);
4291
4369
 
4300
4378
{
4301
4379
    int value;
4302
4380
 
4303
 
    API_FUNC(1, "hdata_check_pointer", API_RETURN_INT(0));
 
4381
    API_INIT_FUNC(1, "hdata_check_pointer", API_RETURN_INT(0));
4304
4382
    if (!scm_is_string (hdata) || !scm_is_string (list)
4305
4383
        || !scm_is_string (pointer))
4306
4384
        API_WRONG_ARGS(API_RETURN_INT(0));
4318
4396
    char *result;
4319
4397
    SCM return_value;
4320
4398
 
4321
 
    API_FUNC(1, "hdata_move", API_RETURN_EMPTY);
 
4399
    API_INIT_FUNC(1, "hdata_move", API_RETURN_EMPTY);
4322
4400
    if (!scm_is_string (hdata) || !scm_is_string (pointer)
4323
4401
        || !scm_is_integer (count))
4324
4402
        API_WRONG_ARGS(API_RETURN_EMPTY);
4336
4414
    char *result;
4337
4415
    SCM return_value;
4338
4416
 
4339
 
    API_FUNC(1, "hdata_search", API_RETURN_EMPTY);
 
4417
    API_INIT_FUNC(1, "hdata_search", API_RETURN_EMPTY);
4340
4418
    if (!scm_is_string (hdata) || !scm_is_string (pointer)
4341
4419
        || !scm_is_string (search) || !scm_is_integer (move))
4342
4420
        API_WRONG_ARGS(API_RETURN_EMPTY);
4354
4432
{
4355
4433
    int value;
4356
4434
 
4357
 
    API_FUNC(1, "hdata_char", API_RETURN_INT(0));
 
4435
    API_INIT_FUNC(1, "hdata_char", API_RETURN_INT(0));
4358
4436
    if (!scm_is_string (hdata) || !scm_is_string (pointer)
4359
4437
        || !scm_is_string (name))
4360
4438
        API_WRONG_ARGS(API_RETURN_INT(0));
4371
4449
{
4372
4450
    int value;
4373
4451
 
4374
 
    API_FUNC(1, "hdata_integer", API_RETURN_INT(0));
 
4452
    API_INIT_FUNC(1, "hdata_integer", API_RETURN_INT(0));
4375
4453
    if (!scm_is_string (hdata) || !scm_is_string (pointer)
4376
4454
        || !scm_is_string (name))
4377
4455
        API_WRONG_ARGS(API_RETURN_INT(0));
4388
4466
{
4389
4467
    long value;
4390
4468
 
4391
 
    API_FUNC(1, "hdata_long", API_RETURN_LONG(0));
 
4469
    API_INIT_FUNC(1, "hdata_long", API_RETURN_LONG(0));
4392
4470
    if (!scm_is_string (hdata) || !scm_is_string (pointer)
4393
4471
        || !scm_is_string (name))
4394
4472
        API_WRONG_ARGS(API_RETURN_LONG(0));
4405
4483
{
4406
4484
    const char *result;
4407
4485
 
4408
 
    API_FUNC(1, "hdata_string", API_RETURN_EMPTY);
 
4486
    API_INIT_FUNC(1, "hdata_string", API_RETURN_EMPTY);
4409
4487
    if (!scm_is_string (hdata) || !scm_is_string (pointer)
4410
4488
        || !scm_is_string (name))
4411
4489
        API_WRONG_ARGS(API_RETURN_EMPTY);
4423
4501
    char *result;
4424
4502
    SCM return_value;
4425
4503
 
4426
 
    API_FUNC(1, "hdata_pointer", API_RETURN_EMPTY);
 
4504
    API_INIT_FUNC(1, "hdata_pointer", API_RETURN_EMPTY);
4427
4505
    if (!scm_is_string (hdata) || !scm_is_string (pointer)
4428
4506
        || !scm_is_string (name))
4429
4507
        API_WRONG_ARGS(API_RETURN_EMPTY);
4438
4516
SCM
4439
4517
weechat_guile_api_hdata_time (SCM hdata, SCM pointer, SCM name)
4440
4518
{
4441
 
    char timebuffer[64], *result;
4442
4519
    time_t time;
4443
 
    SCM return_value;
4444
4520
 
4445
 
    API_FUNC(1, "hdata_time", API_RETURN_EMPTY);
 
4521
    API_INIT_FUNC(1, "hdata_time", API_RETURN_LONG(0));
4446
4522
    if (!scm_is_string (hdata) || !scm_is_string (pointer) || !scm_is_string (name))
4447
 
        API_WRONG_ARGS(API_RETURN_EMPTY);
 
4523
        API_WRONG_ARGS(API_RETURN_LONG(0));
4448
4524
 
4449
 
    timebuffer[0] = '\0';
4450
4525
    time = weechat_hdata_time (API_STR2PTR(API_SCM_TO_STRING(hdata)),
4451
4526
                               API_STR2PTR(API_SCM_TO_STRING(pointer)),
4452
4527
                               API_SCM_TO_STRING(name));
4453
 
    snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)time);
4454
 
    result = strdup (timebuffer);
4455
4528
 
4456
 
    API_RETURN_STRING_FREE(result);
 
4529
    API_RETURN_LONG(time);
4457
4530
}
4458
4531
 
4459
4532
SCM
4461
4534
{
4462
4535
    SCM result_alist;
4463
4536
 
4464
 
    API_FUNC(1, "hdata_hashtable", API_RETURN_EMPTY);
 
4537
    API_INIT_FUNC(1, "hdata_hashtable", API_RETURN_EMPTY);
4465
4538
    if (!scm_is_string (hdata) || !scm_is_string (pointer)
4466
4539
        || !scm_is_string (name))
4467
4540
        API_WRONG_ARGS(API_RETURN_EMPTY);
4480
4553
    struct t_hashtable *c_hashtable;
4481
4554
    int value;
4482
4555
 
4483
 
    API_FUNC(1, "hdata_update", API_RETURN_INT(0));
 
4556
    API_INIT_FUNC(1, "hdata_update", API_RETURN_INT(0));
4484
4557
    if (!scm_is_string (hdata) || !scm_is_string (pointer) || !scm_list_p (hashtable))
4485
4558
        API_WRONG_ARGS(API_RETURN_INT(0));
4486
4559
 
4504
4577
{
4505
4578
    const char *result;
4506
4579
 
4507
 
    API_FUNC(1, "hdata_get_string", API_RETURN_EMPTY);
 
4580
    API_INIT_FUNC(1, "hdata_get_string", API_RETURN_EMPTY);
4508
4581
    if (!scm_is_string (hdata) || !scm_is_string (property))
4509
4582
        API_WRONG_ARGS(API_RETURN_EMPTY);
4510
4583
 
4520
4593
    char *result;
4521
4594
    SCM return_value;
4522
4595
 
4523
 
    API_FUNC(1, "upgrade_new", API_RETURN_EMPTY);
 
4596
    API_INIT_FUNC(1, "upgrade_new", API_RETURN_EMPTY);
4524
4597
    if (!scm_is_string (filename) || !scm_is_integer (write))
4525
4598
        API_WRONG_ARGS(API_RETURN_EMPTY);
4526
4599
 
4536
4609
{
4537
4610
    int rc;
4538
4611
 
4539
 
    API_FUNC(1, "upgrade_write_object", API_RETURN_INT(0));
 
4612
    API_INIT_FUNC(1, "upgrade_write_object", API_RETURN_INT(0));
4540
4613
    if (!scm_is_string (upgrade_file) || !scm_is_integer (object_id)
4541
4614
        || !scm_is_string (infolist))
4542
4615
        API_WRONG_ARGS(API_RETURN_INT(0));
4598
4671
{
4599
4672
    int rc;
4600
4673
 
4601
 
    API_FUNC(1, "upgrade_read", API_RETURN_INT(0));
 
4674
    API_INIT_FUNC(1, "upgrade_read", API_RETURN_INT(0));
4602
4675
    if (!scm_is_string (upgrade_file) || !scm_is_string (function)
4603
4676
        || !scm_is_string (data))
4604
4677
        API_WRONG_ARGS(API_RETURN_INT(0));
4616
4689
SCM
4617
4690
weechat_guile_api_upgrade_close (SCM upgrade_file)
4618
4691
{
4619
 
    API_FUNC(1, "upgrade_close", API_RETURN_ERROR);
 
4692
    API_INIT_FUNC(1, "upgrade_close", API_RETURN_ERROR);
4620
4693
    if (!scm_is_string (upgrade_file))
4621
4694
        API_WRONG_ARGS(API_RETURN_ERROR);
4622
4695
 
4662
4735
    API_DEF_FUNC(string_is_command_char, 1);
4663
4736
    API_DEF_FUNC(string_input_for_buffer, 1);
4664
4737
    API_DEF_FUNC(string_eval_expression, 4);
 
4738
    API_DEF_FUNC(string_eval_path_home, 4);
4665
4739
    API_DEF_FUNC(mkdir_home, 2);
4666
4740
    API_DEF_FUNC(mkdir, 2);
4667
4741
    API_DEF_FUNC(mkdir_parents, 2);
4738
4812
    API_DEF_FUNC(hook_hsignal_send, 2);
4739
4813
    API_DEF_FUNC(hook_config, 3);
4740
4814
    API_DEF_FUNC(hook_completion, 4);
 
4815
    API_DEF_FUNC(hook_completion_get_string, 2);
4741
4816
    API_DEF_FUNC(hook_completion_list_add, 4);
4742
4817
    API_DEF_FUNC(hook_modifier, 3);
4743
4818
    API_DEF_FUNC(hook_modifier_exec, 3);
4801
4876
    API_DEF_FUNC(infolist_new_var_string, 3);
4802
4877
    API_DEF_FUNC(infolist_new_var_pointer, 3);
4803
4878
    API_DEF_FUNC(infolist_new_var_time, 3);
 
4879
    API_DEF_FUNC(infolist_search_var, 2);
4804
4880
    API_DEF_FUNC(infolist_get, 3);
4805
4881
    API_DEF_FUNC(infolist_next, 1);
4806
4882
    API_DEF_FUNC(infolist_prev, 1);