[m-rev.] for review: port tcl/tk binding to Mac OS X
Ian MacLarty
maclarty at cs.mu.OZ.AU
Wed Aug 10 21:58:11 AEST 2005
For review by anyone.
Estimated hours taken: 5
Branches: main
Port the Tcl/Tk binding to Mac OS X.
extras/graphics/mercury_tcltk/HOWTO:
Remove the remark about interior pointers since it is no longer
applicable.
extras/graphics/mercury_tcltk/Mmakefile:
Try to link with tcl/tk 8.4 by default.
extras/graphics/mercury_tcltk/Mmakefile.MacOSX:
Mmakefile for Mac OS X.
extras/graphics/mercury_tcltk/README:
Mention Mmakefile.MacOSX.
extras/graphics/mercury_tcltk/mtcltk.m:
Include the headers from a different location on Mac OS X.
extras/graphics/samples/calc/Mmakefile.MacOSX:
Add a Mmakefile to compile the Tcl/Tk example on Mac OS X.
extras/graphics/samples/calc/README:
Add a README.
extras/graphics/samples/calc/calc.m:
Add spaces around some of the characters on the buttons, so that they
are visible in Mac OS X.
Index: extras/graphics/mercury_tcltk/HOWTO
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/graphics/mercury_tcltk/HOWTO,v
retrieving revision 1.3
diff -u -r1.3 HOWTO
--- extras/graphics/mercury_tcltk/HOWTO 22 Dec 2003 13:23:54 -0000 1.3
+++ extras/graphics/mercury_tcltk/HOWTO 10 Aug 2005 11:43:48 -0000
@@ -1,4 +1,3 @@
-
Using mercury_tcltk is not all that different to using Tcl/Tk itself,
except that all operations are done in Mercury instead of Tcl.
See the samples for example code, and the interfaces of
@@ -6,20 +5,7 @@
fully documented in any way, but if you know Tcl/Tk, you shouldn't
have any problems.
-The main tricky thing is that it is *CRUCIAL* that you enable recognition
-of interior pointers in the garbage collection library. The simplest
-way to do this is to set the GC_ALL_INTERIOR_POINTERS environment variable
-before running your program. Another alternative is to link with a
-version of the garbage collection library (libgc.a or libgc.so) which
-has been compiled with `-DALL_INTERIOR_POINTERS'. You can create
-this by typing the commands
-
- make clean
- make libgc.a libgc.so GC_GRADE=gc EXTRA_CFLAGS=-DALL_INTERIOR_POINTERS
-
-in the boehm_gc directory of the Mercury compiler source distribution.
-
-You also need to add some information to your Mmakefile to tell mmake where
+You may need to add some information to your Mmakefile to tell mmake where
the mercury_tcltk library is, and to link with the mercury_tcltk, tcl,
tk and X libraries.
@@ -42,10 +28,7 @@
MLLIBS = -lmercury_tcltk $(TCLTK_MLLIBS) $(EXTRA_MLLIBS)
C2INITFLAGS = $(MERCURY_TCLTK_DIR)/mercury_tcltk.init
- # Tell ml to link with our specially-compiled version of
- # the libgc library instead of the usual one.
- MLFLAGS += -L some/other/directory/boehm_gc
-
You can then use EXTRA_MCFLAGS, EXTRA_MLFLAGS, etc to set any other
options you need.
+../samples/calc contains an example program.
Index: extras/graphics/mercury_tcltk/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/graphics/mercury_tcltk/Mmakefile,v
retrieving revision 1.4
diff -u -r1.4 Mmakefile
--- extras/graphics/mercury_tcltk/Mmakefile 22 Dec 2003 13:23:54 -0000 1.4
+++ extras/graphics/mercury_tcltk/Mmakefile 10 Aug 2005 11:49:58 -0000
@@ -8,7 +8,7 @@
# You may need to modify the line below
-MLLIBS = -ltk8.0 -ltcl8.0 -L/usr/X11R6/lib -lX11 -lXmu -lXext -lm -ldl \
+MLLIBS = -ltk8.4 -ltcl8.4 -L/usr/X11R6/lib -lX11 -lXmu -lXext -lm -ldl \
-lXt -lICE -lSM
MLFLAGS = -R/usr/X11R6/lib
Index: extras/graphics/mercury_tcltk/Mmakefile.MacOSX
===================================================================
RCS file: extras/graphics/mercury_tcltk/Mmakefile.MacOSX
diff -N extras/graphics/mercury_tcltk/Mmakefile.MacOSX
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ extras/graphics/mercury_tcltk/Mmakefile.MacOSX 10 Aug 2005 11:43:48 -0000
@@ -0,0 +1,25 @@
+#-----------------------------------------------------------------------------#
+# Copyright (C) 1998, 2001, 2003 The University of Melbourne.
+# This file may only be copied under the terms of the GNU Library General
+# Public License - see the file COPYING.LIB in the Mercury distribution.
+#-----------------------------------------------------------------------------#
+# To compile the Mercury Tcl/Tk binding on MacOSX you must first install the
+# Tcl/Tk Aqua framework, available from http://tcltkaqua.sourceforge.net/.
+# Then do:
+# $ mmake -f Mmakefile.MacOSX depend
+# $ mmake -f Mmakefile.MacOSX
+# and to install do:
+# $ mmake -f Mmakefile.MacOSX install
+#
+
+include Mercury.options
+
+MLLIBS = -framework Tcl -framework Tk
+
+EXTRA_CFLAGS = -Wno-uninitialized
+
+MAIN_TARGET = libmercury_tcltk
+
+depend: mercury_tcltk.depend
+
+install: libmercury_tcltk.install
Index: extras/graphics/mercury_tcltk/README
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/graphics/mercury_tcltk/README,v
retrieving revision 1.1
diff -u -r1.1 README
--- extras/graphics/mercury_tcltk/README 17 Feb 1998 06:33:33 -0000 1.1
+++ extras/graphics/mercury_tcltk/README 10 Aug 2005 11:43:48 -0000
@@ -13,6 +13,8 @@
See HOWTO for details on how to link the package in with your own
Mercury programs.
+To build the Tcl/Tk binding on MacOSX see Mmakefile.MacOSX.
+
The mercury_tcltk package is free software, but is Copyright
(C) 1997-1998 The University of Melbourne. It is distributed
under the terms of the GNU Library General Public License.
Index: extras/graphics/mercury_tcltk/mtcltk.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/graphics/mercury_tcltk/mtcltk.m,v
retrieving revision 1.8
diff -u -r1.8 mtcltk.m
--- extras/graphics/mercury_tcltk/mtcltk.m 16 Feb 2005 07:08:28 -0000 1.8
+++ extras/graphics/mercury_tcltk/mtcltk.m 10 Aug 2005 11:43:48 -0000
@@ -98,7 +98,11 @@
** SCCS: @(#) tkAppInit.c 1.20 96/02/15 18:55:27
**/
-#include ""tk.h""
+#if defined(__APPLE__) && defined(__MACH__)
+ #include <Tk/tk.h>
+#else
+ #include ""tk.h""
+#endif
").
/*
Index: extras/graphics/samples/calc/Mmakefile.MacOSX
===================================================================
RCS file: extras/graphics/samples/calc/Mmakefile.MacOSX
diff -N extras/graphics/samples/calc/Mmakefile.MacOSX
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ extras/graphics/samples/calc/Mmakefile.MacOSX 10 Aug 2005 11:43:48 -0000
@@ -0,0 +1,16 @@
+MAIN_TARGET = calc
+
+# Specify the location of the `mercury_tcltk' package.
+MERCURY_TCLTK_DIR = ../../mercury_tcltk
+
+MGNUCFLAGS = -I$(MERCURY_TCLTK_DIR)
+
+# 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 = -lmercury_tcltk $(EXTRA_MLLIBS)
+C2INITARGS = $(MERCURY_TCLTK_DIR)/mercury_tcltk.init
+
+depend : calc.depend
Index: extras/graphics/samples/calc/README
===================================================================
RCS file: extras/graphics/samples/calc/README
diff -N extras/graphics/samples/calc/README
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ extras/graphics/samples/calc/README 10 Aug 2005 11:43:48 -0000
@@ -0,0 +1,23 @@
+A simple calculator using the Mercury Tcl/Tk binding.
+
+Before building this example you will need to build
+the Tcl/Tk binding in ../mercury_tcltk.
+
+To compile the example on Linux do:
+mmake depend
+mmake
+
+To compile the example on Mac OS X:
+
+If you built the mercury_tcltk library on Mac OS X, but haven't installed it,
+then do:
+mmake -f Mmakefile.MacOSX depend
+mmake -f Mmakefile.MacOSX
+export DYLD_LIBRARY_PATH=../../mercury_tcltk
+
+If you installed the mercury_tcltk library on Mac OS X,
+then you will need to use a Mmakefile like the following:
+MAIN_TARGET = calc
+EXTRA_LIB_DIRS = $(INSTALL_PREFIX)/lib/mercury
+EXTRA_LIBRARIES = mercury_tcltk
+depend : calc.depend
Index: extras/graphics/samples/calc/calc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/graphics/samples/calc/calc.m,v
retrieving revision 1.5
diff -u -r1.5 calc.m
--- extras/graphics/samples/calc/calc.m 13 Aug 2003 05:49:47 -0000 1.5
+++ extras/graphics/samples/calc/calc.m 10 Aug 2005 11:43:48 -0000
@@ -92,11 +92,11 @@
button(Interp, [text("/")], NumPad, Div),
button(Interp, [text("x")], NumPad, Times),
button(Interp, [text("-")], NumPad, Minus),
- button(Interp, [text(".")], NumPad, Dot),
+ button(Interp, [text(" . ")], NumPad, Dot),
button(Interp, [text("=")], NumPad, Equal),
button(Interp, [text("+")], NumPad, Plus),
- button(Interp, [text("(")], NumPad, LParen),
- button(Interp, [text(")")], NumPad, RParen),
+ button(Interp, [text(" ( ")], NumPad, LParen),
+ button(Interp, [text(" ) ")], NumPad, RParen),
button(Interp, [text("C")], NumPad, Clear),
layout_grid(Interp, [
--------------------------------------------------------------------------
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