Skip to content

Commit

Permalink
Replaced Pervasives.xxx by Stdlib.xxx
Browse files Browse the repository at this point in the history
  • Loading branch information
jserot committed Sep 16, 2019
1 parent 046b290 commit a502190
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 191 deletions.
5 changes: 4 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changes

## 0.6 (Aug, 18, 2019)
## 0.6.0 (Sep, 16, 2019)
* minor rewritings for ocaml >= 4.08

## 0.6-alpha (Aug, 18, 2019)
* removed dependency on camlp4 by rewriting the Fsm_expr, Fsm and ListExt parsers
* dunified build and install process

Expand Down
3 changes: 0 additions & 3 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
- check build and use on Win32 (required for building RFSM) and update HOWTO
- use dune watermarking for VERSION, HOMEPAGE, etc..
- rewrite for ocaml 4.08 (revise Utils)
- "classical" operations (product, union, ...) for NFAs and DFAs
- Kripke structures
- Buchi automata
Expand Down
4 changes: 2 additions & 2 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
(authors "Jocelyn Sérot <jocelyn.serot@uca.fr>")
(maintainers "Jocelyn Sérot <jocelyn.serot@uca.fr>")
(bug_reports "jocelyn.serot@uca.fr")
(homepage "github.com/jserot/lascar")
(homepage "http://github.com/jserot/lascar")
(documentation "http://jserot.github.io/lascar")

(package
Expand All @@ -14,6 +14,6 @@
(description "A library for manipulating Labeled Transition Systems in OCaml")
(depends
(dune (>= 1.11))
(ocaml (>= 4.06))))
(ocaml (>= 4.08))))

(generate_opam_files true)
153 changes: 0 additions & 153 deletions lascar.install

This file was deleted.

6 changes: 3 additions & 3 deletions src/lib/builtins.ml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@

module Int = struct
type t = int
let compare = Pervasives.compare
let compare = Stdlib.compare
let to_string = string_of_int
end

module String = struct
type t = string
let compare = Pervasives.compare
let compare = Stdlib.compare
let to_string x = x
end

module Bool = struct
type t = bool
let compare = Pervasives.compare
let compare = Stdlib.compare
let to_string = string_of_bool
end
2 changes: 1 addition & 1 deletion src/lib/fsm.ml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ module Transition = struct

type t = Condition.t list * Action.t list

let compare = Pervasives.compare
let compare = Stdlib.compare

let to_string (conds,acts) =
let s1 = ListExt.to_string Condition.to_string ", " conds in
Expand Down
6 changes: 3 additions & 3 deletions src/lib/lts.ml
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ struct
let attr_of s q = ()

let create ~states:qs ~itrans:ts0 ~trans:ts =
empty |> (function s -> List.fold_left (Misc.flip add_state) s qs)
|> (function s -> List.fold_left (Misc.flip add_transition) s ts)
|> (function s -> List.fold_left (Misc.flip add_itransition) s ts0)
empty |> (function s -> List.fold_left (Fun.flip add_state) s qs)
|> (function s -> List.fold_left (Fun.flip add_transition) s ts)
|> (function s -> List.fold_left (Fun.flip add_itransition) s ts0)

let states s = Repr.states s
let istates s = Repr.istates s
Expand Down
8 changes: 4 additions & 4 deletions src/lib/ltsa.ml
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ struct
{ s with irel = H.add q l s.irel }

let create ~states:qs ~itrans:ts0 ~trans:ts =
empty |> (function s -> List.fold_left (Misc.flip add_state) s qs)
|> (function s -> List.fold_left (Misc.flip add_transition) s ts)
|> (function s -> List.fold_left (Misc.flip add_itransition) s ts0)
empty |> (function s -> List.fold_left (Fun.flip add_state) s qs)
|> (function s -> List.fold_left (Fun.flip add_transition) s ts)
|> (function s -> List.fold_left (Fun.flip add_itransition) s ts0)

