From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id FAA16463; Sun, 14 Oct 2001 05:14:20 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id FAA16303 for ; Sun, 14 Oct 2001 05:14:19 +0200 (MET DST) Received: from verdot.inria.fr (verdot.inria.fr [128.93.11.7]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f9E3EIj26663 for ; Sun, 14 Oct 2001 05:14:18 +0200 (MET DST) Received: (from ddr@localhost) by verdot.inria.fr (8.9.3/8.9.3) id FAA05013 for caml-list@inria.fr; Sun, 14 Oct 2001 05:14:18 +0200 Date: Sun, 14 Oct 2001 05:14:18 +0200 From: Daniel de Rauglaudre To: caml-list@inria.fr Subject: Re: [Caml-list] Some suggested improvements to the Graphics and Bigarray modules Message-ID: <20011014051418.A4994@verdot.inria.fr> References: <20011009233142.A10140@gogol.zorgol> <20011012170200.G18676@pauillac.inria.fr> <20011012173824.A6595@gogol.zorgol> <20011012191534.I32576@verdot.inria.fr> <20011014011625.A6069@gogol.zorgol> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20011014011625.A6069@gogol.zorgol>; from berke@altern.org on Sun, Oct 14, 2001 at 01:16:25AM +0200 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, On Sun, Oct 14, 2001 at 01:16:25AM +0200, Berke Durak wrote: > Erm, I couldn't use both Bigarrays and Streams under 3.03 ALPHA. Tried > '-pp camlp4o'. Grepped 'bigarray' in ocaml-3.03-alpha/camlp4, > unsuccessfully. Am I missing something ? Sorry, I meant it is fixed in the CVS version. Here is the patch: Index: camlp4/etc/pa_o.ml =================================================================== diff -c -r1.12 -r1.13 *** camlp4/etc/pa_o.ml 2001/10/09 16:39:04 1.12 --- camlp4/etc/pa_o.ml 2001/10/12 15:35:41 1.13 *************** *** 10,16 **** (* *) (***********************************************************************) ! (* $Id: pa_o.ml,v 1.12 2001/10/09 16:39:04 ddr Exp $ *) open Stdpp; open Pcaml; --- 10,16 ---- (* *) (***********************************************************************) ! (* $Id: pa_o.ml,v 1.13 2001/10/12 15:35:41 ddr Exp $ *) open Stdpp; open Pcaml; *************** *** 292,297 **** --- 292,323 ---- | _ -> None ] ; + value bigarray_get loc arr arg = + let coords = + match arg with + [ <:expr< ($list:el$) >> -> el + | _ -> [arg] ] + in + match coords with + [ [c1] -> <:expr< Bigarray.Array1.get $arr$ $c1$ >> + | [c1; c2] -> <:expr< Bigarray.Array2.get $arr$ $c1$ $c2$ >> + | [c1; c2; c3] -> <:expr< Bigarray.Array3.get $arr$ $c1$ $c2$ $c3$ >> + | coords -> <:expr< Bigarray.Genarray.get $arr$ [| $list:coords$ |] >> ] + ; + + value bigarray_set loc var newval = + match var with + [ <:expr< Bigarray.Array1.get $arr$ $c1$ >> -> + Some <:expr< Bigarray.Array1.set $arr$ $c1$ $newval$ >> + | <:expr< Bigarray.Array2.get $arr$ $c1$ $c2$ >> -> + Some <:expr< Bigarray.Array2.set $arr$ $c1$ $c2$ $newval$ >> + | <:expr< Bigarray.Array3.get $arr$ $c1$ $c2$ $c3$ >> -> + Some <:expr< Bigarray.Array3.set $arr$ $c1$ $c2$ $c3$ $newval$ >> + | <:expr< Bigarray.Genarray.get $arr$ [| $list:coords$ |] >> -> + Some <:expr< Bigarray.Genarray.set $arr$ [| $list:coords$ |] $newval$ >> + | _ -> None ] + ; + (* ...works bad... value rec sync cs = match cs with parser *************** *** 498,504 **** | ":=" NONA [ e1 = SELF; ":="; e2 = expr LEVEL "expr1" -> <:expr< $e1$.val := $e2$ >> ! | e1 = SELF; "<-"; e2 = expr LEVEL "expr1" -> <:expr< $e1$ := $e2$ >> ] | "||" RIGHTA [ e1 = SELF; "or"; e2 = SELF -> <:expr< $lid:"or"$ $e1$ $e2$ >> | e1 = SELF; "||"; e2 = SELF -> <:expr< $e1$ || $e2$ >> ] --- 524,533 ---- | ":=" NONA [ e1 = SELF; ":="; e2 = expr LEVEL "expr1" -> <:expr< $e1$.val := $e2$ >> ! | e1 = SELF; "<-"; e2 = expr LEVEL "expr1" -> ! match bigarray_set loc e1 e2 with ! [ Some e -> e ! | None -> <:expr< $e1$ := $e2$ >> ] ] | "||" RIGHTA [ e1 = SELF; "or"; e2 = SELF -> <:expr< $lid:"or"$ $e1$ $e2$ >> | e1 = SELF; "||"; e2 = SELF -> <:expr< $e1$ || $e2$ >> ] *************** *** 570,575 **** --- 599,605 ---- | "simple" LEFTA [ e1 = SELF; "."; "("; e2 = SELF; ")" -> <:expr< $e1$ .( $e2$ ) >> | e1 = SELF; "."; "["; e2 = SELF; "]" -> <:expr< $e1$ .[ $e2$ ] >> + | e1 = SELF; "."; "{"; e2 = SELF; "}" -> bigarray_get loc e1 e2 | e1 = SELF; "."; e2 = SELF -> <:expr< $e1$ . $e2$ >> | "!"; e = SELF -> <:expr< $e$ . val>> | f = [ op = "~-" -> op | op = "~-." -> op | op = prefixop -> op ]; -- Daniel de RAUGLAUDRE daniel.de_rauglaudre@inria.fr http://cristal.inria.fr/~ddr/ ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr