From b329198101dd7134de87d00f55e121d326577510 Mon Sep 17 00:00:00 2001
From: Erwan Jahier <jahier@imag.fr>
Date: Thu, 6 Mar 2008 15:51:47 +0100
Subject: [PATCH] Add a flush in the Verbose.print so that the non-reg test are
 not sensible to flushing, which is painful.

---
 src/test/test.res.exp | 118 +++++++++++++++++++++---------------------
 src/verbose.ml        |   4 +-
 2 files changed, 61 insertions(+), 61 deletions(-)

diff --git a/src/test/test.res.exp b/src/test/test.res.exp
index bafc9738..0fd4cd27 100644
--- a/src/test/test.res.exp
+++ b/src/test/test.res.exp
@@ -637,136 +637,136 @@ End of Syntax table dump. 
 
 *** SyntaxTab.create pass 1
 *** SyntaxTab.create pass 2
-    init pack dummy
-       export node fold_left
-       export node consensus
-       export node bt_void
+    init pack P1
+       export const y
+       export type titi
 *** SyntaxTab.create pass 3
-   init symbol tables for pack dummy
+   init symbol tables for pack P1
 *** SyntaxTab.create done
 *** « Syntax table dump:
  	 - Package or model list:
-		t1 (pack) 
+		P1 (pack) 
 		
 	 - Raw model table: 
-	 - Raw Package table: dummy 
-	 - Package manager table: dummy 
+	 - Raw Package table: P1 
+	 - Package manager table: P1 
 End of Syntax table dump. »
--- MAIN NODE: "t1::main"
+-- MAIN NODE: "P1::main"
 *** Dump the exported items of the packages.
- * package dummy
+ * package P1
 	Exported types:
+		type P1::titi = P1::titi
 	Exported constants:
+		const P1::y = 3
 	Exported nodes:
- ### skipping fold_left
- ### skipping consensus
- ### skipping bt_void
 *** SyntaxTab.create pass 1
 *** SyntaxTab.create pass 2
     init pack dummy
-       export node fold_left
-       export node consensus_6_bis
-       export node consensus_6
-       export node consensus_bis
-       export node consensus
+       export node trivial
 *** SyntaxTab.create pass 3
    init symbol tables for pack dummy
 *** SyntaxTab.create done
 *** « Syntax table dump:
  	 - Package or model list:
-		t2 (pack) 
+		trivial (pack) 
 		
 	 - Raw model table: 
 	 - Raw Package table: dummy 
 	 - Package manager table: dummy 
 End of Syntax table dump. »
--- MAIN NODE: "t2::main"
+-- MAIN NODE: "trivial::main"
 *** Dump the exported items of the packages.
  * package dummy
 	Exported types:
 	Exported constants:
 	Exported nodes:
- ### skipping fold_left
-		node dummy::consensus_6_bis = dummy::fold_left<<type bool, type bool, const 6, operator and>>(bool, bool^6) returns (bool) on clock XXX
-
-		node dummy::consensus_6 = dummy::consensus_6(bool^6) returns (bool) on clock XXX
+		node dummy::trivial = dummy::trivial(int) returns (int) on clock XXX
 
- ### skipping consensus_bis
- ### skipping consensus
 *** SyntaxTab.create pass 1
 *** SyntaxTab.create pass 2
-    init pack P1
-       export const y
-       export type titi
+    init pack dummy
+       export const B
+       export node map2
+       export node toto
 *** SyntaxTab.create pass 3
-   init symbol tables for pack P1
+   init symbol tables for pack dummy
 *** SyntaxTab.create done
 *** « Syntax table dump:
  	 - Package or model list:
-		P1 (pack) 
+		t (pack) 
 		
 	 - Raw model table: 
-	 - Raw Package table: P1 
-	 - Package manager table: P1 
+	 - Raw Package table: dummy 
+	 - Package manager table: dummy 
 End of Syntax table dump. »
--- MAIN NODE: "P1::main"
+-- MAIN NODE: "t::main"
 *** Dump the exported items of the packages.
- * package P1
+ * package dummy
 	Exported types:
-		type P1::titi = P1::titi
 	Exported constants:
-		const P1::y = 3
+		const dummy::B = [2, 2]
 	Exported nodes:
