Commits

Justin Hsu  committed efbd4ad Merge

merged master

  • Participants
  • Parent commits e8b901f, 52aa6dd
  • Branches mergin

Comments (0)

Files changed (3)

 (* let ()  = reset ~until:3 () *)
 
 let _ =
-  try 
-    while true do 
-      (* List.iter parse_instruction_eoi lines *)
-      let line = read_line () in
-      let ()  =  prerr_endline line in
-      parse_instruction_eoi line
-    done
-  with
-    End_of_file ->
-      prerr_endlinef "finished"
-        
+
+  let () = reset ~until:5 () in
+  let file_name = Sys.argv.(1) in
+  if Sys.file_exists file_name then 
+    let chan = open_in file_name in
+    try      
+      while true do 
+        (* List.iter parse_instruction_eoi lines *)
+        let line = input_line chan in 
+        let ()  =  prerr_endline line in
+        parse_instruction_eoi line
+      done
+    with
+      End_of_file ->
+        prerr_endlinef "finished"
+  else 
+    prerr_endlinef "file %snot exists" file_name
 
 then you will see a link to DSL_util.byte
 
-         ./DSL_util.byte < leader_sce.ml
+         ./DSL_util.byte  leader_sce.ml
          or type line by line to check
          leader_sce.ml is a very *complex* scenario, it will generate more than
          3000 messages.
          (alice bob marry) 1000 interval 0.00
          means the three guys will take turns to speak, with interval 0.00
          (so concurrency happens here), and do it 1000 times
-         
+
          the log is in the same directory, after it finished,
          i.e,
          alice.log, alice.err.log

File leader_elect.sce

 time 1
 alice via bob
 time 1
-(alice bob  marry )   1000 interval 0.00  
+(alice bob  marry )   10 interval 0.03  
 alice: "bob !!"
 time 1
  (* test leader election *)