From: Stefano Zacchiroli Date: Fri, 29 Nov 2002 11:26:58 +0000 (+0000) Subject: implemented saveResultToChannel X-Git-Tag: V_0_0_6~35 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=54c2dc43bd9a12dca1d4edacc4324acd7bd07f0d;p=helm.git implemented saveResultToChannel --- diff --git a/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/gdome_xslt.ml b/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/gdome_xslt.ml index 6ca611cb3..aa05777ab 100644 --- a/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/gdome_xslt.ml +++ b/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/gdome_xslt.ml @@ -4,7 +4,9 @@ * The code is largely based on the code of T.J. Mather's XML::GDOME::XSLT * Perl module (http://kobesearch.cpan.org/search?dist=XML-GDOME-XSLT) * - * Copyright (C) 2002 Claudio Sacerdoti Coen + * Copyright (C) 2002: + * Claudio Sacerdoti Coen + * Stefano Zacchiroli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +22,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * For more information, please send an email to + * For more information, please send an email to {sacerdot,zack}@cs.unibo.it *) let processStylesheet style = @@ -34,3 +36,11 @@ let applyStylesheet ~source ~stylesheet ~params = in new Gdome.document res ;; + +let saveResultToChannel ~outchan ~result ~stylesheet = + I_gdome_xslt.saveResultToChannel + ~outchan + ~result:result#as_Document + ~stylesheet +;; + diff --git a/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/gdome_xslt.mli b/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/gdome_xslt.mli index a67fdd61e..3c7c232ec 100644 --- a/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/gdome_xslt.mli +++ b/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/gdome_xslt.mli @@ -4,7 +4,9 @@ * The code is largely based on the code of T.J. Mather's XML::GDOME::XSLT * Perl module (http://kobesearch.cpan.org/search?dist=XML-GDOME-XSLT) * - * Copyright (C) 2002 Claudio Sacerdoti Coen + * Copyright (C) 2002: + * Claudio Sacerdoti Coen + * Stefano Zacchiroli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,19 +22,30 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * For more information, please send an email to + * For more information, please send an email to {sacerdot,zack}@cs.unibo.it *) -(* processStylesheet stylesheet *) -(* Process a stylesheet so that it can be subsequently used *) -(* with applyStylesheet. *) -val processStylesheet : - Gdome.document -> I_gdome_xslt.processed_stylesheet +(* processStylesheet stylesheet *) +(* Process a stylesheet so that it can be subsequently used *) +(* with applyStylesheet. *) +val processStylesheet: + Gdome.document -> + I_gdome_xslt.processed_stylesheet (* applyStylesheet source stylesheet params *) (* Applies a processed stylesheet to a source document, using *) (* the given list of parameters (couples name,value) *) -val applyStylesheet : +val applyStylesheet: source: Gdome.document -> stylesheet:I_gdome_xslt.processed_stylesheet -> - params:(string * string) list -> Gdome.document + params:(string * string) list -> + Gdome.document + +(* output the result of a previous XSLT transformation to an *) +(* output channel *) +val saveResultToChannel: + outchan: out_channel -> + result: Gdome.document -> + stylesheet: I_gdome_xslt.processed_stylesheet -> + unit + diff --git a/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/gdome_xslt_init.ml b/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/gdome_xslt_init.ml index 447f6c510..e7da4e02d 100644 --- a/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/gdome_xslt_init.ml +++ b/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/gdome_xslt_init.ml @@ -4,7 +4,9 @@ * The code is largely based on the code of T.J. Mather's XML::GDOME::XSLT * Perl module (http://kobesearch.cpan.org/search?dist=XML-GDOME-XSLT) * - * Copyright (C) 2002 Claudio Sacerdoti Coen + * Copyright (C) 2002: + * Claudio Sacerdoti Coen + * Stefano Zacchiroli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +22,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * For more information, please send an email to + * For more information, please send an email to {sacerdot,zack}@cs.unibo.it *) exception ProcessStylesheetException diff --git a/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/gdome_xslt_init.mli b/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/gdome_xslt_init.mli index 2d5278791..d3e6d670e 100644 --- a/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/gdome_xslt_init.mli +++ b/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/gdome_xslt_init.mli @@ -4,7 +4,9 @@ * The code is largely based on the code of T.J. Mather's XML::GDOME::XSLT * Perl module (http://kobesearch.cpan.org/search?dist=XML-GDOME-XSLT) * - * Copyright (C) 2002 Claudio Sacerdoti Coen + * Copyright (C) 2002: + * Claudio Sacerdoti Coen + * Stefano Zacchiroli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +22,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * For more information, please send an email to + * For more information, please send an email to {sacerdot,zack}@cs.unibo.it *) (**************************** WARNING!!! ***********************************) diff --git a/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/i_gdome_xslt.ml b/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/i_gdome_xslt.ml index c4f25e6c8..92f74da39 100644 --- a/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/i_gdome_xslt.ml +++ b/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/i_gdome_xslt.ml @@ -4,7 +4,9 @@ * The code is largely based on the code of T.J. Mather's XML::GDOME::XSLT * Perl module (http://kobesearch.cpan.org/search?dist=XML-GDOME-XSLT) * - * Copyright (C) 2002 Claudio Sacerdoti Coen + * Copyright (C) 2002: + * Claudio Sacerdoti Coen + * Stefano Zacchiroli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,12 +22,32 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * For more information, please send an email to + * For more information, please send an email to {sacerdot,zack}@cs.unibo.it *) type processed_stylesheet -external setXsltMaxDepth : int -> unit = "setXsltMaxDepth" +external setXsltMaxDepth: + int -> + unit + = "setXsltMaxDepth" + +external processStylesheet: + [> `Document] GdomeT.t -> + processed_stylesheet + = "ml_processStylesheet" + +external applyStylesheet: + source: [> `Document] GdomeT.t -> + stylesheet: processed_stylesheet -> + params: (string * string) list -> + TDocument.t + = "ml_applyStylesheet" + +external saveResultToChannel: + outchan: out_channel -> + result: TDocument.t -> + stylesheet: processed_stylesheet -> + unit + = "ml_saveResultToChannel" -external processStylesheet: [> `Document] GdomeT.t -> processed_stylesheet = "ml_processStylesheet" -external applyStylesheet : source:[> `Document] GdomeT.t -> stylesheet:processed_stylesheet -> params:(string * string) list -> TDocument.t = "ml_applyStylesheet" diff --git a/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/ml_gdome_xslt.c b/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/ml_gdome_xslt.c index e9af428a3..b6330868f 100644 --- a/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/ml_gdome_xslt.c +++ b/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/ml_gdome_xslt.c @@ -4,7 +4,9 @@ * The code is largely based on the code of T.J. Mather's XML::GDOME::XSLT * Perl module (http://kobesearch.cpan.org/search?dist=XML-GDOME-XSLT) * - * Copyright (C) 2002 Claudio Sacerdoti Coen + * Copyright (C) 2002: + * Claudio Sacerdoti Coen + * Stefano Zacchiroli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +22,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * For more information, please send an email to + * For more information, please send an email to {sacerdot,zack}@cs.unibo.it */ #include @@ -32,6 +34,7 @@ #include #include +#include "ocaml-io.h" #include "mlgdomevalue.h" #include "gdome_xslt.h" @@ -124,3 +127,17 @@ value ml_applyStylesheet(value source, value style, value params) } CAMLreturn(Val_Document(res)); } + +value ml_saveResultToChannel(value channel, + value result, + value stylesheet) +{ + CAMLparam3(channel, result, stylesheet); + + saveResultToFd((Channel(channel))->fd, + Document_val(result), + XsltStylesheetPtr_val(stylesheet)); + + CAMLreturn0; +} + diff --git a/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/ml_gdome_xslt.h b/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/ml_gdome_xslt.h index 6f12e4b11..974ad7d14 100644 --- a/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/ml_gdome_xslt.h +++ b/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/ml_gdome_xslt.h @@ -4,7 +4,9 @@ * The code is largely based on the code of T.J. Mather's XML::GDOME::XSLT * Perl module (http://kobesearch.cpan.org/search?dist=XML-GDOME-XSLT) * - * Copyright (C) 2002 Claudio Sacerdoti Coen + * Copyright (C) 2002: + * Claudio Sacerdoti Coen + * Stefano Zacchiroli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +22,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * For more information, please send an email to + * For more information, please send an email to {sacerdot,zack}@cs.unibo.it */ xsltStylesheetPtr XsltStylesheetPtr_val(value); @@ -28,3 +30,6 @@ value Val_XsltStylesheetPtr(xsltStylesheetPtr); value ml_processStylesheet(value style); value ml_applyStylesheet(value source, value style, value params); + +value ml_saveResultToChannel(value channel, value result, value stylesheet); +