35
35
/* max strings created by an API function */
36
36
#define GUILE_MAX_STRINGS 64
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; \
70
70
#define API_RETURN_OK \
71
71
API_FREE_STRINGS; \
73
73
#define API_RETURN_ERROR \
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; \
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; \
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)
159
API_FUNC(0, "register", API_RETURN_ERROR);
160
API_INIT_FUNC(0, "register", API_RETURN_ERROR);
160
161
if (guile_registered_script)
162
163
/* script already registered */
235
236
const char *result;
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);
247
248
weechat_guile_api_charset_set (SCM charset)
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);
262
263
SCM return_value;
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);
278
279
SCM return_value;
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);
293
294
const char *result;
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);
307
308
const char *result;
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);
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));
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));
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));
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));
386
387
SCM return_value;
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);
401
402
SCM return_value;
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);
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));
430
431
const char *result;
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);
446
447
SCM return_value;
447
448
struct t_hashtable *c_pointers, *c_extra_vars, *c_options;
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);
483
weechat_guile_api_string_eval_path_home (SCM path, SCM pointers,
484
SCM extra_vars, SCM options)
488
struct t_hashtable *c_pointers, *c_extra_vars, *c_options;
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);
495
c_pointers = weechat_guile_alist_to_hashtable (
497
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
498
WEECHAT_HASHTABLE_STRING,
499
WEECHAT_HASHTABLE_POINTER);
500
c_extra_vars = weechat_guile_alist_to_hashtable (
502
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
503
WEECHAT_HASHTABLE_STRING,
504
WEECHAT_HASHTABLE_STRING);
505
c_options = weechat_guile_alist_to_hashtable (
507
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
508
WEECHAT_HASHTABLE_STRING,
509
WEECHAT_HASHTABLE_STRING);
511
result = weechat_string_eval_path_home (API_SCM_TO_STRING(path),
512
c_pointers, c_extra_vars,
516
weechat_hashtable_free (c_pointers);
518
weechat_hashtable_free (c_extra_vars);
520
weechat_hashtable_free (c_options);
522
API_RETURN_STRING_FREE(result);
482
526
weechat_guile_api_mkdir_home (SCM directory, SCM mode)
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);
495
539
weechat_guile_api_mkdir (SCM directory, SCM mode)
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);
508
552
weechat_guile_api_mkdir_parents (SCM directory, SCM mode)
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);
525
API_FUNC(1, "list_new", API_RETURN_EMPTY);
569
API_INIT_FUNC(1, "list_new", API_RETURN_EMPTY);
527
571
result = API_PTR2STR(weechat_list_new ());
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);
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);
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));
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);
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));
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);
626
670
weechat_guile_api_list_set (SCM item, SCM new_value)
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);
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);
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);
669
713
const char *result;
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);
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));
695
739
weechat_guile_api_list_remove (SCM weelist, SCM item)
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);
708
752
weechat_guile_api_list_remove_all (SCM weelist)
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);
720
764
weechat_guile_api_list_free (SCM weelist)
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);
772
816
SCM return_value;
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);
1009
1053
SCM return_value;
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);
1068
1112
SCM return_value;
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);
1185
1229
SCM return_value;
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);
1252
1296
SCM return_value;
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);
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));
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));
1289
1333
rc = weechat_config_option_reset (API_STR2PTR(API_SCM_TO_STRING(option)),
1290
1334
scm_to_int (run_callback));
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));
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));
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));
1343
1387
weechat_guile_api_config_option_rename (SCM option, SCM new_name)
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);
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));
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));
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));
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));
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));
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));
1442
1486
const char *result;
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);
1456
1500
const char *result;
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);
1470
1514
const char *result;
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);
1476
1520
result = weechat_config_color (API_STR2PTR(API_SCM_TO_STRING(option)));
1484
1528
const char *result;
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);
1490
1534
result = weechat_config_color_default (API_STR2PTR(API_SCM_TO_STRING(option)));
1496
1540
weechat_guile_api_config_write_option (SCM config_file, SCM option)
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);
1509
1553
weechat_guile_api_config_write_line (SCM config_file,
1510
1554
SCM option_name, SCM value)
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);
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));
1533
1577
rc = weechat_config_write (API_STR2PTR(API_SCM_TO_STRING(config_file)));
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));
1547
1591
rc = weechat_config_read (API_STR2PTR(API_SCM_TO_STRING(config_file)));
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));
1561
1605
rc = weechat_config_reload (API_STR2PTR(API_SCM_TO_STRING(config_file)));
1567
1611
weechat_guile_api_config_option_free (SCM option)
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);
1581
1625
weechat_guile_api_config_section_free_options (SCM section)
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);
1595
1639
weechat_guile_api_config_section_free (SCM section)
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);
1609
1653
weechat_guile_api_config_free (SCM config_file)
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);
1626
1670
SCM return_value;
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);
1640
1684
const char *result;
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);
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));
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));
1687
1731
weechat_guile_api_config_set_desc_plugin (SCM option, SCM description)
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);
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));
1720
1764
struct t_hashtable *c_keys;
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));
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));
1758
1802
const char *result;
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);
1772
1816
const char *result;
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);
1784
1828
weechat_guile_api_print (SCM buffer, SCM message)
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);
1799
1843
weechat_guile_api_print_date_tags (SCM buffer, SCM date, SCM tags, SCM message)
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);
1817
1861
weechat_guile_api_print_y (SCM buffer, SCM y, SCM message)
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);
1834
1878
weechat_guile_api_log_print (SCM message)
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);
1894
1938
SCM return_value;
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);
1903
1947
result = API_PTR2STR(plugin_script_api_hook_command (weechat_guile_plugin,
1904
1948
guile_current_script,
1959
2003
SCM return_value;
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);
2018
2062
SCM return_value;
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))
2079
2123
SCM return_value;
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))
2144
2188
SCM return_value;
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;
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))
2247
2291
SCM return_value;
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)
2336
2380
SCM return_value;
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))
2421
2465
SCM return_value;
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);
2441
2485
int number, rc;
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));
2519
2563
SCM return_value;
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;
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));
2598
2642
SCM return_value;
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);
2662
2706
SCM return_value;
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);
2725
weechat_guile_api_hook_completion_get_string (SCM completion, SCM property)
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);
2733
result = weechat_hook_completion_get_string (
2734
API_STR2PTR(API_SCM_TO_STRING(completion)),
2735
API_SCM_TO_STRING(property));
2737
API_RETURN_STRING(result);
2681
2741
weechat_guile_api_hook_completion_list_add (SCM completion, SCM word,
2682
2742
SCM nick_completion, SCM where)
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);
2727
2787
SCM return_value;
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);
2749
2809
SCM return_value;
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);
2793
2853
SCM return_value;
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))
2845
2905
SCM return_value;
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))
2904
2964
SCM return_value;
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))
2952
3012
SCM return_value;
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);
2970
3030
weechat_guile_api_hook_set (SCM hook, SCM property, SCM value)
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);
2985
3045
weechat_guile_api_unhook (SCM hook)
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);
2999
3059
weechat_guile_api_unhook_all ()
3001
API_FUNC(1, "unhook_all", API_RETURN_ERROR);
3061
API_INIT_FUNC(1, "unhook_all", API_RETURN_ERROR);
3003
3063
plugin_script_api_unhook_all (weechat_guile_plugin, guile_current_script);
3087
3147
SCM return_value;
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))
3112
3172
SCM return_value;
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);
3128
3188
SCM return_value;
3130
API_FUNC(1, "buffer_search_main", API_RETURN_EMPTY);
3190
API_INIT_FUNC(1, "buffer_search_main", API_RETURN_EMPTY);
3132
3192
result = API_PTR2STR(weechat_buffer_search_main ());
3141
3201
SCM return_value;
3143
API_FUNC(1, "current_buffer", API_RETURN_EMPTY);
3203
API_INIT_FUNC(1, "current_buffer", API_RETURN_EMPTY);
3145
3205
result = API_PTR2STR(weechat_current_buffer ());
3151
3211
weechat_guile_api_buffer_clear (SCM buffer)
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);
3163
3223
weechat_guile_api_buffer_close (SCM buffer)
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);
3177
3237
weechat_guile_api_buffer_merge (SCM buffer, SCM target_buffer)
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);
3190
3250
weechat_guile_api_buffer_unmerge (SCM buffer, SCM number)
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);
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));
3220
3280
const char *result;
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);
3236
3296
SCM return_value;
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);
3249
3309
weechat_guile_api_buffer_set (SCM buffer, SCM property, SCM value)
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);
3267
3327
SCM return_value;
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);
3273
3333
result = weechat_buffer_string_replace_local_var (API_STR2PTR(API_SCM_TO_STRING(buffer)),
3274
3334
API_SCM_TO_STRING(string));
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));
3298
3358
SCM return_value;
3300
API_FUNC(1, "current_window", API_RETURN_EMPTY);
3360
API_INIT_FUNC(1, "current_window", API_RETURN_EMPTY);
3302
3362
result = API_PTR2STR(weechat_current_window ());
3311
3371
SCM return_value;
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);
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));
3340
3400
const char *result;
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);
3356
3416
SCM return_value;
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);
3369
3429
weechat_guile_api_window_set_title (SCM title)
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);
3385
3445
SCM return_value;
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))
3406
3466
SCM return_value;
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);
3426
3486
SCM return_value;
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)
3450
3510
SCM return_value;
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);
3465
3525
weechat_guile_api_nicklist_remove_group (SCM buffer, SCM group)
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);
3478
3538
weechat_guile_api_nicklist_remove_nick (SCM buffer, SCM nick)
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);
3491
3551
weechat_guile_api_nicklist_remove_all (SCM buffer)
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);
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));
3524
3584
const char *result;
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);
3543
3603
SCM return_value;
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,
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);
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));
3593
3653
const char *result;
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);
3611
3671
SCM return_value;
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,
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);
3646
3706
SCM return_value;
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);
3720
3780
SCM return_value;
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);
3738
3798
weechat_guile_api_bar_item_update (SCM name)
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);
3750
3810
weechat_guile_api_bar_item_remove (SCM item)
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);
3767
3827
SCM return_value;
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);
3785
3845
SCM return_value;
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);
3837
3897
weechat_guile_api_bar_set (SCM bar, SCM property, SCM value)
3839
API_FUNC(1, "bar_set", API_RETURN_ERROR);
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);
3844
weechat_bar_set (API_STR2PTR(API_SCM_TO_STRING(bar)),
3845
API_SCM_TO_STRING(property),
3846
API_SCM_TO_STRING(value));
3904
API_WRONG_ARGS(API_RETURN_INT(0));
3906
rc = weechat_bar_set (API_STR2PTR(API_SCM_TO_STRING(bar)),
3907
API_SCM_TO_STRING(property),
3908
API_SCM_TO_STRING(value));
3852
3914
weechat_guile_api_bar_update (SCM name)
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);
3864
3926
weechat_guile_api_bar_remove (SCM bar)
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);
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));
3884
3946
rc = plugin_script_api_command (weechat_guile_plugin,
3885
3947
guile_current_script,
3895
3957
const char *result;
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);
3910
3972
struct t_hashtable *c_hashtable, *result_hashtable;
3911
3973
SCM result_alist;
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);
3938
4000
SCM return_value;
3940
API_FUNC(1, "infolist_new", API_RETURN_EMPTY);
4002
API_INIT_FUNC(1, "infolist_new", API_RETURN_EMPTY);
3942
4004
result = API_PTR2STR(weechat_infolist_new ());
3951
4013
SCM return_value;
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);
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)
3966
4028
SCM return_value;
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);
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)));
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)
3984
4046
SCM return_value;
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);
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)));
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)
4002
4064
SCM return_value;
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);
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))));
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)
4020
4082
SCM return_value;
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);
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)));
4097
weechat_guile_api_infolist_search_var (SCM infolist, SCM name)
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);
4106
result = API_PTR2STR(weechat_infolist_search_var (API_STR2PTR(API_SCM_TO_STRING(infolist)),
4107
API_SCM_TO_STRING(name)));
4109
API_RETURN_STRING_FREE(result);
4035
4113
weechat_guile_api_infolist_get (SCM name, SCM pointer, SCM arguments)
4038
4116
SCM return_value;
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);
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));
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));
4081
4159
weechat_guile_api_infolist_reset_item_cursor (SCM infolist)
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);
4095
4173
const char *result;
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);
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));
4124
4202
const char *result;
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);
4140
4218
SCM return_value;
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);
4157
4235
struct tm *date_tmp;
4158
4236
SCM return_value;
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);
4176
4254
weechat_guile_api_infolist_free (SCM infolist)
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);
4191
4269
SCM return_value;
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);
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));
4220
4298
const char *result;
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);
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));
4253
4331
const char *result;
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);
4270
4348
const char *result;
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);
4286
4364
SCM return_value;
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);
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));
4319
4397
SCM return_value;
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);
4337
4415
SCM return_value;
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);
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));
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));
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));
4406
4484
const char *result;
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);
4424
4502
SCM return_value;
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);
4439
4517
weechat_guile_api_hdata_time (SCM hdata, SCM pointer, SCM name)
4441
char timebuffer[64], *result;
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));
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);
4456
API_RETURN_STRING_FREE(result);
4529
API_RETURN_LONG(time);
4462
4535
SCM result_alist;
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;
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));
4505
4578
const char *result;
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);
4521
4594
SCM return_value;
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);
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));
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));
4617
4690
weechat_guile_api_upgrade_close (SCM upgrade_file)
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);
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);