Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re: problems compiling lablGL-0.94 polymorphic variants #2513

Closed
vicuna opened this issue Jul 2, 2000 · 2 comments
Closed

Re: problems compiling lablGL-0.94 polymorphic variants #2513

vicuna opened this issue Jul 2, 2000 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Jul 2, 2000

Original bug ID: 152
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Hi,

Thank you for your message to the Caml mailing list.

However your message seems to be a bug report; hence I send it to the
relevant mailing list

caml-bugs@inria.fr

Thank again for your interest in Caml.

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://cristal.inria.fr/~weis/

proff@foo:/src/caml/lablGL-0.94$ make
ocamlc -c -labels -I /usr/local/lib/ocaml/labltk gl.ml
The implementation gl.ml does not match the interface gl.cmi:
Values do not match:
val format_size : #format[>luminance_alpha rgb `rgba] -> int
is not included in
val format_size : #format -> int
make: *** [gl.cmo] Error 2
proff@foo:/src/caml/lablGL-0.94$ ocamlc -v
The Objective Caml compiler, version 3.00+8 (2000-06-30)
Standard library directory: /usr/local/lib/ocaml

@vicuna
Copy link
Author

vicuna commented Jul 3, 2000

Comment author: administrator

proff@foo:/src/caml/lablGL-0.94$ make
ocamlc -c -labels -I /usr/local/lib/ocaml/labltk gl.ml
The implementation gl.ml does not match the interface gl.cmi:
Values do not match:
val format_size : #format[>luminance_alpha rgb `rgba] -> int
is not included in
val format_size : #format -> int
make: *** [gl.cmo] Error 2
proff@foo:/src/caml/lablGL-0.94$ ocamlc -v
The Objective Caml compiler, version 3.00+8 (2000-06-30)
Standard library directory: /usr/local/lib/ocaml

Such things may happen when you are using bleeding edge versions of the
compiler.

Polymorphic variant typing has changed a bit, to become safer and more
usable in everyday programming.
In particular, open matches (matches containing a wild card default) are
now given a lower bound, rather than no bound at all.

Here is a patch correcting these problems:
Index: gl.ml

RCS file: /staff2/garrigue/repos/lablGL/gl.ml,v
retrieving revision 1.23
diff -u -r1.23 gl.ml
--- gl.ml 1999/11/15 09:55:03 1.23
+++ gl.ml 2000/07/03 02:43:26
@@ -19,12 +19,13 @@
type clampf = float
type short = int
type kind = [bitmap|byte|float|int|short|ubyte|uint|ushort]
+type real_kind = [byte|float|int|short|ubyte|uint|`ushort]

type format =
[alpha|blue|color_index|depth_component|green|luminance
|luminance_alpha|red|rgb|rgba|`stencil_index]
-let format_size (format : #format) =

  • match format with
    +let format_size (#format as f) =
  • match f with
    rgba -> 4 | rgb -> 3
    | `luminance_alpha -> 2
    Index: glPix.ml
    ===================================================================
    RCS file: /staff2/garrigue/repos/lablGL/glPix.ml,v
    retrieving revision 1.6
    retrieving revision 1.7
    diff -u -r1.6 -r1.7
    --- glPix.ml 2000/04/12 07:40:25 1.6
    +++ glPix.ml 2000/06/12 07:27:29 1.7
    @@ -4,16 +4,17 @@

type ('a,'b) t = { format: 'a ; width: int ; height:int ; raw: 'b Raw.t }

-let create (k : #Gl.kind) ~format ~width ~height =
+let create k ~format ~width ~height =
let size = format_size format * width * height in

  • let len = match k with `bitmap -> (size-1)/8+1 | _ -> size in
  • let len = match k with `bitmap -> (size-1)/8+1 | #Gl.real_kind -> size in
    let raw = Raw.create k ~len:(width * height * format_size format) in
    { format = format; width = width; height = height; raw = raw }

let of_raw raw ~format ~width ~height =
let size = format_size format * width * height
and len = Raw.length raw in

  • let len = match Raw.kind raw with `bitmap -> len * 8 | _ -> len in
  • let len =
  • match Raw.kind raw with `bitmap -> len * 8 | #Gl.real_kind -> len in
    if size > len then invalid_arg "GlPix.of_raw";
    { format = format; width = width; height = height; raw = raw }

@@ -25,7 +26,7 @@
let raw_pos img =
let width =
match Raw.kind img.raw with `bitmap -> (img.width-1)/8+1

  • | _ -> img.width
  • | #Gl.real_kind -> img.width
    in
    let stride = format_size img.format in
    let line = stride * width in
    Index: gluMisc.ml
    ===================================================================
    RCS file: /staff2/garrigue/repos/lablGL/gluMisc.ml,v
    retrieving revision 1.3
    retrieving revision 1.4
    diff -u -r1.3 -r1.4
    --- gluMisc.ml 2000/04/12 07:40:25 1.3
    +++ gluMisc.ml 2000/06/06 02:15:35 1.4
    @@ -29,7 +29,7 @@
    format:#Gl.format ->
    w:int -> h:int -> data:#kind Raw.t ->
    w:int -> h:int -> data:#kind Raw.t -> unit
  • = "ml_gluScaleImage"
  • = "ml_gluScaleImage_bc" "ml_gluScaleImage"
    let scale_image ~width ~height img =
    let k = Raw.kind (to_raw img) and format = format img in
    let new_img = GlPix.create k ~format ~height ~width in
    Index: gl.mli
    ===================================================================
    RCS file: /staff2/garrigue/repos/lablGL/gl.mli,v
    retrieving revision 1.17
    retrieving revision 1.18
    diff -u -r1.17 -r1.18
    --- gl.mli 1999/11/15 09:55:04 1.17
    +++ gl.mli 2000/06/12 07:27:29 1.18
    @@ -17,6 +17,7 @@
    type clampf = float
    type short = int
    type kind = [bitmap|byte|float|int|short|ubyte|uint|ushort]
    +type real_kind = [byte|float|int|short|ubyte|uint|`ushort]

type format =
[alpha|blue|color_index|depth_component|green|luminance

@vicuna
Copy link
Author

vicuna commented Jul 3, 2000

Comment author: administrator

LablGL to modify.

@vicuna vicuna closed this as completed Jul 3, 2000
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant