diff options
author | John Estabrook <jestabro@vyos.io> | 2023-02-11 13:11:03 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-11 13:11:03 -0600 |
commit | 020716d9823a76b674ff0c820b278e10e32d686f (patch) | |
tree | ca04a2382a9a1b631d3c0b48e9ba08ea66228a23 | |
parent | d24dcc6862b3291ffd98887f460a17392dd7cb78 (diff) | |
parent | bfafd03e38c4295962554cb76eb5a4845d241139 (diff) | |
download | libvyosconfig-020716d9823a76b674ff0c820b278e10e32d686f.tar.gz libvyosconfig-020716d9823a76b674ff0c820b278e10e32d686f.zip |
Merge pull request #7 from jestabro/udiff
T4991: add binding for function show_diff
-rw-r--r-- | lib/bindings.ml | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/bindings.ml b/lib/bindings.ml index 61f65cd..7f6cb76 100644 --- a/lib/bindings.ml +++ b/lib/bindings.ml @@ -191,6 +191,16 @@ let trim_tree c_ptr_l c_ptr_r = | CD.Incommensurable -> error_message := "Incommensurable"; Ctypes.null | CD.Empty_comparison -> error_message := "Empty comparison"; Ctypes.null +let show_diff cmds path c_ptr_l c_ptr_r = + let path = split_on_whitespace path in + let ct_l = Root.get c_ptr_l in + let ct_r = Root.get c_ptr_r in + try + CD.show_diff ~cmds:cmds path ct_l ct_r + with + | CD.Incommensurable -> error_message := "Incommensurable"; "#1@" + | CD.Empty_comparison -> error_message := "Empty comparison"; "#1@" + module Stubs(I : Cstubs_inverted.INTERNAL) = struct @@ -218,4 +228,5 @@ struct let () = I.internal "return_values" ((ptr void) @-> string @-> returning string) return_values let () = I.internal "diff_tree" (string @-> (ptr void) @-> (ptr void) @-> returning (ptr void)) diff_tree let () = I.internal "trim_tree" ((ptr void) @-> (ptr void) @-> returning (ptr void)) trim_tree + let () = I.internal "show_diff" (bool @-> string @-> (ptr void) @-> (ptr void) @-> returning string) show_diff end |