mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-22 21:03:53 +00:00
Estimated hours taken: 5 Branches: main and 0.12 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.
42 lines
1.8 KiB
Plaintext
42 lines
1.8 KiB
Plaintext
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
|
|
`mtk.m' and `mtcltk.m'. Note that we don't consider these modules
|
|
fully documented in any way, but if you know Tcl/Tk, you shouldn't
|
|
have any problems.
|
|
|
|
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.
|
|
|
|
The following is an example. You may need to change the `tk8.0' and
|
|
`tcl8.0' if you are using a different version of Tcl/Tk, and don't
|
|
forget to change `some/directory' to the directory where this package
|
|
is installed.
|
|
|
|
TCLTK_MLLIBS = -ltk8.0 -ltcl8.0 -L/usr/X11R6/lib -lX11 -lXmu \
|
|
-lXext -lm -ldl
|
|
|
|
# Specify the location of the `mercury_tcltk' package.
|
|
MERCURY_TCLTK_DIR = some/directory/mercury_tcltk
|
|
|
|
# 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 $(TCLTK_MLLIBS) $(EXTRA_MLLIBS)
|
|
C2INITFLAGS = $(MERCURY_TCLTK_DIR)/mercury_tcltk.init
|
|
|
|
You can then use EXTRA_MCFLAGS, EXTRA_MLFLAGS, etc to set any other
|
|
options you need.
|
|
|
|
../samples/calc contains an example program.
|
|
|
|
The Mercury Tcl/Tk binding will work only with a version of the garbage
|
|
collector which has recognition of interior pointers enabled. This is the
|
|
default. If you compiled the garbage collector without interior pointer
|
|
recognition, then you must set the GC_ALL_INTERIOR_POINTERS environment
|
|
variable before running your program. If you have not changed any of the
|
|
garbage collectors default settings then you should not have to do anything.
|