let states s = s.states
let states' s = H.bindings s.attrs
Expand Down Expand Up @@ -294,7 +294,7 @@ struct
let node_id i = name ^ "_" ^ string_of_int i in
let ini_id = name ^ "_ini" in
let extra_id j = name ^ "_extra" ^ string_of_int j in
let extra_idxs = ListExt.range Misc.id 0 (List.length extra_nodes -1) in
let extra_idxs = ListExt.range Fun.id 0 (List.length extra_nodes -1) in
let ndescs, nbn =
fold_states
(fun s a (acc,n) ->
Expand Down
2 changes: 1 addition & 1 deletion src/lib/moore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module BVal =
Valuation.Make(
struct
type t = bool
let compare = Pervasives.compare
let compare = Stdlib.compare
let to_string = function true -> "1" | false -> "0"
end)

Expand Down
8 changes: 4 additions & 4 deletions src/lib/valuation.ml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct
let assoc n vs = List.assoc n vs

let compare vs1 vs2 =
let module S = Set.Make (struct type t = name * value let compare = Pervasives.compare end) in
let module S = Set.Make (struct type t = name * value let compare = Stdlib.compare end) in
S.compare (S.of_list vs1) (S.of_list vs2)

let of_list l = l
Expand All @@ -63,7 +63,7 @@ struct
let names_of v = List.map fst v

let check names v =
let module S = Set.Make (struct type t = string let compare = Pervasives.compare end) in
let module S = Set.Make (struct type t = string let compare = Stdlib.compare end) in
if not (S.equal (S.of_list names) (S.of_list (names_of v))) then raise (Invalid_valuation v)

end
Expand All @@ -72,14 +72,14 @@ module Bool =
Make(
struct
type t = bool
let compare = Pervasives.compare
let compare = Stdlib.compare
let to_string = function true -> "1" | false -> "0"
end)

module Int =
Make(
struct
type t = int
let compare = Pervasives.compare
let compare = Stdlib.compare
let to_string = string_of_int
end)
12 changes: 6 additions & 6 deletions src/utils/listExt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ let rec union l1 l2 = match l1, l2 with
else if r < 0 then x1 :: union xs1 l2 (* x1 < x2 *)
else x2 :: union l1 xs2 (* x1 > x2 *)

let merge ?(cmp=Pervasives.compare) l1 l2 =
let merge ?(cmp=Stdlib.compare) l1 l2 =
let rec h l1 l2 = match l1, l2 with
[], [] -> []
| l1, [] -> l1
Expand Down Expand Up @@ -102,27 +102,27 @@ let rec power n l =
if n = 0 then [[]]
else flat_map (function l' -> List.map (function x -> x::l') l) (power (n-1) l)

let assoc ?(cmp=Pervasives.compare) k l =
let assoc ?(cmp=Stdlib.compare) k l =
let rec h = function
[] -> raise Not_found
| (k',v)::l -> if cmp k k' = 0 then v else h l in
h l

let mem_assoc ?(cmp=Pervasives.compare) k l =
let mem_assoc ?(cmp=Stdlib.compare) k l =
let rec h = function
| [] -> false
| (k',_)::l -> cmp k k' = 0 || h l in
h l

let update_assoc ?(cmp=Pervasives.compare) f k v l =
let update_assoc ?(cmp=Stdlib.compare) f k v l =
let rec h = function
| [] -> []
| (k',v')::rest -> let v'' = if cmp k k' = 0 then f v' v else v' in (k',v'') :: h rest in
h l

let replace_assoc ?(cmp=Pervasives.compare) k v l = update_assoc ~cmp:cmp (fun _ v -> v) k v l
let replace_assoc ?(cmp=Stdlib.compare) k v l = update_assoc ~cmp:cmp (fun _ v -> v) k v l

let partition ?(cmp=Pervasives.compare) l =
let partition ?(cmp=Stdlib.compare) l =
List.fold_left
(fun acc (x,y) ->
if List.mem_assoc x acc
Expand Down
4 changes: 0 additions & 4 deletions src/utils/misc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ type ('a, 'b) either =
| Snd of 'b
| Both of 'a * 'b

let flip f x y = f y x

let id x = x

let max x y = if x > y then x else y
let min x y = if x < y then x else y

Expand Down
6 changes: 0 additions & 6 deletions src/utils/misc.mli
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ val log2 : int -> int

val time_of_day : unit -> string

val flip: ('a -> 'b -> 'c) -> 'b -> 'a -> 'c
(** [flip f x y] is [f y x] *)

val id: 'a -> 'a
(** [id x] is [x] *)

val max: 'a -> 'a -> 'a
val min: 'a -> 'a -> 'a

Expand Down

0 comments on commit a502190

Please sign in to comment.