[m-rev.] for review: separate mtogl from mercury_opengl

Julien Fischer juliensf at cs.mu.OZ.AU
Wed Dec 1 02:48:26 AEDT 2004


For review by anyone.

Estimated hours taken: 2
Branches: main

Separate mtogl completely from the OpenGL binding by
providing a separate mmakefile to build it (via mmake's
`-f' option).  This change means that it is no longer
necessary to have the Tcl/Tk binding around in order
to build the OpenGL binding (or at least that it's
no longer necessary to edit the Mmakefile when you
do want to build it without the Tcl/Tk binding).

Also, fix a bug in the implementation of mogl.push_attrib/3.

extras/graphics/mercury_opengl/Mmakefile:
	Remove the parts of this file related to building
	mtogl.  It now builds only the OpenGL binding.  Add
	some brief instructions on how to build the binding.

	Build the OpenGL binding using intermodule optimization.

extras/graphics/mercury_opengl/Mmakefile.mtogl:
	New file.  Shift the parts of the Mmakefile that
	relate to mtogl to this file.  mtogl can be built
	using the `-f' option to mmake.

extras/graphics/mercury_opengl/README:
	Refer users to the above files for instructions on
	how to build.

extras/graphics/mercury_opengl/mogl.m:
	Fix a bug in the predicate push_attrib/3.  There
	should have been a foreign proc called push_attrib_2/3
	but it was also called push_attrib/3.  The Mercury clauses
	were being ignored.

Julien.

Index: Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/graphics/mercury_opengl/Mmakefile,v
retrieving revision 1.4
diff -u -r1.4 Mmakefile
--- Mmakefile	13 Aug 2003 05:54:33 -0000	1.4
+++ Mmakefile	30 Nov 2004 15:14:11 -0000
@@ -1,41 +1,29 @@
+# To build the OpenGL binding, do the following:
+#
+# $ mmake depend
+# $ mmake
+#
+# After which you can install by ....
+#
+# $ mmake install

-MAIN_TARGET	= all
-
-MLOBJS-mtogl = togl.o
-
-# Don't issue a warning because mercury_opengl doesn't export anything.
-MCFLAGS-mercury_opengl = --no-warn-nothing-exported
-
-# Specify the location of the `mercury_tcltk' package.
-MERCURY_TCLTK_DIR 	= ../mercury_tcltk
-
-# Specify the version of Tcl/Tk.
-TCLTK_VERSION = 8.0
+MAIN_TARGET = libmercury_opengl

 # Specify what libraries we need to link against for OpenGL on this system.
 # (The following works on Debian with mesa as the OpenGL implementation).
 GL_LIBS = -lGL -lGLU -L/usr/X11R6/lib -lX11 -lXi -lXmu -lXt -lICE -lXext -lSM

-# Specify what libraries we need to link against for Tcl/Tk on this system.
-TCLTK_LIBS = -ltcl$(TCLTK_VERSION) -ltk$(TCLTK_VERSION) -ldl
+# Don't issue a warning because mercury_opengl doesn't export anything.
+MCFLAGS-mercury_opengl = --no-warn-nothing-exported

-# Tell mmake to use the `mercury_tcltk' library.
-VPATH 		= $(MERCURY_TCLTK_DIR):$(MMAKE_VPATH)
-MCFLAGS 	= -I$(MERCURY_TCLTK_DIR) $(EXTRA_MCFLAGS)
-MLFLAGS 	= -R$(MERCURY_TCLTK_DIR) $(EXTRA_MLFLAGS) \
-          	  -L$(MERCURY_TCLTK_DIR)
-MLLIBS 		= $(GL_LIBS) $(TCLTK_LIBS) $(EXTRA_MLLIBS)
-C2INITARGS 	= $(MERCURY_TCLTK_DIR)/mercury_tcltk.init
-
-# We may need to tell mmake where tcl.h and tk.h are.
-# If we are using Tcl/Tk version 8.0 on Debian the include directory
-# we need is `/usr/include/tcl8.0/generic'.
-CFLAGS = -I/usr/include/tcl$(TCLTK_VERSION)
+# This is necessary for a couple of predicatest that have not been
+# implemented completely.
+MCFLAGS-mogl = --no-warn-inferred-erroneous

-# We need to also access mtcltk.mh
-MGNUCFLAGS	= -I$(MERCURY_TCLTK_DIR)
+MCFLAGS = --halt-at-warn --intermodule-optimization

-depend: mercury_opengl.depend mtogl.depend
+MLLIBS 	= $(GL_LIBS) $(EXTRA_MLLIBS)

-all: libmtogl libmercury_opengl
+depend: mercury_opengl.depend

+install: libmercury_opengl.install
Index: Mmakefile.mtogl
===================================================================
RCS file: Mmakefile.mtogl
diff -N Mmakefile.mtogl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Mmakefile.mtogl	30 Nov 2004 15:15:11 -0000
@@ -0,0 +1,41 @@
+# To build mtogl, do the following
+# $ mmake -f Mmakefile.mtogl depend
+# $ mmake -f Mmakefile.mtogl
+#
+# After which you can install by ...
+#
+# $ mmake -f Mmakefile.mtogl install
+
+MAIN_TARGET = libmtogl
+
+MLOBJS-mtogl = togl.o
+
+# Specify the location of the `mercury_tcltk' package.
+MERCURY_TCLTK_DIR 	= ../mercury_tcltk
+
+# Specify the version of Tcl/Tk.
+TCLTK_VERSION = 8.0
+
+# Specify what libraries we need to link against for Tcl/Tk on this system.
+TCLTK_LIBS = -ltcl$(TCLTK_VERSION) -ltk$(TCLTK_VERSION) -ldl
+
+# Tell mmake to use the `mercury_tcltk' library.
+VPATH 		= $(MERCURY_TCLTK_DIR):$(MMAKE_VPATH)
+MCFLAGS 	= -I$(MERCURY_TCLTK_DIR) $(EXTRA_MCFLAGS)
+MLFLAGS 	= -R$(MERCURY_TCLTK_DIR) $(EXTRA_MLFLAGS) \
+          	  -L$(MERCURY_TCLTK_DIR)
+MLLIBS 		= $(TCLTK_LIBS) $(EXTRA_MLLIBS)
+C2INITARGS 	= $(MERCURY_TCLTK_DIR)/mercury_tcltk.init
+
+# We may need to tell mmake where tcl.h and tk.h are.
+# If we are using Tcl/Tk version 8.0 on Debian the include directory
+# we need is `/usr/include/tcl8.0/generic'.
+CFLAGS = -I/usr/include/tcl$(TCLTK_VERSION)
+
+# We need to also access mtcltk.mh
+MGNUCFLAGS	= -I$(MERCURY_TCLTK_DIR)
+
+depend: mtogl.depend
+
+install: libmtogl.install
+
Index: README
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/graphics/mercury_opengl/README,v
retrieving revision 1.2
diff -u -r1.2 README
--- README	13 Aug 2003 05:49:47 -0000	1.2
+++ README	30 Nov 2004 15:21:04 -0000
@@ -32,6 +32,9 @@
 	other .c and .h - Internals of Tk.
 	files

+See the file Mmakefile for instructions on how to build the OpenGL binding.
+The file Mmakefile.mtogl contains instructions on how to build mtogl.
+
 See HOWTO for details on how to link the package in with your own
 Mercury programs.

Index: mogl.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/graphics/mercury_opengl/mogl.m,v
retrieving revision 1.12
diff -u -r1.12 mogl.m
--- mogl.m	30 Nov 2004 14:54:39 -0000	1.12
+++ mogl.m	30 Nov 2004 15:01:00 -0000
@@ -4333,8 +4333,9 @@
 	Mask = server_attrib_group_flags[Flag];
 ").

+:- pred push_attrib_2(int::in, io::di, io::uo) is det.
 :- pragma foreign_proc("C",
-	push_attrib(Mask::in, IO0::di, IO::uo),
+	push_attrib_2(Mask::in, IO0::di, IO::uo),
 	[will_not_call_mercury, promise_pure],
 "
 	glPushAttrib((GLbitfield) Mask);

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