+ ### skipping map2
+		node dummy::toto = dummy::toto(bool) returns (int^2^3, int^2) on clock XXX
+
 *** SyntaxTab.create pass 1
 *** SyntaxTab.create pass 2
     init pack dummy
-       export node trivial
+       export node fold_left
+       export node consensus
+       export node bt_void
 *** SyntaxTab.create pass 3
    init symbol tables for pack dummy
 *** SyntaxTab.create done
 *** « Syntax table dump:
  	 - Package or model list:
-		trivial (pack) 
+		t1 (pack) 
 		
 	 - Raw model table: 
 	 - Raw Package table: dummy 
 	 - Package manager table: dummy 
 End of Syntax table dump. »
--- MAIN NODE: "trivial::main"
+-- MAIN NODE: "t1::main"
 *** Dump the exported items of the packages.
  * package dummy
 	Exported types:
 	Exported constants:
 	Exported nodes:
-		node dummy::trivial = dummy::trivial(int) returns (int) on clock XXX
-
+ ### skipping fold_left
+ ### skipping consensus
+ ### skipping bt_void
 *** SyntaxTab.create pass 1
 *** SyntaxTab.create pass 2
     init pack dummy
-       export const B
-       export node map2
-       export node toto
+       export node fold_left
+       export node consensus_6_bis
+       export node consensus_6
+       export node consensus_bis
+       export node consensus
 *** SyntaxTab.create pass 3
    init symbol tables for pack dummy
 *** SyntaxTab.create done
 *** « Syntax table dump:
  	 - Package or model list:
-		t (pack) 
+		t2 (pack) 
 		
 	 - Raw model table: 
 	 - Raw Package table: dummy 
 	 - Package manager table: dummy 
 End of Syntax table dump. »
--- MAIN NODE: "t::main"
+-- MAIN NODE: "t2::main"
 *** Dump the exported items of the packages.
  * package dummy
 	Exported types:
 	Exported constants:
-		const dummy::B = [2, 2]
 	Exported nodes:
- ### skipping map2
-		node dummy::toto = dummy::toto(bool) returns (int^2^3, int^2) on clock XXX
+ ### skipping fold_left
+		node dummy::consensus_6_bis = dummy::fold_left<<type bool, type bool, const 6, operator and>>(bool, bool^6) returns (bool) on clock XXX
 
+		node dummy::consensus_6 = dummy::consensus_6(bool^6) returns (bool) on clock XXX
+
+ ### skipping consensus_bis
+ ### skipping consensus
 *** SyntaxTab.create pass 1
 *** SyntaxTab.create pass 2
     init pack dummy
@@ -1484,9 +1484,9 @@ End of Syntax table dump. 
  * package dummy
 	Exported types:
 	Exported constants:
+	Exported nodes:
 *** Error in file "should_work/call/call01.lus", line 2, col 13 to 23, token 'Lustre::and': unknown node
 
-	Exported nodes:
 		node dummy::call01 = dummy::call01(bool, bool) returns (bool) on clock XXX
 
 *** Error in file "should_work/call/call03.lus", line 2, col 18 to 19, token 'or': syntax error
@@ -1514,9 +1514,9 @@ End of Syntax table dump. 
  * package dummy
 	Exported types:
 	Exported constants:
+	Exported nodes:
 *** Error in file "should_work/call/call04.lus", line 4, col 13 to 15, token 'map': unknown node
 
-	Exported nodes:
 *** SyntaxTab.create pass 1
 *** SyntaxTab.create pass 2
     init pack dummy
@@ -1591,9 +1591,9 @@ End of Syntax table dump. 
  * package dummy
 	Exported types:
 	Exported constants:
+	Exported nodes:
 *** Error in file "should_work/call/call02.lus", line 2, col 13 to 23, token 'Lustre::and': unknown node
 
-	Exported nodes:
 *** Error in file "should_work/packEnvTest/contractForElementSelectionInArray/main.lus", line 3, col 45 to 45, token '=': syntax error
 
 *** SyntaxTab.create pass 1
@@ -5037,9 +5037,9 @@ End of Syntax table dump. 
 	Exported types:
 	Exported constants:
 		const dummy::SIZE = 3
