Skip to content

Commit

Permalink
Cleanup primitive (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
denismerigoux authored Jul 11, 2024
2 parents 9897762 + b19a705 commit e15393b
Show file tree
Hide file tree
Showing 80 changed files with 5,918 additions and 9,172 deletions.
14 changes: 2 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,18 @@ include $(ROOT_DIR)/makefiles/c_backend.mk
test tests quick_test test_one \
calc_dir info_c calc_o dgfip_c_backend compile_dgfip_c_backend \
backend_tests test_dgfip_c_backend \
clean_backend clean_backend_c clean_backend_exe clean_backend_tmp clean_backend_res clean_backend_all \
test_java_backend
clean_backend clean_backend_c clean_backend_exe clean_backend_tmp clean_backend_res clean_backend_all

FORCE:

.DEFAULT_GOAL:=default

default: FORCE build

test_java_backend: FORCE build
@echo "\033[0;31mWarning: Java backend not supported\033[0m"
#ifeq ($(OPTIMIZE), 0)
# @echo "\033[0;31mWarning, non-optimized Java files cannot be executed for now (too many constants for the JVM)\033[0m"
#else
#endif
# $(MAKE) -C examples/java/ run_tests

all: FORCE quick_test tests test_dgfip_c_backend test_java_backend
all: FORCE quick_test tests test_dgfip_c_backend

clean: FORCE
$(call make_in,$(DGFIP_DIR),clean_backend_all)
# $(MAKE) -C examples/java clean
rm -f doc/doc.html
dune clean

23 changes: 1 addition & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,26 +74,6 @@ The interpreter and the C backend in `examples/dgfip_c/` should be usable straig
as the C compiler was installed for Opam. Mlang results are tested on GCC and Clang, the latter
being preferred if available.

The Java backend in `examples/java/` requires Java development environment.
The generated code targets Java 7, and could be used with OpenJDK 1.7 or more.
However, the test harness code requires Java 8, so to use the automated backend tests, we ask for
OpenJDK 1.8 or more.

For Debian-based distributions, you can try:

sudo apt install default-jdk

For Red Hat-based distributions, depending on your version:

sudo yum install java-1.8.0-openjdk-devel

or

sudo yum install java-11-openjdk-devel

NB : if you are using JDK 1.8, in order to cross-compile the generated code to 1.7, you would also need JDK 1.7
installed in order to provide the correct version of the base classes.

## Usage

Mlang also need an M file to know how to run the "liquidations multiples"
Expand Down Expand Up @@ -131,8 +111,7 @@ their internal tooling. The `--run_test` and `--run_all_tests` options ease
the testing process of the interpreter (with or without optimizations) and
report test errors in a convenient format.

Mlang backends are also tested using the same `FIP` format, see for instance
`examples/java/backend_test`.
Mlang backends are also tested using the same `FIP` format.

When running `--run_all_tests`, you can enable code coverage instrumentation
with the `--code_coverage` option. Another interesting option is `--precision`,
Expand Down
20 changes: 0 additions & 20 deletions UpdateMlangDeps.sh

This file was deleted.

4 changes: 1 addition & 3 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ code.
To know more about using a particular Mlang backend, please read the dedicated
`README.md` inside the correct folder:

* [C](c/README.md)
* [Java](java/README.md)
* [Python](python/README.md)
* [C](dgfip_c/README.md)

### Configuring the generated file

Expand Down
15 changes: 8 additions & 7 deletions examples/dgfip_c/ml_primitif/ml_driver/common.ml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ type type_ = Reel | Booleen | Date
type domaine = Indefini | Contexte | Famille | Revenu |
RevenuCorr | Variation | Penalite

external init_errs : unit -> unit = "ml_init_errs"
external get_err_list : unit -> string list = "ml_get_err_list"
external free_errs : unit -> unit = "ml_free_errs"

let get_errs () =
List.fold_left (fun res e -> StrSet.add e res) StrSet.empty (get_err_list ())

module Var = struct

type t = {
Expand Down Expand Up @@ -301,3 +294,11 @@ module TGV = struct
) var_list

end

external init_errs : TGV.t -> unit = "ml_init_errs"
external get_err_list : TGV.t -> string list = "ml_get_err_list"
external free_errs : TGV.t -> unit = "ml_free_errs"

let get_errs tgv =
List.fold_left (fun res e -> StrSet.add e res) StrSet.empty (get_err_list tgv)

Loading

0 comments on commit e15393b

Please sign in to comment.