From bb48738c4111f5f4e2faa40fe67ae1b8b9d7c2eb Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Wed, 29 Nov 2017 15:51:39 +0100 Subject: Rework on the Sheet.ml API : removed low level functions, made the sheet mutable --- src/sheet.mli | 81 ++++++++++++++--------------------------------------------- 1 file changed, 19 insertions(+), 62 deletions(-) (limited to 'src/sheet.mli') diff --git a/src/sheet.mli b/src/sheet.mli index 14856d4..169932e 100755 --- a/src/sheet.mli +++ b/src/sheet.mli @@ -1,80 +1,37 @@ (** This module represent a sheet *) type cell = int * int - -module Raw: sig - type t - - (** An empty sheet *) - val empty: t - - (** Add a new value in the sheet. The previous value is replaced - @return All the successors to update and the new sheet. - *) - val add: cell -> Expression.t -> Functions.C.t -> t -> Cell.Set.t * t - - val remove: cell -> Functions.C.t -> t -> Cell.Set.t * t +type t - (** Get the value content. - @return None if the cell is not defined - *) - val get_value: cell -> t -> ScTypes.Result.t option - - val get_expr: cell -> t -> Expression.t +(** Crate an empty sheet. *) +val create: Functions.C.t -> t - val get_sink: cell -> t -> Cell.Set.t - - (** Fold over all the defined values *) - val fold: ('a -> cell -> (Expression.t * ScTypes.Result.t ) -> 'a) -> 'a -> t -> 'a - -end - -type yank -type history - -type t = { - selected: Selection.t; (* The selected cell *) - data: Raw.t; - history: history; (* Unlimited history *) - yank: yank list; (* All the selected cells *) - catalog: Functions.C.t -} - -type search = [ - | `Pattern of ScTypes.Result.t option - | `Next - | `Previous -] - -(** Undo the last action and return the previous state, if any *) -val undo: t -> t option +(** Add or update the sheet. + The expression is added at given position. + @return A set containing all updated cells. *) +val add: history:bool -> Expression.t -> cell -> t -> Cell.Set.t -(** Move the cursor in one direction, return the state updated if the move is - allowed *) -val move: Actions.direction -> t -> t option +(** Undo the last action and return true if something has been undone *) +val undo: t -> bool (** Delete the content of selected cells. @return The sheet and the number of cells deleted *) -val delete: t -> t * int +val delete: Selection.t -> t -> int (** Copy the selected cells @return The sheet and the number of cells deleted *) -val yank: t -> t * int - -(** Search for a pattern on the sheet - @return The state updated if the pattern has been found. *) -val search: search -> t -> t option +val yank: Selection.t -> t -> int -val paste: t -> t * int +(** Paste all the selection at the given position. *) +val paste: cell -> t -> int -(** Add or update the sheet. - The expression is added at current selection. - @return A set containing all updated cells, and the tree updated. *) -val add: Expression.t -> t -> Cell.Set.t * t - -(** Create an empty sheet *) -val create: Functions.C.t -> Raw.t -> t +(** Fold over all the defined values *) +val fold: ('a -> cell -> (Expression.t * ScTypes.Result.t) -> 'a) -> 'a -> t -> 'a +(** Get the content from a cell. + Also return all the other cell pointing to it. +*) +val get_cell: cell -> t -> Expression.t * ScTypes.Result.t option * Cell.Set.t -- cgit v1.2.3