src/Tools/isac/Frontend/states.sml
changeset 59405 49d7d410b83c
parent 59279 255c853ea2f0
child 59489 cfcbcac0bae8
     1.1 --- a/src/Tools/isac/Frontend/states.sml	Tue Mar 13 15:04:27 2018 +0100
     1.2 +++ b/src/Tools/isac/Frontend/states.sml	Thu Mar 15 10:17:44 2018 +0100
     1.3 @@ -140,9 +140,9 @@
     1.4  
     1.5  (* holds calculations; these are read/updated from the java-frontend at each interaction*)
     1.6  val states = Synchronized.var "isac_states" ([] :
     1.7 -  (calcID *            (* the id unique for a calculation                               *)
     1.8 +  (Celem.calcID *      (* the id unique for a calculation                               *)
     1.9      (Chead.calcstate * (* the interpreter state                                         *) 
    1.10 -      (iterID *        (* 1 sets the 'active formula': a calc. can have several visitors*)
    1.11 +      (Celem.iterID *  (* 1 sets the 'active formula': a calc. can have several visitors*)
    1.12          Ctree.pos'     (* for iterator of a user                                        *)
    1.13        (* TODO iterID * pos' should go to java-frontend                                  *)
    1.14    ) list)) list);
    1.15 @@ -183,11 +183,11 @@
    1.16  val it = 1 : calcID
    1.17  *)
    1.18  (* add users to a calcstate *)
    1.19 -fun get_iterID (cI:calcID) 
    1.20 -	       (p:(calcID * (Chead.calcstate * (iterID * Ctree.pos') list)) list) = 
    1.21 +fun get_iterID (cI: Celem.calcID) 
    1.22 +	       (p: (Celem.calcID * (Chead.calcstate * (Celem.iterID * Ctree.pos') list)) list) = 
    1.23    case assoc (p, cI) of
    1.24      NONE => error ("get_iterID: no iterID " ^ (string_of_int cI))
    1.25 -  | SOME (_, us) => (new_key us 1):iterID;
    1.26 +  | SOME (_, us) => (new_key us 1): Celem.iterID;
    1.27  (* get_iterID 3 (!states);
    1.28  val it = 2 : iterID*)
    1.29  
    1.30 @@ -207,11 +207,11 @@
    1.31  fun get_state (uI:iterID) (pI:calcID) = get_cal uI pI (!states);
    1.32  fun get_calc  (uI:iterID) (pI:calcID) = (snd o (get_cal uI pI)) (!states);
    1.33  *)
    1.34 -fun get_calc  (cI:calcID) = 
    1.35 +fun get_calc  (cI: Celem.calcID) = 
    1.36      case assoc (Synchronized.value states, cI) of 
    1.37  	NONE => error ("get_calc "^(string_of_int cI)^" not existent")
    1.38        | SOME (c, _) => c;
    1.39 -fun get_pos (cI:calcID) (uI:iterID) = 
    1.40 +fun get_pos (cI: Celem.calcID) (uI: Celem.iterID) = 
    1.41      case assoc (Synchronized.value states, cI) of 
    1.42  	NONE => error ("get_pos: calc " ^ (string_of_int cI) 
    1.43  			     ^ " not existent")
    1.44 @@ -249,7 +249,7 @@
    1.45  > !states;
    1.46  val it = [(4,[(#,#)]),(1,[(#,#)])] : states
    1.47  *)
    1.48 -fun del_assoc2 (cI:calcID) (uI:iterID) ps =
    1.49 +fun del_assoc2 (cI: Celem.calcID) (uI: Celem.iterID) ps =
    1.50      case assoc (ps, cI) of
    1.51  	NONE => ps
    1.52        | SOME (cs, us) => 
    1.53 @@ -267,7 +267,7 @@
    1.54      handle _ => error ("overwrite2 " ^ (string_of_int uI) ^
    1.55  			      " " ^ (string_of_int pI) ^ " not existent")
    1.56    end;*)
    1.57 -fun overwrite2 (ps, (((cI:calcID), (uI:iterID)), p)) =
    1.58 +fun overwrite2 (ps, (((cI: Celem.calcID), (uI: Celem.iterID)), p)) =
    1.59      case assoc (ps, cI) of
    1.60  	NONE => 
    1.61  	error ("overwrite2: calc " ^ (string_of_int uI) ^" not existent")
    1.62 @@ -281,7 +281,7 @@
    1.63      | SOME (_, us) => 
    1.64        Synchronized.change states (fn s => overwrite ...)
    1.65  *)
    1.66 -fun upd_calc (cI:calcID) cs = Synchronized.change states
    1.67 +fun upd_calc (cI: Celem.calcID) cs = Synchronized.change states
    1.68          (fn s => case assoc (s, cI) of 
    1.69  	          NONE => error ("upd_calc " ^ (string_of_int cI) ^ " not existent")
    1.70            | SOME (_, us) => overwrite (s, (cI, (cs, us))));
    1.71 @@ -301,7 +301,7 @@
    1.72     let val (p, (ptp,_)) = get_state uI pI 
    1.73     in states:= 
    1.74        overwrite2 ((!states), ((uI, pI), (p, (ptp, tacis)))) end;*)
    1.75 -fun upd_tacis (cI:calcID) tacis = Synchronized.change states
    1.76 +fun upd_tacis (cI: Celem.calcID) tacis = Synchronized.change states
    1.77          (fn s => case assoc (s, cI) of 
    1.78  	          NONE => 
    1.79  	            error ("upd_tacis: calctree " ^ (string_of_int cI) ^ " not existent")
    1.80 @@ -310,7 +310,7 @@
    1.81  fun upd_ipos (uI:iterID) (pI:calcID) (ip:pos') =
    1.82     let val (_, calc) = get_state uI pI 
    1.83     in states:= overwrite2 ((!states), ((uI, pI), (ip, calc))) end;*)
    1.84 -fun upd_ipos (cI:calcID) (uI:iterID) (ip: Ctree.pos') = Synchronized.change states
    1.85 +fun upd_ipos (cI: Celem.calcID) (uI: Celem.iterID) (ip: Ctree.pos') = Synchronized.change states
    1.86          (fn s => case assoc (s, cI) of 
    1.87  	          NONE =>
    1.88  	            error ("upd_ipos: calctree " ^ (string_of_int cI) ^ " not existent")
    1.89 @@ -343,19 +343,19 @@
    1.90      let val (new_calcID, new_calcs) = add_pID uI s (!states)
    1.91      in states:= new_calcs; 
    1.92      new_calcID end; *)
    1.93 -fun add_user (cI:calcID) = Synchronized.change_result states
    1.94 +fun add_user (cI: Celem.calcID) = Synchronized.change_result states
    1.95          (fn s => case assoc (s, cI) of 
    1.96  	          NONE =>
    1.97  	            error ("add_user: calctree " ^ (string_of_int cI) ^ " not existent")
    1.98            | SOME (cs, us) =>
    1.99  	            let
   1.100                  val new_uI = new_key us 1
   1.101 -	            in (new_uI:iterID, overwrite2 (s, ((cI, new_uI), Ctree.e_pos'))) end);
   1.102 +	            in (new_uI: Celem.iterID, overwrite2 (s, ((cI, new_uI), Ctree.e_pos'))) end);
   1.103  
   1.104  (*///10.10.
   1.105  fun del_calc (uI:iterID) (pI:calcID) = 
   1.106      (states:= del_assoc2 uI pI (!states); pI);*)
   1.107 -fun del_user (cI:calcID) (uI:iterID) =
   1.108 +fun del_user (cI: Celem.calcID) (uI: Celem.iterID) =
   1.109        Synchronized.change_result states (fn s => (uI, del_assoc2 cI uI s));
   1.110  
   1.111  
   1.112 @@ -366,14 +366,14 @@
   1.113  fun add_calc (cs: Chead.calcstate) = Synchronized.change_result states
   1.114          (fn s =>
   1.115              let val new_cI = new_key s 1
   1.116 -            in (new_cI:calcID, s @ [(new_cI, (cs, []))]) end);
   1.117 +            in (new_cI: Celem.calcID, s @ [(new_cI, (cs, []))]) end);
   1.118  
   1.119  (* delete doesn't report non existing elements *)
   1.120  (*///7.10
   1.121  fun del_user (uI:userID) = 
   1.122      (states:= del_assoc (!states, uI); uI);*)
   1.123 -fun del_calc (cI:calcID) = Synchronized.change_result states
   1.124 -        (fn s => (cI:calcID, del_assoc (s, cI)));
   1.125 +fun del_calc (cI: Celem.calcID) = Synchronized.change_result states
   1.126 +        (fn s => (cI: Celem.calcID, del_assoc (s, cI)));
   1.127  
   1.128  (* -------------- test all exported funs -------------- 
   1.129  ///7.10