(* Copyright (C) 2000, HELM Team. * * This file is part of HELM, an Hypertextual, Electronic * Library of Mathematics, developed at the Computer Science * Department, University of Bologna, Italy. * * HELM is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * HELM is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HELM; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. * * For details, see the HELM World-Wide-Web page, * http://cs.unibo.it/helm/. *) (* AUTOR: Ferruccio Guidi *) type arity_t = Const of int | Positive | Any type eval_spec = {eval : MathQL.query -> MathQL.result; conn : MQIConn.handle } type text_out_spec = {out : string -> unit; path : (string -> unit) -> MathQL.path -> unit; query : (string -> unit) -> string -> MathQL.query -> unit; result : (string -> unit) -> string -> MathQL.result -> unit } type text_in_spec = {result_in : Lexing.lexbuf -> MathQL.result} val fun_arity : MathQL.path -> int -> int -> unit val fun_eval : eval_spec -> text_out_spec -> text_in_spec -> MathQL.path -> MathQL.path list -> MathQL.query list -> MathQL.result val fun_txt_out : text_out_spec -> MathQL.path -> MathQL.path list -> MathQL.query list -> unit val gen_arity : MathQL.path -> int -> unit val gen_eval : eval_spec -> MathQL.path -> MathQL.query list -> MathQL.query exception ArityError of MathQL.path * arity_t * int exception NameError of MathQL.path type std_text_out_spec = {s_out : string -> unit; s_path : MathQL.path -> unit; s_query : MathQL.query -> unit; s_result : MathQL.result -> unit } val std : text_out_spec -> std_text_out_spec (* function registration ****************************************************) type fun_spec = {arity_p : arity_t; arity_s : arity_t; body : eval_spec -> text_out_spec -> text_in_spec -> MathQL.path list -> MathQL.query list -> MathQL.result; txt_out : text_out_spec -> MathQL.path list -> MathQL.query list -> unit } val fun_register : MathQL.path -> fun_spec -> unit val fun_arity0 : MathQL.path -> string -> MathQL.result -> fun_spec val fun_arity1 : MathQL.path -> string -> (MathQL.result -> MathQL.result) -> fun_spec val fun_arity2 : MathQL.path -> string -> (MathQL.result -> MathQL.result -> MathQL.result) -> fun_spec val out_txt2 : std_text_out_spec -> string -> MathQL.query -> MathQL.query -> unit val out_txt_ : std_text_out_spec -> MathQL.path -> MathQL.query list -> unit val out_txt_full : std_text_out_spec -> MathQL.path -> MathQL.path list -> MathQL.query list -> unit (* generator registration ***************************************************) type gen_spec = {arity : arity_t; code : eval_spec -> MathQL.query list -> MathQL.query } val gen_register : MathQL.path -> gen_spec -> unit