Skip to content

Commit

Permalink
Bind the weechat_color function
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerl13 committed Dec 21, 2020
1 parent dd23f04 commit c698fca
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/api/bindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ value caml_weechat_unhook(value hook);
/* 13. Display */

value caml_weechat_prefix(value prefix);
value caml_weechat_prefix(value color_name);
value caml_weechat_printf(value buffer, value message);


Expand Down
6 changes: 6 additions & 0 deletions src/api/bindings_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ value caml_weechat_prefix(value prefix) {
CAMLreturn(res);
}

value caml_weechat_color(value color_name) {
CAMLparam1(color_name);
CAMLlocal1(res);
res = caml_copy_string(weechat_color(String_val(color_name)));
CAMLreturn(res);
}

value caml_weechat_printf(value buffer, value message) {
CAMLparam2(buffer, message);
Expand Down
1 change: 1 addition & 0 deletions src/api/weechat.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ type gui_buffer
(** {2 13. Display} *)

external prefix: string -> string = "caml_weechat_prefix"
external color: string -> string = "caml_weechat_color"
external printf: gui_buffer -> string -> unit = "caml_weechat_printf"
let printf buffer = Format.kasprintf (printf buffer)

Expand Down

0 comments on commit c698fca

Please sign in to comment.