[SCM] applications.git branch, master, updated. 4f44687c6448835602fccbfad27fc046538fe11b

ontologiae ontologiae at ordinateur-de-ontologiae-3.local
Tue Apr 6 09:30:48 UTC 2010


The following commit has been merged in the master branch:
commit 4f44687c6448835602fccbfad27fc046538fe11b
Author: ontologiae <ontologiae at ordinateur-de-ontologiae-3.local>
Date:   Tue Apr 6 11:28:02 2010 +0200

    Java2Lisaac improvment : Statement, generation

diff --git a/java2lisaac/Java2Lisaac.ml/ParserJava.ml b/java2lisaac/Java2Lisaac.ml/ParserJava.ml
index 55a569b..f38155d 100644
--- a/java2lisaac/Java2Lisaac.ml/ParserJava.ml
+++ b/java2lisaac/Java2Lisaac.ml/ParserJava.ml
@@ -51,26 +51,29 @@ block = Block of (statement list)
 and (*  Un Statement = Soit une expression, un if then else, un while, un do
         while, un try catch, switch, synchronized ??, Return, Throw, break,
         continue *)
-statement = Local_variable of (local_variable list)
+statement = Local_variables of (local_variable list)
 | Expression of expression
 | IfThenElse of expression * block * block
 | While of expression * block
 | DoWhile of expression * block (* Question : doit-on typer les expression et est-il possible et intéressant de le faire au niveau du xml ? *)
-| TryCatchFinaly of block * local_variable * block
-| Switch of expression * ((expression * block) list) * block (* Expression de test (entière), la liste des cases, et le block de défaut *)
+| TryCatchFinaly of block * local_variable * block * block (*try block
+catch(local_variable) { block } finaly { block } *)
+| Switch of expression * caseThen list * block (* Expression de test (entière), la liste des cases, et le block de défaut *)
+
 | Synchronized of expression * block (* C'est quoi ça ??*)
 | Return of expression
 | Throw of expression
 | Break
 | Continue 
 | Rien (* Block vide  *)
-| For of expression * expression * expression (* pose problème pour le 1er et le
-dernier  *)
+| For of expression * expression * expression * block (* init :: test :: update :: block *)
+
 | ForEach of definition_typ * local_variable * expression
 (* Manque le for et For Each !!  *)
 and
 (* VARIABLE LOCALES    *)
 local_variable = { final_l : bool;   continued : string (*c quoi ??*);  id : definition_typ (*c quoi ?? Le type ??*);  name : string ; definition : litteral_def } 
+and caseThen =  CaseThen of (expression * block)
 
 
 
@@ -130,8 +133,9 @@ and expression =
 |       False
 |       True
 
-|       NewClassName of definition_typ * definition_typ list * expression list
-(*Le type créé, sa liste de génériques, éventuel expression d'init associée*)
+|       LocalVariable of string * definition_typ * definition_typ list * expression 
+|       NewClassName of definition_typ * definition_typ list * expression 
+(*Le type créé, sa liste de génériques, éventuelle expression d'init associée*)
 |       LiteralExpre of litteral_def
 |       Message of string * expression * expression list (*Appel de méthode :
         Nom, receveur, arguments *)
@@ -149,6 +153,11 @@ type xmls = Elem of (string * (string * string) list * xmls list);;
 
 let hash_variables = Hashtbl.create 123456;;
 
+(*==========================================================================================*)
+(*================================    Exception DECLARATION     =================================*)
+(*==========================================================================================*)
+
+exception Stmt_exp of statement;;
 
 
 (* UTILITAIRES *)
@@ -215,9 +224,11 @@ let get_typ_info = function cpl -> Hashtbl.find hash_variables cpl;;
 (*==========================================================================================*)
 (* DEF VARIABLES POUR TESTS *)
 
-let x = Xml.parse_file "2expre.xml";;
+(*let x = Xml.parse_file "2expre.xml";;*)
+let x = Xml.parse_file "ExempleCode.xml";;
 let x = to_xmls x;;
 let bin_expr = List.nth (children x) 0;;  
+let stm_expr = List.nth (children x) 0;; 
 
 let typ = Def_typ ("UnType" , false , [] );;
 let champ = { name_f="jk" ; type_field=typ ; transient_f=false ; volatile_f= false ; static_f=false ; final_f=false ; visibility_f=Private ; litteral_def_f=LiteralBool(true) };; 
@@ -229,8 +240,8 @@ let lit_str= Elem ("literal-string", [("kind","string");("value","truc")],[]) ;;
 let lit_ch=  Elem ("literal-string", [("kind","string");("value","truc")],[]) ;;
 
 let var = Elem( "field" , [("name","ANGLE_315");("visibility","public");("final","true");("static","true")], [
-                Elem( "type", [("primitive","true");("name","int")], []);
-                Elem( "literal-number",[("kind","integer");("value","1680")], [])]);; 
+        Elem( "type", [("primitive","true");("name","int")], []);
+        Elem( "literal-number",[("kind","integer");("value","1680")], [])]);; 
 
 
 (*==========================================================================================*)
@@ -256,15 +267,14 @@ let rec recup_info_literal = function
         |  Elem("literal-char", lst, children) -> let kind = key ("kind",lst) in
         (match kind with "char" -> LiteralChar (String.get (key ("value", lst)) 1)
         | _ -> LiteralNull)
-        |  Elem("literal-bool", lst, children) -> let kind = key ("kind",lst) in
-        (match kind with "char" ->  LiteralBool  (is_true (key ("value", lst)))
-        | _ -> LiteralNull )
+        |  Elem("literal-boolean", lst, children) ->  LiteralBool  (is_true (key ("value", lst)))
+
         | Elem ( b , t , chil) -> print_string (erreur ("recup_info_literal", b, "literal", t)); LiteralNull;; 
 
 
 
 (*On verra après pour savoir
-        comment gérer les types génériques*)
+comment gérer les types génériques*)
 let rec recup_info_type_field = function
         | Elem("type", infos, fils) -> let res =  Def_typ ( key("name",infos) ,
         is_true (key("primitive",infos)) , [] )  in Hashtbl.add hash_variables
