[m-rev.] for review: changes for mercury_opengl

Julien Fischer juliensf at students.cs.mu.OZ.AU
Mon Aug 11 16:49:12 AEST 2003


On Mon, 11 Aug 2003, Fergus Henderson wrote:

> On 11-Aug-2003, Julien Fischer <juliensf at students.cs.mu.OZ.AU> wrote:
> >
> > Index: mercury_opengl/mglu.m
...
>
> It would be nicer to use `pragma foreign_type' to declare
> that the `quadric' type is `GLUquadric *', rather than
> adding lots of casts everywhere.
>
Done.

diff -u mercury_opengl/mglu.m mercury_opengl/mglu.m
--- mercury_opengl/mglu.m	11 Aug 2003 04:45:20 -0000
+++ mercury_opengl/mglu.m	11 Aug 2003 06:44:34 -0000
@@ -122,7 +122,7 @@

 %------------------------------------------------------------------------------%

-:- type quadric == c_pointer.
+:- pragma foreign_type("C", quadric, "GLUquadric *").

 :- func quadric_normals_to_int(quadric_normals) = int.

@@ -185,13 +185,13 @@
 bool_to_int(no) = 0.

 :- pragma c_code(new_quadric(Q::out, IO0::di, IO::uo), "
-	Q = (MR_Word)gluNewQuadric();
+	Q = gluNewQuadric();
 	IO = IO0;
 ").


 :- pragma c_code(delete_quadric(Q::in, IO0::di, IO::uo), "
-	gluDeleteQuadric((GLUquadric *)Q);
+	gluDeleteQuadric(Q);
 	IO = IO0;
 ").

@@ -204,7 +204,7 @@
 :- mode quadric_draw_style2(in, in, di, uo) is det.

 :- pragma c_code(quadric_draw_style2(Q::in, S::in, IO0::di, IO::uo), "
-	gluQuadricDrawStyle((GLUquadric *)Q, quadric_draw_style_flags[S]);
+	gluQuadricDrawStyle(Q, quadric_draw_style_flags[S]);
 	IO = IO0;
 ").

@@ -215,7 +215,7 @@
 :- mode quadric_orientation2(in, in, di, uo) is det.

 :- pragma c_code(quadric_orientation2(Q::in, O::in, IO0::di, IO::uo), "
-	gluQuadricOrientation((GLUquadric *)Q, quadric_orientation_flags[O]);
+	gluQuadricOrientation(Q, quadric_orientation_flags[O]);
 	IO = IO0;
 ").

@@ -227,7 +227,7 @@
 :- mode quadric_normals2(in, in, di, uo) is det.

 :- pragma c_code(quadric_normals2(Q::in, N::in, IO0::di, IO::uo), "
-	gluQuadricNormals((GLUquadric *)Q, quadric_normals_flags[N]);
+	gluQuadricNormals(Q, quadric_normals_flags[N]);
 	IO = IO0;
 ").

@@ -239,27 +239,27 @@

 :- pragma c_code(quadric_texture2(Q::in, B::in, IO0::di, IO::uo), "
-	gluQuadricTexture((GLUquadric *)Q, B);
+	gluQuadricTexture(Q, B);
 	IO = IO0;
 ").

 :- pragma c_code(cylinder(Q::in, BR::in, TR::in, H::in, SL::in, ST::in,
 			IO0::di, IO::uo), "
-	gluCylinder((GLUquadric *)Q, BR, TR, H, SL, ST);
+	gluCylinder(Q, BR, TR, H, SL, ST);
 	IO = IO0;
 ").

 :- pragma c_code(sphere(Q::in, R::in, SL::in, ST::in, IO0::di, IO::uo), "
-	gluSphere((GLUquadric *)Q, R, SL, ST);
+	gluSphere(Q, R, SL, ST);
 	IO = IO0;
 ").

 :- pragma c_code(disk(Q::in, IR::in, OR::in, S::in, L::in, IO0::di, IO::uo), "
-	gluDisk((GLUquadric *)Q, IR, OR, S, L);
+	gluDisk(Q, IR, OR, S, L);
 	IO = IO0;
 ").

 :- pragma c_code(partial_disk(Q::in, IR::in, OR::in, S::in, L::in, STA::in,
 			SWA::in, IO0::di, IO::uo), "
-	gluPartialDisk((GLUquadric *)Q, IR, OR, S, L, STA, SWA);
+	gluPartialDisk(Q, IR, OR, S, L, STA, SWA);
 	IO = IO0;
 ").
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list