+	Exported nodes:
 *** Error in file "should_work/demo/alias.lus", line 39, col 23 to 33, token 'Lustre::not': unknown node
 
-	Exported nodes:
 		node dummy::aliasGivenNode = dummy::unNoeud(int, int^3) returns (int) on clock XXX
 
 *** SyntaxTab.create pass 1
@@ -5639,13 +5639,13 @@ End of Syntax table dump. 
 *** Dump the exported items of the packages.
  * package dummy
 	Exported types:
+	Exported constants:
 *** Error in file "should_fail/semantics/x.lus", line 4, col 7 to 7, token 'm': recursion loop detected:
    > const ref in file "should_fail/semantics/x.lus", line 4, col 11 to 11, token 'x'
    > const ref in file "should_fail/semantics/x.lus", line 6, col 11 to 11, token 't'
    > const ref in file "should_fail/semantics/x.lus", line 8, col 11 to 11, token 'n'
    > const ref in file "should_fail/semantics/x.lus", line 2, col 11 to 11, token 'm'
 
-	Exported constants:
 *** SyntaxTab.create pass 1
 *** SyntaxTab.create pass 2
     init pack dummy
@@ -5866,10 +5866,10 @@ End of Syntax table dump. 
  * package dummy
 	Exported types:
 	Exported constants:
+	Exported nodes:
 *** Error in file "dummy", line 0, col 0 to 0, token 'dummy': recursion loop detected:
    > node ref in file "should_fail/semantics/bad_call01.lus", line 2, col 13 to 16, token 'titi'
 
-	Exported nodes:
 *** Error in file "should_fail/semantics/bad_call03.lus", line 2, col 18 to 18, token '+': syntax error
 
 *** SyntaxTab.create pass 1
@@ -5899,9 +5899,9 @@ End of Syntax table dump. 
 	Exported types:
 		type dummy::t2 = bool^7^8^9^10
 		type dummy::t = bool^3^4
+	Exported constants:
 *** Error in file "should_fail/semantics/tranche.lus", line 7, col 6 to 6, token 'n': can't eval constant: external constant not allowed (in file "should_fail/semantics/tranche.lus", line 7, col 6 to 6, token 'n')
 
-	Exported constants:
 *** SyntaxTab.create pass 1
 *** SyntaxTab.create pass 2
     init pack dummy
@@ -5942,9 +5942,9 @@ End of Syntax table dump. 
 		type dummy::t6 = int^3^6^3^2^12
 		type dummy::t7 = int^3^6^3^2^12^3
 		type dummy::t8 = int^3^6^3^2^12^3^3
+	Exported constants:
 *** Error in file "should_fail/semantics/const2.lus", line 4, col 13 to 16, token 'when': can't eval constant: operation when not allowed in static expression
 
-	Exported constants:
 		const dummy::c10 = 12
 *** Error in file "should_fail/clock/clock.lus", line 6, col 1 to 4, token 'node': syntax error
 
@@ -6000,7 +6000,7 @@ End of Syntax table dump. 
 		type dummy::t6 = int^3^7^8^9^3
 		type dummy::t7 = int^3^7^8^9^3^8
 		type dummy::t8 = int^3^7^8^9^3^8^8
+	Exported constants:
 *** Error in file "should_fail/type/const2.lus", line 16, col 12 to 13, token '<>': can't eval constant: type combination error, t*t for some type t expected
 
-	Exported constants:
 		const dummy::c10 = 3
diff --git a/src/verbose.ml b/src/verbose.ml
index 9761f4ea..0a278b55 100644
--- a/src/verbose.ml
+++ b/src/verbose.ml
@@ -31,10 +31,10 @@ let get_level () = !_level
 
 (**** VERSION PAS TROP GORE *****)
 let printf ?(level=1) s = Printf.kprintf
-  (fun t -> if (!_level >= level) then (print_string t) else ()) s
+  (fun t -> if (!_level >= level) then (print_string t; flush stdout) else ()) s
 
 let print_string ?(level=1) s = 
-  if (!_level >= level) then (print_string s)
+  if (!_level >= level) then (print_string s; flush stdout)
 
 
 (**** VERSION GORE *****)
-- 
GitLab