From 91d3a9ef606abf0a5490659f1fef73bdb66a3fbe Mon Sep 17 00:00:00 2001 From: Mysaa Date: Thu, 11 Mar 2021 16:25:36 +0100 Subject: [PATCH] =?UTF-8?q?Tentatives=20de=20modularisation=20des=20classe?= =?UTF-8?q?s,=20y=20a=20encore=20deux=20trois=20probl=C3=A8mes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + Codes.ml => Code.ml | 9 ++++++--- Makefile | 13 ++++++++++++- Maths.ml => Math.ml | 0 Maths.mli | 1 - Test.ml | 8 ++++++-- 6 files changed, 25 insertions(+), 7 deletions(-) rename Codes.ml => Code.ml (97%) rename Maths.ml => Math.ml (100%) delete mode 100644 Maths.mli diff --git a/.gitignore b/.gitignore index 141d355..6c0bf2e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.cmi *.cmx +*.cmo *.o *.a *.ascii.txt diff --git a/Codes.ml b/Code.ml similarity index 97% rename from Codes.ml rename to Code.ml index 9e7336a..f754ac6 100644 --- a/Codes.ml +++ b/Code.ml @@ -24,10 +24,13 @@ *) -#cd "/home/mysaa/Documents/Arbeiten/TIPE2021";; -#use "Maths.ml";; +#cd "/home/mysaa/Documents/Arbeiten/TIPE2021/";; +#load "Math.cmo";; + +open Math;; + (* La bonne structure *) -type code_lineaire = {klin : int; nlin : int; g : matrice; h : matrice};; +type code_lineaire = {klin : int; nlin : int; g : matrice; h : Math.matrice};; (* La super stucture *) type code_cyclique = {kcyc : int; ncyc: int; pol: polynome};; diff --git a/Makefile b/Makefile index 47c2a45..02d022d 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,17 @@ ascii: $(shell find textes/ -type f -iname "*.txt" ! -iname "*.ascii.txt" | sed %.cmx: %.ml ocamlopt -c $< + +%.cmo: %.ml + ocamlc -c $< + + +Code.cmo: Code.ml Math.cmo + mkdir tmp + cat Code.ml | sed '/^#/d' > tmp/Code.ml + ocamlc -c tmp/Code.ml Math.cmo + mv tmp/Code.cmo Code.cmo + rm -r tmp tipe: tipe.cmx ocamlopt -o tipe str.cmxa tipe.cmx @@ -16,4 +27,4 @@ tipe: tipe.cmx runall: $(shell find textes/ -type f -iname "*.txt" ! -iname "*.ascii.txt" | sed "s/\.txt/\.txt\.test/") clean: - rm -rf tipe *.cmx *.cmi *.o textes/*.ascii.txt + rm -rf tipe *.cmx *.cmi *.cmo *.o textes/*.ascii.txt *.ntl.ml diff --git a/Maths.ml b/Math.ml similarity index 100% rename from Maths.ml rename to Math.ml diff --git a/Maths.mli b/Maths.mli deleted file mode 100644 index 8d1c8b6..0000000 --- a/Maths.mli +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Test.ml b/Test.ml index 69e421d..8656e08 100644 --- a/Test.ml +++ b/Test.ml @@ -1,10 +1,14 @@ #cd "/home/mysaa/Documents/Arbeiten/TIPE2021";; -#use "Codes.ml";; +Sys.command "make Math.cmo Code.cmo";; +#load "Math.cmo";; +#load "Code.cmo";; +open Math;; +open Code;; (* Test du produit de matrice *) let matest = [0b01110; 0b00101; 0b10111];; print_matrice 5 matest;; -produit matest 0b110;; (* -> 0b10010 = 8*) +produit matest 0b110;; (* -> 0b10010 = 8 *) (* Tests des polynomes *) let pol1 = 13 and pol2 = 67;;