File indexing completed on 2022-11-29 12:50:43

0001 /*
0002     SPDX-FileCopyrightText: 2004 Thomas Nagy <tnagy2^8@yahoo.fr>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include <stdio.h>
0008 #include <string.h>
0009 
0010 #include <caml/alloc.h>
0011 #include <caml/callback.h>
0012 #include <caml/mlvalues.h>
0013 
0014 char *solve_equation(const char *eq)
0015 {
0016     static value *solve_equation_closure = NULL;
0017     if (solve_equation_closure == NULL) {
0018         solve_equation_closure = caml_named_value("solve_equation");
0019     }
0020 
0021     value v = copy_string(eq);
0022     return strdup(String_val(callback(*solve_equation_closure, v)));
0023 }