[m-rev.] diff: use intialise declaration in GLUT binding

Julien Fischer juliensf at cs.mu.OZ.AU
Thu Oct 6 19:24:57 AEST 2005


Estimated hours taken: 0.1
Branches: main

Provide an example of how to use an initialise declaration in a library
binding.

extras/graphics/mercury_glut/glut.m:
	Use an initialise declaration to automatically initialise the GLUT
	binding.

extras/graphics/samples/gears/gears.m:
extras/graphics/samples/maze/maze.m:
	Conform to the above change.

Julien.

Index: mercury_glut/glut.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/graphics/mercury_glut/glut.m,v
retrieving revision 1.5
diff -u -r1.5 glut.m
--- mercury_glut/glut.m	8 Aug 2005 07:13:21 -0000	1.5
+++ mercury_glut/glut.m	6 Oct 2005 09:18:23 -0000
@@ -35,13 +35,8 @@

 %-----------------------------------------------------------------------------%
 %
-% Initialisation.
+% Initialisation
 %
-	% Initialise the GLUT library.
-	% You must call this before calling any other GLUT procedures.
-	% The program will abort if there is an error.
-	%
-:- pred glut.init(io::di, io::uo) is det.

 :- type display_mode
 	--->	rgba
@@ -90,7 +85,7 @@

 %-----------------------------------------------------------------------------%
 %
-% State retrieval.
+% State retrieval
 %

 	% Return the number of milliseconds since GLUT was initialised (or
@@ -161,7 +156,11 @@
 	#endif
 ").

+:- initialise glut.init/2.
+
 %-----------------------------------------------------------------------------%
+
+:- pred glut.init(io::di, io::uo) is det.

 :- pragma foreign_proc("C",
 	glut.init(IO0::di, IO::uo),
Index: samples/gears/gears.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/graphics/samples/gears/gears.m,v
retrieving revision 1.3
diff -u -r1.3 gears.m
--- samples/gears/gears.m	29 Jun 2005 05:21:44 -0000	1.3
+++ samples/gears/gears.m	6 Oct 2005 09:19:50 -0000
@@ -63,7 +63,6 @@
 :- pred gears.main_2(int::in, io::di, io::uo) is det.

 gears.main_2(Limit, !IO) :-
-	glut.init(!IO),
 	glut.init_display_mode([rgba, depth, double], !IO),
 	glut.window.create("Gears", !IO),

Index: samples/maze/maze.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/graphics/samples/maze/maze.m,v
retrieving revision 1.5
diff -u -r1.5 maze.m
--- samples/maze/maze.m	29 Jun 2005 05:21:45 -0000	1.5
+++ samples/maze/maze.m	6 Oct 2005 09:20:39 -0000
@@ -117,7 +117,6 @@
 :- pred maze.main_2(maze::in, io::di, io::uo) is det.

 maze.main_2(Maze, !IO) :-
-	glut.init(!IO),
 	glut.init_display_mode([double, rgba], !IO),
 	glut.init_window_size(300, 300, !IO),
 	glut.window.create("Maze", !IO),


--------------------------------------------------------------------------
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