[m-rev.] for review: changes for mercury_opengl
Julien Fischer
juliensf at students.cs.mu.OZ.AU
Mon Aug 11 16:15:56 AEST 2003
Estimated hours taken: 14.
Branches: main.
Remove dependency between mercury_opengl and mercury_tcltk by making
mtogl a separate library.
Modify togl so that it works with Tcl/Tk 8.0.5
(XXX It doesn't work (easily) with versions of Tcl/Tk greater than 8.0,
we probably ought to consider using togl 1.6 at some point).
Add some casts and missing MR_* prefixes.
Modify mtogl to use the new foreign language interface and remove
references to header files that are no longer generated by the compiler.
extras/graphics/README:
Mention the `mtogl' package.
extras/graphics/mercury_opengl/mercury_opengl.m:
extras/graphics/mercury_opengl/mglu.m:
extras/graphics/mercury_opengl/mogl.m:
Remove mtogl from mercury_opengl package.
Add some casts.
Add some missing MR_* prefixes.
extras/graphics/mercury_opengl/mtogl:
Remove references to header files that are no longer generated
by the compiler.
Use the new foreign language interface.
Add some missing MR_* prefixes.
extras/graphics/mercury_opengl/togl.c:
Allow the use of tk version 8.0.5
extras/graphics/mercury_opengl/tkInt8.0p5.h:
New file. (This is a part of tk - I haven't included it in the
diff).
extras/graphics/mercury_opengl/Mmakefile:
Update mmakefile to reflect above changes.
extras/graphics/mercury_opengl/README:
Mention mtogl.
extras/graphics/samples/calc/calc.m:
Add some missing underscores; this prevents compiler warnings
when compiling with intermodule-optimization enabled.
extras/graphics/samples/maze/Mmakefile:
extras/graphics/samples/pent/Mmakefile:
Update mmakefiles to reflect above changes.
Index: README
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/graphics/README,v
retrieving revision 1.3
diff -u -r1.3 README
--- README 29 Sep 1998 05:57:14 -0000 1.3
+++ README 11 Aug 2003 05:51:43 -0000
@@ -7,8 +7,10 @@
mercury_tcltk/ A Mercury binding to Tcl/Tk.
- mercury_opengl/ A Mercury binding to OpenGL (or the
- free alternative, Mesa).
+ mercury_opengl/ A Mercury binding to OpenGL. This
+ directory also contains `mtogl' which
+ is a Mercury binding to Togl, a Tk widget
+ for OpenGL.
samples/
calc/ A calculator that uses mercury_tcltk
Index: mercury_opengl/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/graphics/mercury_opengl/Mmakefile,v
retrieving revision 1.3
diff -u -r1.3 Mmakefile
--- mercury_opengl/Mmakefile 18 May 2001 14:23:51 -0000 1.3
+++ mercury_opengl/Mmakefile 11 Aug 2003 06:01:06 -0000
@@ -1,23 +1,41 @@
MAIN_TARGET = all
-MLOBJS = togl.o
+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
+
+# 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
+
# 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 = $(EXTRA_MLLIBS)
+MLLIBS = $(GL_LIBS) $(TCLTK_LIBS) $(EXTRA_MLLIBS)
C2INITARGS = $(MERCURY_TCLTK_DIR)/mercury_tcltk.init
-# We need to also access mtcltk.h
+# 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: mercury_opengl.depend
+depend: mercury_opengl.depend mtogl.depend
-all: libmercury_opengl
+all: libmtogl libmercury_opengl
Index: mercury_opengl/README
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/graphics/mercury_opengl/README,v
retrieving revision 1.1
diff -u -r1.1 README
--- mercury_opengl/README 10 Mar 1998 06:31:34 -0000 1.1
+++ mercury_opengl/README 11 Aug 2003 06:12:50 -0000
@@ -1,21 +1,33 @@
This directory contains the package `mercury_opengl', which is a Mercury
-binding for OpenGL, using tcl/tk.
+binding for OpenGL and the package `mtogl' which is a tk widget for
+creating and managing OpenGL rendering contexts.
-You will need:
- - the Mercury system.
- - Tcl/Tk (Tk 4.0 or later).
- - the `mercury_tcltk' package.
+For `mercury_opengl', you will need:
+ - the Mercury system
- an OpenGL implementation such as Mesa.
-It contains the following modules:
+In order to use it you will also need some way for your program to
+create and manage rendering contexts (mtogl is one such way).
+
+For `mtogl' you will need:
+ - the Mercury system.
+ - Tcl/Tk (Tk 4.0 or later)
+ - the `mercury_tcltk' package
- mglu.m - provides Mercury bindings to the GLU library.
- mogl.m - provides Mercury bindings to Open GL 1.1
- mtogl.m - provides Mercury bindings to Togl, a
- tcl/tk Open GL binding.
+NOTES:
+ - You must link `mtogl' against the same version of Tcl/Tk as the
+ `mercury_tcltk' package.
+ - mtogl will probably not work versions of Tcl/Tk greater than 8.0.
+
+This directory contains the following modules.
+
+ mglu.m - provides Mercury bindings to (some of) the GLU library.
+ mogl.m - provides Mercury bindings to (some of) Open GL 1.1
+ mtogl.m - provides a Mercury binding to Togl, a
+ tcl/tk OpenGL widget.
- togl.c, togl.h - Togl 1.5
+ togl.c, togl.h - Togl 1.5
other .c and .h - Internals of Tk.
files
Index: mercury_opengl/mercury_opengl.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/graphics/mercury_opengl/mercury_opengl.m,v
retrieving revision 1.1
diff -u -r1.1 mercury_opengl.m
--- mercury_opengl/mercury_opengl.m 10 Mar 1998 06:31:36 -0000 1.1
+++ mercury_opengl/mercury_opengl.m 11 Aug 2003 04:45:20 -0000
@@ -9,5 +9,5 @@
:- module mercury_opengl.
-:- import_module mglu, mogl, mtogl.
+:- import_module mglu, mogl.
Index: mercury_opengl/mglu.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/graphics/mercury_opengl/mglu.m,v
retrieving revision 1.1
diff -u -r1.1 mglu.m
--- mercury_opengl/mglu.m 10 Mar 1998 06:31:37 -0000 1.1
+++ mercury_opengl/mglu.m 11 Aug 2003 04:45:20 -0000
@@ -185,13 +185,13 @@
bool_to_int(no) = 0.
:- pragma c_code(new_quadric(Q::out, IO0::di, IO::uo), "
- Q = gluNewQuadric();
+ Q = (MR_Word)gluNewQuadric();
IO = IO0;
").
:- pragma c_code(delete_quadric(Q::in, IO0::di, IO::uo), "
- gluDeleteQuadric(Q);
+ gluDeleteQuadric((GLUquadric *)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(Q, quadric_draw_style_flags[S]);
+ gluQuadricDrawStyle((GLUquadric *)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(Q, quadric_orientation_flags[O]);
+ gluQuadricOrientation((GLUquadric *)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(Q, quadric_normals_flags[N]);
+ gluQuadricNormals((GLUquadric *)Q, quadric_normals_flags[N]);
IO = IO0;
").
@@ -238,28 +238,28 @@
:- mode quadric_texture2(in, in, di, uo) is det.
:- pragma c_code(quadric_texture2(Q::in, B::in, IO0::di, IO::uo), "
- gluQuadricTexture(Q, B);
+ gluQuadricTexture((GLUquadric *)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(Q, BR, TR, H, SL, ST);
+ gluCylinder((GLUquadric *)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(Q, R, SL, ST);
+ gluSphere((GLUquadric *)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(Q, IR, OR, S, L);
+ gluDisk((GLUquadric *)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(Q, IR, OR, S, L, STA, SWA);
+ gluPartialDisk((GLUquadric *)Q, IR, OR, S, L, STA, SWA);
IO = IO0;
").
Index: mercury_opengl/mogl.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/graphics/mercury_opengl/mogl.m,v
retrieving revision 1.1
diff -u -r1.1 mogl.m
--- mercury_opengl/mogl.m 10 Mar 1998 06:31:38 -0000 1.1
+++ mercury_opengl/mogl.m 11 Aug 2003 04:45:20 -0000
@@ -876,7 +876,7 @@
%------------------------------------------------------------------------------%
:- pragma c_code(vertex2(X::in, Y::in, IO0::di, IO::uo), "
- if (sizeof(Float) == sizeof(GLfloat))
+ if (sizeof(MR_Float) == sizeof(GLfloat))
{
glVertex2f((GLfloat) X, (GLfloat) Y);
}
@@ -888,7 +888,7 @@
").
:- pragma c_code(vertex3(X::in, Y::in, Z::in, IO0::di, IO::uo), "
- if (sizeof(Float) == sizeof(GLfloat))
+ if (sizeof(MR_Float) == sizeof(GLfloat))
{
glVertex3f((GLfloat) X, (GLfloat) Y, (GLfloat) Z);
}
@@ -900,7 +900,7 @@
").
:- pragma c_code(vertex4(X::in, Y::in, Z::in, W::in, IO0::di, IO::uo), "
- if (sizeof(Float) == sizeof(GLfloat))
+ if (sizeof(MR_Float) == sizeof(GLfloat))
{
glVertex4f((GLfloat) X, (GLfloat) Y, (GLfloat) Z, (GLfloat) W);
}
@@ -915,7 +915,7 @@
%------------------------------------------------------------------------------%
:- pragma c_code(tex_coord1(X::in, IO0::di, IO::uo), "
- if (sizeof(Float) == sizeof(GLfloat))
+ if (sizeof(MR_Float) == sizeof(GLfloat))
{
glTexCoord1f((GLfloat) X);
}
@@ -927,7 +927,7 @@
").
:- pragma c_code(tex_coord2(X::in, Y::in, IO0::di, IO::uo), "
- if (sizeof(Float) == sizeof(GLfloat))
+ if (sizeof(MR_Float) == sizeof(GLfloat))
{
glTexCoord2f((GLfloat) X, (GLfloat) Y);
}
@@ -939,7 +939,7 @@
").
:- pragma c_code(tex_coord3(X::in, Y::in, Z::in, IO0::di, IO::uo), "
- if (sizeof(Float) == sizeof(GLfloat))
+ if (sizeof(MR_Float) == sizeof(GLfloat))
{
glTexCoord3f((GLfloat) X, (GLfloat) Y, (GLfloat) Z);
}
@@ -951,7 +951,7 @@
").
:- pragma c_code(tex_coord4(X::in, Y::in, Z::in, W::in, IO0::di, IO::uo), "
- if (sizeof(Float) == sizeof(GLfloat))
+ if (sizeof(MR_Float) == sizeof(GLfloat))
{
glTexCoord4f((GLfloat) X, (GLfloat) Y, (GLfloat) Z,
(GLfloat) W);
@@ -967,7 +967,7 @@
%------------------------------------------------------------------------------%
:- pragma c_code(normal3(X::in, Y::in, Z::in, IO0::di, IO::uo), "
- if (sizeof(Float) == sizeof(GLfloat))
+ if (sizeof(MR_Float) == sizeof(GLfloat))
{
glNormal3f((GLfloat) X, (GLfloat) Y, (GLfloat) Z);
}
@@ -981,7 +981,7 @@
%------------------------------------------------------------------------------%
:- pragma c_code(color3(R::in, G::in, B::in, IO0::di, IO::uo), "
- if (sizeof(Float) == sizeof(GLfloat))
+ if (sizeof(MR_Float) == sizeof(GLfloat))
{
glColor3f((GLfloat) R, (GLfloat) G, (GLfloat) B);
}
@@ -993,7 +993,7 @@
").
:- pragma c_code(color4(R::in, G::in, B::in, A::in, IO0::di, IO::uo), "
- if (sizeof(Float) == sizeof(GLfloat))
+ if (sizeof(MR_Float) == sizeof(GLfloat))
{
glColor4f((GLfloat) R, (GLfloat) G, (GLfloat) B, (GLfloat) A);
}
@@ -1164,7 +1164,7 @@
").
:- pragma c_code(rotate(Theta::in, X::in, Y::in, Z::in, IO0::di, IO::uo), "
- if(sizeof(Float) == sizeof(GLfloat))
+ if(sizeof(MR_Float) == sizeof(GLfloat))
{
glRotatef((GLfloat) Theta,
(GLfloat) X, (GLfloat) Y, (GLfloat) Z);
@@ -1176,7 +1176,7 @@
").
:- pragma c_code(translate(X::in, Y::in, Z::in, IO0::di, IO::uo), "
- if(sizeof(Float) == sizeof(GLfloat))
+ if(sizeof(MR_Float) == sizeof(GLfloat))
{
glTranslatef((GLfloat) X, (GLfloat) Y, (GLfloat) Z);
} else {
@@ -1186,7 +1186,7 @@
").
:- pragma c_code(scale(X::in, Y::in, Z::in, IO0::di, IO::uo), "
- if(sizeof(Float) == sizeof(GLfloat))
+ if(sizeof(MR_Float) == sizeof(GLfloat))
{
glScalef((GLfloat) X, (GLfloat) Y, (GLfloat) Z);
} else {
@@ -1322,7 +1322,7 @@
%------------------------------------------------------------------------------%
:- pragma c_code(raster_pos2(X::in, Y::in, IO0::di, IO::uo), "
- if(sizeof(Float) == sizeof(GLfloat))
+ if(sizeof(MR_Float) == sizeof(GLfloat))
{
glRasterPos2f((GLfloat) X, (GLfloat) Y);
} else {
@@ -1332,7 +1332,7 @@
").
:- pragma c_code(raster_pos3(X::in, Y::in, Z::in, IO0::di, IO::uo), "
- if(sizeof(Float) == sizeof(GLfloat))
+ if(sizeof(MR_Float) == sizeof(GLfloat))
{
glRasterPos3f((GLfloat) X, (GLfloat) Y, (GLfloat) Z);
} else {
@@ -1342,7 +1342,7 @@
").
:- pragma c_code(raster_pos4(X::in, Y::in, Z::in, W::in, IO0::di, IO::uo), "
- if(sizeof(Float) == sizeof(GLfloat))
+ if(sizeof(MR_Float) == sizeof(GLfloat))
{
glRasterPos4f((GLfloat) X, (GLfloat) Y, (GLfloat) Z,
(GLfloat) W);
Index: mercury_opengl/mtogl.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/graphics/mercury_opengl/mtogl.m,v
retrieving revision 1.2
diff -u -r1.2 mtogl.m
--- mercury_opengl/mtogl.m 8 May 2000 13:48:13 -0000 1.2
+++ mercury_opengl/mtogl.m 11 Aug 2003 04:45:20 -0000
@@ -52,28 +52,29 @@
:- type togl == c_pointer.
-:- pragma c_header_code("
+:- pragma foreign_import_module("C", mtcltk).
+
+:- pragma foreign_decl("C", "
#include ""togl.h""
- #include ""mtcltk.h""
- #include ""mtogl.h""
- extern Word mtogl_create_callback;
+ extern MR_Word mtogl_create_callback;
void create_callback(struct Togl *togl);
- extern Word mtogl_display_callback;
+ extern MR_Word mtogl_display_callback;
void display_callback(struct Togl *togl);
- extern Word mtogl_reshape_callback;
+ extern MR_Word mtogl_reshape_callback;
void reshape_callback(struct Togl *togl);
- extern Word mtogl_destroy_callback;
+ extern MR_Word mtogl_destroy_callback;
void destroy_callback(struct Togl *togl);
").
-:- pragma c_code("
- Word mtogl_create_callback;
- Word mtogl_display_callback;
- Word mtogl_reshape_callback;
- Word mtogl_destroy_callback;
+:- pragma foreign_code("C", "
+ MR_Word mtogl_create_callback;
+ MR_Word mtogl_display_callback;
+ MR_Word mtogl_reshape_callback;
+ MR_Word mtogl_destroy_callback;
").
-:- pragma c_code(mtogl__init(Interp::in, Stat::out, IO0::di, IO::uo), "
+:- pragma foreign_proc("C", mtogl__init(Interp::in, Stat::out, IO0::di, IO::uo),
+ [will_not_call_mercury, promise_pure], "
{
int err;
@@ -104,17 +105,18 @@
:- pragma export(do_create_callback(pred(in, di, uo) is det, in, di, uo),
"do_create_callback").
-:- pragma c_code(mtogl__create(Closure::pred(in, di, uo) is det,
- IO0::di, IO::uo),"
+:- pragma foreign_proc("C", mtogl__create(Closure::pred(in, di, uo) is det,
+ IO0::di, IO::uo),
+ [may_call_mercury, promise_pure], "
mtogl_create_callback = Closure;
Togl_CreateFunc(create_callback);
IO = IO0;
").
-:- pragma c_code("
+:- pragma foreign_code("C", "
void create_callback(struct Togl *togl)
{
- do_create_callback(mtogl_create_callback, (Word) togl);
+ do_create_callback(mtogl_create_callback, (MR_Word) togl);
}
").
@@ -130,14 +132,15 @@
:- pragma export(do_display_callback(pred(in, di, uo) is det, in, di, uo),
"do_display_callback").
-:- pragma c_code(mtogl__display(Closure::pred(in, di, uo) is det,
- IO0::di, IO::uo),"
+:- pragma foreign_proc("C", mtogl__display(Closure::pred(in, di, uo) is det,
+ IO0::di, IO::uo),
+ [will_not_call_mercury, promise_pure], "
mtogl_display_callback = Closure;
Togl_DisplayFunc(display_callback);
IO = IO0;
").
-:- pragma c_code("
+:- pragma foreign_code("C", "
void display_callback(struct Togl *togl)
{
do_display_callback(mtogl_display_callback, (Word) togl);
@@ -156,17 +159,18 @@
:- pragma export(do_reshape_callback(pred(in, di, uo) is det, in, di, uo),
"do_reshape_callback").
-:- pragma c_code(mtogl__reshape(Closure::pred(in, di, uo) is det,
- IO0::di, IO::uo),"
+:- pragma foreign_proc("C", mtogl__reshape(Closure::pred(in, di, uo) is det,
+ IO0::di, IO::uo),
+ [will_not_call_mercury, promise_pure], "
mtogl_reshape_callback = Closure;
Togl_ReshapeFunc(reshape_callback);
IO = IO0;
").
-:- pragma c_code("
+:- pragma foreign_code("C", "
void reshape_callback(struct Togl *togl)
{
- do_reshape_callback(mtogl_reshape_callback, (Word) togl);
+ do_reshape_callback(mtogl_reshape_callback, (MR_Word) togl);
}
").
@@ -189,7 +193,7 @@
IO = IO0;
").
-:- pragma c_code("
+:- pragma foreign_code("C", "
void destroy_callback(struct Togl *togl)
{
do_destroy_callback(mtogl_destroy_callback, (Word) togl);
@@ -198,16 +202,20 @@
%------------------------------------------------------------------------------%
-:- pragma c_code(mtogl__post_redisplay(Togl::in, IO0::di, IO::uo), "
+:- pragma foreign_proc("C", mtogl__post_redisplay(Togl::in, IO0::di, IO::uo),
+ [will_not_call_mercury, promise_pure], "
Togl_PostRedisplay((struct Togl *) Togl);
IO = IO0;
").
%------------------------------------------------------------------------------%
-:- pragma c_code(mtogl__swap_buffers(Togl::in, IO0::di, IO::uo), "
+:- pragma foreign_proc("C", mtogl__swap_buffers(Togl::in, IO0::di, IO::uo),
+ [will_not_call_mercury, promise_pure], "
Togl_SwapBuffers((struct Togl *) Togl);
IO = IO0;
").
+%------------------------------------------------------------------------------%
+:- end_module mtogl.
%------------------------------------------------------------------------------%
Index: mercury_opengl/togl.c
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/graphics/mercury_opengl/togl.c,v
retrieving revision 1.1
diff -u -r1.1 togl.c
--- mercury_opengl/togl.c 10 Mar 1998 06:32:02 -0000 1.1
+++ mercury_opengl/togl.c 11 Aug 2003 04:45:21 -0000
@@ -236,6 +236,8 @@
# include "tkInt8.0.h"
#elif TK_MAJOR_VERSION==8 && TK_MINOR_VERSION==0 && TK_RELEASE_SERIAL==2
# include "tkInt8.0p2.h"
+#elif TK_MAJOR_VERSION==8 && TK_MINOR_VERSION==0 && TK_RELEASE_SERIAL==5
+# include "tkInt8.0p5.h"
#else
Sorry, you will have to edit togl.c to include the right tkInt.h file
#endif
Index: samples/calc/calc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/graphics/samples/calc/calc.m,v
retrieving revision 1.4
diff -u -r1.4 calc.m
--- samples/calc/calc.m 16 Jul 2001 10:21:52 -0000 1.4
+++ samples/calc/calc.m 11 Aug 2003 04:45:21 -0000
@@ -135,7 +135,7 @@
:- mode config_calc(in, in, di, uo) is det.
config_calc(Interp, State) -->
- { State = calc(Ans, Store, Clr, Buttons, Clear, AnsLab) },
+ { State = calc(Ans, _Store, Clr, Buttons, Clear, AnsLab) },
{ Pred = (pred((Wid - _)::in, IO0::di, IO::uo) is det :-
unbind_command(Interp, Wid, IO0, IO)
) },
@@ -310,7 +310,7 @@
compute(dot, _, _, _, _, _) :-
error("dot").
compute(lpar, Acc, Store, 0, Acc, [mark|Store]).
-compute(rpar, Acc0, [], 0, 0, []). % error!
+compute(rpar, _Acc0, [], 0, 0, []). % error!
compute(rpar, Acc, [Op|Ops], NewAcc, DispAcc, Stack) :-
( Op = times(Fac),
compute(rpar, Fac*Acc, Ops, NewAcc, DispAcc, Stack)
Index: samples/maze/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/graphics/samples/maze/Mmakefile,v
retrieving revision 1.3
diff -u -r1.3 Mmakefile
--- samples/maze/Mmakefile 19 Dec 2001 15:08:27 -0000 1.3
+++ samples/maze/Mmakefile 11 Aug 2003 05:37:45 -0000
@@ -1,25 +1,33 @@
+# To use shared libraries under Linux you need this.
+#MGNUCFLAGS = --pic-reg
+#EXTRA_MLFLAGS = -shared
-# To use static libraries under Linux you need this.
-MGNUCFLAGS = --pic-reg
-EXTRA_MLFLAGS = -shared
+TCLTK_VERSION = 8.0
-EXTRA_MLLIBS = -ltk8.0 -ltcl8.0 -lMesaGLU -lMesaGL -L/usr/X11R6/lib -lX11 \
- -lXmu -lXext -ldl
+EXTRA_MLLIBS = -ltk$(TCLTK_VERSION) -ltcl$(TCLTK_VERSION) -lGLU -lGL \
+ -L/usr/X11R6/lib -lX11 -lXmu -lXext -ldl -lSM -lXt -lXi
-# Specify the location of the `mercury_tcltk' and `mercury_opengl' packages.
+# Specify the location of the `mercury_tcltk', `mtogl' and
+# `mercury_opengl' packages.
MERCURY_TCLTK_DIR = ../../mercury_tcltk
MERCURY_OPENGL_DIR = ../../mercury_opengl
+MERCURY_MTOGL_DIR = ../../mercury_opengl
-# Tell mmake to use the `mercury_tcltk' and `mercury_opengl' libraries.
-VPATH = $(MERCURY_OPENGL_DIR):$(MERCURY_TCLTK_DIR):$(MMAKE_VPATH)
-MCFLAGS = -I$(MERCURY_TCLTK_DIR) -I$(MERCURY_OPENGL_DIR) \
- $(EXTRA_MCFLAGS)
-MLFLAGS = -R$(MERCURY_TCLTK_DIR) -R$(MERCURY_OPENGL_DIR) \
- $(EXTRA_MLFLAGS) -L$(MERCURY_TCLTK_DIR) \
- -L$(MERCURY_OPENGL_DIR)
-MLLIBS = -lmercury_opengl -lmercury_tcltk $(EXTRA_MLLIBS)
+# Tell mmake to use the `mercury_tcltk' and `mtogl', `mercury_opengl' libraries.
+VPATH = $(MERCURY_MTOGL_DIR):$(MERCURY_OPENGL_DIR):$(MMAKE_VPATH)
+VPATH = $(MERCURY_TCLTK_VERSION):$(MMAKE_VPATH)
+
+MCFLAGS = -I$(MERCURY_MTOGL_DIR) -I$(MERCURY_TCLTK_DIR) \
+ -I$(MERCURY_OPENGL_DIR) $(EXTRA_MCFLAGS)
+MLFLAGS = -R$(MERCURY_MTOGL_DIR) -R$(MERCURY_TCLTK_DIR) \
+ -R$(MERCURY_OPENGL_DIR) $(EXTRA_MLFLAGS) -L$(MERCURY_TCLTK_DIR) \
+ -L$(MERCURY_OPENGL_DIR) -L$(MERCURY_OPENGL_DIR)
+MLLIBS = -lmtogl -lmercury_opengl -lmercury_tcltk $(EXTRA_MLLIBS)
C2INITARGS = $(MERCURY_TCLTK_DIR)/mercury_tcltk.init \
- $(MERCURY_OPENGL_DIR)/mercury_opengl.init
+ $(MERCURY_OPENGL_DIR)/mercury_opengl.init \
+ $(MERCURY_MTOGL_DIR)/mtogl.init
+
+MGNUCFLAGS = -I../../mercury_tcltk
default_target : maze
Index: samples/pent/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/graphics/samples/pent/Mmakefile,v
retrieving revision 1.3
diff -u -r1.3 Mmakefile
--- samples/pent/Mmakefile 19 Dec 2001 15:08:28 -0000 1.3
+++ samples/pent/Mmakefile 11 Aug 2003 05:58:55 -0000
@@ -3,23 +3,33 @@
#MGNUCFLAGS = --pic-reg
#EXTRA_MLFLAGS = -shared
-EXTRA_MLLIBS = -ltk8.0 -ltcl8.0 -lMesaGLU -lMesaGL -L/usr/X11R6/lib -lX11 \
- -lXmu -lXext -ldl
+TCLTK_VERSION = 8.0
-# Specify the location of the `mercury_tcltk' and `mercury_opengl' packages.
+EXTRA_MLLIBS = -ltk$(TCLTK_VERSION) -ltcl$(TCLTK_VERSION) -lGLU -lGL \
+ -L/usr/X11R6/lib -lX11 -lXmu -lXext -ldl -lSM -lXi -lXt
+
+# Specify the location of the `mercury_tcltk' `mtogl' and
+# `mercury_opengl' packages.
MERCURY_TCLTK_DIR = ../../mercury_tcltk
MERCURY_OPENGL_DIR = ../../mercury_opengl
+MERCURY_MTOGL_DIR = ../../mercury_opengl
# Tell mmake to use the `mercury_tcltk' and `mercury_opengl' libraries.
VPATH = $(MERCURY_OPENGL_DIR):$(MERCURY_TCLTK_DIR):$(MMAKE_VPATH)
-MCFLAGS = -I$(MERCURY_TCLTK_DIR) -I$(MERCURY_OPENGL_DIR) \
- $(EXTRA_MCFLAGS)
-MLFLAGS = -R$(MERCURY_TCLTK_DIR) -R$(MERCURY_OPENGL_DIR) \
- $(EXTRA_MLFLAGS) -L$(MERCURY_TCLTK_DIR) \
- -L$(MERCURY_OPENGL_DIR)
-MLLIBS = -lmercury_opengl -lmercury_tcltk $(EXTRA_MLLIBS)
+MCFLAGS = -I$(MERCURY_TCLTK_DIR) -I$(MERCURY_OPENGL_DIR) \
+ -I$(MERCURY_MTOGL_DIR) $(EXTRA_MCFLAGS)
+MLFLAGS = -R$(MERCURY_TCLTK_DIR) -R$(MERCURY_OPENGL_DIR) \
+ -R$(MERCURY_MTOGL_DIR) $(EXTRA_MLFLAGS) \
+ -L$(MERCURY_TCLTK_DIR) -L$(MERCURY_OPENGL_DIR) \
+ -L$(MERCURY_MTOGL_DIR)
+MLLIBS = -lmtogl -lmercury_opengl -lmercury_tcltk $(EXTRA_MLLIBS)
C2INITARGS = $(MERCURY_TCLTK_DIR)/mercury_tcltk.init \
- $(MERCURY_OPENGL_DIR)/mercury_opengl.init
+ $(MERCURY_OPENGL_DIR)/mercury_opengl.init \
+ $(MERCURY_MTOGL_DIR)/mtogl.init
+
+ # If we are using intermodule-optimization mmake needs to know where
+ # the .mh files are.
+MGNUCFLAGS = -I../../mercury_tcltk
default_target : pent
--------------------------------------------------------------------------
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