caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Daniel de Rauglaudre <daniel.de_rauglaudre@inria.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Some suggested improvements to the Graphics and Bigarray modules
Date: Sun, 14 Oct 2001 05:14:18 +0200	[thread overview]
Message-ID: <20011014051418.A4994@verdot.inria.fr> (raw)
In-Reply-To: <20011014011625.A6069@gogol.zorgol>; from berke@altern.org on Sun, Oct 14, 2001 at 01:16:25AM +0200

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


      reply	other threads:[~2001-10-14  3:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-09 21:31 Berke Durak
2001-10-09 23:21 ` [Caml-list] " Christopher Quinn
2001-10-10  0:52 ` [Caml-list] " Jeff Henrikson
2001-10-10  7:04   ` Chris Hecker
2001-10-10 19:47     ` Jeff Henrikson
2001-10-11  0:50       ` John Prevost
2001-10-12 14:29 ` Jun P. FURUSE
2001-10-12 15:02 ` Xavier Leroy
2001-10-12 15:38   ` Berke Durak
2001-10-12 17:15     ` Daniel de Rauglaudre
2001-10-13 23:16       ` Berke Durak
2001-10-14  3:14         ` Daniel de Rauglaudre [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20011014051418.A4994@verdot.inria.fr \
    --to=daniel.de_rauglaudre@inria.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).