To run this program, enter the following command lines in the
@file{src/gtk} directory of your build tree.
-@smallexample
+@example
../microcode/scheme --library ../lib
(load-option 'Gtk)
(ge '(gtk))
(load "hello")
(hello)
-@end smallexample
+@end example
@unnumberedsec Gtk Event Viewer
widget, enter the following command lines in the @file{src/gtk}
directory of your build tree.
-@smallexample
+@example
../microcode/scheme --library ../lib
(load-option 'GTK)
(make-gtk-event-viewer-demo)
-@end smallexample
+@end example
The code can be found in @file{gtk-ev.scm}.
enter the following command lines in the @file{src/gtk} directory of
your build tree.
-@smallexample
+@example
../microcode/scheme --library ../lib
(load-option 'Gtk)
(make-fix-layout-demo)
-@end smallexample
+@end example
The code can be found in @file{fix-demo.scm}.
To see the Pole Zero application, enter the following command lines in
the @file{src/gtk} directory of your build tree.
-@smallexample
+@example
../microcode/scheme --library ../lib
(load-option 'Gtk)
(make-pole-zero)
-@end smallexample
+@end example
@unnumberedsec The Gtk Package
facilities, like a time slice counter. Evaluating the following
expression should cause a small window to pop up.
-@smallexample
+@example
(gtk-time-slice-window! #t)
-@end smallexample
+@end example
The window is created and updated on the toolkit side of the
interface, and shows a running count of the number of times the
currently being polled by Scheme. The count can be slowed and stopped
by evaluating the first and second expressions below, respectively.
-@smallexample
+@example
(set-thread-timer-interval! 1000)
(set-thread-timer-interval! #f)
-@end smallexample
+@end example
@xref{Debugging Facilities}.
as @var{alien-function}. @var{alien-function} should be a callback
trampoline, as in this example:
-@smallexample
+@example
(g-signal-connect window (C-callback "delete_event") delete-callback)
-@end smallexample
+@end example
Note that @var{delete-callback} should reference @var{window} via
parameter @emph{only} (per discussion above).
@deffn Procedure g-signal-disconnect gobject name
@var{name} should be a string, e.g.:
-@smallexample
+@example
(g-signal-disconnect window "delete_event")
-@end smallexample
+@end example
@end deffn
The @bref{gobject-get-property} and @bref{gobject-set-properties}
@node Installation, Implementation Notes, API Reference, Top
@chapter Installation
-If you have a recent version of MIT Scheme (with C/Unix FFI)
-installed, you can build and install the snapshot (in
-@file{$HOME/}) with these three commands.
+The Gtk system comes as a source snapshot or as a portable C
+distribution.
-@smallexample
+@section Source Snapshot
+
+If you downloaded the source snapshot, unpack it and change to its
+@file{src/} subdirectory. Build and install it in @file{$HOME}
+with the following commands.
+
+@example
./configure --prefix=$HOME
make
make install
-@end smallexample
+@end example
-If your MIT Scheme does not include the FFI, you will need to install
-a version that does. Use the same three commands (above) and you will
-have built and installed the requisite MIT Scheme, in @file{$HOME}.
+Note that you must have a binary distribution of MIT Scheme already
+installed. MIT Scheme is used to build itself.
-To verify your install, check that your @code{mit-scheme} command
-invokes a Scheme with FFI. If you used a configure option like
-@code{--prefix=$HOME}, you might use these commands:
+To test before installing, use the following command.
-@smallexample
- export MIT_SCHEME_EXE=$HOME/bin/mit-scheme
- echo "(load-option 'FFI)" | $MIT_SCHEME_EXE --batch-mode
-@end smallexample
+@example
+ echo "(load-option 'Gtk)" | microcode/scheme --library lib
+@end example
-If that command completes without complaint, you have a host for the
-Gtk system, which can now be built and installed like this:
+@section Portable C Distribution
-@smallexample
- export MIT_SCHEME_EXE=$HOME/bin/mit-scheme
- (cd src && make && make install)
-@end smallexample
+If you downloaded the portable C distribution, you do not need MIT
+Scheme already installed. Unpack the distribution and change to its
+@file{src/} subdirectory, then use the following commands to build and
+install it.
+
+@example
+ etc/make-liarc.sh --prefix=$HOME
+ make install
+@end example
-If you have trouble, please feel free to contact the author.
+It should be as simple as that. If not, please feel free to contact
+the author.
@node Implementation Notes, GNU Free Documentation License, Installation, Top
@chapter Implementation Notes
in two steps: a toolkit function returns an alien address, and the C
string at that address is copied into the heap.
-@smallexample
+@example
(let ((retval (make-alien '|gchar|)))
(C-call "gtk_label_get_text" retval (gobject-alien label))
(c-peek-cstring retval))
@result{} "!dlrow ,olleH"
-@end smallexample
+@end example
The @code{gtk-label-get-text} wrapper procedure hides these details.
-@smallexample
+@example
(gtk-label-get-text label)
@result{} "!dlrow ,olleH"
-@end smallexample
+@end example
In the example call to @code{gtk-label-get-text} above, a Scheme
object represents the GtkLabel. It is a gtk-label instance, whose
# **** END BOILERPLATE ****
-LIARC_BOOT_BUNDLES = compiler cref sf star-parser ffi
-LIARC_BUNDLES = $(LIARC_BOOT_BUNDLES) edwin imail sos ssp xml $(FFIS)
+LIARC_BOOT_BUNDLES = compiler cref sf star-parser
+LIARC_BUNDLES = $(LIARC_BOOT_BUNDLES) edwin imail sos ssp xml ffi
FFIS = @FFIS@
SUBDIRS = $(INSTALLED_SUBDIRS) 6001 compiler rcs win32 xdoc
-INSTALLED_SUBDIRS = microcode runtime $(LIARC_BUNDLES)
+INSTALLED_SUBDIRS = microcode runtime $(LIARC_BUNDLES) $(FFIS)
MIT_SCHEME_EXE = @MIT_SCHEME_EXE@
AUXDIR_NAME = @AUXDIR_NAME@
all: @ALL_TARGET@
all-native: compile-microcode
- etc/make-in-subdirs.sh generate $(FFIS)
@$(top_srcdir)/etc/compile.sh "$(MIT_SCHEME_EXE)" \
--compiler --batch-mode
- $(MAKE) build-bands
- etc/make-in-subdirs.sh build $(FFIS)
+ $(MAKE) build-bands build-ffis
all-svm: microcode/svm1-defns.h
- etc/make-in-subdirs.sh generate $(FFIS)
$(MAKE) compile-microcode
@$(top_srcdir)/etc/compile-svm.sh "$(MIT_SCHEME_EXE)"
- $(MAKE) build-bands
- etc/make-in-subdirs.sh build $(FFIS)
+ $(MAKE) build-bands build-ffis
microcode/svm1-defns.h: compiler/machines/svm/svm1-defns.h
if cmp compiler/machines/svm/svm1-defns.h microcode/svm1-defns.h; \
</dev/null )
all-liarc:
- etc/make-in-subdirs.sh generate $(FFIS)
@$(top_srcdir)/etc/c-compile.sh "$(MIT_SCHEME_EXE)" \
--compiler --batch-mode
- $(MAKE) compile-liarc-bundles build-bands
+ $(MAKE) compile-liarc-bundles build-bands build-ffis
+
+build-ffis:
etc/make-in-subdirs.sh build $(FFIS)
macosx-app: stamp_macosx-app
AC_CHECK_PROG([PKG_CONFIG], [pkg-config], [yes])
AC_MSG_CHECKING([for gtk])
if test "${with_gtk}" = "yes"; then
- AC_MSG_RESULT([by request: yes])
-fi
-if test "${with_gtk}" = "auto"; then
- if test "${PKG_CONFIG}" != yes; then
- AC_MSG_RESULT([no pkg-config: no])
- with_gtk=no
- elif ! pkg-config --exists gtk+-2.0; then
- AC_MSG_RESULT([! pkg-config --exists gtk+-2.0: no])
- with_gtk=no
- elif test "${mit_scheme_native_code}" == "c" \
- -a -f ffi/syntax.c; then
- # The LIARC boot compiler will have an FFI.
- AC_MSG_RESULT([FFI in liarc boot: yes])
- with_gtk=yes
- elif "${MIT_SCHEME_EXE}" --eval "(load-option'FFI)" \
- </dev/null >/dev/null 2>&1; then
- AC_MSG_RESULT([FFI in host: yes])
+ AC_MSG_RESULT([by request... yes])
+elif test "${with_gtk}" = "no"; then
+ AC_MSG_RESULT([by request... no])
+elif test "${with_gtk}" = "auto"; then
+ if pkg-config --exists gtk+-2.0 2>/dev/null; then
+ AC_MSG_RESULT([yes])
with_gtk=yes
else
- AC_MSG_RESULT([no FFI: no])
+ AC_MSG_RESULT([no Gtk 2.0... no])
with_gtk=no
fi
fi
(cd lib; rm -f ${BN}; ${LN_S} ../${BN} .)
done
BUNDLES="6001 compiler cref edwin ffi imail sf sos ssp star-parser xdoc xml"
- if test "${with_gtk}" = yes; then BUNDLES="$BUNDLES gtk"; fi
- for BUNDLE in $BUNDLES; do
+ for BUNDLE in $BUNDLES $FFIS; do
SO=${BUNDLE}.so
(cd lib/lib; rm -f ${SO}; ${LN_S} ../../${BUNDLE}/${SO} .)
done
(define (compile-ffi dir)
(if (eq? microcode-id/compiled-code-type 'C)
- (c-compile-dir dir)
+ (in-liarc
+ (lambda ()
+ (c-compile-dir dir)))
(compile-dir dir)))
(define (compile-boot-dirs compile-dir)
run_make stamp_install-liarc-boot-compiler c-clean distclean
run_configure --enable-native-code=c --disable-host-scheme-test "${@}"
-run_make stamp_compile-liarc-bundles build-bands clean-boot-root
+run_make stamp_compile-liarc-bundles build-bands clean-boot-root build-ffis
TARGET_DIR = $(AUXDIR)/gtk
-MIT_SCHEME_EXE = @MIT_SCHEME_EXE@
-
-generate: ../lib/gtk-shim.so ../lib/gtk-types.bin ../lib/gtk-const.bin \
- ../lib/conses.png
+build: compile
+ if test `echo "(pp microcode-id/compiled-code-type)" \
+ | ../microcode/scheme --library ../lib --batch-mode` = "c"; \
+ then $(MAKE) compile-liarc-bundle; fi
+
+compile: ../lib/gtk-shim.so ../lib/gtk-types.bin ../lib/gtk-const.bin \
+ ../lib/conses.png swat-pole-zero.scm
+ cd ../ && echo '(load "etc/compile.scm")(compile-ffi "gtk")' \
+ | microcode/scheme --library lib --batch-mode
../lib/gtk-shim.so: gtk-shim.so
$(INSTALL_DATA) gtk-shim.so $@
../lib/conses.png: conses.png
$(INSTALL_DATA) conses.png $@
-build:
- if [ ! -e swat-pole-zero.scm ]; then \
- ln -sf ../swat/scheme/other/pole-zero.scm swat-pole-zero.scm; fi
- cd ../; echo '(load "etc/compile.scm")(compile-ffi "gtk")' \
- | microcode/scheme --library lib --batch-mode
-
-liarc-build:
- $(MAKE) compile-liarc-bundle gtk
+swat-pole-zero.scm:
+ ln -sf ../swat/scheme/other/pole-zero.scm swat-pole-zero.scm
install:
rm -rf $(DESTDIR)$(TARGET_DIR)
$(INSTALL_DATA) gtk-shim.so $(DESTDIR)$(AUXDIR)/.
$(INSTALL_DATA) gtk-types.bin $(DESTDIR)$(AUXDIR)/.
$(INSTALL_DATA) gtk-const.bin $(DESTDIR)$(AUXDIR)/.
+ if test `echo "(pp microcode-id/compiled-code-type)" \
+ | ../microcode/scheme --library ../lib --batch-mode` = "c"; \
+ then $(MAKE) install-liarc-bundle; fi
gtk-shim.so: gtk-shim.o scmwidget.o gtkio.o
$(LINK_SHIM) $^ `pkg-config --libs gtk+-2.0`
scmwidget.c: scmwidget.c.stay
cp -p scmwidget.c.stay scmwidget.c
-# $(COMPILE) will not do. Its DEFS conflict (cause warnings) with config.h.
+# COMPILE_SHIM will not do. COMPILE's DEFS conflict (cause warnings)
+# with config.h. This is COMPILE_SHIM without DEFS.
gtkio.o: gtkio.c
- $(CC) $(CPPFLAGS) $(CFLAGS) `pkg-config --cflags gtk+-2.0` \
- -I../microcode -c $<
+ $(CC) $(CPPFLAGS) $(CFLAGS) $(SHIM_CFLAGS) \
+ `pkg-config --cflags gtk+-2.0` -I../microcode -c $<
gtkio.c: gtkio.c.stay
cp -p gtkio.c.stay gtkio.c
$(COMPILE_SHIM) `pkg-config --cflags gtk+-2.0` -o $@ -c $<
gtk-shim.c gtk-const.c gtk-types.bin: gtk.cdecl Includes/*.cdecl
- (echo "(load-option 'FFI)"; \
- echo '(C-generate "gtk" "#include \"gtk-shim.h\"")') \
- | $(MIT_SCHEME_EXE) --batch-mode
+ ( echo "(load-option 'FFI)"; \
+ echo '(C-generate "gtk" "#include \"gtk-shim.h\"")' ) \
+ | ../microcode/scheme --library ../lib --batch-mode
gtk-const.bin: gtk-const.scm
- echo '(sf "gtk-const")' | $(MIT_SCHEME_EXE) --batch-mode
+ echo '(sf "gtk-const")' \
+ | ../microcode/scheme --library ../lib --batch-mode
gtk-const.scm: gtk-const
./gtk-const
gtk-const.o: gtk-const.c
$(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0` -o $@ -c $<
+
+.PHONY: build compile
extern void gtk_main_plus (void);
extern void gtk_main_plus_quit (void);
-extern void run_gtk (ulong registry, double time);
+extern void run_gtk (unsigned long registry, double time);
extern gboolean gtk_time_slice_window_p (void);
extern void gtk_time_slice_window (gboolean open_p);
extern gboolean gtk_select_trace_p (void);
}
void
-run_gtk (select_registry_t r, double time)
+run_gtk (unsigned long registry, double time)
{
/* Return to the toolkit with the scheme_source set up to dispatch
to Scheme again when I/O is ready, or a certain TIME has passed.
Scheme is ready to run again immediately. If I/O is empty, the
simulated poll should not re-enter Scheme until TIME. */
- set_registry (scheme_source, gtk_registry (r), time);
+ set_registry (scheme_source,
+ gtk_registry ((select_registry_t)registry),
+ time);
if (tracing_gtk_select)
{
GSList * gpollfds = scheme_source->gpollfds;