From 6feb4b76b332a68c1935a3cf42bef10eea88b670 Mon Sep 17 00:00:00 2001
From: Erwan Jahier <jahier@imag.fr>
Date: Wed, 20 Jan 2010 11:13:08 +0100
Subject: [PATCH] Fix the ec generator : extern functions and extern types were
 not dumped.

---
 Makefile            | 14 ++++++++++----
 src/lazyCompiler.ml | 19 ++++++++++++-------
 2 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile
index 5abd6b91..e54e84c2 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,8 @@
 
 
 
-all:
+all: nc
+lus2lic:
 	cd src; make nc ; make test
 
 .PHONY: diff test log
@@ -14,9 +15,14 @@ diff:
 log:
 	rm -f lv6.log; git log > lv6.log
 
+clean_src:
+	cd src ; make clean
 
-test:
+
+test_nc: 
 	cd src/test ; make test
+test: clean_src lus2lic test_nc
+
 test_ec:
 	cd src/test ; make test_ec
 test_lic:
@@ -35,7 +41,7 @@ utest_lv4:
 
 
 ci:src/version.ml
-	make alltest && git commit -F log && rm -f src/version.ml
+	make test && git commit -F log && rm -f src/version.ml
 
 cia:src/version.ml
-	make alltest && git commit -a -F log && rm -f src/version.ml
\ No newline at end of file
+	make test && git commit -a -F log && rm -f src/version.ml
\ No newline at end of file
diff --git a/src/lazyCompiler.ml b/src/lazyCompiler.ml
index 1c97b1d8..a5bf2866 100644
--- a/src/lazyCompiler.ml
+++ b/src/lazyCompiler.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 13/05/2009 (at 16:36) by Erwan Jahier> *)
+(** Time-stamp: <modified the 20/01/2010 (at 10:01) by Erwan Jahier> *)
 
 
 open Lxm
@@ -468,8 +468,8 @@ and (type_check_do: t -> Ident.long -> Lxm.t -> SymbolTab.t -> bool ->
         if 
           (not provide_flag) 
           && (not (!Global.expand_structs & is_struct_or_array)) 
-          && not !Global.ec (* ec does not need type decl at all *)
-        then
+(*           && not !Global.ec (* ec does not need type decl at all *) *)
+         then
           output_string !Global.oc (LicDump.type_decl type_name type_eff);
         type_eff
     )
@@ -671,7 +671,7 @@ and (node_check_do: t -> Eff.node_key -> Lxm.t -> SymbolTab.t ->
              raise (Compile_error(
                       lxm,
                       "\n*** '"^(Ident.string_of_idref id)^
-                        "': Unknown variable.\n*** Current variables are: " ^
+                        "': Unknown variable.\n*** Current variables are: " ^ 
                         (Hashtbl.fold
                            (fun id vi_eff acc ->
                               acc ^ (Format.sprintf 
@@ -1003,20 +1003,25 @@ and (node_check_do: t -> Eff.node_key -> Lxm.t -> SymbolTab.t ->
       if !Global.expand_nodes && is_main_node then NodesExpand.f local_env res
       else res
     in
+    let is_extern_oper = 
+      match res.def_eff with
+	| ExternEff | AbstractEff None -> true
+	| AbstractEff Some _ | BodyEff _ -> false
+    in
     let res_struct =
       if 
 	!Global.expand_structs 
 	&& not (res.is_polym_eff) 
 	&& ((not !Global.expand_nodes) || is_main_node) (* it is useless otherwise *)
-      then 
-	StructArrayExpand.node node_id_solver local_env res 
+      then
+	StructArrayExpand.node node_id_solver local_env res
       else 
 	res
     in
     let _ = UniqueOutput.check res node_def.src in
       if not provide_flag then 
         (
-          if not !Global.expand_nodes || is_main_node then
+          if not !Global.expand_nodes || is_extern_oper || is_main_node then
             if res.is_polym_eff then
               Polymorphism.push_on_polymorphic_node_stack (node_id_solver,local_env,res)
             else
-- 
GitLab