From: Taylor R Campbell Date: Sat, 13 Feb 2010 21:22:28 +0000 (-0500) Subject: Make X11 modules dynamically loadable. X-Git-Tag: 20100708-Gtk~170 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=9850b5992fc64035ded408eca86185adf94d1055;p=mit-scheme.git Make X11 modules dynamically loadable. Make the modules depend on `scheme' only for Mac OS X, and let that be an option to configure, so that users can just build modules against an already installed Scheme. This is a step toward making every feature that currently involves a compile-time decision instead be dynamically loadable, and compilable separately from the microcode executable. All that is left is termcap support. --- diff --git a/src/Setup.sh b/src/Setup.sh index edcdf1947..5531a1b84 100755 --- a/src/Setup.sh +++ b/src/Setup.sh @@ -58,8 +58,8 @@ OTHER_SUBDIRS="6001 compiler rcs runtime win32 xdoc microcode" # lib maybe_mkdir lib -maybe_mkdir lib/lib maybe_link lib/edwin ../edwin +maybe_link lib/lib ../microcode maybe_link lib/include ../microcode maybe_link lib/optiondb.scm ../etc/optiondb.scm maybe_link lib/runtime ../runtime diff --git a/src/edwin/xterm.scm b/src/edwin/xterm.scm index 29cbbae71..9631b80e5 100644 --- a/src/edwin/xterm.scm +++ b/src/edwin/xterm.scm @@ -1359,8 +1359,10 @@ Otherwise, it is copied from the primary selection." ;; X-OPEN-DISPLAY hangs, uninterruptibly, when the X server is ;; running the login loop of xdm. Can this be fixed? (or x-display-data - (and (implemented-primitive-procedure? - (ucode-primitive x-open-display 1)) + (and (begin + (load-library-object-file "prx11" #f) + (implemented-primitive-procedure? + (ucode-primitive x-open-display 1))) (or x-display-name (get-environment-variable "DISPLAY")) (let ((display (x-open-display x-display-name))) (set! x-display-data display) diff --git a/src/microcode/configure.ac b/src/microcode/configure.ac index 8578e01c2..20c7d3467 100644 --- a/src/microcode/configure.ac +++ b/src/microcode/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([MIT/GNU Scheme microcode], [15.1], [bug-mit-scheme@gnu.org], [mit-scheme]) +AC_INIT([MIT/GNU Scheme microcode], [15.2], [bug-mit-scheme@gnu.org], [mit-scheme]) AC_CONFIG_SRCDIR([boot.c]) AC_CONFIG_HEADERS([config.h]) AC_PROG_MAKE_SET @@ -169,6 +169,11 @@ AC_ARG_WITH([macosx-version], AS_HELP_STRING([--with-macosx-version], [MacOSX version to compile for @<:@host's version@:>@])) +AC_ARG_WITH([module-loader], + AS_HELP_STRING([--with-module-loader], + [Pathname of the Scheme executable, for building modules only])) +: ${with_module_loader='yes'} + if test ${enable_static_libs} != no && test ${enable_native_code} = c; then AC_MSG_ERROR( [--enable-native-code=c incompatible with --enable-static-libs]) @@ -189,11 +194,13 @@ PRMD5_LIBS= SCHEME_DEFS=-DMIT_SCHEME SCHEME_LDFLAGS= MODULE_BASES= +MODULE_AUX_BASES= MODULE_LIBS= MODULE_TARGETS= MODULE_RULES=/dev/null MODULE_CFLAGS= MODULE_LDFLAGS= +MODULE_LOADER= LIARC_VARS=/dev/null LIARC_RULES=/dev/null AUX_PROGRAMS= @@ -336,7 +343,15 @@ darwin*) CFLAGS="${CFLAGS} ${MACOSX_CFLAGS}" LDFLAGS="${LDFLAGS} ${MACOSX_CFLAGS} -Wl,-syslibroot,${MACOSX_SYSROOT}" LDFLAGS="${LDFLAGS} -framework CoreFoundation" - MODULE_LDFLAGS="${MODULE_LDFLAGS} -bundle -bundle_loader "'${SCHEME_EXE}' + MODULE_LDFLAGS="${MODULE_LDFLAGS} -bundle" + if test "${with_module_loader}" != no; then + if test "${with_module_loader}" = yes; then + MODULE_LOADER='$(SCHEME_EXE)' + else + MODULE_LOADER="${with_module_loader}" + fi + MODULE_LDFLAGS="${MODULE_LDFLAGS} -bundle_loader "'$(MODULE_LOADER)' + fi AUX_PROGRAMS="${AUX_PROGRAMS} macosx-starter" ;; netbsd*) @@ -931,6 +946,21 @@ if test "${with_libpq}" != no; then ]) fi +dnl Add support for X if present. +if test "${no_x}" != yes; then + if test "x${x_includes}" != x; then + FOO=-I`echo ${x_includes} | sed -e "s/:/ -I/g"` + CPPFLAGS="${CPPFLAGS} ${FOO}" + fi + if test "x${x_libraries}" != x; then + FOO=-L`echo ${x_libraries} | sed -e "s/:/ -L/g"` + LDFLAGS="${LDFLAGS} ${FOO}" + fi + MODULE_LIBS="-lX11 ${MODULE_LIBS}" + MODULE_BASES="${MODULE_BASES} prx11" + MODULE_AUX_BASES="${MODULE_AUX_BASES} x11base x11color x11graph x11term" +fi + dnl Decide whether we're using static or dynamic libraries. if test "${enable_static_libs}" = no; then AC_CHECK_FUNC([dlopen], @@ -967,20 +997,6 @@ if test ${enable_valgrind_mode} != no; then M4_FLAGS="${M4_FLAGS} -P VALGRIND_MODE,1" fi -dnl Add support for X if present. -if test "${no_x}" != yes; then - if test "x${x_includes}" != x; then - FOO=-I`echo ${x_includes} | sed -e "s/:/ -I/g"` - CPPFLAGS="${CPPFLAGS} ${FOO}" - fi - if test "x${x_libraries}" != x; then - FOO=-L`echo ${x_libraries} | sed -e "s/:/ -L/g"` - LIBS="${LIBS} ${FOO}" - fi - LIBS="${LIBS} -lX11" - OPTIONAL_BASES="${OPTIONAL_BASES} x11base x11term x11graph x11color" -fi - OPTIONAL_BASES="${OPTIONAL_BASES} cmpint cmpintmd comutl" case ${mit_scheme_native_code} in @@ -1022,6 +1038,9 @@ if test "x${MODULE_BASES}" != x; then rm -f ${MODULE_RULES} for BASE in ${MODULE_BASES}; do MODULE_TARGETS="${MODULE_TARGETS} ${BASE}.so" + MODULE_AUX_BASES="${MODULE_AUX_BASES} ${BASE}" + done + for BASE in ${MODULE_AUX_BASES}; do echo >> ${MODULE_RULES} echo ${BASE}.o: ${BASE}.c >> ${MODULE_RULES} echo " " '$(COMPILE_MODULE)' -c '$*.c' >> ${MODULE_RULES} @@ -1044,6 +1063,7 @@ AC_SUBST([MODULE_TARGETS]) AC_SUBST_FILE([MODULE_RULES]) AC_SUBST([MODULE_CFLAGS]) AC_SUBST([MODULE_LDFLAGS]) +AC_SUBST([MODULE_LOADER]) AC_SUBST_FILE([LIARC_VARS]) AC_SUBST_FILE([LIARC_RULES]) AC_SUBST([AUX_PROGRAMS]) diff --git a/src/microcode/makegen/Makefile.in.in b/src/microcode/makegen/Makefile.in.in index a5153b9f4..477354307 100644 --- a/src/microcode/makegen/Makefile.in.in +++ b/src/microcode/makegen/Makefile.in.in @@ -108,6 +108,7 @@ PRMD5_LIBS = @PRMD5_LIBS@ MODULE_TARGETS = @MODULE_TARGETS@ MODULE_CFLAGS = @MODULE_CFLAGS@ MODULE_LDFLAGS = @MODULE_LDFLAGS@ +MODULE_LOADER = @MODULE_LOADER@ COMPILE_MODULE = $(COMPILE) -DCOMPILE_AS_MODULE $(MODULE_CFLAGS) LINK_MODULE = $(LINK) $(MODULE_LDFLAGS) MODULE_LIBS = -lc @@ -191,27 +192,31 @@ extract-liarc-decls: extract-liarc-decls.o macosx-starter: macosx-starter.o $(LINK) macosx-starter.o -prbfish.so: prbfish.o scheme +prbfish.so: prbfish.o @MODULE_LOADER@ $(LINK_MODULE) prbfish.o $(PRBFISH_LIBS) $(MODULE_LIBS) -prmd5.so: prmd5.o scheme +prmd5.so: prmd5.o @MODULE_LOADER@ $(LINK_MODULE) prmd5.o $(PRMD5_LIBS) $(MODULE_LIBS) -prmhash.so: prmhash.o scheme +prmhash.so: prmhash.o @MODULE_LOADER@ $(LINK_MODULE) prmhash.o -lmhash $(MODULE_LIBS) -prmcrypt.so: prmcrypt.o scheme +prmcrypt.so: prmcrypt.o @MODULE_LOADER@ $(LINK_MODULE) prmcrypt.o -lmcrypt -lltdl $(MODULE_LIBS) -prgdbm.so: prgdbm.o scheme +prgdbm.so: prgdbm.o @MODULE_LOADER@ $(LINK_MODULE) prgdbm.o -lgdbm $(MODULE_LIBS) -prdb4.so: prdb4.o scheme +prdb4.so: prdb4.o @MODULE_LOADER@ $(LINK_MODULE) prdb4.o -ldb-4 $(MODULE_LIBS) -prpgsql.so: prpgsql.o scheme +prpgsql.so: prpgsql.o @MODULE_LOADER@ $(LINK_MODULE) prpgsql.o -lpq $(MODULE_LIBS) +prx11.so: prx11.o x11base.o x11color.o x11graph.o x11term.o @MODULE_LOADER@ + $(LINK_MODULE) prx11.o x11base.o x11color.o x11graph.o x11term.o \ + -lX11 $(MODULE_LIBS) + @MODULE_RULES@ tags: TAGS diff --git a/src/microcode/makegen/files-optional.scm b/src/microcode/makegen/files-optional.scm index c3ff0c306..990fefbd2 100644 --- a/src/microcode/makegen/files-optional.scm +++ b/src/microcode/makegen/files-optional.scm @@ -34,6 +34,7 @@ USA. "prmhash" "prpgsql" "pruxdld" +"prx11" "svm1-interp" "termcap" "terminfo" diff --git a/src/microcode/prx11.c b/src/microcode/prx11.c new file mode 100644 index 000000000..1aed240a7 --- /dev/null +++ b/src/microcode/prx11.c @@ -0,0 +1,46 @@ +/* -*-C-*- + +Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, + 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, + 2006, 2007, 2008, 2009, 2010 Massachusetts Institute of Technology + +This file is part of MIT/GNU Scheme. + +MIT/GNU Scheme is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +MIT/GNU Scheme is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with MIT/GNU Scheme; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, +USA. + +*/ + +#ifdef COMPILE_AS_MODULE + +#include "scheme.h" + +extern void dload_initialize_x11base (void); +extern void dload_initialize_x11color (void); +extern void dload_initialize_x11graph (void); +extern void dload_initialize_x11term (void); + +char * +dload_initialize_file (void) +{ + + dload_initialize_x11base (); + dload_initialize_x11color (); + dload_initialize_x11graph (); + dload_initialize_x11term (); + return ("#prx11"); +} + +#endif /* defined (COMPILE_AS_MODULE) */ diff --git a/src/microcode/x11.h b/src/microcode/x11.h index b250f476e..472849f08 100644 --- a/src/microcode/x11.h +++ b/src/microcode/x11.h @@ -23,6 +23,9 @@ USA. */ +#ifndef SCHEME_X11_H +#define SCHEME_X11_H + #include #include #include @@ -344,3 +347,5 @@ extern void xw_make_window_map const char * resource_name, const char * resource_class, int map_p); + +#endif /* defined (SCHEME_X11_H) */ diff --git a/src/microcode/x11base.c b/src/microcode/x11base.c index e5a93d168..f59c3533a 100644 --- a/src/microcode/x11base.c +++ b/src/microcode/x11base.c @@ -2434,8 +2434,8 @@ FONT is either a font name or a font ID.") } } -DEFINE_PRIMITIVE ("X-WINDOW-FONT-STRUCTURE", Prim_x_window_font_structure, - 1, 1, "(X-WINDOW)\n\ +DEFINE_PRIMITIVE ("X-WINDOW-FONT-STRUCTURE", Prim_x_window_font_structure, 1, 1, + "(X-WINDOW)\n\ Returns the font-structure for the font currently associated with X-WINDOW.") { XFontStruct *font; @@ -2738,3 +2738,81 @@ DEFINE_PRIMITIVE ("X-SEND-SELECTION-NOTIFY", Prim_x_send_selection_notify, 6, 6, } PRIMITIVE_RETURN (UNSPECIFIC); } + +#ifdef COMPILE_AS_MODULE + +/* sed -n -e 's/^DEFINE_PRIMITIVE *(\([^)]*\))$/ declare_primitive (\1);/pg' \ + -e 's/^DEFINE_PRIMITIVE *(\([^)]*\)$/ declare_primitive (\1 0);/pg' */ + +void +dload_initialize_x11base (void) +{ + declare_primitive ("X-CHANGE-PROPERTY", Prim_x_change_property, 7, 7, 0); + declare_primitive ("X-CLOSE-ALL-DISPLAYS", Prim_x_close_all_displays, 0, 0, 0); + declare_primitive ("X-CLOSE-DISPLAY", Prim_x_close_display, 1, 1, 0); + declare_primitive ("X-CLOSE-WINDOW", Prim_x_close_window, 1, 1, 0); + declare_primitive ("X-CONVERT-SELECTION", Prim_x_convert_selection, 6, 6, 0); + declare_primitive ("X-DEBUG", Prim_x_debug, 1, 1, 0); + declare_primitive ("X-DELETE-PROPERTY", Prim_x_delete_property, 3, 3, 0); + declare_primitive ("X-DISPLAY-DESCRIPTOR", Prim_x_display_descriptor, 1, 1, 0); + declare_primitive ("X-DISPLAY-FLUSH", Prim_x_display_flush, 1, 1, 0); + declare_primitive ("X-DISPLAY-GET-DEFAULT", Prim_x_display_get_default, 3, 3, 0); + declare_primitive ("X-DISPLAY-GET-SIZE", Prim_x_display_get_size, 2, 2, 0); + declare_primitive ("X-DISPLAY-PROCESS-EVENTS", Prim_x_display_process_events, 2, 2, 0); + declare_primitive ("X-DISPLAY-SYNC", Prim_x_display_sync, 2, 2, 0); + declare_primitive ("X-FONT-STRUCTURE", Prim_x_font_structure, 2, 2, 0); + declare_primitive ("X-GET-ATOM-NAME", Prim_x_get_atom_name, 2, 2, 0); + declare_primitive ("X-GET-SELECTION-OWNER", Prim_x_get_selection_owner, 2, 2, 0); + declare_primitive ("X-GET-WINDOW-PROPERTY", Prim_x_get_window_property, 7, 7, 0); + declare_primitive ("X-ID->WINDOW", Prim_x_id_to_window, 2, 2, 0); + declare_primitive ("X-INTERN-ATOM", Prim_x_intern_atom, 3, 3, 0); + declare_primitive ("X-LIST-FONTS", Prim_x_list_fonts, 3, 3, 0); + declare_primitive ("X-MAX-REQUEST-SIZE", Prim_x_max_request_size, 1, 1, 0); + declare_primitive ("X-OPEN-DISPLAY", Prim_x_open_display, 1, 1, 0); + declare_primitive ("X-SELECT-INPUT", Prim_x_select_input, 3, 3, 0); + declare_primitive ("X-SEND-SELECTION-NOTIFY", Prim_x_send_selection_notify, 6, 6, 0); + declare_primitive ("X-SET-DEFAULT-FONT", Prim_x_set_default_font, 2, 2, 0); + declare_primitive ("X-SET-SELECTION-OWNER", Prim_x_set_selection_owner, 4, 4, 0); + declare_primitive ("X-WINDOW-ANDC-EVENT-MASK", Prim_x_window_andc_event_mask, 2, 2, 0); + declare_primitive ("X-WINDOW-BEEP", Prim_x_window_beep, 1, 1, 0); + declare_primitive ("X-WINDOW-CLEAR", Prim_x_window_clear, 1, 1, 0); + declare_primitive ("X-WINDOW-COORDS-LOCAL->ROOT", Prim_x_window_coords_local2root, 3, 3, 0); + declare_primitive ("X-WINDOW-COORDS-ROOT->LOCAL", Prim_x_window_coords_root2local, 3, 3, 0); + declare_primitive ("X-WINDOW-DISPLAY", Prim_x_window_display, 1, 1, 0); + declare_primitive ("X-WINDOW-EVENT-MASK", Prim_x_window_event_mask, 1, 1, 0); + declare_primitive ("X-WINDOW-FLUSH", Prim_x_window_flush, 1, 1, 0); + declare_primitive ("X-WINDOW-FONT-STRUCTURE", Prim_x_window_font_structure, 1, 1, 0); + declare_primitive ("X-WINDOW-GET-POSITION", Prim_x_window_get_position, 1, 1, 0); + declare_primitive ("X-WINDOW-GET-SIZE", Prim_x_window_get_size, 1, 1, 0); + declare_primitive ("X-WINDOW-ICONIFY", Prim_x_window_iconify, 1, 1, 0); + declare_primitive ("X-WINDOW-ID", Prim_x_window_id, 1, 1, 0); + declare_primitive ("X-WINDOW-LOWER", Prim_x_window_lower, 1, 1, 0); + declare_primitive ("X-WINDOW-MAP", Prim_x_window_map, 1, 1, 0); + declare_primitive ("X-WINDOW-OR-EVENT-MASK", Prim_x_window_or_event_mask, 2, 2, 0); + declare_primitive ("X-WINDOW-QUERY-POINTER", Prim_x_window_query_pointer, 1, 1, 0); + declare_primitive ("X-WINDOW-RAISE", Prim_x_window_raise, 1, 1, 0); + declare_primitive ("X-WINDOW-SET-BACKGROUND-COLOR", Prim_x_window_set_background_color, 2, 2, 0); + declare_primitive ("X-WINDOW-SET-BORDER-COLOR", Prim_x_window_set_border_color, 2, 2, 0); + declare_primitive ("X-WINDOW-SET-BORDER-WIDTH", Prim_x_window_set_border_width, 2, 2, 0); + declare_primitive ("X-WINDOW-SET-CLASS-HINT", Prim_x_window_set_class_hint, 3, 3, 0); + declare_primitive ("X-WINDOW-SET-CURSOR-COLOR", Prim_x_window_set_cursor_color, 2, 2, 0); + declare_primitive ("X-WINDOW-SET-EVENT-MASK", Prim_x_window_set_event_mask, 2, 2, 0); + declare_primitive ("X-WINDOW-SET-FONT", Prim_x_window_set_font, 2, 2, 0); + declare_primitive ("X-WINDOW-SET-FOREGROUND-COLOR", Prim_x_window_set_foreground_color, 2, 2, 0); + declare_primitive ("X-WINDOW-SET-ICON-NAME", Prim_x_window_set_icon_name, 2, 2, 0); + declare_primitive ("X-WINDOW-SET-INPUT-FOCUS", Prim_x_window_set_input_focus, 2, 2, 0); + declare_primitive ("X-WINDOW-SET-INPUT-HINT", Prim_x_window_set_input_hint, 2, 2, 0); + declare_primitive ("X-WINDOW-SET-INTERNAL-BORDER-WIDTH", Prim_x_window_set_internal_border_width, 2, 2, 0); + declare_primitive ("X-WINDOW-SET-MOUSE-COLOR", Prim_x_window_set_mouse_color, 2, 2, 0); + declare_primitive ("X-WINDOW-SET-MOUSE-SHAPE", Prim_x_window_set_mouse_shape, 2, 2, 0); + declare_primitive ("X-WINDOW-SET-NAME", Prim_x_window_set_name, 2, 2, 0); + declare_primitive ("X-WINDOW-SET-POSITION", Prim_x_window_set_position, 3, 3, 0); + declare_primitive ("X-WINDOW-SET-SIZE", Prim_x_window_set_size, 3, 3, 0); + declare_primitive ("X-WINDOW-SET-TRANSIENT-FOR-HINT", Prim_x_window_set_transient_for, 2, 2, 0); + declare_primitive ("X-WINDOW-UNMAP", Prim_x_window_unmap, 1, 1, 0); + declare_primitive ("X-WINDOW-WITHDRAW", Prim_x_window_withdraw, 1, 1, 0); + declare_primitive ("X-WINDOW-X-SIZE", Prim_x_window_x_size, 1, 1, 0); + declare_primitive ("X-WINDOW-Y-SIZE", Prim_x_window_y_size, 1, 1, 0); +} + +#endif /* defined (COMPILE_AS_MODULE) */ diff --git a/src/microcode/x11color.c b/src/microcode/x11color.c index 50fbe4223..c2bc28ba2 100644 --- a/src/microcode/x11color.c +++ b/src/microcode/x11color.c @@ -239,8 +239,7 @@ If third arg WRITEABLE is true, returned colormap may be modified.") } } -DEFINE_PRIMITIVE ("X-COPY-COLORMAP-AND-FREE", Prim_x_copy_colormap_and_free, - 1, 1, +DEFINE_PRIMITIVE ("X-COPY-COLORMAP-AND-FREE", Prim_x_copy_colormap_and_free, 1, 1, "Return a new copy of COLORMAP.") { PRIMITIVE_HEADER (1); @@ -536,3 +535,36 @@ DEFINE_PRIMITIVE("X-LOOKUP-COLOR", Prim_x_lookup_color, 2, 2, 0) VECTOR_SET(Result, 7, long_to_integer(Exact.blue)); PRIMITIVE_RETURN(Result); } + +#ifdef COMPILE_AS_MODULE + +/* sed -n -e 's/^DEFINE_PRIMITIVE *(\([^)]*\))$/ declare_primitive (\1);/pg' \ + -e 's/^DEFINE_PRIMITIVE *(\([^)]*\)$/ declare_primitive (\1 0);/pg' */ + +void +dload_initialize_x11color (void) +{ + declare_primitive ("X-ALLOCATE-COLOR", Prim_x_allocate_color, 4, 4, 0); + declare_primitive ("X-ALLOCATE-NAMED-COLOR", Prim_x_allocate_named_color, 2, 2, 0); + declare_primitive ("X-COPY-COLORMAP-AND-FREE", Prim_x_copy_colormap_and_free, 1, 1, 0); + declare_primitive ("X-CREATE-COLORMAP", Prim_x_create_colormap, 3, 3, 0); + declare_primitive ("X-FREE-COLORMAP", Prim_x_free_colormap, 1, 1, 0); + declare_primitive ("X-FREE-COLORS", Prim_x_free_colors, 1, -1, 0); + declare_primitive ("X-GET-DEFAULT-COLORMAP", Prim_x_get_default_colormap, 2, 2, 0); + declare_primitive ("X-GET-DEFAULT-VISUAL", Prim_x_get_default_visual, 2, 2, 0); + declare_primitive ("X-GET-VISUAL-INFO", Prim_x_get_visual_info, 10, 10, 0); + declare_primitive ("X-GET-WINDOW-ATTRIBUTES", Prim_x_get_window_attributes, 1, 1, 0); + declare_primitive ("X-LOOKUP-COLOR", Prim_x_lookup_color, 2, 2, 0); + declare_primitive ("X-PARSE-COLOR", Prim_x_parse_color, 2, 2, 0); + declare_primitive ("X-QUERY-COLOR", Prim_x_query_color, 2, 2, 0); + declare_primitive ("X-QUERY-COLORS", Prim_x_query_colors, 1, -1, 0); + declare_primitive ("X-SET-WINDOW-COLORMAP", Prim_x_set_window_colormap, 2, 2, 0); + declare_primitive ("X-STORE-COLOR", Prim_x_store_color, 5, 5, 0); + declare_primitive ("X-STORE-COLORS", Prim_x_store_colors, 2, 2, 0); + declare_primitive ("X-STORE-NAMED-COLOR", Prim_x_store_named_color, 6, 6, 0); + declare_primitive ("X-VISUAL-DEALLOCATE", Prim_x_visual_deallocate, 1, 1, 0); + declare_primitive ("X-WINDOW-COLORMAP", Prim_x_window_colormap, 1, 1, 0); + declare_primitive ("X-WINDOW-VISUAL", Prim_x_window_visual, 1, 1, 0); +} + +#endif /* defined (COMPILE_AS_MODULE) */ diff --git a/src/microcode/x11graph.c b/src/microcode/x11graph.c index d414a019e..2cefdde2f 100644 --- a/src/microcode/x11graph.c +++ b/src/microcode/x11graph.c @@ -196,8 +196,7 @@ reset_virtual_device_coordinates (struct xwindow * xw) reset_clip_rectangle (xw); } -DEFINE_PRIMITIVE ("X-GRAPHICS-SET-VDC-EXTENT", Prim_x_graphics_set_vdc_extent, - 5, 5, +DEFINE_PRIMITIVE ("X-GRAPHICS-SET-VDC-EXTENT", Prim_x_graphics_set_vdc_extent, 5, 5, "(X-GRAPHICS-SET-VDC-EXTENT WINDOW X-MIN Y-MIN X-MAX Y-MAX)\n\ Set the virtual device coordinates to the given values.") { @@ -238,8 +237,7 @@ DEFINE_PRIMITIVE ("X-GRAPHICS-RESET-CLIP-RECTANGLE", Prim_x_graphics_reset_clip_ PRIMITIVE_RETURN (UNSPECIFIC); } -DEFINE_PRIMITIVE ("X-GRAPHICS-SET-CLIP-RECTANGLE", - Prim_x_graphics_set_clip_rectangle, 5, 5, +DEFINE_PRIMITIVE ("X-GRAPHICS-SET-CLIP-RECTANGLE", Prim_x_graphics_set_clip_rectangle, 5, 5, "(X-GRAPHICS-SET-CLIP-RECTANGLE WINDOW X-LEFT Y-BOTTOM X-RIGHT Y-TOP)\n\ Set the clip rectangle to the given coordinates.") { @@ -617,8 +615,7 @@ transparent background.") PRIMITIVE_RETURN (UNSPECIFIC); } -DEFINE_PRIMITIVE ("X-GRAPHICS-DRAW-IMAGE-STRING", - Prim_x_graphics_draw_image_string, 4, 4, +DEFINE_PRIMITIVE ("X-GRAPHICS-DRAW-IMAGE-STRING", Prim_x_graphics_draw_image_string, 4, 4, "(X-GRAPHICS-DRAW-IMAGE-STRING WINDOW X Y STRING)\n\ Draw characters in the current font at the given coordinates, with\n\ solid background.") @@ -1136,3 +1133,46 @@ DEFINE_PRIMITIVE ("X-GRAPHICS-MAP-Y-COORDINATE", Prim_x_graphics_map_y_coordinat : by))); } } + +#ifdef COMPILE_AS_MODULE + +/* sed -n -e 's/^DEFINE_PRIMITIVE *(\([^)]*\))$/ declare_primitive (\1);/pg' \ + -e 's/^DEFINE_PRIMITIVE *(\([^)]*\)$/ declare_primitive (\1 0);/pg' */ + +void +dload_initialize_x11graph (void) +{ + declare_primitive ("X-BYTES-INTO-IMAGE", Prim_x_bytes_into_image, 2, 2, 0); + declare_primitive ("X-CREATE-IMAGE", Prim_x_create_image, 3, 3, 0); + declare_primitive ("X-DESTROY-IMAGE", Prim_x_destroy_image, 1, 1, 0); + declare_primitive ("X-DISPLAY-IMAGE", Prim_x_display_image, 8, 8, 0); + declare_primitive ("X-GET-PIXEL-FROM-IMAGE", Prim_x_get_image_pixel, 3, 3, 0); + declare_primitive ("X-GRAPHICS-COPY-AREA", Prim_x_graphics_copy_area, 8, 8, 0); + declare_primitive ("X-GRAPHICS-DRAG-CURSOR", Prim_x_graphics_drag_cursor, 3, 3, 0); + declare_primitive ("X-GRAPHICS-DRAW-ARC", Prim_x_graphics_draw_arc, 8, 8, 0); + declare_primitive ("X-GRAPHICS-DRAW-IMAGE-STRING", Prim_x_graphics_draw_image_string, 4, 4, 0); + declare_primitive ("X-GRAPHICS-DRAW-LINE", Prim_x_graphics_draw_line, 5, 5, 0); + declare_primitive ("X-GRAPHICS-DRAW-LINES", Prim_x_graphics_draw_lines, 3, 3, 0); + declare_primitive ("X-GRAPHICS-DRAW-POINT", Prim_x_graphics_draw_point, 3, 3, 0); + declare_primitive ("X-GRAPHICS-DRAW-POINTS", Prim_x_graphics_draw_points, 3, 3, 0); + declare_primitive ("X-GRAPHICS-DRAW-STRING", Prim_x_graphics_draw_string, 4, 4, 0); + declare_primitive ("X-GRAPHICS-FILL-POLYGON", Prim_x_graphics_fill_polygon, 2, 2, 0); + declare_primitive ("X-GRAPHICS-MAP-X-COORDINATE", Prim_x_graphics_map_x_coordinate, 2, 2, 0); + declare_primitive ("X-GRAPHICS-MAP-Y-COORDINATE", Prim_x_graphics_map_y_coordinate, 2, 2, 0); + declare_primitive ("X-GRAPHICS-MOVE-CURSOR", Prim_x_graphics_move_cursor, 3, 3, 0); + declare_primitive ("X-GRAPHICS-OPEN-WINDOW", Prim_x_graphics_open_window, 3, 3, 0); + declare_primitive ("X-GRAPHICS-RECONFIGURE", Prim_x_graphics_reconfigure, 3, 3, 0); + declare_primitive ("X-GRAPHICS-RESET-CLIP-RECTANGLE", Prim_x_graphics_reset_clip_rectangle, 1, 1, 0); + declare_primitive ("X-GRAPHICS-SET-CLIP-RECTANGLE", Prim_x_graphics_set_clip_rectangle, 5, 5, 0); + declare_primitive ("X-GRAPHICS-SET-DASHES", Prim_x_graphics_set_dashes, 3, 3, 0); + declare_primitive ("X-GRAPHICS-SET-FILL-STYLE", Prim_x_graphics_set_fill_style, 2, 2, 0); + declare_primitive ("X-GRAPHICS-SET-FUNCTION", Prim_x_graphics_set_function, 2, 2, 0); + declare_primitive ("X-GRAPHICS-SET-LINE-STYLE", Prim_x_graphics_set_line_style, 2, 2, 0); + declare_primitive ("X-GRAPHICS-SET-VDC-EXTENT", Prim_x_graphics_set_vdc_extent, 5, 5, 0); + declare_primitive ("X-GRAPHICS-VDC-EXTENT", Prim_x_graphics_vdc_extent, 1, 1, 0); + declare_primitive ("X-READ-IMAGE", Prim_x_read_image, 8, 8, 0); + declare_primitive ("X-SET-PIXEL-IN-IMAGE", Prim_x_set_image_pixel, 4, 4, 0); + declare_primitive ("X-WINDOW-DEPTH", Prim_x_window_depth, 1, 1, 0); +} + +#endif /* defined (COMPILE_AS_MODULE) */ diff --git a/src/microcode/x11term.c b/src/microcode/x11term.c index 11b274647..8f8725095 100644 --- a/src/microcode/x11term.c +++ b/src/microcode/x11term.c @@ -856,8 +856,7 @@ xterm_scroll_lines_down (struct xwindow * xw, (XTERM_Y_PIXEL (xw, (y_start + lines)))); } -DEFINE_PRIMITIVE ("XTERM-SCROLL-LINES-DOWN", Prim_xterm_scroll_lines_down, - 6, 6, +DEFINE_PRIMITIVE ("XTERM-SCROLL-LINES-DOWN", Prim_xterm_scroll_lines_down, 6, 6, "(XTERM-SCROLL-LINES-DOWN XTERM X-START X-END Y-START Y-END LINES)\n\ Scroll the contents of the region down by LINES.") { @@ -976,3 +975,36 @@ See `XTERM-SCREEN-CONTENTS' for the format of CONTENTS.") } PRIMITIVE_RETURN (UNSPECIFIC); } + +#ifdef COMPILE_AS_MODULE + +/* sed -n -e 's/^DEFINE_PRIMITIVE *(\([^)]*\))$/ declare_primitive (\1);/pg' \ + -e 's/^DEFINE_PRIMITIVE *(\([^)]*\)$/ declare_primitive (\1 0);/pg' */ + +void +dload_initialize_x11term (void) +{ + declare_primitive ("XTERM-CLEAR-RECTANGLE!", Prim_xterm_clear_rectangle, 6, 6, 0); + declare_primitive ("XTERM-DRAW-CURSOR", Prim_xterm_draw_cursor, 1, 1, 0); + declare_primitive ("XTERM-DUMP-RECTANGLE", Prim_xterm_dump_rectangle, 5, 5, 0); + declare_primitive ("XTERM-ENABLE-CURSOR", Prim_xterm_enable_cursor, 2, 2, 0); + declare_primitive ("XTERM-ERASE-CURSOR", Prim_xterm_erase_cursor, 1, 1, 0); + declare_primitive ("XTERM-MAP-X-COORDINATE", Prim_xterm_map_x_coordinate, 2, 2, 0); + declare_primitive ("XTERM-MAP-X-SIZE", Prim_xterm_map_x_size, 2, 2, 0); + declare_primitive ("XTERM-MAP-Y-COORDINATE", Prim_xterm_map_y_coordinate, 2, 2, 0); + declare_primitive ("XTERM-MAP-Y-SIZE", Prim_xterm_map_y_size, 2, 2, 0); + declare_primitive ("XTERM-OPEN-WINDOW", Prim_xterm_open_window, 3, 3, 0); + declare_primitive ("XTERM-RECONFIGURE", Prim_xterm_reconfigure, 3, 3, 0); + declare_primitive ("XTERM-RESTORE-CONTENTS", Prim_xterm_restore_contents, 6, 6, 0); + declare_primitive ("XTERM-SAVE-CONTENTS", Prim_xterm_save_contents, 5, 5, 0); + declare_primitive ("XTERM-SCROLL-LINES-DOWN", Prim_xterm_scroll_lines_down, 6, 6, 0); + declare_primitive ("XTERM-SCROLL-LINES-UP", Prim_xterm_scroll_lines_up, 6, 6, 0); + declare_primitive ("XTERM-SET-SIZE", Prim_xterm_set_size, 3, 3, 0); + declare_primitive ("XTERM-WRITE-CHAR!", Prim_xterm_write_char, 5, 5, 0); + declare_primitive ("XTERM-WRITE-CURSOR!", Prim_xterm_write_cursor, 3, 3, 0); + declare_primitive ("XTERM-WRITE-SUBSTRING!", Prim_xterm_write_substring, 7, 7, 0); + declare_primitive ("XTERM-X-SIZE", Prim_xterm_x_size, 1, 1, 0); + declare_primitive ("XTERM-Y-SIZE", Prim_xterm_y_size, 1, 1, 0); +} + +#endif /* defined (COMPILE_AS_MODULE) */ diff --git a/src/runtime/x11graph.scm b/src/runtime/x11graph.scm index baf264de2..4563275e0 100644 --- a/src/runtime/x11graph.scm +++ b/src/runtime/x11graph.scm @@ -206,6 +206,7 @@ USA. (initialize-colormap-datatype)) (define (x-graphics/available?) + (load-library-object-file "prx11" #f) (implemented-primitive-procedure? (ucode-primitive x-graphics-open-window 3)))