@@ -298,27 +308,17 @@ let rec match_field = function
 (*Comment détecter les expressions ? Il peut y en avoir plein*)
 
 
-   (* PAS FINI !!!!!!!!! *)
-(*let rec match_statement = function
-        | Elem ("loop",["kind","for"], init :: test :: update :: block ) -> a
-        | Elem ("local-variable", ["name",nomvar] , typ :: literal ) -> a
-        | Elem ("block" , [] , expressions ) -> List.map match_statement
-        expressions
-        | Elem( "switch" , [] , var :: lstSwitch ) -> Switch ( match_expression var, 
 
 
-*)
-
 (*TODO : Gestion de l'opérateur dans assignment-expr *)
 let rec match_expression = function
         | Elem ("new", [] , type_info :: args :: [] ) -> NewClassName (
                 recup_info_type_field type_info , List.map  recup_info_type_field
-                (children type_info), List.map  match_expression (children args)) 
+                (children type_info),   match_expression (List.nth  (children args) 0)) 
         | Elem ("type-argument", [] , fils :: [] ) -> match_expression fils 
         | Elem("paren", infos , fils :: [] ) -> EntreParenth ( match_expression
         fils) 
-        | Elem("binary-expr", infos , fils ) -> match_expre_binaire
-        (Elem("binary-expr", infos , fils ))
+
         | Elem("assignment-expr", ["op",op], lval :: rval :: [] ) -> Affect (
                 match_expression lval , match_expression rval )
         | Elem("lvalue", [], value :: [] ) -> match_expression value
@@ -330,12 +330,14 @@ let rec match_expression = function
                         Message  (method_name, This,  List.map match_expression (children
                         arguments) )  
         | Elem("var-ref", infos, fils) -> VarRef (key ("name",infos),get_typ_info ("class",(key ("name",infos)))) 
+        | Elem("var-ref", infos, []) -> VarRef (key ("name",infos),get_typ_info ("class",(key ("name",infos)))) 
         | Elem(a , infos, []) when is_substring (a,"literal") -> LiteralExpre ( recup_info_literal (Elem(a,infos,[])) )   
         | Elem("this-call", [], fils :: []) ->  ThisCall (match_expression fils) 
-        | Elem( a, i , f ) -> print_string (erreur ("match_expression",a, "new,
-type-argument, paren, binary-expr, send, var-ref, literal.+, this-call  ", i)) ; Null
+        | Elem("this", [],  []) ->  This
+        | Elem( "local-variable", [("name", n)] , t :: e :: []) ->  LocalVariable ( n, recup_info_type_field t , [] , match_expression e)
+
+
 
-and match_expre_binaire = function
         | Elem ("binary-expr",["op","&amp;"], elem1 :: elem2 :: [] )-> EtBin  ( match_expression elem1 , match_expression elem2 ) 
         | Elem ("binary-expr",["op","&gt;"], elem1 :: elem2 :: [] )-> SupStrict
         ( match_expression elem1 , match_expression elem2 ) 
@@ -346,6 +348,8 @@ and match_expre_binaire = function
         | Elem ("binary-expr",["op","-"], elem1 :: elem2 :: [])-> Moins ( match_expression elem1 , match_expression elem2 )
         | Elem ("binary-expr",["op","/"], elem1 :: elem2 :: [] )-> Div ( match_expression elem1 , match_expression elem2 )
         | Elem ("binary-expr",["op","||"], elem1 :: elem2 :: [] )-> OuLogic ( match_expression elem1 , match_expression elem2 )
+        | Elem ("binary-expr",["op","&&"], elem1 :: elem2 :: [] )-> OuLogic ( match_expression elem1 , match_expression elem2 )
+        | Elem ("unary-expr",[("op", "++"); ("post", "true")], elem1  :: [] )-> PlusPlusPost ( match_expression elem1  ) (* TODO EXPRE UNAIRE !!!! *)
 
         | Elem ( "binary-expr",  ["op","%"] , elem1 :: elem2 :: [] ) -> Modulo ( match_expression elem1 , match_expression elem2 )  
 
@@ -372,7 +376,123 @@ and match_expre_binaire = function
         | Elem ( "binary-expr",  ["op","^"] , elem1 :: elem2 :: [] ) ->
                         OuExclusif (match_expression elem1 , match_expression
                         elem2 )  
-        | Elem( a, i , f ) -> print_string (erreur ("match_expre_binaire", a, "binary-expr", i)); Null;; 
+        | Elem( a, i , f ) -> print_string (erreur ("match_expression",a, "new,
+type-argument, paren, binary-expr, send, var-ref, literal.+, this-call,binary-expr  ", i)) ; Null;; 
+
+
+let rec match_block = function 
+        | Elem ("block" , [] , stmt ) -> Block (List.map match_statement
+        stmt )
+        | Elem( a, i , f ) -> print_string (erreur ("match_block", a, "block", i)); Block([Rien])
+
+and match_switch_bloc = function
+        |  Elem ("switch-block" , [] , case ::  blocksw  :: [] ) -> CaseThen (match_expression (List.nth (children  case ) 0) , match_block blocksw)
+        | Elem( a, i , f ) -> print_string (erreur ("match_switch_bloc", a, "switch-block", i)); CaseThen (Null, Block([Rien]))
+and 
+(* PAS FINI !!!!!!!!! *)
+match_statement = function
+        | Elem ("loop",["kind","for"], init :: test :: update :: block :: [] ) -> For
+        ( match_expression  (List.nth (children  init ) 0) , match_expression (List.nth (children  test ) 0), match_expression
+        (List.nth (children update) 0) ,match_block block)
+        | Elem ("loop",["kind","while"],  test :: block :: []  ) -> While ( match_expression (List.nth (children test) 0) ,  match_block  block )
+        (*TODO Gérer les cas de if sans block...
+        TODO : 4 cas Block/Pas Bloc, If avec else ou SANS...*)
+
+        (*If/Else Avec Avec*)
+
+
+
+        | Elem ("if",[],  test :: Elem("true-case", [], Elem ("block" , [] , blockt  ) :: [] )
+        :: Elem("false-case", [], Elem ("block" , [] , blockf ) :: [] ) 
+        :: []) -> 
+                IfThenElse ( 
+                        match_expression (List.nth (children test) 0) ,
+                        match_block  (Elem ("block" , [] , blockt  )) , 
+                        match_block  (Elem ("block" , [] , blockf )) 
+                        )
+
+                (*1 : If  Avec block*)
+        | Elem ("if",[],  test :: Elem("true-case", [],  Elem ("block" , [] , blockt ) :: [] )  
+                               :: []) -> print_string "If Avec block"; 
+                               IfThenElse ( 
+                                       match_expression (List.nth (children test) 0) , 
+                                       match_block  (   Elem ("block" , [] , blockt ) ) ,
+                                       Block([Rien])
+                                       ) 
+
+
+       
+
+
+
+                      (*If  / Else Avec Sans*)
+        | Elem ("if",[],  test :: Elem("true-case", [], Elem ("block" , [] , blockt ):: [] )
+                               :: Elem("false-case", [], Elem ( q2 , a2 , f2) :: [] ) 
+                               :: []) when q2 <> "block" -> print_string "If  / Else Avec Sans"; 
+                               IfThenElse (
+                                       match_expression (List.nth (children test) 0) ,
+                                       match_block ( Elem ("block" , [] , blockt ) ),
+                                       match_block (Elem("block",[],  Elem ( q2 , a2 , f2) :: [])    ) 
+                                       ) 
+
+                               (*If / Else Sans Avec *)
+        | Elem ("if",[],  test :: Elem("true-case", [], Elem ( q , a , f) :: [] ) 
+                               :: Elem("false-case", [], Elem ("block" , [] , blockf ):: [] )  
+                               :: []) when q <> "block" -> print_string "If / Else Sans Avec"; 
+                               IfThenElse (
+                                       match_expression (List.nth (children test) 0) , 
+                                       match_block (Elem("block",[],  Elem ( q , a , f) :: [])),
+                                       match_block (Elem ("block" , [] , blockf ) ) 
+                                       )
+
+
+
+
+                               (*If Sans block*)
+        | Elem ("if",[],  test :: Elem("true-case", [], Elem ( q , a , f) :: [] ) ::  []) when q <> "block"-> print_string "If Sans block";
+                      IfThenElse (
+                              match_expression (List.nth (children test) 0) , 
+                              match_block  ( Elem("block",[],  Elem ( q , a , f) :: []) ),
+                              Block([Rien]) 
+                              )
+
+
+         (*If / Else Sans Sans*)
+        | Elem ("if",[],  test :: Elem("true-case", [], Elem ( q , a , f) :: [] ) 
+                               :: Elem("false-case", [], Elem ( q2 , a2 , f2) :: [] ) 
+                               :: []) 
+                      when ((q <> "block") && (q2 <> "block")) -> print_string "If / Else Sans Sans";  
+                      IfThenElse (
+                              match_expression (List.nth (children test) 0) ,
+                              match_block (Elem("block",[],  Elem ( q , a , f) :: [] )),
+                              match_block (Elem("block",[],  Elem ( q2 , a2 , f2) :: [])  ) 
+                              )
+
+         | Elem("send", [("message", method_name)], target :: arguments :: []) -> 
+                         Expression ( match_expression (Elem("send", [("message", method_name)], target :: arguments :: []) ) )
+                       
+        | Elem("send", [("message", method_name)], arguments :: []) -> 
+                        Expression ( match_expression ( Elem("send", [("message", method_name)], arguments :: [])  ) )
+
+
+        | Elem("assignment-expr", op, v ) -> Expression (  match_expression (Elem("assignment-expr", op, v ))   )
+        | Elem( "switch" , [] , var :: lstSwitch ) -> Switch ( match_expression var, List.map match_switch_bloc lstSwitch, Block([Rien]) )
+        | Elem( "break" , [] ,[] ) -> Break
+        | Elem( a, i , f ) -> print_string (erreur ("match_statement", a, "stmt", i)); Rien ;;
+
+(* | Elem ("try",[],  block :: Elem("catch",[], Elem(formalargument,["name",n],typref :: []) :: blockc :: [] ) :: [] ) -> TryCatchFinaly (
+        match_block block,  (*TODO : Gérer le formal argument *) ,
+        match_block blockc, Block([Rien]) ) 
+        | Elem ("try",[],  block :: Elem("catch",[], formalargument :: blockc :: [] ) :: Elem("finally",[],blockfinally ::[] ) :: [] ) -> TryCatchFinaly (
+                match_block block,  match_block formalargument TODO : Idem ici,
+                match_block blockc, match_block blockfinally );; *)
+
+(*  | Elem ("local-variable", ["name",nomvar] , typ :: literal  :: []  ) -> a *)
+
+(*TODO TODO : Prendre en compte les switchs quand on aura amélioré le
+foutoir dans java2xml*)
+(*  | Elem( "switch" , [] , var :: lstSwitch ) -> Switch ( match_expression var, List.map) *)
+
 
 
 (*==========================================================================================*)
@@ -380,39 +500,71 @@ and match_expre_binaire = function
 (*==========================================================================================*)
 
 
-let rec bin_expre_to_lisaac = function
-        | Plus ( l , r) -> bin_expre_to_lisaac l ^" + "^bin_expre_to_lisaac r
-        | Moins ( l , r) -> bin_expre_to_lisaac l ^" - "^bin_expre_to_lisaac r
-        | Mult ( l , r) -> bin_expre_to_lisaac l ^" * "^bin_expre_to_lisaac r
-        | Div ( l , r) -> bin_expre_to_lisaac l ^" / "^bin_expre_to_lisaac r
-        | Modulo ( l , r) -> bin_expre_to_lisaac l ^" % "^bin_expre_to_lisaac r
-        | Puissance ( l , r) -> bin_expre_to_lisaac l ^" ** "^bin_expre_to_lisaac r
-        | EtBin ( l , r) -> bin_expre_to_lisaac l ^" & "^bin_expre_to_lisaac r
-        | OuBin ( l , r) -> bin_expre_to_lisaac l ^" | "^bin_expre_to_lisaac r
-        | EtLogic ( l , r) -> bin_expre_to_lisaac l ^" && "^bin_expre_to_lisaac r
-        | OuLogic ( l , r) -> bin_expre_to_lisaac l ^" || "^bin_expre_to_lisaac r
-        | OuExclusif ( l , r) -> bin_expre_to_lisaac l ^" ^ "^bin_expre_to_lisaac r
-
-        | DecG ( l , r) -> bin_expre_to_lisaac l ^" << "^bin_expre_to_lisaac r
-        | DecD ( l , r) -> bin_expre_to_lisaac l ^" >> "^bin_expre_to_lisaac r
-        | DecGZ ( l , r) -> bin_expre_to_lisaac l ^" <<< "^bin_expre_to_lisaac r
-        | DecDZ ( l , r) -> bin_expre_to_lisaac l ^" >>> "^bin_expre_to_lisaac r
-
-        | Affect ( l , r) -> bin_expre_to_lisaac l ^" := "^bin_expre_to_lisaac r
-        | SupEgal ( l , r) -> bin_expre_to_lisaac l ^" >= "^bin_expre_to_lisaac r
-        | SupStrict ( l , r) -> bin_expre_to_lisaac l ^" > "^bin_expre_to_lisaac r
-        | InfEgal ( l , r) -> bin_expre_to_lisaac l ^" <= "^bin_expre_to_lisaac r
-        | InfStrict ( l , r) -> bin_expre_to_lisaac l ^" < "^bin_expre_to_lisaac r
-        | EntreParenth ( l ) -> "( "^ bin_expre_to_lisaac l ^" ) "
+let rec block_list_to_stmt = function
+        | Block a -> a;;
+
+let rec block_to_lisaac = function
+        | Block  stl ->   String.concat ";" (List.map statement_to_lisaac stl)
+        | Block ([Rien]) -> "" 
+
+and caseThen_to_Lisaac = function 
+        | CaseThen (e, b) -> "{ "^expression_to_lisaac e^"}.when {"^block_to_lisaac b^"};\n\t"
+and statement_to_lisaac = function
+        | Expression e -> expression_to_lisaac e
+        | IfThenElse ( t , tc , fc ) -> "("^ expression_to_lisaac t ^").if 	{"^ block_to_lisaac tc ^"} else {  "^block_to_lisaac fc ^"};"
+        | IfThenElse ( t , tc , Block([Rien]) ) -> "("^ expression_to_lisaac t ^").if {"^ block_to_lisaac tc ^"};"
+        | While (e , blc ) -> "{ "^ expression_to_lisaac e ^ "}.while_do {	"^block_to_lisaac blc ^"};"
+        | TryCatchFinaly ( t  , l , c , f ) -> "{"^block_to_lisaac t^"}; // A revoir"
+        | Switch ( e , ebl, b ) -> expression_to_lisaac e ^ ".when {?? Mettre
+        l'expression ds chaque block}"^String.concat ";" (List.map caseThen_to_Lisaac ebl)
+        | Break -> "// Oula !!";
+        | For ( i , t , d , blc ) -> expression_to_lisaac i ^";"^ statement_to_lisaac ( While(  t, Block ( (Expression d)::( block_list_to_stmt blc) ) )   )
+        | Rien -> ""
+        (* | _  -> raise Stmt_exp e *)
+
+        (*| Local_variables *)
+
+and expression_to_lisaac = function
+        | Plus ( l , r) -> expression_to_lisaac l ^" + "^expression_to_lisaac r
+        | PlusPlusPost l -> expression_to_lisaac l ^" := "^expression_to_lisaac
+        l^" + 1 "
+        | Moins ( l , r) -> expression_to_lisaac l ^" - "^expression_to_lisaac r
+        | Mult ( l , r) -> expression_to_lisaac l ^" * "^expression_to_lisaac r
+        | Div ( l , r) -> expression_to_lisaac l ^" / "^expression_to_lisaac r
+        | Modulo ( l , r) -> expression_to_lisaac l ^" % "^expression_to_lisaac r
+        | Puissance ( l , r) -> expression_to_lisaac l ^" ** "^expression_to_lisaac r
+        | EtBin ( l , r) -> expression_to_lisaac l ^" & "^expression_to_lisaac r
+        | OuBin ( l , r) -> expression_to_lisaac l ^" | "^expression_to_lisaac r
+        | EtLogic ( l , r) -> expression_to_lisaac l ^" && "^expression_to_lisaac r
+        | OuLogic ( l , r) -> expression_to_lisaac l ^" || "^expression_to_lisaac r
+        | OuExclusif ( l , r) -> expression_to_lisaac l ^" ^ "^expression_to_lisaac r
+
+        | DecG ( l , r) -> expression_to_lisaac l ^" << "^expression_to_lisaac r
+        | DecD ( l , r) -> expression_to_lisaac l ^" >> "^expression_to_lisaac r
+        | DecGZ ( l , r) -> expression_to_lisaac l ^" <<< "^expression_to_lisaac r
+        | DecDZ ( l , r) -> expression_to_lisaac l ^" >>> "^expression_to_lisaac r
+
+        | Affect ( l , r) -> expression_to_lisaac l ^" := "^expression_to_lisaac r
+        | SupEgal ( l , r) -> expression_to_lisaac l ^" >= "^expression_to_lisaac r
+        | SupStrict ( l , r) -> expression_to_lisaac l ^" > "^expression_to_lisaac r
+        | InfEgal ( l , r) -> expression_to_lisaac l ^" <= "^expression_to_lisaac r
+        | InfStrict ( l , r) -> expression_to_lisaac l ^" < "^expression_to_lisaac r
+        | EntreParenth ( l ) -> "( "^ expression_to_lisaac l ^" ) "
         | VarRef (nom,info_typ) -> nom (*(match info_typ with Def_typ (n, m , c) -> n) *)
-        | Message (nom, receveur, arguments) -> bin_expre_to_lisaac receveur
-        ^"."^ nom ^"("^ (String.concat " " (List.map bin_expre_to_lisaac
+        | Message (nom, receveur, arguments) -> expression_to_lisaac receveur
+        ^"."^ nom ^"("^ (String.concat " " (List.map expression_to_lisaac
         arguments)) ^")"
-       (* | NewClassName ( def_type, lst_def_typ , expre) -> *)
-        | LiteralExpre (LiteralNombre a) -> a.value     
-        | This -> "Self";; 
-
-let rec def_typ_to_lisaac = function 
+        | NewClassName ( def_type, lst_def_typ , expre) -> def_typ_to_lisaac def_type ^"(A implem...) := "^    expression_to_lisaac expre
+        | NewClassName ( def_type, [] , expre) -> def_typ_to_lisaac def_type
+        ^" := "^ expression_to_lisaac expre
+        | LiteralExpre (LiteralNombre a) -> a.value  
+        | LiteralExpre (LiteralBool a) -> if a = true then "TRUE" else "FALSE"
+        | ThisCall e -> "Self."^expression_to_lisaac e
+        | LocalVariable ( n , f, g, e ) -> n ^ ":= "^ expression_to_lisaac e
+        | This -> "Self"
+        | _ -> "Erreur" 
+
+and  def_typ_to_lisaac = function 
         | Def_typ ( nom, is_primit , typs_generiq ) -> nom^"("^(String.concat "," (List.map  def_typ_to_lisaac typs_generiq))
         | Def_typ ( nom, is_primit , [] ) -> nom;;
 
@@ -420,15 +572,22 @@ let rec def_typ_to_lisaac = function
 (*let test_match_field = match_field var;;
 let test_substr = is_substring ("literal-number","literal");;
 let test_hash = ajoute_info ("class","test", typ);; *)
-
-#trace match_expre_binaire;;
+#trace match_block;;
+#trace match_statement;;
 #trace match_expression;;
+#trace match_switch_bloc;;
+#trace expression_to_lisaac;;
+#trace def_typ_to_lisaac;;
+#trace statement_to_lisaac;;
+#trace block_to_lisaac;;
+
+
 (*#trace match_field;;
 #trace recup_info_type_field;;
 #trace recup_info_literal;;
 #trace get_typ_info;; 
 #trace ajoute_info;; 
-#trace bin_expre_to_lisaac;; 
+#trace expression_to_lisaac;; 
 *)
 (*==========================================================================================*)
 (*================================          TESTS          =================================*)
@@ -442,11 +601,48 @@ ajoute_info ("class","view_pos_x", Def_typ ("viewx" , false , [] ));;
 ajoute_info ("class","COS_LOOK", Def_typ ("coslook" , false , [] ));;
 ajoute_info ("class","view_ang_y", Def_typ ("viewy" , false , [] ));;
 
-
-
-
-Hashtbl.find_all hash_variables ("class","ch");;
-
-let expre = match_expression bin_expr;; 
-bin_expre_to_lisaac expre;;
+ajoute_info ("class","dx", Def_typ ("dx" , false , [] ));; 
+ajoute_info ("class","dy", Def_typ ("dy" , false , [] ));;
+ajoute_info ("class","str", Def_typ ("str" , false , [] ));;
+ajoute_info ("class","FIXP_SHIFT", Def_typ ("FIXP" , false , [] ));;
+ajoute_info ("class","speed", Def_typ ("speed" , false , [] ));;
+ajoute_info ("class","view_pos_x", Def_typ ("viewx" , false , [] ));;
+ajoute_info ("class","COS_LOOK", Def_typ ("coslook" , false , [] ));;
+ajoute_info ("class","view_ang_y", Def_typ ("viewy" , false , [] ));
+(*examplebcl*)
+ajoute_info ("class","MAX_SPEED", Def_typ ("MAX_SPEED" , false , [] ));
+ajoute_info ("class","cursorKeyUp", Def_typ ("cursorKeyUp" , false , [] ));
+ajoute_info ("class","strafe", Def_typ ("strafe" , false , [] ));
+ajoute_info ("class","ANGLE_5", Def_typ ("ANGLE_5D" , false , [] ));
+ajoute_info ("class","toto", Def_typ ("toto" , false , [] ));
+ajoute_info ("class","y_", Def_typ ("y_" , false , [] ));
+ajoute_info ("class","ANGLE_360", Def_typ ("ANGLE_360" , false , [] ));
+ajoute_info ("class","Math", Def_typ ("Math" , false , [] ));
+ajoute_info ("class","off1", Def_typ ("off1" , false , [] ));
+ajoute_info ("class","key", Def_typ ("key" , false , [] ));
+ajoute_info ("class","Math", Def_typ ("Math" , false , [] ));
+ajoute_info ("class","ascend", Def_typ ("ascend" , false , [] ));
+
+ajoute_info ("class","heightMap", Def_typ ("heightMap" , false , [] ));
+ajoute_info ("class","heightMapRaw", Def_typ ("heightMapRaw" , false , [] ));
+ajoute_info ("class","mapping", Def_typ ("mapping" , false , [] ));
+ajoute_info ("class","mapWidth", Def_typ ("mapWidth" , false , [] ));
+ajoute_info ("class","mapHeight", Def_typ ("mapHeight" , false , [] ));
+ajoute_info ("class","colorMapRaw", Def_typ ("colorMapRaw" , false , [] ));
+ajoute_info ("class","colorMap", Def_typ ("colorMap" , false , [] ));
+ajoute_info ("class","t", Def_typ ("t" , false , [] ));
+ajoute_info ("class","grabber", Def_typ ("grabber" , false , [] ));
+ajoute_info ("class","skyTextureWidth", Def_typ ("skyTextureWidth" , false , [] ));
+ajoute_info ("class","skyTextureHeight", Def_typ ("skyTextureHeight" , false , [] ));
+ajoute_info ("class","skyTextureRaw", Def_typ ("skyTextureRaw" , false , [] ));
+ajoute_info ("class","skyTexture", Def_typ ("skyTexture" , false , [] ));
+(*Hashtbl.find_all hash_variables ("class","ch");; *)
+exception Stmt_exp of statement;;
+
+
+
+let stmt = match_block stm_expr;;
+block_to_lisaac stmt;; 
+(*let expre = match_expression bin_expr;; 
+expression_to_lisaac expre;; *)
 

-- 
applications.git



More information about the Lisaac-commits mailing list