From 01d7f77f65c3a2b83978b1f00c87b54f00647816 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Wed, 25 Oct 2017 14:50:32 +0200 Subject: Update sheet traversal --- scTypes.mli | 64 ++++++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 51 insertions(+), 13 deletions(-) (limited to 'scTypes.mli') diff --git a/scTypes.mli b/scTypes.mli index 1d8fe54..17b51eb 100755 --- a/scTypes.mli +++ b/scTypes.mli @@ -6,32 +6,70 @@ type cell = (int * int) * (bool * bool) type ident = UTF8.t -type types = - | Num of Num.num * (UTF8.t option) (** A number *) - | Str of UTF8.t (** A string *) - | Date of Num.num (** A date in julian day *) - | Bool of bool (** A boolean *) +type 'a number_format = (float -> 'a, Format.formatter, unit) format + +type 'a dataFormat = + | Date: DataType.Num.t dataFormat (* A date in julian day *) + | Number: DataType.Num.t dataFormat (* Number *) + | String: DataType.String.t dataFormat (* String result, there is only one representation *) + | Bool: DataType.Bool.t dataFormat (* Boolean result *) + +type 'a returnType = + | Num : DataType.Num.t dataFormat option -> DataType.Num.t returnType (** A number *) + | Str : DataType.String.t returnType (** A string *) + | Bool : DataType.Bool.t returnType (** A boolean *) + +type numericType = + | Date + | Number + +val get_numeric_type: DataType.Num.t dataFormat -> numericType + +type 'a types = + | Num : DataType.Num.t dataFormat * DataType.Num.t -> DataType.Num.t types (** A number *) + | Str : DataType.String.t -> DataType.String.t types (** A string *) + | Bool : DataType.Bool.t -> DataType.Bool.t types (** A boolean *) + +type typeContainer = + | Value: 'a types -> typeContainer + + +(** Numeric (any format) *) +val f_num: DataType.Num.t returnType + +(** Date *) +val f_date: DataType.Num.t returnType + +(** Number *) +val f_number: DataType.Num.t returnType + +(** Boolean result *) +val f_bool: DataType.Bool.t returnType + +(** String *) +val f_string: DataType.String.t returnType type refs = | Cell of cell (** A cell *) | Range of cell * cell (** An area of cells *) +(** This is the cell content *) type expression = - | Value of types (** A direct value *) - | Ref of refs (** A reference to another cell *) - | Call of ident * expression list (** A call to a function *) - | Expression of expression (** An expression *) + | Value : 'a types -> expression (** A direct value *) + | Ref : refs -> expression (** A reference to another cell *) + | Call : ident * expression list -> expression (** A call to a function *) + | Expression : expression -> expression (** An expression *) (** Result from a computation *) type result = - | Result of types - | Error of exn + | Result : 'a types -> result + | Error : exn -> result module Type : sig - val (=) : types -> types -> bool + val (=) : 'a types -> 'b types -> bool - val show: UTF8.Buffer.buffer -> types -> unit + val show: UTF8.Buffer.buffer -> 'a types -> unit end -- cgit v1.2.3