module type Sortie=sig val affichage : ((string * string * string) list * string) list->out_channel-> unit end;; module Sortie_affichage= struct type triplet=string*string*string type sous_reponse=triplet list type reponse=(sous_reponse*string) list let rec aff_trois_chaines liste= match liste with |[]->print_newline(); |(query,cor,comp)::reste->begin let longueur=String.length query in let i=ref 0 in if longueur>50 then while ((!i)!=(longueur))do let s1=String.sub query (!i-1) 50 in print_string s1; print_newline(); let s2=String.sub cor (!i-1) 50 in print_string s2; print_newline(); let s3=String.sub comp (!i-1) 50 in print_string s3; print_newline(); i:=!i+50; done else begin print_string query; print_newline(); print_string cor; print_newline(); print_string comp ; print_newline(); end; aff_trois_chaines reste; end;; let rec affichage_sous_reponse liste= aff_trois_chaines liste ;; let rec affichage rep channel= match rep with |[]->Printf.printf("fin\n"); |(liste,nom)::reste->begin Printf.printf("comparaison \n"); print_string nom ; print_newline(); affichage_sous_reponse liste; affichage reste channel; end ;; end;; module Sortie_fichier= struct type triplet=string*string*string type sous_reponse=triplet list type reponse=(sous_reponse*string) list let aff_trois_chaines channel tri= let (query,cor,comp)=tri in let longueur=String.length query in let i=ref 0 in while ((!i)!=longueur) do let s1=String.sub query (!i-1) 50 in output channel s1 !i 50 ; let s2=String.sub cor (!i-1) 50 in output channel s2 !i 50 ; let s3=String.sub comp (!i-1) 50 in output channel s3 !i 50 ; done; ;; let affichage_sous_reponse liste channel= List.iter(aff_trois_chaines channel)( liste) ;; let rec affichage rep channel= match rep with |[]->() |(liste,nom)::reste->begin output channel nom 0 (String.length nom); affichage_sous_reponse liste channel; affichage reste channel; end; ;; end;;